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)
|
||||
for i, chest in pairs(arena.chests) do
|
||||
local treasures = skywars.select_random_treasures(chest, arena)
|
||||
|
|
|
@ -385,8 +385,7 @@ ChatCmdBuilder.new("skywars", function(cmd)
|
|||
return
|
||||
end
|
||||
|
||||
local chest_id = 1
|
||||
if arena.chests[#arena.chests] then chest_id = arena.chests[#arena.chests].id+1 end
|
||||
local chest_id = skywars.generate_chest_id(arena)
|
||||
local chest =
|
||||
{
|
||||
pos = pos,
|
||||
|
|
Loading…
Reference in New Issue