Use "register_lbm" with "run_at_every_load" instead of...

..."register_abm" to save resources. Suggested by bell07: https://forum.minetest.net/viewtopic.php?p=325519#p325519
This commit is contained in:
Jordan Irwin 2021-05-27 20:42:04 -07:00
parent 6b50d1c52a
commit 2c127af4af
3 changed files with 11 additions and 7 deletions

View File

@ -1,3 +1,2 @@
TODO: TODO:
- use register_lbm with run_at_every_load instead of register_abm ( https://forum.minetest.net/viewtopic.php?p=325519#p325519 )

View File

@ -1,4 +1,9 @@
v1.1
----
- uses "register_lbm" with "run_at_every_load" instead of "register_abm" to save resources
- suggested by bell07 ( https://forum.minetest.net/viewtopic.php?p=325519#p325519 )
v1.0 v1.0
---- ----
- changed license to MIT - changed license to MIT

View File

@ -56,10 +56,10 @@ for _, n in ipairs(n_list.remove) do
}) })
end end
core.register_abm({ core.register_lbm({
name = "cleaner:remove_nodes",
nodenames = {"group:to_remove"}, nodenames = {"group:to_remove"},
interval = 1, run_at_every_load = true,
chance = 1,
action = function(pos, node) action = function(pos, node)
core.remove_node(pos) core.remove_node(pos)
end, end,
@ -73,10 +73,10 @@ for n_old, n_new in pairs(n_list.replace) do
}) })
end end
core.register_abm({ core.register_lbm({
name = "cleaner:replace_nodes",
nodenames = {"group:to_replace"}, nodenames = {"group:to_replace"},
interval = 1, run_at_every_load = true,
chance = 1,
action = function(pos, node) action = function(pos, node)
core.remove_node(pos) core.remove_node(pos)