mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
- fixed: P_SpawnMapThing may not call playsim code.
There was one special case allowing to let an actor die on spawn, but this could call script code on an incompletely set up map which resulted in crashes.
This commit is contained in:
parent
ec1525b0c4
commit
435e7dddcd
3 changed files with 10 additions and 1 deletions
|
@ -347,6 +347,7 @@ xx(Greetings)
|
|||
xx(Idle)
|
||||
xx(GenericFreezeDeath)
|
||||
xx(GenericCrush)
|
||||
xx(DieFromSpawn)
|
||||
|
||||
// Bounce state names
|
||||
xx(Bounce)
|
||||
|
|
|
@ -5776,7 +5776,12 @@ AActor *FLevelLocals::SpawnMapThing (FMapThing *mthing, int position)
|
|||
else
|
||||
mobj->health = -int(mthing->Health);
|
||||
if (mthing->Health == 0)
|
||||
mobj->CallDie(NULL, NULL);
|
||||
{
|
||||
// We cannot call 'Die' here directly because the level is not yet fully set up.
|
||||
// This needs to be delayed by one tic.
|
||||
auto state = mobj->FindState(NAME_DieFromSpawn);
|
||||
if (state) mobj->SetState(state, true);
|
||||
}
|
||||
else if (mthing->Health != 1)
|
||||
mobj->StartHealth = mobj->health;
|
||||
|
||||
|
|
|
@ -1360,6 +1360,9 @@ class Actor : Thinker native
|
|||
GenericCrush:
|
||||
POL5 A -1;
|
||||
Stop;
|
||||
DieFromSpawn:
|
||||
TNT1 A 1;
|
||||
TNT1 A 1 { self.Die(null, null); }
|
||||
}
|
||||
|
||||
// Internal functions
|
||||
|
|
Loading…
Reference in a new issue