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

changeset 10
101603241531
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fusion-lab/menu-simulations/menu-simulation-fusion-lab.lua	Wed Jul 02 14:28:57 2025 +0300
@@ -0,0 +1,38 @@
+require("__fusion-lab__.control")
+
+local sim_planet = game.surfaces.fulgora
+local tick = 0
+local heat_interfaces = {}
+
+for _, ent in pairs(sim_planet.find_entities_filtered{name = 'fusion-lab-heat-interface'})
+do
+	table.insert(heat_interfaces, ent)
+	ent.set_heat_setting{temperature=705, mode="exactly"}
+end
+
+-- compatibility for mods that add extra science packs (like nuclear science),
+-- we just cheat those into the labs to get them running
+for _, ent in pairs(sim_planet.find_entities_filtered{name = 'fusion-lab'})
+do
+	for _, science_pack in pairs(ent.prototype.lab_inputs)
+	do
+		if ent.get_item_count(science_pack) == 0
+		then
+			ent.insert{name = science_pack, count = prototypes.item[science_pack].stack_size}
+		end
+	end
+end
+
+script.on_nth_tick(1, function()
+	tick = tick + 1
+	if tick >= 240
+	then
+		for _, ent in pairs(heat_interfaces)
+		do
+			if math.random() > 0.95
+			then
+				ent.set_heat_setting{temperature=715, mode="exactly"}
+			end
+		end
+	end
+end)

mercurial