use lbm for caching positions for those nodes

This commit is contained in:
HybridDog 2016-03-22 11:41:19 +01:00
parent 8f303f1b2a
commit 26e1fad5cc
3 changed files with 10 additions and 22 deletions

@ -123,10 +123,8 @@ minetest.register_craft({
{"", "moremesecons_wireless:jammer_off", ""}} {"", "moremesecons_wireless:jammer_off", ""}}
}) })
minetest.register_abm({ minetest.register_lbm({
name = "moremesecons_jammer:add_jammer",
nodenames = {"moremesecons_jammer:jammer_on"}, nodenames = {"moremesecons_jammer:jammer_on"},
interval = 5,
chance = 1,
catch_up = false,
action = add_jammer action = add_jammer
}) })

@ -73,9 +73,7 @@ minetest.register_node("moremesecons_teleporter:teleporter", {
action_on = teleport_nearest action_on = teleport_nearest
}}, }},
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
on_construct = function(pos) on_construct = register,
register(pos)
end,
on_destruct = function(pos) on_destruct = function(pos)
local RID = vector.get_data_from_pos(teleporters_rids, pos.z,pos.y,pos.x) local RID = vector.get_data_from_pos(teleporters_rids, pos.z,pos.y,pos.x)
if RID then if RID then
@ -86,12 +84,8 @@ minetest.register_node("moremesecons_teleporter:teleporter", {
}) })
minetest.register_abm({ minetest.register_lbm({
name = "moremesecons_teleporter:add_teleporter",
nodenames = {"moremesecons_teleporter:teleporter"}, nodenames = {"moremesecons_teleporter:teleporter"},
interval=5, action = register
chance=1,
catch_up = false,
action = function(pos)
register(pos)
end
}) })

@ -185,18 +185,14 @@ minetest.register_craft({
} }
}) })
minetest.register_abm({ minetest.register_lbm({
name = "moremesecons_wireless:add_jammer",
nodenames = {"moremesecons_wireless:jammer_on"}, nodenames = {"moremesecons_wireless:jammer_on"},
interval = 5,
chance = 1,
catch_up = false,
action = add_jammer action = add_jammer
}) })
minetest.register_abm({ minetest.register_lbm({
name = "moremesecons_wireless:add_wireless",
nodenames = {"moremesecons_wireless:wireless"}, nodenames = {"moremesecons_wireless:wireless"},
interval = 5,
chance = 1,
catch_up = false,
action = register_RID action = register_RID
}) })