From b2d2ccbcba41620f7d4d818ec125e6ed3e7093ee Mon Sep 17 00:00:00 2001 From: HybridDog Date: Wed, 3 Feb 2021 18:06:56 +0100 Subject: Remove or comment unused code and declare some variables local --- pressure_logic/abms.lua | 9 +++++---- pressure_logic/flowable_node_registry_install.lua | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'pressure_logic') diff --git a/pressure_logic/abms.lua b/pressure_logic/abms.lua index 083d8c3..47e8949 100644 --- a/pressure_logic/abms.lua +++ b/pressure_logic/abms.lua @@ -29,7 +29,7 @@ end -local formatvec = function(vec) local sep="," return "("..tostring(vec.x)..sep..tostring(vec.y)..sep..tostring(vec.z)..")" end +--~ local formatvec = function(vec) local sep="," return "("..tostring(vec.x)..sep..tostring(vec.y)..sep..tostring(vec.z)..")" end @@ -69,11 +69,13 @@ end -- logging is unreliable when something is crashing... +--[[ local nilexplode = function(caller, label, value) if value == nil then error(caller..": "..label.." was nil") end end +--]] @@ -185,13 +187,12 @@ flowlogic.balance_pressure = function(pos, node, currentpressure) -- local dname = "flowlogic.balance_pressure()@"..formatvec(pos).." " -- check the pressure of all nearby flowable nodes, and average it out. - -- pressure handles to average over - local connections = {} -- unconditionally include self in nodes to average over. -- result of averaging will be returned as new pressure for main flow logic callback local totalv = currentpressure local totalc = 1 + -- pressure handles to average over local connections = get_neighbour_positions(pos, node) -- for each neighbour, add neighbour's pressure to the total to balance out @@ -287,7 +288,7 @@ flowlogic.run_output = function(pos, node, currentpressure, oldpressure, outputd local upper = outputdef.upper local lower = outputdef.lower local result = currentpressure - local threshold = nil + local threshold if finitemode then threshold = lower else threshold = upper end if currentpressure > threshold then local takenpressure = outputdef.outputfn(pos, node, currentpressure, finitemode) diff --git a/pressure_logic/flowable_node_registry_install.lua b/pressure_logic/flowable_node_registry_install.lua index 0ad00a6..7f671a8 100644 --- a/pressure_logic/flowable_node_registry_install.lua +++ b/pressure_logic/flowable_node_registry_install.lua @@ -26,8 +26,8 @@ local insertbase = function(nodename) end local regwarning = function(kind, nodename) - local tail = "" - if pipeworks.toggles.pipe_mode ~= "pressure" then tail = " but pressure logic not enabled" end + --~ local tail = "" + --~ if pipeworks.toggles.pipe_mode ~= "pressure" then tail = " but pressure logic not enabled" end --pipeworks.logger(kind.." flow logic registry requested for "..nodename..tail) end -- cgit v1.2.3