Skip to content

Commit 1ebd50a

Browse files
author
Vanessa Ezekowitz
committedSep 2, 2014
use one ABM for blinkyplant instead of two.
using two ABMs allows the engine to desynchronize them, which makes the duty cycle unpredictable.
1 parent 0c62545 commit 1ebd50a

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed
 

‎mesecons_blinkyplant/init.lua

+10-15
Original file line numberDiff line numberDiff line change
@@ -77,26 +77,21 @@ minetest.register_craft({
7777
}
7878
})
7979

80-
minetest.register_abm(
81-
{nodenames = {"mesecons_blinkyplant:blinky_plant_off"},
80+
minetest.register_abm({
81+
nodenames = {
82+
"mesecons_blinkyplant:blinky_plant_off",
83+
"mesecons_blinkyplant:blinky_plant_on"
84+
},
8285
interval = BLINKY_PLANT_INTERVAL,
8386
chance = 1,
8487
action = function(pos, node, active_object_count, active_object_count_wider)
85-
--minetest.remove_node(pos)
86-
minetest.add_node(pos, {name="mesecons_blinkyplant:blinky_plant_on"})
88+
if node.name == "mesecons_blinkyplant:blinky_plant_off" then
89+
minetest.add_node(pos, {name="mesecons_blinkyplant:blinky_plant_on"})
90+
else
91+
minetest.add_node(pos, {name="mesecons_blinkyplant:blinky_plant_off"})
92+
end
8793
nodeupdate(pos)
8894
mesecon:receptor_on(pos)
8995
end,
9096
})
9197

92-
minetest.register_abm({
93-
nodenames = {"mesecons_blinkyplant:blinky_plant_on"},
94-
interval = BLINKY_PLANT_INTERVAL,
95-
chance = 1,
96-
action = function(pos, node, active_object_count, active_object_count_wider)
97-
--minetest.remove_node(pos)
98-
minetest.add_node(pos, {name="mesecons_blinkyplant:blinky_plant_off"})
99-
nodeupdate(pos)
100-
mesecon:receptor_off(pos)
101-
end,
102-
})

0 commit comments

Comments
 (0)
Please sign in to comment.