OpenPerpetuum / PerpetuumServer

The Open Perpetuum Project's fork of the Perpetuum Standalone Server
https://openperpetuum.com
Other
44 stars 21 forks source link

Fix npc roamspawn #352

Closed MikeJeffers closed 3 years ago

MikeJeffers commented 3 years ago

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: