move new flow logic flag to dedicated toggles table

This commit is contained in:
thetaepsilon-gamedev 2017-10-03 20:38:56 +01:00
parent 8e53526b54
commit 894ea5174f
3 changed files with 10 additions and 8 deletions

View File

@ -17,14 +17,16 @@ dofile(pipeworks.modpath.."/default_settings.lua")
-- Read the external config file if it exists. -- Read the external config file if it exists.
-- please add any new feature toggles to be a flag in this table...
pipeworks.toggles = {}
local worldsettingspath = pipeworks.worldpath.."/pipeworks_settings.txt" local worldsettingspath = pipeworks.worldpath.."/pipeworks_settings.txt"
local worldsettingsfile = io.open(worldsettingspath, "r") local worldsettingsfile = io.open(worldsettingspath, "r")
if worldsettingsfile then if worldsettingsfile then
worldsettingsfile:close() worldsettingsfile:close()
dofile(worldsettingspath) dofile(worldsettingspath)
end end
if pipeworks.enable_new_flow_logic then if pipeworks.toggles.pressure_logic then
minetest.log("warning", "pipeworks new_flow_logic is WIP and incomplete!") minetest.log("warning", "pipeworks pressure-based logic is WIP and incomplete!")
end end
-- Random variables -- Random variables
@ -123,7 +125,7 @@ local logicdir = "/new_flow_logic/"
-- note that even with these files the new flow logic is not yet default. -- note that even with these files the new flow logic is not yet default.
-- registration will take place but no actual ABMs/node logic will be installed, -- registration will take place but no actual ABMs/node logic will be installed,
-- unless pipeworks.enable_new_flow_logic has been set. -- unless the toggle flag is specifically enabled in the per-world settings flag.
dofile(pipeworks.modpath..logicdir.."flowable_node_registry.lua") dofile(pipeworks.modpath..logicdir.."flowable_node_registry.lua")
dofile(pipeworks.modpath..logicdir.."abms.lua") dofile(pipeworks.modpath..logicdir.."abms.lua")
dofile(pipeworks.modpath..logicdir.."abm_register.lua") dofile(pipeworks.modpath..logicdir.."abm_register.lua")

View File

@ -24,7 +24,7 @@ end
local regwarning = function(kind, nodename) local regwarning = function(kind, nodename)
local tail = "" local tail = ""
if not pipeworks.enable_new_flow_logic then tail = " but new_flow_logic not enabled" end if not pipeworks.toggles.pressure_logic then tail = " but pressure logic not enabled" end
pipeworks.logger(kind.." flow logic registry requested for "..nodename..tail) pipeworks.logger(kind.." flow logic registry requested for "..nodename..tail)
end end
@ -35,7 +35,7 @@ register.simple = function(nodename)
insertbase(nodename) insertbase(nodename)
pipeworks.flowables.list.simple[nodename] = true pipeworks.flowables.list.simple[nodename] = true
table.insert(pipeworks.flowables.list.simple_nodenames, nodename) table.insert(pipeworks.flowables.list.simple_nodenames, nodename)
if pipeworks.enable_new_flow_logic then if pipeworks.toggles.pressure_logic then
abmregister.balance(nodename) abmregister.balance(nodename)
end end
regwarning("simple", nodename) regwarning("simple", nodename)
@ -54,7 +54,7 @@ register.intake_simple = function(nodename, maxpressure)
checkbase(nodename) checkbase(nodename)
pipeworks.flowables.inputs.list[nodename] = { maxpressure=maxpressure } pipeworks.flowables.inputs.list[nodename] = { maxpressure=maxpressure }
table.insert(pipeworks.flowables.inputs.nodenames, nodename) table.insert(pipeworks.flowables.inputs.nodenames, nodename)
if pipeworks.enable_new_flow_logic then if pipeworks.toggles.pressure_logic then
abmregister.input(nodename, maxpressure, pipeworks.flowlogic.check_for_liquids_v2) abmregister.input(nodename, maxpressure, pipeworks.flowlogic.check_for_liquids_v2)
end end
regwarning("simple intake", nodename) regwarning("simple intake", nodename)
@ -66,7 +66,7 @@ end
register.output = function(nodename, threshold, outputfn) register.output = function(nodename, threshold, outputfn)
checkbase(nodename) checkbase(nodename)
pipeworks.flowables.outputs.list[nodename] = { threshold=threshold, outputfn=outputfn } pipeworks.flowables.outputs.list[nodename] = { threshold=threshold, outputfn=outputfn }
if pipeworks.enable_new_flow_logic then if pipeworks.toggles.pressure_logic then
abmregister.output(nodename, threshold, outputfn) abmregister.output(nodename, threshold, outputfn)
end end
regwarning("output node", nodename) regwarning("output node", nodename)

View File

@ -213,7 +213,7 @@ pipeworks.pipes_empty_nodenames = pipes_empty_nodenames
if not pipeworks.enable_new_flow_logic then if not pipeworks.toggles.pressure_logic then