Fixed the chest id generation
parent
ecb1e283ec
commit
bfbac33a9d
|
@ -10,6 +10,20 @@ end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function skywars.generate_chest_id(arena)
|
||||||
|
local max_id = 1
|
||||||
|
|
||||||
|
for i = 1, #arena.chests do
|
||||||
|
if arena.chests[i].id > max_id then
|
||||||
|
max_id = arena.chests[i].id
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return max_id+1
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function fill_chests(arena)
|
function fill_chests(arena)
|
||||||
for i, chest in pairs(arena.chests) do
|
for i, chest in pairs(arena.chests) do
|
||||||
local treasures = skywars.select_random_treasures(chest, arena)
|
local treasures = skywars.select_random_treasures(chest, arena)
|
||||||
|
|
|
@ -385,8 +385,7 @@ ChatCmdBuilder.new("skywars", function(cmd)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local chest_id = 1
|
local chest_id = skywars.generate_chest_id(arena)
|
||||||
if arena.chests[#arena.chests] then chest_id = arena.chests[#arena.chests].id+1 end
|
|
||||||
local chest =
|
local chest =
|
||||||
{
|
{
|
||||||
pos = pos,
|
pos = pos,
|
||||||
|
|
Loading…
Reference in New Issue