From a69c5e24a9771dc1818a01092730104c62703908 Mon Sep 17 00:00:00 2001 From: thetaepsilon-gamedev Date: Tue, 17 Oct 2017 23:42:05 +0100 Subject: devices.lua: implement directionfn for pump registration --- devices.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'devices.lua') diff --git a/devices.lua b/devices.lua index f1d1dad..d9edcad 100644 --- a/devices.lua +++ b/devices.lua @@ -163,13 +163,22 @@ for s in ipairs(states) do end, on_rotate = screwdriver.rotate_simple }) + -- FIXME: this currently assumes that pumps can only rotate around the fixed axis pointing Y+. - new_flow_logic_register.directional(pumpname, function(node) return { {x=0,y=1,z=0} } end) + -- TODO: these directionality functions should be behind a helper so the fountainhead can use something similar. + local upwards = {x=0,y=1,z=0} + local neighbourfn = function(node) return { upwards } end + local directionfn = function(node, direction) + return vector.equals(direction, upwards) + end + new_flow_logic_register.directional(pumpname, neighbourfn, directionfn) local pump_drive = 4 if states[s] ~= "off" then new_flow_logic_register.intake_simple(pumpname, pump_drive) end + + local nodename_valve_empty = "pipeworks:valve_"..states[s].."_empty" minetest.register_node(nodename_valve_empty, { description = "Valve", -- cgit v1.2.3