-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinfinity-chest.lua
More file actions
51 lines (48 loc) · 1.47 KB
/
infinity-chest.lua
File metadata and controls
51 lines (48 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/sc
local eq = {
"power-armor-mk2",
"personal-roboport-mk2-equipment",
"battery-mk2-equipment",
"exoskeleton-equipment",
"construction-robot",
"electric-mining-drill",
"fission-reactor-equipment"
}
local gap = 3
local operable = false
local Color = require('utils.color_presets')
local surface = game.surfaces[storage.bb_surface_name]
local position_0 = { x = 0, y = -42 }
local objects = surface.find_entities_filtered({ name = 'infinity-chest' })
for _, object in pairs(objects) do
object.destroy()
end
game.print('Special game Infinity chest is being generated!', { color = Color.warning })
local k = gap + 1
for i, v in ipairs(eq) do
local chest = surface.create_entity({
name = 'infinity-chest',
position = position_0,
force = 'neutral',
fast_replace = true,
})
if chest == nil then
return
end
chest.minable = false
chest.operable = operable
chest.destructible = false
chest.set_infinity_container_filter(i, { name = v, index = i, count = prototypes.item[v].stack_size })
chest.clone({ position = { position_0.x, -position_0.y } })
position_0.x = position_0.x + (i * k)
k = k * -1
end
storage.active_special_games['infinity_chest'] = true
local special = storage.special_games_variables['infinity_chest']
if not special then
special = { freebies = {} }
storage.special_games_variables['infinity_chest'] = special
end
for i, v in ipairs(eq) do
special.freebies[v] = true
end