Rename a few functions and change open_box signature
This commit is contained in:
parent
9eaabbf5ae
commit
cd16ec77c3
@ -590,12 +590,13 @@ minetest.register_globalstep(function(dtime)
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
function boxes.start_box(player, box_data)
|
function boxes.open_box(player, box_id)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
if players_in_boxes[name] ~= nil then
|
if players_in_boxes[name] ~= nil then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local box_data = db.box_get_data(box_id)
|
||||||
local box = boxes.read_box(box_data)
|
local box = boxes.read_box(box_data)
|
||||||
local lobby_spawn = boxes.read_box(entry_lobby_data)
|
local lobby_spawn = boxes.read_box(entry_lobby_data)
|
||||||
local lobby_exit = boxes.read_box(exit_lobby_data)
|
local lobby_exit = boxes.read_box(exit_lobby_data)
|
||||||
@ -629,7 +630,7 @@ function boxes.start_box(player, box_data)
|
|||||||
boxes.open_exit(player)
|
boxes.open_exit(player)
|
||||||
end
|
end
|
||||||
|
|
||||||
function boxes.end_box(player)
|
function boxes.close_box(player)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
if players_in_boxes[name] == nil then
|
if players_in_boxes[name] == nil then
|
||||||
return
|
return
|
||||||
@ -642,7 +643,7 @@ function boxes.end_box(player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_on_leaveplayer(function(player)
|
minetest.register_on_leaveplayer(function(player)
|
||||||
boxes.end_box(player)
|
boxes.close_box(player)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
minetest.register_chatcommand("enter", {
|
minetest.register_chatcommand("enter", {
|
||||||
@ -659,7 +660,7 @@ minetest.register_chatcommand("enter", {
|
|||||||
if not data then
|
if not data then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
boxes.start_box(player, data)
|
boxes.open_box(player, id)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -669,7 +670,7 @@ minetest.register_chatcommand("leave", {
|
|||||||
privs = {server = true},
|
privs = {server = true},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local player = minetest.get_player_by_name(name)
|
local player = minetest.get_player_by_name(name)
|
||||||
boxes.end_box(player)
|
boxes.close_box(player)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user