mesecons
mesecons copied to clipboard
Player Detectors don't reset after player logs out and chunk is unloaded
I have an issue where a player detector continues to falsely detect a player when that player logs out and no one else is in the chunk. The chunk immediately unloads and the player detector is stuck on. This puts my circuits in an infinite loop which may last for hours and the circuit often gets stuck on.
If the chunk unloads, wouldn't the circuit pause? Do you have force loading enabled? If so, then the problem is that the detector doesn't know about players leaving the game.
The reason is that it uses an ABM to detect players, but ABMs are only run in active mapblocks (i.e. near players, or force-loaded). Circuits, OTOH, may run in loaded-but-inactive blocks; the LuaC does that routinely.
The problem is that the player detector reports a player still there to the mese circuit, which has command blocks that teleport the nearest players until no more players are detected. When a player logged out or was teleported out while at the player detector, it got stuck on and the command block teleported the nearest player indefinitely ... We had to shutdown the server to recover. We eventually worked around the problem with a custom command block that teleported @near player (set to 16 block radius) and by making temporary teleport locations just outside the range of the player detectors but close enough to keep it's mapblock active. That usually reset the player detectors. We also provided a manual button to teleport players if they get stuck in those temporary teleport locations. That was a lot of extra work and then we still occasionally had problems with player detectors not resetting, which we solved by replacing player detectors before teleporting a player to it's location.
---- Vitaliy [email protected] wrote:
The reason is that it uses an ABM to detect players, but ABMs are only run in active mapblocks (i.e. near players, or force-loaded). Circuits, OTOH, may run in loaded-but-inactive blocks; the LuaC does that routinely.
-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/minetest-mods/mesecons/issues/377#issuecomment-407025368
Possible workarounds:
- Use our action queue instead of ABM for active detectors (as there is no reliable way to do that for all detectors). Problem: if a detector ever gets stuck in active state, it will be active forever.
- Forceload a block with active detector. Problem: forceloading is a limited resource.
- Watch active detectors and nearby players in globalstep or whatever. Problem: doesn’t persist server restart.