Files
TeslaRel410/restoration/source410/BT/RESERVR.HPP
T
CydandClaude Fable 5 c01e57ab22 BT410 Phase 5.3.13: cockpit-button message layer -- valves, cooling, flush LIVE
The subsystem-family cockpit buttons now work through the authentic Receiver
dispatch -> per-class handler-table path. The id space decodes cleanly:
Receiver::NextMessageID == 3, so ToggleCooling = 3 on the HeatSink chain and
the per-class id 4 is MoveValve on a Condenser / InjectCoolant on the
Reservoir -- same number, different class, the binary's per-receiver-class
convention.

- HeatSink::ToggleCoolingMessageHandler (@004ad6f8, id 3): novice-locked,
  press-only; toggles coolantAvailable + coolantFlowScale together.
- Condenser::MoveValveMessageHandler (@4ae464, id 4): novice-locked; cycles
  the valve 1->5->50->0->1 and calls Condenser::RecomputeValves (@0049f788):
  every condenser's coolantFlowScale = valve / sum-of-valves. The ctor now
  streams the AUTHENTIC flowScale=0; the Mech ctor seeds equal shares once at
  spawn -- the flowScale=1 interim is retired.
- Reservoir::InjectCoolantMessageHandler (@4aee70, id 4): novice-locked;
  press arms the flush when the tank holds charge, release drops it.
- MechSubsystem::NoviceLockout() (@4ac9c8): owner -> playerLink -> experience
  == novice; unlinked mechs read unlocked.
- DEV harness BT_PRESS_VALVE / BT_PRESS_FLUSH: dispatch the REAL messages ~6s
  into the mission from Mech::Simulate.

VERIFIED: spawn shares 6 x 0.166667; one MoveValve press -> Condenser1
valve=5 flow=0.5, others 0.1 (valve/sum exact); flush arms via the real
button message; NOVICE locks both presses (valve lines stay spawn-only, zero
flush). Zero Fail throughout.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-24 08:43:01 -05:00

122 lines
3.9 KiB
C++

//===========================================================================//
// File: reservr.hpp //
// Project: BattleTech Brick: Mech subsystems //
// Contents: Reservoir -- the coolant store //
//---------------------------------------------------------------------------//
// Copyright (C) 1995, Virtual World Entertainment, Inc. //
// All Rights reserved worldwide //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
//===========================================================================//
#if !defined(RESERVR_HPP)
# define RESERVR_HPP
# if !defined(HEAT_HPP)
# include <heat.hpp>
# endif
//##################### Forward Class Declarations #######################
class Mech;
//###########################################################################
//#################### Reservoir Model Resource #########################
//###########################################################################
//
// CoolantCapacity overlays the inherited HeatSink thermalCapacity slot at
// construction; CoolantSquirtMass is the per-second flush rate base.
//
struct Reservoir__SubsystemResource:
public HeatSink::SubsystemResource
{
Scalar coolantCapacity;
Scalar coolantSquirtMass;
};
//###########################################################################
//############################# Reservoir ###############################
//###########################################################################
//
// The coolant store: a HeatSink that holds the mech's coolant charge and
// "squirts" it into the other sinks on demand -- it is the DrawCoolant SOURCE
// (every sink's UpdateCoolant top-up resolves here through the virtual), and
// the manual coolant FLUSH (the InjectCoolant cockpit button) distributes
// charge into the condensers / weapons / heatables, crediting each a negative
// pending-heat chill.
//
class Reservoir:
public HeatSink
{
public:
static Derivation ClassDerivations;
static SharedData DefaultData;
static Logical
TestClass(Mech &);
Logical
TestInstance() const;
public:
typedef Reservoir__SubsystemResource SubsystemResource;
Reservoir(
Mech *owner,
int subsystem_ID,
SubsystemResource *r,
SharedData &shared_data = DefaultData
);
~Reservoir();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Messaging Support: the cockpit coolant-flush button (id 4,
// "InjectCoolant"). Press starts the flush (raises the inject alarm);
// release stops it. Novice-locked.
//
public:
enum {
InjectCoolantMessageID = HeatSink::NextMessageID, // 4
NextMessageID
};
static const HandlerEntry MessageHandlerEntries[];
static MessageHandlerSet MessageHandlers;
void
InjectCoolantMessageHandler(ReceiverDataMessageOf<int> *message);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// The coolant-store interface.
//
public:
//
// The DrawCoolant SOURCE: hand out up to coolantLevel of the requested
// amount and deduct it from the charge.
//
virtual Scalar
DrawCoolant(Scalar requested);
typedef void
(Reservoir::*Performance)(Scalar time_slice);
void
SetPerformance(Performance performance)
{
Check(this);
activePerformance = (Simulation::Performance)performance;
}
void
CoolantSimulation(Scalar time_slice);
void
InjectCoolant(Scalar time_slice);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Local Data. The inject flag is the reservoir alarm's level (1 = flushing).
//
protected:
AlarmIndicator reservoirAlarm;
Scalar coolantSquirtMass;
Scalar injectAccumulator;
Scalar squirtEfficiency;
};
#endif