diff options
author | Vanessa Ezekowitz <vanessaezekowitz@gmail.com> | 2014-09-01 20:59:28 -0400 |
---|---|---|
committer | Vanessa Ezekowitz <vanessaezekowitz@gmail.com> | 2014-09-01 21:01:35 -0400 |
commit | 1ebd50ac75032cd8a90e54a7f1ac4a84b0c08460 (patch) | |
tree | 1e7ea884d354a32b35ce6cd91b5ec8e2b539d8a7 | |
parent | 0c62545a3a29e759c5152202244e00e5bcbd5601 (diff) | |
download | mesecons-1ebd50ac75032cd8a90e54a7f1ac4a84b0c08460.tar mesecons-1ebd50ac75032cd8a90e54a7f1ac4a84b0c08460.tar.gz mesecons-1ebd50ac75032cd8a90e54a7f1ac4a84b0c08460.tar.bz2 mesecons-1ebd50ac75032cd8a90e54a7f1ac4a84b0c08460.tar.xz mesecons-1ebd50ac75032cd8a90e54a7f1ac4a84b0c08460.zip |
use one ABM for blinkyplant instead of two.
using two ABMs allows the engine to desynchronize them, which makes the
duty cycle unpredictable.
-rw-r--r-- | mesecons_blinkyplant/init.lua | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/mesecons_blinkyplant/init.lua b/mesecons_blinkyplant/init.lua index 475d953..39dcc67 100644 --- a/mesecons_blinkyplant/init.lua +++ b/mesecons_blinkyplant/init.lua @@ -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, -}) |