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 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'pressure_logic/abms.lua') 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) -- cgit v1.2.3