pressure logic: detect vertical orientation for horizontal rotating flowables

This commit is contained in:
thetaepsilon-gamedev 2017-11-04 22:27:47 +00:00
parent ee0c276900
commit 59d9e0b97d
1 changed files with 8 additions and 2 deletions

View File

@ -67,8 +67,8 @@ register.directional_vertical_fixed = function(nodename, topside)
end end
-- register a node as a directional flowable whose accepting sides depends upon param2 rotation. -- register a node as a directional flowable whose accepting sides depends upon param2 rotation.
-- used for entry panels, valves, flow sensors and spigots, -- used for entry panels, valves, flow sensors and spigots.
-- whose facing axis is always upwards and can only rotate horizontally. -- this is mostly for legacy reasons and SHOULD NOT BE USED IN NEW CODE.
register.directional_horizonal_rotate = function(nodename, doubleended) register.directional_horizonal_rotate = function(nodename, doubleended)
local rotations = { local rotations = {
{x= 0,y= 0,z= 1}, {x= 0,y= 0,z= 1},
@ -79,6 +79,12 @@ register.directional_horizonal_rotate = function(nodename, doubleended)
local getends = function(node) local getends = function(node)
--local dname = "horizontal rotate getends() " --local dname = "horizontal rotate getends() "
local param2 = node.param2 local param2 = node.param2
-- the pipeworks nodes use a fixed value for vertical facing nodes
-- if that is detected, just return that directly.
if param2 == 17 then
return {{x=0,y=1,z=0}, {x=0,y=-1,z=0}}
end
-- the sole end of the spigot points in the direction the rotation bits suggest -- the sole end of the spigot points in the direction the rotation bits suggest
-- also note to self: lua arrays start at one... -- also note to self: lua arrays start at one...
local mainend = (param2 % 4) + 1 local mainend = (param2 % 4) + 1