Mods/Mesecons/Inactive mapblock handling
As Minetest world is virtually infinite, only part of it can be loaded in memory at any given time. Actually, there are 3 possible states for a mapblock:
- Unloaded
- Loaded (cached)
- Active
Minetest activates blocks around players, and also so-called “force-loaded” (“anchored”) blocks. All internal computations (like liquid flow) happen in active blocks only. But active blocks are expensive, so the activation range is very limited. Blocks farther than that may be loaded (to support larger view range), but they are not activated until you come close enough.
For most mods, that just means they will work near players only. But in Mesecons it may easily happen that a device is very large and spans many blocks, only some of which are active. Such situations need special treatment.
Wiring
Mesecons always load wire nodes and surroundings when necessary to propagate signal edge.
Receptors
Mesecons process signal edges, not power. That is, it only matters when a device changes its state. Static power sources like power plant aren’t affected by block unloading at all.
Switches
This includes button, switch and wall lever. As these require player interaction to change state, they are always in a loaded block at that moment. But they should work in loaded blocks as well (if operated by something).
Torches
That slow version of the NOT-gate operates in an active block only as it relies on an ABM. Otherwise it retains its state.
Blinky plant
Blinks constantly and reliably, but in an active block only as it uses an ABM. Otherwise it retains its state.
Detectors
Player, node, light and water detectors all work in active blocks only. But using Digilines, you can query node detector anywhere (it will be loaded), and even check for unloaded blocks (using a detector looking through block boundary; it reports ignore
when the target node’s block is unloaded).
Known bugs
- GH#377 Player detector may not switch off if a player disappears instantly (e.g. disconnects).
Effectors
As Mesecons load everything connected to a wire, these are always loaded when toggled. Therefore, all single-node effector, including ghoststone, lamps, etc. work regardless of block activation.
Movers
Pistons and movestones should load everything like wires.
Known bugs
- GH#433 Both pistons and movestones ignore
ignore
, including unloaded nodes, treating it more like air. - Falling is unreliable when the piston retracts its pusher from an inactive block.
Logic
Plain logic, that is, gates, FPGA and delayer, work reliably, regardless of block activation.
Lua controller
Fully reliable. Interrupts load the containing block on demand, and work even across server restart.
Note that interrupts were not fully reliable in older versions, the controller was prone to overheating if running continuously even at low interrupt rate.
Microcontroller
Immediate actions are reliable. Deferred (via after
) actions aren’t, however: while they should work in inactive blocks, they doesn’t survive server restart.