Merge pull request #2614 from PewPewCricket/master

Update PWR OpenComputers Compat
This commit is contained in:
HbmMods 2026-01-01 14:54:26 +01:00 committed by GitHub
commit fd348a40e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 9 deletions

View File

@ -582,7 +582,7 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getHeat(Context context, Arguments args) {
return new Object[] {coreHeat, hullHeat};
return new Object[] {coreHeat, hullHeat, coreHeatCapacity, hullHeatCapacityBase};
}
@Callback(direct = true)
@ -612,7 +612,7 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG
@Callback(direct = true)
@Optional.Method(modid = "OpenComputers")
public Object[] getInfo(Context context, Arguments args) {
return new Object[] {coreHeat, hullHeat, flux, rodTarget, rodLevel, amountLoaded, progress, processTime, tanks[0].getFill(), tanks[0].getMaxFill(), tanks[1].getFill(), tanks[1].getMaxFill()};
return new Object[] {coreHeat, hullHeat, coreHeatCapacity, hullHeatCapacityBase, flux, rodTarget, rodLevel, amountLoaded, progress, processTime, tanks[0].getFill(), tanks[0].getMaxFill(), tanks[1].getFill(), tanks[1].getMaxFill()};
}
@Callback(direct = true, limit = 4)

View File

@ -22,7 +22,12 @@ local 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.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)
for address, _ in component.list("ntm_pwr_control") do
pwrController = address
end
gpu.setForeground(0xAAAAAA)
--Control rods
@ -203,7 +204,7 @@ while (runSig == true) do
rodLevel = call(pwrController, "getLevel")
coreHeat, _ = call(pwrController, "getHeat")
coreHeat = coreHeat//1000000
coreHeat = coreHeat // (const.coreHeatCapacity / 10)
for _, b in pairs(buttons) do
drawButton(b, b.colorUp)
@ -243,7 +244,7 @@ while (runSig == true) do
fullCoreHeat, fullHullHeat = call(pwrController, "getHeat")
coldCoolantLevel, _, hotCoolantLevel, maxHotCoolantLevel = call(pwrController, "getCoolantInfo")
coldCoolantOutflow = coldCoolantLevel - prevCoolantFlow
hotCoolantOutflow = hotCoolantLevel - prevHotCoolantFlow