diff options
author | thetaepsilon-gamedev <thetaepsilon-gamedev@noreply.users.github.com> | 2017-10-17 23:42:05 +0100 |
---|---|---|
committer | thetaepsilon-gamedev <thetaepsilon-gamedev@noreply.users.github.com> | 2017-10-17 23:42:05 +0100 |
commit | a69c5e24a9771dc1818a01092730104c62703908 (patch) | |
tree | cdd62519a4298b635525bf1e8bb7c2b794b511ba | |
parent | 0a4d15d26ecc33315a5d088eace532ca3e539bbb (diff) | |
download | pipeworks-a69c5e24a9771dc1818a01092730104c62703908.tar pipeworks-a69c5e24a9771dc1818a01092730104c62703908.tar.gz pipeworks-a69c5e24a9771dc1818a01092730104c62703908.tar.bz2 pipeworks-a69c5e24a9771dc1818a01092730104c62703908.tar.xz pipeworks-a69c5e24a9771dc1818a01092730104c62703908.zip |
devices.lua: implement directionfn for pump registration
-rw-r--r-- | devices.lua | 11 |
1 files changed, 10 insertions, 1 deletions
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", |