1
0
mirror of https://github.com/mt-mods/pipeworks.git synced 2025-06-28 06:20:29 +02:00

pressure logic/flowable node registry: move pump directionality code to dedicated fixed vertical helper

This commit is contained in:
thetaepsilon-gamedev
2017-10-18 21:19:59 +01:00
parent 7b141fb0ea
commit 7f7dfb79d5
2 changed files with 15 additions and 7 deletions

View File

@ -52,6 +52,20 @@ register.directional = function(nodename, neighbourfn, directionfn)
regwarning("directional", nodename)
end
-- register a node as a directional flowable that can only flow through either the top or bottom side.
-- used for fountainheads (bottom side) and pumps (top side).
-- this is in world terms, not facedir relative!
register.directional_vertical_fixed = function(nodename, topside)
local y
if topside then y = 1 else y = -1 end
local side = { x=0, y=y, z=0 }
local neighbourfn = function(node) return { side } end
local directionfn = function(node, direction)
return vector.equals(direction, side)
end
register.directional(nodename, neighbourfn, directionfn)
end
local checkbase = function(nodename)