migrate flowable registration for valve nodes to devices.lua

This commit is contained in:
thetaepsilon-gamedev 2017-10-01 18:05:44 +01:00
parent e6b55028fc
commit a1fc493de1
2 changed files with 13 additions and 3 deletions

View File

@ -164,6 +164,7 @@ for s in ipairs(states) do
-- FIXME - does this preserve metadata? need to look at this
on_rotate = screwdriver.rotate_simple
})
-- FIXME: currently a simple flow device, but needs directionality checking
new_flow_logic_register.simple(pumpname)
if states[s] ~= "off" then
new_flow_logic_register.intake_simple(pumpname, 2)
@ -208,6 +209,12 @@ for s in ipairs(states) do
end,
on_rotate = pipeworks.fix_after_rotation
})
-- only register flow logic for the "on" ABM.
-- this means that the off state automatically blocks flow by not participating in the balancing operation.
if states[s] ~= "off" then
-- FIXME: this still a simple device, directionality not honoured
new_flow_logic_register.simple(nodename_valve_empty)
end
end
local nodename_valve_loaded = "pipeworks:valve_on_loaded"
@ -249,6 +256,12 @@ minetest.register_node(nodename_valve_loaded, {
end,
on_rotate = pipeworks.fix_after_rotation
})
-- register this the same as the on-but-empty variant, so existing nodes of this type work also.
-- note that as new_flow_logic code does not distinguish empty/full in node states,
-- right-clicking a "loaded" valve (becoming an off valve) then turning it on again will yield a on-but-empty valve,
-- but the flow logic will still function.
-- thus under new_flow_logic this serves as a kind of migration.
new_flow_logic_register.simple(nodename_valve_loaded)
-- grating

View File

@ -200,8 +200,6 @@ table.insert(pipes_empty_nodenames, valve_on)
table.insert(pipes_empty_nodenames, valve_off)
table.insert(pipes_empty_nodenames, entry_panel_empty)
table.insert(pipes_empty_nodenames, flow_sensor_empty)
new_flow_logic_register.simple(valve_on)
-- don't register valve_off, automatically makes it block flow in the new logic
new_flow_logic_register.simple(entry_panel_empty)
new_flow_logic_register.simple(flow_sensor_empty)
@ -211,7 +209,6 @@ local flow_sensor_loaded = "pipeworks:flow_sensor_loaded"
table.insert(pipes_full_nodenames, valve_on_loaded)
table.insert(pipes_full_nodenames, entry_panel_loaded)
table.insert(pipes_full_nodenames, flow_sensor_loaded)
new_flow_logic_register.simple(valve_on_loaded)
new_flow_logic_register.simple(entry_panel_loaded)
new_flow_logic_register.simple(flow_sensor_loaded)