When a RandomSpawner attempts to spawn another RandomSpawner which in turn decides to spawn a missile, weird things may happen. This is because the first RandomSpawner will call CheckMissileSpawn for the second RandomSpawner, causing the engine to attempt to treat that spawner as if it were an actual missile. At the very least, this results in wrong dimensions being used to measure if the object fits within the area at the spawn coordinates, and the resulting RandomSpawner may get destroyed by P_ExplodeMissile before the real missile can even appear. See here for a detailed breakdown of events that happen in this scenario.
The suggested resolution is to add another check before calling CheckMissileSpawn to make sure the spawned actor is not another RandomSpawner. My post in Scripting also mentions this code block, but looking at it again I think I've been mistaken about it, and that part does not require any fixing (since the MISSILE flag will only appear on the RandomSpawner itself when it's set in the defaults of the actor class it has chosen to spawn, which can only happen with actual missiles).
RandomSpawner spawning a RandomSpawner spawning a missile
Moderator: GZDoom Developers
Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
- Player701
-
- Posts: 1640
- Joined: Wed May 13, 2009 3:15 am
- Graphics Processor: nVidia with Vulkan support
- Contact:
Re: RandomSpawner spawning a RandomSpawner spawning a missil
Since this hasn't been closed as "don't do that" / "user error", I'm proposing a PR to fix this bug.