move pump flow logic registration to devices.lua

This commit is contained in:
thetaepsilon-gamedev 2017-10-01 17:36:03 +01:00
parent caacc2a261
commit e6b55028fc
3 changed files with 9 additions and 3 deletions

View File

@ -1,3 +1,4 @@
local new_flow_logic_register = pipeworks.flowables.register
-- rotation handlers -- rotation handlers
@ -163,6 +164,10 @@ for s in ipairs(states) do
-- FIXME - does this preserve metadata? need to look at this -- FIXME - does this preserve metadata? need to look at this
on_rotate = screwdriver.rotate_simple 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" local nodename_valve_empty = "pipeworks:valve_"..states[s].."_empty"
minetest.register_node(nodename_valve_empty, { minetest.register_node(nodename_valve_empty, {

View File

@ -40,12 +40,12 @@ if pipeworks.enable_pipes then
]] ]]
if pipeworks.enable_pipe_devices then if pipeworks.enable_pipe_devices then
register.simple(pump_off) --register.simple(pump_off)
register.simple(pump_on) --register.simple(pump_on)
register.simple(spigot_on) register.simple(spigot_on)
register.simple(spigot_off) 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. -- 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 -- So some mechanism to register on/off states would be nice
register.output(spigot_off, thresholds.spigot_min, flowlogic.helpers.output_spigot) register.output(spigot_off, thresholds.spigot_min, flowlogic.helpers.output_spigot)

View File

@ -195,6 +195,7 @@ local valve_on = "pipeworks:valve_on_empty"
local valve_off = "pipeworks:valve_off_empty" local valve_off = "pipeworks:valve_off_empty"
local entry_panel_empty = "pipeworks:entry_panel_empty" local entry_panel_empty = "pipeworks:entry_panel_empty"
local flow_sensor_empty = "pipeworks:flow_sensor_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_on)
table.insert(pipes_empty_nodenames, valve_off) table.insert(pipes_empty_nodenames, valve_off)
table.insert(pipes_empty_nodenames, entry_panel_empty) table.insert(pipes_empty_nodenames, entry_panel_empty)