Skip to content

Commit

Permalink
Use "register_lbm" with "run_at_every_load" instead of...
Browse files Browse the repository at this point in the history
..."register_abm" to save resources. Suggested by bell07: https://forum.minetest.net/viewtopic.php?p=325519#p325519
  • Loading branch information
AntumDeluge committed May 28, 2021
1 parent 6b50d1c commit 2c127af
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
1 change: 0 additions & 1 deletion TODO.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@

TODO:
- use register_lbm with run_at_every_load instead of register_abm ( https://forum.minetest.net/viewtopic.php?p=325519#p325519 )
5 changes: 5 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -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
----
- changed license to MIT
Expand Down
12 changes: 6 additions & 6 deletions nodes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ for _, n in ipairs(n_list.remove) do
})
end

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

core.register_abm({
core.register_lbm({
name = "cleaner:replace_nodes",
nodenames = {"group:to_replace"},
interval = 1,
chance = 1,
run_at_every_load = true,
action = function(pos, node)
core.remove_node(pos)

Expand Down

0 comments on commit 2c127af

Please sign in to comment.