Closes: #351
This one has haunted us for sometime. It is possible via race condition that the randomroamers (because they used NormalFlock) could attempt to spawn flock members while the presence state-machine was attempting to resolve a respawn location.
At best this was wiping the spawnOrigin, at worst it results in double spawns (check-set race).
The fix is to allow both behaviors, but only one at a time!
The NormalFlock update loop checks if it is time to respawn dead members. But if the whole presence is wiped, the RoamingPresence FSM will go into a SpawnState which resolves a location to spawn and respawns the whole presence.
So now the behavior will be:
flock members will respawn based on their respawn times if the presence is non-empty (aka, flock members still actively roaming) and the respawn members will simply join them at their current home position.
if all flock members are dead, the presence will find a new place to spawn all members in at - based on the roaming respawn logic.
Closes: #351 This one has haunted us for sometime. It is possible via race condition that the randomroamers (because they used
NormalFlock
) could attempt to spawn flock members while the presence state-machine was attempting to resolve a respawn location. At best this was wiping the spawnOrigin, at worst it results in double spawns (check-set race).The fix is to allow both behaviors, but only one at a time! The NormalFlock update loop checks if it is time to respawn dead members. But if the whole presence is wiped, the RoamingPresence FSM will go into a SpawnState which resolves a location to spawn and respawns the whole presence.
So now the behavior will be: