From f96ac5dcd9e09041060ad56d13b105440fe76212 Mon Sep 17 00:00:00 2001 From: Beha Date: Tue, 7 Mar 2017 14:02:47 -0500 Subject: Improved falling. --- init.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'init.lua') diff --git a/init.lua b/init.lua index 657c77c..1a6b0b4 100644 --- a/init.lua +++ b/init.lua @@ -145,7 +145,7 @@ local function unbuild(pos, add) p2.y = p2.y + add local motorhash = locate_motor(p2) build_motor(motorhash) - if boxes[motorhash] and minetest.string_to_pos(motorhash).y >= boxes[motorhash]:getpos().y then + if boxes[motorhash] and p2.y >= boxes[motorhash]:getpos().y then boxes[motorhash] = nil end end, table.copy(pos)) @@ -175,6 +175,7 @@ for _,mode in ipairs({"on", "off"}) do local nodename = "elevator:elevator_"..mode local on = (mode == "on") local box +local cbox if on then box = { @@ -186,6 +187,8 @@ if on then { -0.5,-0.5,-0.5,0.5,-0.48, 0.5}, { -0.5, 1.45,-0.5,0.5, 1.5, 0.5}, } + cbox = box + cbox[5] = nil else box = { @@ -202,6 +205,7 @@ else --{ -0.5,-0.5,-0.5,0.5,-0.48, 0.5}, --{ -0.5, 1.45,-0.5,0.5, 1.5, 0.5}, } + cbox = box end minetest.register_node(nodename, { description = "Elevator", @@ -220,7 +224,7 @@ minetest.register_node(nodename, { collision_box = { type = "fixed", - fixed = box, + fixed = cbox, }, node_box = { -- cgit v1.2.3