// ABOUT ME // Components merged into the Radiator. They receive the three network values // this mod broadcasts and combine them into a single gate, AutoPowerToggle, // which mod.rules then substitutes for the radiator's vanilla PowerToggle on // the parts of the radiator that actually dissipate heat. // // Each broadcast arrives as a number, 1 or 0, summarised across the network by // a NetworkValueReceiver and turned back into a toggle by a threshold at 0.5. // A network with no broadcaster at all yields 0, which is why a ship without // thermal batteries or thermal launchers keeps vanilla behaviour. // // The player's manual on/off switch (PowerToggle) is preserved and still wins: // a radiator the player has switched off stays off. The automation can only // idle a radiator the player has left on. // // A radiator vents when ANY of these hold: // - the network is not asking it to hold (no battery, or battery full) // - no launcher on the network is using thermal ammunition // - some part is overflowing heat right now (safety net, overrides all) AutoRad_HoldSignal { Type = NetworkValueReceiver Categories = [ auto_radiator_hold ] Mode = Max AllowUncategorized = false } AutoRad_ThermalAmmoSignal { Type = NetworkValueReceiver Categories = [ auto_radiator_ammo_user ] Mode = Max AllowUncategorized = false } AutoRad_ForceVentSignal { Type = NetworkValueReceiver Categories = [ auto_radiator_force_vent ] Mode = Max AllowUncategorized = false } // "value is not zero", written the way vanilla writes it (the thermal pump's // UtilizationToggle). The signals are only ever 0 or 1, so this is equivalent // to a 0.5 threshold while sticking to a form the game demonstrably honours. AutoRad_IsHolding { Type = ThresholdToggle ValueFrom = AutoRad_HoldSignal MinAmount = 0 MaxAmount = 0 Invert = true } AutoRad_ThermalAmmoInUse { Type = ThresholdToggle ValueFrom = AutoRad_ThermalAmmoSignal MinAmount = 0 MaxAmount = 0 Invert = true } AutoRad_ForceVent { Type = ThresholdToggle ValueFrom = AutoRad_ForceVentSignal MinAmount = 0 MaxAmount = 0 Invert = true } // --- Self-test probes ------------------------------------------------------- // // Three versions of this mod have now loaded cleanly and done nothing, each for // a different reason, so these bisect the remaining possibilities directly. // Each drives an indicator, and an indicator is drawn while its toggle is OFF, // so in every case a visible icon means that probe FAILED. // A: does ThresholdToggle behave as expected at all? No network involved. AutoRad_ProbeOne { Type = StaticValue; Value = 1 } AutoRad_ProbeThresholdOK { Type = ThresholdToggle ValueFrom = AutoRad_ProbeOne MinAmount = 0 MaxAmount = 0 Invert = true } // B: can a mod-defined category carry a value at all? The radiator broadcasts // and receives this one itself, so no second part is involved. AutoRad_ProbeBroadcast { Type = NetworkValue ValueSource = AutoRad_ProbeOne Categories = [ auto_radiator_selftest ] IncludeInBlueprints = false } AutoRad_ProbeReceive { Type = NetworkValueReceiver Categories = [ auto_radiator_selftest ] Mode = Max AllowUncategorized = false } AutoRad_ProbeSelfLoopOK { Type = ThresholdToggle ValueFrom = AutoRad_ProbeReceive MinAmount = 0 MaxAmount = 0 Invert = true } // C: does receiving work for a category vanilla already broadcasts? The // radiator's own NetworkedThermalDissipationLoadValue publishes this one. AutoRad_ProbeVanillaCat { Type = NetworkValueReceiver Categories = [ thermal_load_dissipation ] Mode = Max AllowUncategorized = false } AutoRad_ProbeVanillaCatOK { Type = ThresholdToggle ValueFrom = AutoRad_ProbeVanillaCat MinAmount = 0 MaxAmount = 0 Invert = true } AutoRad_VentAllowed { Type = MultiToggle Toggles [ { Toggle = AutoRad_IsHolding; Invert = true } { Toggle = AutoRad_ThermalAmmoInUse; Invert = true } AutoRad_ForceVent ] Mode = Any } // The replacement gate. PowerToggle is the radiator's vanilla UIToggle, so the // player's switch remains the master control. AutoPowerToggle { Type = MultiToggle Toggles = [ PowerToggle, AutoRad_VentAllowed ] Mode = All } // Diagnostic anchor. An indicator icon shows while its toggle is OFF, so an // icon bound to this one is visible whenever these components were merged onto // the part at all. If that icon is absent, the AddBase in mod.rules did not // take effect and nothing else in this file is running either -- which is the // single most useful thing to be able to tell apart from a dead signal. AutoRad_AlwaysOff { Type = StaticToggle ToggleOn = false }