From e6b55028fc9b6a50ecd6c28c2af1ee94e041edcd Mon Sep 17 00:00:00 2001 From: thetaepsilon-gamedev Date: Sun, 1 Oct 2017 17:36:03 +0100 Subject: [PATCH] move pump flow logic registration to devices.lua --- devices.lua | 5 +++++ new_flow_logic/register_local_pipes.lua | 6 +++--- pipes.lua | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/devices.lua b/devices.lua index 26df862..670ed6c 100644 --- a/devices.lua +++ b/devices.lua @@ -1,3 +1,4 @@ +local new_flow_logic_register = pipeworks.flowables.register -- rotation handlers @@ -163,6 +164,10 @@ for s in ipairs(states) do -- FIXME - does this preserve metadata? need to look at this on_rotate = screwdriver.rotate_simple }) + new_flow_logic_register.simple(pumpname) + if states[s] ~= "off" then + new_flow_logic_register.intake_simple(pumpname, 2) + end local nodename_valve_empty = "pipeworks:valve_"..states[s].."_empty" minetest.register_node(nodename_valve_empty, { diff --git a/new_flow_logic/register_local_pipes.lua b/new_flow_logic/register_local_pipes.lua index 5128d47..005a812 100644 --- a/new_flow_logic/register_local_pipes.lua +++ b/new_flow_logic/register_local_pipes.lua @@ -40,12 +40,12 @@ if pipeworks.enable_pipes then ]] if pipeworks.enable_pipe_devices then - register.simple(pump_off) - register.simple(pump_on) + --register.simple(pump_off) + --register.simple(pump_on) register.simple(spigot_on) register.simple(spigot_off) - register.intake_simple(pump_on, thresholds.pump_pressure) + --register.intake_simple(pump_on, thresholds.pump_pressure) -- TODO: the code doesn't currently care if the spigot is the visually flowing node or not. -- So some mechanism to register on/off states would be nice register.output(spigot_off, thresholds.spigot_min, flowlogic.helpers.output_spigot) diff --git a/pipes.lua b/pipes.lua index 80fb0b3..d907160 100644 --- a/pipes.lua +++ b/pipes.lua @@ -195,6 +195,7 @@ local valve_on = "pipeworks:valve_on_empty" local valve_off = "pipeworks:valve_off_empty" local entry_panel_empty = "pipeworks:entry_panel_empty" local flow_sensor_empty = "pipeworks:flow_sensor_empty" +-- XXX: why aren't these in devices.lua!? table.insert(pipes_empty_nodenames, valve_on) table.insert(pipes_empty_nodenames, valve_off) table.insert(pipes_empty_nodenames, entry_panel_empty)