summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dispatcherfw.lua3
-rw-r--r--doors.lua11
2 files changed, 11 insertions, 3 deletions
diff --git a/dispatcherfw.lua b/dispatcherfw.lua
index 9b0a23b..208b755 100644
--- a/dispatcherfw.lua
+++ b/dispatcherfw.lua
@@ -240,6 +240,7 @@ local function estimatetraveltime(carid,src,dest)
end
local function buildstopsequence(carid,startfloor,direction,target,targetdir,leaving)
+ if not startfloor then return {} end
local carcalls = cartorealfloor(carid,mem.carstatus[carid].carcalls)
local upcalls = cartorealfloor(carid,mem.carstatus[carid].upcalls)
local dncalls = cartorealfloor(carid,mem.carstatus[carid].dncalls)
@@ -258,7 +259,9 @@ local function buildstopsequence(carid,startfloor,direction,target,targetdir,lea
end
repeat
local src = carpos
+ if not src then return sequence end
carpos,direction = predictnextstop(carid,carpos,direction,carcalls,upcalls,dncalls,leaving)
+ if not carpos then return sequence end
carcalls[carpos] = nil
if direction == "up" then
upcalls[carpos] = nil
diff --git a/doors.lua b/doors.lua
index 75cbb8b..f16ced8 100644
--- a/doors.lua
+++ b/doors.lua
@@ -646,12 +646,17 @@ function celevator.doors.carstep(dtime)
end
if data.time >= math.pi then
for _,ref in ipairs(celevator.doors.erefs[hash]) do
- ref:set_velocity(vector.new(0,0,0))
+ ref:remove()
end
- celevator.get_meta(data.positions[1]):set_string("doorstate","closed")
+ local carmeta = celevator.get_meta(data.positions[1])
+ carmeta:set_string("doorstate","closed")
cardoors_moving[hash] = nil
local cartimer = minetest.get_node_timer(data.positions[1])
cartimer:stop()
+ local fdir = minetest.facedir_to_dir(minetest.get_node(data.positions[1]).param2)
+ local doortype = carmeta:get_string("doortype")
+ if (not doortype) or doortype == "" then doortype = "glass" end
+ celevator.doors.spawncardoors(data.positions[1],fdir,doortype)
end
end
else
@@ -738,7 +743,7 @@ function celevator.doors.caropen(pos)
}
local erefs = {}
for _,dpos in ipairs(positions) do
- local objs = minetest.get_objects_inside_radius(dpos,0.1)
+ local objs = minetest.get_objects_inside_radius(dpos,0.5)
for _,obj in pairs(objs) do
if obj:get_luaentity() and obj:get_luaentity().name == "celevator:car_door" then
table.insert(erefs,obj)