summaryrefslogtreecommitdiff
path: root/castle_gates/gate_functions.lua
diff options
context:
space:
mode:
authorVanessa Dannenberg <vanessa.e.dannenberg@gmail.com>2018-08-22 22:28:28 -0400
committerVanessa Dannenberg <vanessa.e.dannenberg@gmail.com>2018-08-22 22:28:28 -0400
commit9c9457e1f50ebdd943695a4cce6b88fa552370f3 (patch)
tree4f6002b266179e0dd1639affffd4f09a18dfcad5 /castle_gates/gate_functions.lua
parent3c47f229fcbdb7cad28bacbc579516bf3ecf6c03 (diff)
downloaddreambuilder_modpack-9c9457e1f50ebdd943695a4cce6b88fa552370f3.tar
dreambuilder_modpack-9c9457e1f50ebdd943695a4cce6b88fa552370f3.tar.gz
dreambuilder_modpack-9c9457e1f50ebdd943695a4cce6b88fa552370f3.tar.bz2
dreambuilder_modpack-9c9457e1f50ebdd943695a4cce6b88fa552370f3.tar.xz
dreambuilder_modpack-9c9457e1f50ebdd943695a4cce6b88fa552370f3.zip
update castles modpack, blox, bobblocks, coloredwood, technic,
gloopblocks, homedecor, ilights, led marquee, plasticbox, solidcolor, stained_glass, unified bricks, and unified dyes In most of these, the update is to shift over to the new "old" coloring paradigm in Unified Dyes. See its forum thread for details.
Diffstat (limited to 'castle_gates/gate_functions.lua')
-rw-r--r--castle_gates/gate_functions.lua15
1 files changed, 7 insertions, 8 deletions
diff --git a/castle_gates/gate_functions.lua b/castle_gates/gate_functions.lua
index 5d1e6b7..4a3c7f7 100644
--- a/castle_gates/gate_functions.lua
+++ b/castle_gates/gate_functions.lua
@@ -153,9 +153,9 @@ local get_door_layout = function(pos, facedir, player)
local test_node_def = minetest.registered_nodes[test_node.name]
can_slide_to:set_pos(test_pos, test_node_def.buildable_to == true)
- if test_node_def.paramtype2 == "facedir" then -- prospective door nodes need to be of type facedir
+ if test_node_def.paramtype2 == "facedir" then
local test_node_dirs = get_dirs(test_node.param2)
- local coplanar = vector.equals(test_node_dirs.back, door.directions.back) -- the "back" vector needs to point in the same direction as the rest of the door
+ local coplanar = vector.equals(test_node_dirs.back, door.directions.back)
if castle_gate_group_value == nil and test_node_def.groups.castle_gate ~= nil then
castle_gate_group_value = test_node_def.groups.castle_gate -- read the group value from the first gate node encountered
@@ -163,18 +163,17 @@ local get_door_layout = function(pos, facedir, player)
if coplanar and test_node_def.groups.castle_gate == castle_gate_group_value then
local entry = {["pos"] = test_pos, ["node"] = test_node}
- table.insert(door.all, entry) -- it's definitely a gate node of some sort.
- if test_node_def._gate_hinge ~= nil then -- it's a hinge type of node, need to do extra work
+ table.insert(door.all, entry)
+ if test_node_def._gate_hinge ~= nil then
local axis, placement = interpret_hinge(test_node_def._gate_hinge, test_pos, test_node_dirs)
- if door.hinge == nil then -- this is the first hinge we've encountered.
+ if door.hinge == nil then
door.hinge = {axis=axis, placement=placement}
- door.directions = test_node_dirs -- force the door as a whole to use the same reference frame as the first hinge
- elseif door.hinge.axis ~= axis then -- there was a previous hinge. Do they rotate on the same axis?
+ elseif door.hinge.axis ~= axis then
return nil -- Misaligned hinge axes, door cannot rotate.
else
local axis_dir = {x=0, y=0, z=0}
axis_dir[axis] = 1
- local displacement = vector.normalize(vector.subtract(placement, door.hinge.placement)) -- check if this new hinge is displaced relative to the first hinge on any axis other than the rotation axis
+ local displacement = vector.normalize(vector.subtract(placement, door.hinge.placement))
if not (vector.equals(displacement, axis_dir) or vector.equals(displacement, vector.multiply(axis_dir, -1))) then
return nil -- Misaligned hinge offset, door cannot rotate.
end