diff options
Diffstat (limited to 'new_flow_logic')
| -rw-r--r-- | new_flow_logic/abms.lua | 15 | 
1 files changed, 15 insertions, 0 deletions
| diff --git a/new_flow_logic/abms.lua b/new_flow_logic/abms.lua index 15adcef..7a720be 100644 --- a/new_flow_logic/abms.lua +++ b/new_flow_logic/abms.lua @@ -131,6 +131,21 @@ flowlogic.helpers.make_neighbour_output_fixed = function(neighbours)  	end  end +-- complementary function to the above when using non-finite mode: +-- removes water sources from neighbor positions when the output is "off" due to lack of pressure. +flowlogic.helpers.make_neighbour_cleanup_fixed = function(neighbours) +	return function(pos, node, currentpressure) +		-- FIXME - this would indiscriminately take blocks while under-pressure, not just one time? +		for _, offset in pairs(neighbours) do +			local npos = vector.add(pos, offset) +			local name = minetest.get_node(npos).name +			if (name == "default:water_source") then +				minetest.remove_node(pos) +			end +		end +	end +end +  flowlogic.run_output = function(pos, node, threshold, outputfn) | 
