mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 07:11:54 +00:00
Execute disconnect scripts immediately before the player is destroyed.
- Disconnect scripts were previously run at some point after the player left. Now they are run immediately before destroying the player. Since the player hasn't actually been destroyed yet, the player also gets to be the script's activator. This gives you a chance to scrape whatever data you want from the player before they're history. Note that if you do anything to make the script wait, the script's activator will become the world, as it was before.
This commit is contained in:
parent
bf31d66d31
commit
786caaf36b
2 changed files with 3 additions and 3 deletions
|
@ -423,8 +423,8 @@ void FCajunMaster::RemoveAllBots (bool fromlist)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FBehavior::StaticStartTypedScripts (SCRIPT_Disconnect, players[i].mo, true, i, true);
|
||||||
ClearPlayer (i, !fromlist);
|
ClearPlayer (i, !fromlist);
|
||||||
FBehavior::StaticStartTypedScripts (SCRIPT_Disconnect, NULL, true, i);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1713,6 +1713,8 @@ void G_DoPlayerPop(int playernum)
|
||||||
|
|
||||||
// [RH] Make the player disappear
|
// [RH] Make the player disappear
|
||||||
FBehavior::StaticStopMyScripts(players[playernum].mo);
|
FBehavior::StaticStopMyScripts(players[playernum].mo);
|
||||||
|
// [RH] Let the scripts know the player left
|
||||||
|
FBehavior::StaticStartTypedScripts(SCRIPT_Disconnect, players[playernum].mo, true, playernum, true);
|
||||||
if (players[playernum].mo != NULL)
|
if (players[playernum].mo != NULL)
|
||||||
{
|
{
|
||||||
P_DisconnectEffect(players[playernum].mo);
|
P_DisconnectEffect(players[playernum].mo);
|
||||||
|
@ -1726,8 +1728,6 @@ void G_DoPlayerPop(int playernum)
|
||||||
players[playernum].mo = NULL;
|
players[playernum].mo = NULL;
|
||||||
players[playernum].camera = NULL;
|
players[playernum].camera = NULL;
|
||||||
}
|
}
|
||||||
// [RH] Let the scripts know the player left
|
|
||||||
FBehavior::StaticStartTypedScripts(SCRIPT_Disconnect, NULL, true, playernum);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void G_ScreenShot (char *filename)
|
void G_ScreenShot (char *filename)
|
||||||
|
|
Loading…
Reference in a new issue