minetest-mods / mesecons

Mod for Minetest that adds digital circuitry [=Minecraft redstone]
https://mesecons.net
Other
209 stars 121 forks source link

Player Detectors don't reset after player logs out and chunk is unloaded #377

Open Billre opened 6 years ago

Billre commented 6 years ago

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.

ssieb commented 6 years ago

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.

numberZero commented 6 years ago

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.

Billre commented 6 years ago

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 notifications@github.com 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

numberZero commented 6 years ago

Possible workarounds: