diff options
| author | thetaepsilon-gamedev <thetaepsilon-gamedev@noreply.users.github.com> | 2017-10-15 18:18:48 +0100 | 
|---|---|---|
| committer | thetaepsilon-gamedev <thetaepsilon-gamedev@noreply.users.github.com> | 2017-10-15 18:18:48 +0100 | 
| commit | 30bedbfecc57f515f3c8578e225e27671e52316b (patch) | |
| tree | 011f49ffd45455c86022e79dd2207f9ec002de42 | |
| parent | edbb3aace9870404f92e13d808d7eeea5b16c400 (diff) | |
new flow logic: abms.lua: hoist simple flowable neighbour calculation into if-block in preparation for directional flowables support
| -rw-r--r-- | new_flow_logic/abms.lua | 11 | 
1 files changed, 10 insertions, 1 deletions
| diff --git a/new_flow_logic/abms.lua b/new_flow_logic/abms.lua index 38ae4b6..0b0b799 100644 --- a/new_flow_logic/abms.lua +++ b/new_flow_logic/abms.lua @@ -131,8 +131,17 @@ flowlogic.balance_pressure = function(pos, node, currentpressure)  	local totalv = currentpressure  	local totalc = 1 +	-- get list of node neighbours. +	-- if this node is directional and only flows on certain sides, +	-- invoke the callback to retrieve the set. +	-- for simple flowables this is just an auto-gen'd list of all six possible neighbours. +	local candidates = {} +	if pipeworks.flowables.list.simple[node.name] then +		candidates = make_coords_offsets(pos, false) +	end +  	-- then handle neighbours, but if not a pressure node don't consider them at all -	for _, npos in ipairs(make_coords_offsets(pos, false)) do +	for _, npos in ipairs(candidates) do  		local nodename = minetest.get_node(npos).name  		-- for now, just check if it's in the simple table.  		-- TODO: the "can flow from" logic in flowable_node_registry.lua | 
