Skip to content

Commit

Permalink
use one ABM for blinkyplant instead of two.
Browse files Browse the repository at this point in the history
using two ABMs allows the engine to desynchronize them, which makes the
duty cycle unpredictable.
  • Loading branch information
Vanessa Ezekowitz committed Sep 2, 2014
1 parent 0c62545 commit 1ebd50a
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions mesecons_blinkyplant/init.lua
Expand Up @@ -77,26 +77,21 @@ minetest.register_craft({
}
})

minetest.register_abm(
{nodenames = {"mesecons_blinkyplant:blinky_plant_off"},
minetest.register_abm({
nodenames = {
"mesecons_blinkyplant:blinky_plant_off",
"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_on"})
if node.name == "mesecons_blinkyplant:blinky_plant_off" then
minetest.add_node(pos, {name="mesecons_blinkyplant:blinky_plant_on"})
else
minetest.add_node(pos, {name="mesecons_blinkyplant:blinky_plant_off"})
end
nodeupdate(pos)
mesecon:receptor_on(pos)
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,
})

0 comments on commit 1ebd50a

Please sign in to comment.