fix PWRangler crashing with PWRs using heat sinks

This commit is contained in:
PewPewCricket 2025-12-30 18:40:08 -06:00
parent 89b1cb1de0
commit 871de4ae47

View File

@ -22,7 +22,12 @@ local mt = {
} }
setmetatable(const, mt) setmetatable(const, mt)
const.fullCoreHeatMAX = 9000000 for address, _ in component.list("ntm_pwr_control") do
pwrController = address
end
_, _, const.coreHeatCapacity = call(pwrController, "getHeat")
const.fullCoreHeatMAX = const.coreHeatCapacity * 0.9
const.coldCoolantLevelMIN = 10000 const.coldCoolantLevelMIN = 10000
const.hotCoolantLevelMAX = 0.5 const.hotCoolantLevelMAX = 0.5
@ -88,10 +93,6 @@ buttons[9] = newButton(94, 9, 12, 2, 0x00FF00, 0x00AA00, function() coolantLossE
buttons[10] = newButton(107, 8, 5, 3, 0xFF0000, 0xAA0000, function() runSig = false end) buttons[10] = newButton(107, 8, 5, 3, 0xFF0000, 0xAA0000, function() runSig = false end)
for address, _ in component.list("ntm_pwr_control") do
pwrController = address
end
gpu.setForeground(0xAAAAAA) gpu.setForeground(0xAAAAAA)
--Control rods --Control rods
@ -203,7 +204,7 @@ while (runSig == true) do
rodLevel = call(pwrController, "getLevel") rodLevel = call(pwrController, "getLevel")
coreHeat, _ = call(pwrController, "getHeat") coreHeat, _ = call(pwrController, "getHeat")
coreHeat = coreHeat//1000000 coreHeat = coreHeat // (const.coreHeatCapacity / 10)
for _, b in pairs(buttons) do for _, b in pairs(buttons) do
drawButton(b, b.colorUp) drawButton(b, b.colorUp)