Files
Project-M/Assets/_Project/Scripts/Simulation/Meta/MetaComponents.cs
T
kronic 77de740b63 LANTERN purge B7: rename CharacterId -> FrameKind (frame terminology)
Enum renamed in StatIds.cs (byte values unchanged - serialized definitions/saves
never re-mean); all call sites + doc mentions swept (ClassTraits, PlayerAuthoring,
CharacterStatsDefinition field type, menu/UI, tests). CharacterStatsDefinition SO
CLASS name kept (asset-binding risk; deferred per plan). 390 green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-15 15:51:48 -07:00

77 lines
3.7 KiB
C#

using Unity.Entities;
using Unity.NetCode;
namespace ProjectM.Simulation
{
/// <summary>
/// One owned permanent meta-upgrade tier, keyed by (class, upgrade). The CycleDirector's DynamicBuffer of these is
/// the authoritative per-class meta-progression record. A GLOBAL <c>[GhostField]</c> buffer on the ownerless
/// interpolated director ghost (no OwnerSendType — the party invests together and every client reads it for the
/// shop), mirroring <see cref="StorageEntry"/>. Persisted to disk (SaveData v6) and re-applied born-correct at
/// player spawn as meta-band <see cref="StatModifier"/>s. Bytes only (Burst/serialization safe). Sparse — an
/// absent (class, upgrade) row means tier 0.
/// </summary>
[InternalBufferCapacity(24)]
public struct MetaTierState : IBufferElementData
{
/// <summary>Owning class id (Warrior/Ranger — the FrameKind anchor).</summary>
[GhostField] public byte ClassId;
/// <summary>Upgrade id (append-only key into the meta catalog).</summary>
[GhostField] public byte UpgradeId;
/// <summary>Owned tier (&gt;=1; an absent row = 0).</summary>
[GhostField] public byte Tier;
}
/// <summary>
/// Server-only singleton on the CycleDirector: the FIRST-COMMIT latch for the co-op route choice. Written IN-PLACE
/// (immediate SystemAPI.SetComponent, not a deferred ECB) inside <c>RouteSelectSystem</c>'s drain loop so two
/// same-tick picks cannot both observe <see cref="HasPick"/>==0 (the DR-014 atomicity idiom). NOT replicated.
/// </summary>
public struct RouteCommand : IComponentData
{
/// <summary>1 once a route has been committed for the current (RunEpoch, layer).</summary>
public byte HasPick;
/// <summary>The committed option index (into the replicated RouteOpt* set).</summary>
public byte OptionIndex;
/// <summary>Run epoch the pick is for (stale-reject guard).</summary>
public int ForRunEpoch;
/// <summary>Layer the pick is for (stale-reject guard).</summary>
public int ForLayer;
}
/// <summary>
/// Server-only singleton on the CycleDirector: the room-exit PORTAL interact latch (DR-046). PortalInteractReceiveSystem
/// sets <see cref="HasInteract"/> when a player interacts the portal during RoomExplore; RunDirectorSystem (the sole
/// RunInfo/RunRuntime writer) reads it to advance the run + tear the room down, then clears it. NOT replicated.
/// Added unconditionally at director spawn (like RouteCommand).
/// </summary>
public struct PortalCommand : IComponentData
{
/// <summary>1 once a participant has interacted the room-exit portal this RoomExplore.</summary>
public byte HasInteract;
}
/// <summary>
/// Server-only persisted meta counters on the CycleDirector (mirrored to the replicated <see cref="RunInfo"/> for
/// the HUD). Added UNCONDITIONALLY at director spawn (like CycleRuntime/ThreatState/RunPhase) so a New-Game boot
/// has the component the bank block reads; restored values are SetComponent'd only inside the save-present block.
/// NOT replicated.
/// </summary>
public struct MetaCounters : IComponentData
{
public int RunsCompleted;
public int MaxDepthReached;
}
/// <summary>
/// Server-only tag of a player's class id, added at spawn by <c>GoInGameServerSystem</c>. Lets the meta systems
/// resolve which per-class tier record to seed / spend against (class was previously only an <c>AbilityRef</c> /
/// wire concern). NOT replicated.
/// </summary>
public struct PlayerClass : IComponentData
{
public byte ClassId;
}
}