Issue #20: wire Mech BalanceCoolant (id 0x16) -- the auto-cooling-balance button

Third instance of the silent-swallow pattern (unregistered handler id ->
Receiver NullHandler).  The Mech handler table @0x50BDF8 binds
{0x16, "BalanceCoolant" -> @0049f728}; the reconstruction never registered it.

Disasm-verified body (@0049f728): press-only guard (msg+0xc > 0; the binary
has NO novice lockout on this one), set EVERY condenser's valveState@0x1D0
to 1 (equal weights), then the shared redistribute @0049f788 -- which the
port ALREADY had faithfully as BTRecomputeCondenserValves (flow =
valve/total + condenserAlarm pulse; MoveValve calls it).  So the fix is:
- mech.hpp/mech.cpp: BalanceCoolantMessageID=0x16 + handler + MESSAGE_ENTRY
- heatfamily_reslice.cpp: BTBalanceCondenserValves bridge (Condenser is a
  complete type there; sets valves to 1 + redistributes)
- mech4.cpp: BT_BALTEST scripted harness (MoveValve press alternating with
  a Balance press)

VERIFIED headless (BT_BALTEST=1 BT_VALVE_LOG=1):
  boot     -> all valves 1, flows 0.1667 each
  MoveValve-> condenser#1 valve 5, flows 0.5 / 0.1x5 (the priority boost)
  BALANCE  -> all valves 1, flows 0.1667 each (equalized)
Awaiting the tester's live ADV-mode confirmation.

KB: decomp-reference.md Mech-table row marked wired.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
arcattack
2026-07-21 14:31:46 -05:00
co-authored by Claude Opus 4.8
parent 4aab10ba89
commit e9db161404
5 changed files with 89 additions and 1 deletions
+20
View File
@@ -461,8 +461,28 @@ const Receiver::HandlerEntry
{
MESSAGE_ENTRY(Mech, TakeDamage),
MESSAGE_ENTRY(Mech, PlayerLink),
MESSAGE_ENTRY(Mech, BalanceCoolant), // id 0x16 @0049f728 (issue #20)
};
//
// @0049f728 -- BalanceCoolant (id 0x16): the auto-cooling-balance button.
// Disasm-verified: press-only guard (NO novice lockout in the binary), then
// equal-weight every condenser valve + redistribute via the condenser-
// complete bridge. Issue #20 fix, 2026-07-21.
//
void
Mech::BalanceCoolantMessageHandler(ReceiverDataMessageOf<int> *message)
{
if (message->dataContents <= 0) // press only (msg+0xc)
{
return;
}
extern void BTBalanceCondenserValves(Entity *owner); // heatfamily_reslice.cpp
BTBalanceCondenserValves(this);
if (getenv("BT_VALVE_LOG"))
DEBUG_STREAM << "[valve] BALANCE (all valves -> 1)" << std::endl;
}
Receiver::MessageHandlerSet
Mech::MessageHandlers(
ELEMENTS(Mech::MessageHandlerEntries),