diff options
author | Jeija <norrepli@gmail.com> | 2015-10-04 12:30:04 +0200 |
---|---|---|
committer | Jeija <norrepli@gmail.com> | 2015-10-04 12:30:04 +0200 |
commit | 24958e253b95da19fa47c0c6ba7990123ee7724a (patch) | |
tree | 54ea3e4889eb2bf579d42d645bafb3466bb678ea | |
parent | 0e7f68ea92b272d3cca0a1544691cab8d05a08d9 (diff) | |
download | mesecons-24958e253b95da19fa47c0c6ba7990123ee7724a.tar mesecons-24958e253b95da19fa47c0c6ba7990123ee7724a.tar.gz mesecons-24958e253b95da19fa47c0c6ba7990123ee7724a.tar.bz2 mesecons-24958e253b95da19fa47c0c6ba7990123ee7724a.tar.xz mesecons-24958e253b95da19fa47c0c6ba7990123ee7724a.zip |
Revert "Do not send action_off signal when newly placing nodes"
This caused #238, reverting that commit fixes #238.
This reverts commit 30468b09cf35b3122e05f1e2867923fdcad5a5d2.
-rw-r--r-- | mesecons/services.lua | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/mesecons/services.lua b/mesecons/services.lua index 469ab95..215fb31 100644 --- a/mesecons/services.lua +++ b/mesecons/services.lua @@ -28,11 +28,13 @@ mesecon.on_placenode = function (pos, node) -- Effectors: Send changesignal and activate or deactivate if mesecon.is_effector(node.name) then local powered_rules = {} + local unpowered_rules = {} -- for each input rule, check if powered for _, r in ipairs(mesecon.effector_get_rules(node)) do local powered = mesecon.is_powered(pos, r) - if powered then table.insert(powered_rules, r) end + if powered then table.insert(powered_rules, r) + else table.insert(unpowered_rules, r) end local state = powered and mesecon.state.on or mesecon.state.off mesecon.changesignal(pos, node, r, state, 1) @@ -42,6 +44,10 @@ mesecon.on_placenode = function (pos, node) for _, r in ipairs(powered_rules) do mesecon.activate(pos, node, r, 1) end + else + for _, r in ipairs(unpowered_rules) do + mesecon.deactivate(pos, node, r, 1) + end end end end |