Files
Project-M/Assets/_Project/Scripts/Simulation/Persistence/SaveComponents.cs
T
kronic b34945c2d2 LANTERN purge B3+B5: delete the cycle/core/win-lose spine + onboarding; save epoch v7
Deletes CyclePhaseSystem, GoalReachedSystem, CoreDamage/CoreRestore, ThreatDirector,
CoreIntegrity/GoalProgress/RunPhase/RunOutcome/ThreatState components,
CoreVisualFeedbackSystem, and the whole Client/Onboarding slice (+6 test files).

Keepers reworked: RunDirectorSystem (UpdateBefore attr + launch guard + goal/threat
bank removed; sole SaveRequest raiser now), CycleDirectorSpawnSystem (ledger/meta
host only), WaveSystem UNGATED (waves run wherever a WaveDirector is baked),
EnemyAISystem core-fallback stripped, AmbientAudioSystem reworked (bed + run cues;
no CycleState gate), MusicSystem RunInfo-only, HudSystem big trim (goal meter, core
bar, siege banner, terminal banner, outcome flash, onboarding hook all gone),
MetaShop/ClassPrep/AimReticle siege gates dropped, DebugOverlay/ops re-meant
(SpawnWave=force next wave, EndSiege=quiet arena; SetCalm/AdvanceGoal/SetHeat
retired, bytes reserved), TuningConfig Core knobs retired (ids 20-23 reserved),
StorageMath.DrainFraction deleted, HowToPlay copy rewritten.

Save epoch v7 (fresh epoch, operator-approved): SaveData drops goal/core/outcome +
conveyor/machine-IO fields; MinLoadableVersion=7; PendingSave/PendingStructure
trimmed; RollTerminalCampaignForward deleted; SaveStructureScan signature slimmed.

390 tests green; Play world-creation clean (player + waves live, no exceptions).

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

62 lines
2.9 KiB
C#

using Unity.Entities;
namespace ProjectM.Simulation
{
/// <summary>
/// Server-world, UNMANAGED bridge holding a save slice the menu staged for a "Continue" session, applied
/// AT SPAWN by the server CycleDirectorSpawnSystem so the director ghost is BORN correct — it never
/// serializes an empty ledger to clients (no replication flicker). The menu creates exactly one of these
/// (with the <see cref="PendingSaveLedgerRow"/> buffer) in the freshly created ServerWorld BEFORE the
/// gameplay subscene streams in; the spawn system consumes + destroys it. Unmanaged so the Bursted spawn
/// system reads it without a managed bridge.
/// </summary>
public struct PendingSave : IComponentData
{
/// <summary>v6: persisted run counters to restore into MetaCounters + the born-correct RunInfo HUD mirror.</summary>
public int RunsCompleted;
public int MaxDepthReached;
/// <summary>0 = nothing staged (New Game); non-zero = apply the staged slice at director spawn.</summary>
public byte HasData;
}
/// <summary>One staged ledger row for a Continue session; copied into the director's StorageEntry buffer at spawn.</summary>
public struct PendingSaveLedgerRow : IBufferElementData
{
public ushort ItemId;
public int Count;
}
/// <summary>One staged PERMANENT meta tier for a Continue session (v6) — copied VERBATIM into the director's
/// replicated MetaTierState buffer at spawn (unknown ids preserved for round-trip; clamping happens only at
/// seed/shop/spend). The buffer is added UNCONDITIONALLY at staging (empty OK) — the Bursted spawn system
/// GetBuffers it inside the HasData block and a missing buffer would throw on any Continue.</summary>
public struct PendingMetaRow : IBufferElementData
{
public byte ClassId;
public byte UpgradeId;
public byte Tier;
}
/// <summary>One staged player-built structure row for a Continue session; BaseRestoreSystem replays it
/// charge-free into the freshly-streamed base. Mirrors <see cref="StructureSave"/> but as an unmanaged ECS
/// buffer element (staged in the ServerWorld before the subscene streams).</summary>
public struct PendingStructure : IBufferElementData
{
public byte Type;
public int CellX;
public int CellZ;
public float HP; // EB-1: staged hit points (BaseRestoreSystem restores 0 -> baked Max)
}
/// <summary>
/// Host-only autosave request flag on the director entity (added at spawn). RunDirectorSystem sets
/// <see cref="Pending"/>=1 on the terminal bank; the managed SaveWriteSystem reads it, writes the JSON save,
/// and clears it. A plain byte => Burst-safe (no managed/string/file touch in the sim loop).
/// </summary>
public struct SaveRequest : IComponentData
{
public byte Pending;
}
}