From Minetest Developer Wiki
(Redirected from ABM)
Jump to navigation Jump to search
Mbox warning.png This page contains unofficial, low-quality Lua API documentation and is likely to be outdated or wrong. Do not rely on it!
For the official and up-to-date documentation, see Lua API Documentation.
Mbox warning.png This page has been proposed for deletion for the following reason: "Contains unofficial and potentially outdated, redundant and inconsistent Lua API information"
If you don't think that this page should be deleted, please explain why on the talk page.


<source> minetest.register_abm(abm_defintion_table) </source>


The Active Block Modifier consists of a function that is executed at a specific interval for single nodes.

<source enclose="none">abm_defintion_table</source> is a table which can contain following fields:

index description
<source enclose="none">label</source> a name used by profiling to show how much time the ABM is using.
<source enclose="none">nodenames</source> a list of the nodenames that should execute the function. <source enclose="none">"group:groupname"</source> is also possible.
<source enclose="none">neighbors</source> a list of nodenames. At least one of these nodes has to be near node that executes the function (can be omitted). <source enclose="none">"group:groupname"</source> is also possible.
<source enclose="none">interval</source> the interval in seconds that specifies when the function is executed.
<source enclose="none">chance</source> the inverted chance for each node to execute the function.
<source enclose="none">catch_up</source> if this is set to false, the time when the node was unloaded is ignored

thus if chance is 1 and interval is 1, disabling this does nothing. if omitted, it is set to true

<source enclose="none">action</source> the function that is executed. The parameters are <source enclose="none">(pos, node, active_object_count, active_object_count_wider)</source> The object counts are useful for preventing overcrowding of spawned entities.
  • pos is the position of the node
  • node is the node
  • active_object_count is the amount of objects inside the node's mapblock
  • active_object_count_wider is the amount of objects inside the node's mapblock and its 26 neighbouring mapblocks

abms only work in active blocks,
there's the active_block_range setting telling how far blocks are active,
and abm_interval sets the Length of time between ABM execution cycles

abms begin south/west


<source> minetest.register_abm{

       label = "lava cooling",

nodenames = {"group:lava"}, neighbors = {"group:water"}, interval = 1, chance = 1, action = function(pos) minetest.set_node(pos, {name = "default:cobblestone"}) end, } </source>