local TICKS_PER_UPDATE = 60
do
local unit_number = panel.unit_number
local bucket_number = unit_number % TICKS_PER_UPDATE
local panel_table = global.CW_Thermal_solar_panel_table
if not panel_table then
panel_table = {}
global.CW_Thermal_solar_panel_table = panel_table
end
local bucket = panel_table[bucket_number]
if not bucket then
bucket = {}
panel_table[bucket_number] = bucket
end
bucket[unit_number] = panel
end
do
local panel_table = global.CW_Thermal_solar_panel_table
if not panel_table then return end
local bucket_number = event.tick % TICKS_PER_UPDATE
local bucket = panel_table[bucket_number]
if not bucket then return end
for unit_number, panel in pairs(bucket) do
if panel.valid then
panel.temperature = panel.temperature + ...
else
bucket[unit_number] = nil
end
end
end