mirror of
https://github.com/minetest-mods/mesecons.git
synced 2024-08-20 13:04:10 +02:00
Do not send action_off signal when newly placing nodes, this didn't
cause any bugs, but unneccessary sounds (experimental change)
This commit is contained in:
parent
a895715720
commit
30468b09cf
@ -28,13 +28,11 @@ mesecon.on_placenode = function (pos, node)
|
|||||||
-- Effectors: Send changesignal and activate or deactivate
|
-- Effectors: Send changesignal and activate or deactivate
|
||||||
if mesecon.is_effector(node.name) then
|
if mesecon.is_effector(node.name) then
|
||||||
local powered_rules = {}
|
local powered_rules = {}
|
||||||
local unpowered_rules = {}
|
|
||||||
|
|
||||||
-- for each input rule, check if powered
|
-- for each input rule, check if powered
|
||||||
for _, r in ipairs(mesecon.effector_get_rules(node)) do
|
for _, r in ipairs(mesecon.effector_get_rules(node)) do
|
||||||
local powered = mesecon.is_powered(pos, r)
|
local powered = mesecon.is_powered(pos, r)
|
||||||
if powered then table.insert(powered_rules, r)
|
if powered then table.insert(powered_rules, r) end
|
||||||
else table.insert(unpowered_rules, r) end
|
|
||||||
|
|
||||||
local state = powered and mesecon.state.on or mesecon.state.off
|
local state = powered and mesecon.state.on or mesecon.state.off
|
||||||
mesecon.changesignal(pos, node, r, state, 1)
|
mesecon.changesignal(pos, node, r, state, 1)
|
||||||
@ -44,10 +42,6 @@ mesecon.on_placenode = function (pos, node)
|
|||||||
for _, r in ipairs(powered_rules) do
|
for _, r in ipairs(powered_rules) do
|
||||||
mesecon.activate(pos, node, r, 1)
|
mesecon.activate(pos, node, r, 1)
|
||||||
end
|
end
|
||||||
else
|
|
||||||
for _, r in ipairs(unpowered_rules) do
|
|
||||||
mesecon.deactivate(pos, node, r, 1)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user