temporarily move ABM registration out of register_flow_logic.lua to allow refactoring it into flowable registry
This commit is contained in:
parent
afcec82ae3
commit
d69941a0ae
@ -16,6 +16,7 @@ local pipes_full_nodenames = pipeworks.pipes_full_nodenames
|
||||
local pipes_empty_nodenames = pipeworks.pipes_empty_nodenames
|
||||
|
||||
local register = pipeworks.flowables.register
|
||||
local abmregister = pipeworks.flowlogic.abmregister
|
||||
|
||||
|
||||
|
||||
@ -29,9 +30,11 @@ local spigot_on = "pipeworks:spigot_pouring"
|
||||
if pipeworks.enable_pipes then
|
||||
for _, pipe in ipairs(pipes_full_nodenames) do
|
||||
register.simple(pipe)
|
||||
abmregister.balance(pipe)
|
||||
end
|
||||
for _, pipe in ipairs(pipes_empty_nodenames) do
|
||||
register.simple(pipe)
|
||||
abmregister.balance(pipe)
|
||||
end
|
||||
|
||||
if pipeworks.enable_pipe_devices then
|
||||
@ -39,7 +42,12 @@ if pipeworks.enable_pipes then
|
||||
register.simple(pump_on)
|
||||
register.simple(spigot_on)
|
||||
register.simple(spigot_off)
|
||||
abmregister.balance(pump_off)
|
||||
abmregister.balance(pump_on)
|
||||
abmregister.balance(spigot_on)
|
||||
abmregister.balance(spigot_off)
|
||||
|
||||
register.intake_simple(pump_on, thresholds.pump_pressure)
|
||||
abmregister.input(pump_on, thresholds.pump_pressure)
|
||||
end
|
||||
end
|
||||
|
2
init.lua
2
init.lua
@ -124,8 +124,8 @@ if pipeworks.enable_pipe_devices then dofile(pipeworks.modpath.."/devices.lua")
|
||||
-- individual enable flags also checked in flowable_nodes_add_pipes.lua
|
||||
if pipeworks.enable_new_flow_logic then
|
||||
dofile(pipeworks.modpath.."/new_flow_logic.lua")
|
||||
dofile(pipeworks.modpath.."/flowable_nodes_add_pipes.lua")
|
||||
dofile(pipeworks.modpath.."/register_flow_logic.lua")
|
||||
dofile(pipeworks.modpath.."/flowable_nodes_add_pipes.lua")
|
||||
end
|
||||
|
||||
if pipeworks.enable_redefines then
|
||||
|
@ -8,21 +8,8 @@ pipeworks.flowlogic.abmregister = register
|
||||
|
||||
|
||||
|
||||
-- note that checking for feature toggles (because otherwise certain pipes aren't define)
|
||||
-- is now done by flowable_nodes_add_pipes.lua
|
||||
--[[
|
||||
if pipeworks.enable_pipes then
|
||||
minetest.register_abm({
|
||||
nodenames = pipes_all_nodenames,
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
pipeworks.balance_pressure(pos, node)
|
||||
end
|
||||
})
|
||||
end
|
||||
]]
|
||||
|
||||
-- register a node name for the pressure balancing ABM.
|
||||
-- currently this only exists as a per-node function to allow nodes to be registered outside pipeworks.
|
||||
local register_abm_balance = function(nodename)
|
||||
minetest.register_abm({
|
||||
nodenames = { nodename },
|
||||
@ -34,11 +21,10 @@ local register_abm_balance = function(nodename)
|
||||
})
|
||||
end
|
||||
register.balance = register_abm_balance
|
||||
for nodename, _ in pairs(pipeworks.flowables.list.simple) do
|
||||
register_abm_balance(nodename)
|
||||
end
|
||||
|
||||
local register_abm_input = function(nodename, properties)
|
||||
-- register a node for the pump ABM.
|
||||
-- maxpressure is the maximum pressure that this pump can drive.
|
||||
local register_abm_input = function(nodename, maxpressure)
|
||||
minetest.register_abm({
|
||||
nodenames = { nodename },
|
||||
interval = 1,
|
||||
@ -50,15 +36,7 @@ local register_abm_input = function(nodename, properties)
|
||||
end
|
||||
register.input = register_abm_input
|
||||
|
||||
if pipeworks.enable_pipe_devices then
|
||||
-- absorb water into pumps if it'll fit
|
||||
for nodename, properties in pairs(pipeworks.flowables.inputs.list) do
|
||||
register_abm_input(nodename, properties)
|
||||
end
|
||||
|
||||
-- output water from spigots
|
||||
-- add both "on/off" spigots so one can be used to indicate a certain level of fluid.
|
||||
-- temp. disabled as the node names were moved to flowable_node_add_pipes.lua
|
||||
-- old spigot ABM code, not yet migrated
|
||||
--[[
|
||||
minetest.register_abm({
|
||||
nodenames = { spigot_on, spigot_off },
|
||||
@ -69,4 +47,3 @@ if pipeworks.enable_pipe_devices then
|
||||
end
|
||||
})
|
||||
]]
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user