- 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:
Christoph Oelckers 2022-11-05 09:43:06 +01:00
commit 435e7dddcd
3 changed files with 10 additions and 1 deletions

View file

@ -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;