fusion-lab/menu-simulations/menu-simulation-fusion-lab.lua

changeset 10
101603241531
equal deleted inserted replaced
9:b0f85ff1a503 10:101603241531
1 require("__fusion-lab__.control")
2
3 local sim_planet = game.surfaces.fulgora
4 local tick = 0
5 local heat_interfaces = {}
6
7 for _, ent in pairs(sim_planet.find_entities_filtered{name = 'fusion-lab-heat-interface'})
8 do
9 table.insert(heat_interfaces, ent)
10 ent.set_heat_setting{temperature=705, mode="exactly"}
11 end
12
13 -- compatibility for mods that add extra science packs (like nuclear science),
14 -- we just cheat those into the labs to get them running
15 for _, ent in pairs(sim_planet.find_entities_filtered{name = 'fusion-lab'})
16 do
17 for _, science_pack in pairs(ent.prototype.lab_inputs)
18 do
19 if ent.get_item_count(science_pack) == 0
20 then
21 ent.insert{name = science_pack, count = prototypes.item[science_pack].stack_size}
22 end
23 end
24 end
25
26 script.on_nth_tick(1, function()
27 tick = tick + 1
28 if tick >= 240
29 then
30 for _, ent in pairs(heat_interfaces)
31 do
32 if math.random() > 0.95
33 then
34 ent.set_heat_setting{temperature=715, mode="exactly"}
35 end
36 end
37 end
38 end)

mercurial