mirror of
https://github.com/mt-mods/pipeworks.git
synced 2024-12-26 19:00:24 +01:00
new flow logic: abms.lua: hoist simple flowable neighbour calculation into if-block in preparation for directional flowables support
This commit is contained in:
parent
edbb3aace9
commit
30bedbfecc
@ -131,8 +131,17 @@ flowlogic.balance_pressure = function(pos, node, currentpressure)
|
|||||||
local totalv = currentpressure
|
local totalv = currentpressure
|
||||||
local totalc = 1
|
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
|
-- 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
|
local nodename = minetest.get_node(npos).name
|
||||||
-- for now, just check if it's in the simple table.
|
-- for now, just check if it's in the simple table.
|
||||||
-- TODO: the "can flow from" logic in flowable_node_registry.lua
|
-- TODO: the "can flow from" logic in flowable_node_registry.lua
|
||||||
|
Loading…
Reference in New Issue
Block a user