some improvement if nodes not loaded
This commit is contained in:
parent
3b8f629d0f
commit
c7620656ab
@ -364,14 +364,18 @@ minetest.register_node("hyperloop:elevator_bottom", {
|
||||
end
|
||||
-- store the floor name in the global elevator list
|
||||
local floor_pos = get_floor_pos(pos)
|
||||
if floor_pos ~= nil then
|
||||
add_to_elevator_list(floor_pos, {name=floor})
|
||||
hyperloop.update_elevator(floor_pos)
|
||||
end
|
||||
-- destination selected?
|
||||
elseif fields.button ~= nil then
|
||||
local floor = get_floor_item(get_floor_pos(pos))
|
||||
if floor then
|
||||
local idx = tonumber(fields.button)
|
||||
local list = floor_list(floor.pos)
|
||||
local dest = list[#list-idx]
|
||||
if dest and dest.pos and floor.pos then
|
||||
local dist = math.abs(dest.pos.y - floor.pos.y)
|
||||
|
||||
if dist ~= 0 and floor.busy ~= true then
|
||||
@ -384,6 +388,8 @@ minetest.register_node("hyperloop:elevator_bottom", {
|
||||
minetest.after(1.0, on_travel, floor, dest, player, seconds)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
on_punch = function(pos, node, puncher, pointed_thing)
|
||||
|
Loading…
x
Reference in New Issue
Block a user