1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-02-05 13:15:03 +02:00

fix laggy module

This commit is contained in:
Gerkiz 2022-04-07 00:10:58 +02:00
parent b19daf9b76
commit 8cb713af67

View File

@ -407,6 +407,15 @@ local tech_tier_list = {
'rocket-silo'
}
local function shuffle(tbl)
local size = #tbl
for i = size, 1, -1 do
local rand = math_random(size)
tbl[i], tbl[rand] = tbl[rand], tbl[i]
end
return tbl
end
local item_names = {}
for k, _ in pairs(item_worths) do
table_insert(item_names, k)
@ -418,7 +427,7 @@ local function get_raffle_keys()
for i = 1, size_of_item_names, 1 do
raffle_keys[i] = i
end
table_shuffle_table(raffle_keys)
shuffle(raffle_keys)
return raffle_keys
end