From 7f7dfb79d5f81dfe09920b8c872e1a11f22bff43 Mon Sep 17 00:00:00 2001 From: thetaepsilon-gamedev Date: Wed, 18 Oct 2017 21:19:59 +0100 Subject: pressure logic/flowable node registry: move pump directionality code to dedicated fixed vertical helper --- pressure_logic/flowable_node_registry_install.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'pressure_logic') diff --git a/pressure_logic/flowable_node_registry_install.lua b/pressure_logic/flowable_node_registry_install.lua index 3cd9c4d..d8f945b 100644 --- a/pressure_logic/flowable_node_registry_install.lua +++ b/pressure_logic/flowable_node_registry_install.lua @@ -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) -- cgit v1.2.3