The full circuit, workflow-researched (5 parallel dossiers over BT411 + the engine) and adversarially reviewed (3 lenses) before landing: Mech side: the once-per-death transition in Simulate (freeze, motion kill, DeathShutdown sweep, MASTER-only VehicleDead(-1) to the player link); Mech::Reset @0049fb74 (reposition + heal every hull zone + the roster DeathReset sweep + PreRun -- the reset-based respawn that REUSES the entity); dead-owner terms in both weapon hard gates (wrecks fall silent). Player side: the VehicleDead(-1) branch (deathPending dedup, deathCount bump+stamp, scenario-role life debit, +5s re-post -> the engine drop-zone hunt) and the DropZoneReply respawn branch (reset the dead mech at the replied drop zone; probes on a live mech are moot). Subsystem side: the engine base virtual DeathReset implemented across the family -- MechSubsystem (zone heal + DestroyedState clear), MechWeapon (full powered/thermal restore + fresh Loading cycle), AmmoBin (restock from the ctor-cached count), HeatSink/HeatWatcher/PowerWatcher/Generator/Sensor/ MissileLauncher. Review catches fixed before commit: AmmoBin restocked through the FREED padBuffer pointer (use-after-free -> initialAmmoCount; MechSubsystem:: resource is now documented as never-deref-post-ctor); died-hot weapons respawned at FailureHeat (now full thermal re-init); Generator tap counts desynced across reset (preserved); Sensor skipped the base heal; PowerWatcher inherited a statically-bound reset; cooling toggle + connect mode restored. Verified: kill -> wreck (0 shots while dead) -> +5s -> drop-zone hunt -> HEALED + placed at a real drop zone -> 134 shots after respawn incl. 12 SRM (restock proof); unowned enemy wreck settles silently; fight/smoke/novice regressions green, zero faults. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
119 lines
3.4 KiB
C++
119 lines
3.4 KiB
C++
//===========================================================================//
|
|
// File: ammobin.hpp //
|
|
// Project: BattleTech Brick: Mech weapons //
|
|
// Contents: AmmoBin -- an ammunition store (with cook-off heat) //
|
|
//---------------------------------------------------------------------------//
|
|
// Copyright (C) 1995, Virtual World Entertainment, Inc. //
|
|
// All Rights reserved worldwide //
|
|
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
|
|
//===========================================================================//
|
|
|
|
#if !defined(AMMOBIN_HPP)
|
|
# define AMMOBIN_HPP
|
|
|
|
# if !defined(HEAT_HPP)
|
|
# include <heat.hpp>
|
|
# endif
|
|
|
|
//##################### Forward Class Declarations #######################
|
|
class Mech;
|
|
|
|
//###########################################################################
|
|
//###################### AmmoBin Model Resource ########################
|
|
//###########################################################################
|
|
|
|
struct AmmoBin__SubsystemResource:
|
|
public HeatWatcher::SubsystemResource
|
|
{
|
|
int ammoClassID;
|
|
int ammoModelFile;
|
|
int explosionModelFile;
|
|
int ammoCount;
|
|
Scalar feedRate;
|
|
Scalar heatPerRound;
|
|
};
|
|
|
|
//###########################################################################
|
|
//############################## AmmoBin ###############################
|
|
//###########################################################################
|
|
|
|
class AmmoBin:
|
|
public HeatWatcher
|
|
{
|
|
public:
|
|
static Derivation ClassDerivations;
|
|
static SharedData DefaultData;
|
|
|
|
static Logical
|
|
TestClass(Mech &);
|
|
Logical
|
|
TestInstance() const;
|
|
|
|
int GetAmmoCount() const { return ammoCount; }
|
|
|
|
//
|
|
// The feed interface the ballistic fire path consumes. Ammo states
|
|
// (the 1995 feed alarm): 1 = a round is chambered/ready, 2 = EMPTY.
|
|
// FeedAmmo pulls one round (the launcher calls it on a granted shot);
|
|
// returns 0 when dry. (Feed-rate pacing + the cook-off heat source
|
|
// join with the heat wave; the launcher's own recharge already paces
|
|
// shots.)
|
|
//
|
|
enum {
|
|
AmmoLoadedState = 1,
|
|
AmmoEmptyState = 2
|
|
};
|
|
int
|
|
GetAmmoState() const
|
|
{ Check(this); return (ammoCount > 0) ? AmmoLoadedState : AmmoEmptyState; }
|
|
//
|
|
// Respawn restock: refill the magazine from the authored count.
|
|
//
|
|
virtual void
|
|
DeathReset(Logical full_reset);
|
|
|
|
int
|
|
FeedAmmo()
|
|
{
|
|
Check(this);
|
|
if (ammoCount <= 0)
|
|
{
|
|
return 0;
|
|
}
|
|
--ammoCount;
|
|
return 1;
|
|
}
|
|
|
|
public:
|
|
typedef AmmoBin__SubsystemResource SubsystemResource;
|
|
|
|
AmmoBin(
|
|
Mech *owner,
|
|
int subsystem_ID,
|
|
SubsystemResource *subsystem_resource,
|
|
SharedData &shared_data = DefaultData
|
|
);
|
|
~AmmoBin();
|
|
|
|
protected:
|
|
int ammoCount;
|
|
int initialAmmoCount;
|
|
Scalar feedTimer;
|
|
Scalar feedRate;
|
|
int ammoClassID;
|
|
int ammoModelFile;
|
|
int explosionModelFile;
|
|
Scalar heatPerRound;
|
|
int cookOffArmed;
|
|
int cookOffTime;
|
|
int reserved;
|
|
AlarmIndicator ammoAlarm;
|
|
//
|
|
// Cook-off heat-source registration state (advanced by the heat sim).
|
|
// Reserved until the per-frame path is reconstructed.
|
|
//
|
|
int cookOffState[12];
|
|
};
|
|
|
|
#endif
|