Files
TotenKnopfandClaude Fable 5 ad17425508 feat: v4.0.0 -- radiator switch picks the mode, ammo gate removed
ON vents constantly (vanilla). OFF banks heat and vents only when the
network is nearly full. The gate is now PowerToggle OR MustVent.

The launcher's thermal-ammo broadcast is gone: it did not follow the ammo
selection live, and the switch states the player's intent directly. Only
the radiator is patched now. New test_gate_is_power_or_must_vent pins the
semantics.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011oLWY1G6S8U35bi2FxVWni
2026-08-29 01:44:06 +02:00

100 lines
3.2 KiB
Plaintext

// ABOUT ME
// Components merged into the Radiator. They decide whether this radiator must
// vent right now, and combine that with the player's switch into a single gate,
// AutoPowerToggle, which mod.rules substitutes for the vanilla PowerToggle on
// the parts of the radiator that actually dissipate heat.
//
// The player's on/off switch (PowerToggle) chooses the mode:
// ON -> vanilla. Vent constantly; the player wants the heat gone.
// OFF -> bank heat for Thermal Canister Missiles. The radiator idles while
// the heat network has room, and vents only when it is nearly full,
// so the ship never overflows heat onto its own parts.
//
// The gate is therefore PowerToggle OR MustVent. Fail-safe: idling requires
// positive evidence that the network has room to spare. Anything missing,
// disconnected or unmeasurable results in venting.
// --- Is the heat network running out of room? -------------------------------
//
// Measured locally with a bare NetworkResourceInput, the same component an
// overclocked part pushes its heat through (base_part_overclock.rules:
// NetworkHeatInput), so this is exactly the producer's view of the network.
//
// Its Value, from Cosmoteer.dll (PartNetworkResourceInput.get_Value, see
// tools/ildump.py), is the FREE FRACTION of the connected heat storage:
// 1 - stored / total capacity -> 1.0 empty, 0.0 full, 0 if nothing attached
// and a ThresholdToggle compares that against MinAmount/MaxAmount as plain
// floats, so the amounts below are fractions too ("5%" is 0.05).
AutoRad_NetworkSpace
{
Type = NetworkResourceInput
ResourceType = heat
Mode = DistributeProportionallyByAvailable
Categories = [ thermal_storage ]
}
// Vent while less than VENT_BELOW_FREE of the network is still free.
AutoRad_SpaceLow
{
Type = ThresholdToggle
ValueFrom = AutoRad_NetworkSpace
VENT_BELOW_FREE = 5%
MaxAmount = &VENT_BELOW_FREE
}
// Hold heat again once at least HOLD_ABOVE_FREE is free. The gap between the
// two is a deadband so radiators do not chatter at the threshold.
AutoRad_SpaceAmple
{
Type = ThresholdToggle
ValueFrom = AutoRad_NetworkSpace
HOLD_ABOVE_FREE = 10%
MinAmount = &HOLD_ABOVE_FREE
}
AutoRad_LowTrigger
{
Type = ToggleTrigger
Toggle = AutoRad_SpaceLow
TriggerWhenOn = true
TriggerWhenOff = false
}
AutoRad_AmpleTrigger
{
Type = ToggleTrigger
Toggle = AutoRad_SpaceAmple
TriggerWhenOn = true
TriggerWhenOff = false
}
// The deadband, so radiators do not chatter at the threshold.
AutoRad_VentLatch
{
Type = TriggeredToggle
OnTrigger = AutoRad_LowTrigger
OffTrigger = AutoRad_AmpleTrigger
}
// OR the raw low reading back in, so a ship that loads already out of room
// vents at once instead of waiting for a crossing that never comes.
AutoRad_MustVent
{
Type = MultiToggle
Toggles = [ AutoRad_VentLatch, AutoRad_SpaceLow ]
Mode = Any
}
// --- The gate ---------------------------------------------------------------
//
// ON always vents (vanilla). OFF vents only while MustVent says the network is
// nearly full. Indicators and the steam plume follow this gate, so a radiator
// that is OFF but venting looks like a working radiator.
AutoPowerToggle
{
Type = MultiToggle
Toggles = [ PowerToggle, AutoRad_MustVent ]
Mode = Any
}