Gitea #53: generators can be switched off -- ToggleGeneratorOnOff reconstructed from @004b1ed0
TWO missing pieces, both now in place.
1. Generator had NO handler set of its own, so every message aimed at it hit a
default-constructed blackhole. Proved empirically with the new
unhandled-message trace by pressing button 0x1A:
[msg] UNHANDLED: Generator has no handler for message id 4 -- silently dropped
Added Generator::GetMessageHandlers() chained to **HeatSink**, deliberately NOT
PoweredSubsystem: id 4 there is SelectGeneratorA (the weapon-side generator
SELECTION that already works), so chaining to it would have made these four
buttons invoke the WRONG function instead of doing nothing. HeatSink owns id 3
(ToggleCooling), leaving id 4 free.
2. ToggleGeneratorOnOff had no body at all (0 references in game/). Transcribed
instruction-for-instruction from @004b1ed0:
- call @004ac9c8 -> BTPlayerRoleLocksAdvanced: a NOVICE pilot cannot use it
- [msg+0xc] <= 0 -> press only, ignore the release
- ON : startTimer = 0; if heatAlarm(@0x184) < 1 also stateAlarm -> 0
(Starting, so it spins up -- a heat-faulted generator keeps its fault
level); generatorOn = 1, coolantAvailable = 1, coolantFlowScale = 1.0
- OFF : stateAlarm -> 1 (GeneratorIdle); generatorOn = 0,
coolantAvailable = 0, coolantFlowScale = 0 (its coolant share is
released back to the loop)
So taking a generator off line idles it, drops its coolant draw and stops it
feeding its taps -- the authentic heat-management trade from the manual.
VERIFIED LIVE (BT_BTNTEST=0x1A,400,900 through the real click seam):
[btntest] PRESS 0x1a at poll 400
[gensel] GeneratorA generator OFF LINE (stateAlarm 1, coolantFlowScale 0)
and the UNHANDLED warning for Generator is gone.
Answers Cyd's report from two playtests ('still cannot turn of gennies'). Note
this is the ON/OFF control -- generator SELECTION (which generator a subsystem
draws from) is a different message and already worked.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0166KTsC7ADm7VXEi1HF1jNg
This commit is contained in:
co-authored by
Claude Opus 5
parent
33ca99eb69
commit
62513b2f8a
@@ -480,6 +480,28 @@ class Generator;
|
||||
return (ownZone != 0) ? (Scalar)ownZone->damageLevel : (Scalar)0.0f; // +0x158
|
||||
}
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Message handling (Gitea #53 -- the Generator A-D ON/OFF buttons).
|
||||
//
|
||||
// Generator had NO handler set of its own, so every message aimed at it hit a
|
||||
// default-constructed blackhole and was dropped in silence. Proved live with
|
||||
// the new unhandled-message trace by pressing button 0x1A:
|
||||
// [msg] UNHANDLED: Generator has no handler for message id 4
|
||||
//
|
||||
// The set MUST chain HeatSink, not PoweredSubsystem: on PoweredSubsystem id 4
|
||||
// is `SelectGeneratorA` (a completely different function -- the weapon-side
|
||||
// generator SELECTION that already works), so chaining there would make these
|
||||
// four buttons do the WRONG thing rather than nothing. HeatSink owns id 3
|
||||
// (ToggleCooling), leaving id 4 free.
|
||||
//
|
||||
public:
|
||||
enum { ToggleGeneratorOnOffMessageID = 4 }; // table @0050fb90, fn @004b1ed0
|
||||
|
||||
static Receiver::MessageHandlerSet& GetMessageHandlers();
|
||||
|
||||
void
|
||||
ToggleGeneratorOnOffMessageHandler(ReceiverDataMessageOf<int> *message);
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Local data.
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user