summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2015-02-03 01:23:16 -0500
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2015-06-18 12:42:19 -0400
commitdcf65b6878da9e2927537624a4007f06948f5aa3 (patch)
treec03d3c185ed3f490382526316b46674f7712183e
parent7f94ed4c1ac06b5bbe05e87323eb90a099df321b (diff)
make flow sensor activate mesecons wires again
only swap flow sensor if it actually changes
-rw-r--r--flowing_logic.lua27
1 files changed, 26 insertions, 1 deletions
diff --git a/flowing_logic.lua b/flowing_logic.lua
index 3396a89..d89bef5 100644
--- a/flowing_logic.lua
+++ b/flowing_logic.lua
@@ -4,6 +4,22 @@
local finite_liquids = minetest.setting_getbool("liquid_finite")
local pipe_liquid_shows_loaded = 0.5
+if mesecon then
+ pipereceptor_on = {
+ receptor = {
+ state = mesecon.state.on,
+ rules = pipeworks.mesecons_rules
+ }
+ }
+
+ pipereceptor_off = {
+ receptor = {
+ state = mesecon.state.off,
+ rules = pipeworks.mesecons_rules
+ }
+ }
+end
+
-- Evaluate and balance liquid in all pipes
minetest.register_abm({
@@ -262,13 +278,22 @@ minetest.register_abm({
local sensor = string.match(node.name, "pipeworks:flow_sensor_")
local newnode = nil
+
if my_level > 1 then
newnode = sensor.."loaded"
else
newnode = sensor.."empty"
end
- if newnode then
+
+ if newnode ~= node.name then
minetest.swap_node(pos, {name = newnode, param2 = node.param2})
+ if mesecon then
+ if newnode == "pipeworks:flow_sensor_empty" then
+ mesecon.receptor_off(pos, rules)
+ else
+ mesecon.receptor_on(pos, rules)
+ end
+ end
end
end
else