use one ABM for blinkyplant instead of two.

using two ABMs allows the engine to desynchronize them, which makes the
duty cycle unpredictable.
This commit is contained in:
Vanessa Ezekowitz 2014-09-01 20:59:28 -04:00
parent 0c62545a3a
commit 1ebd50ac75

View File

@ -77,26 +77,21 @@ minetest.register_craft({
} }
}) })
minetest.register_abm( minetest.register_abm({
{nodenames = {"mesecons_blinkyplant:blinky_plant_off"}, nodenames = {
"mesecons_blinkyplant:blinky_plant_off",
"mesecons_blinkyplant:blinky_plant_on"
},
interval = BLINKY_PLANT_INTERVAL, interval = BLINKY_PLANT_INTERVAL,
chance = 1, chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
--minetest.remove_node(pos) if node.name == "mesecons_blinkyplant:blinky_plant_off" then
minetest.add_node(pos, {name="mesecons_blinkyplant:blinky_plant_on"}) minetest.add_node(pos, {name="mesecons_blinkyplant:blinky_plant_on"})
else
minetest.add_node(pos, {name="mesecons_blinkyplant:blinky_plant_off"})
end
nodeupdate(pos) nodeupdate(pos)
mesecon:receptor_on(pos) mesecon:receptor_on(pos)
end, end,
}) })
minetest.register_abm({
nodenames = {"mesecons_blinkyplant:blinky_plant_on"},
interval = BLINKY_PLANT_INTERVAL,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
--minetest.remove_node(pos)
minetest.add_node(pos, {name="mesecons_blinkyplant:blinky_plant_off"})
nodeupdate(pos)
mesecon:receptor_off(pos)
end,
})