Files
Project-M/Assets/_Project/Scripts/Simulation/Persistence/SaveData.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

59 lines
2.3 KiB
C#

using System;
namespace ProjectM.Simulation
{
/// <summary>One serialized ledger row (item id + count). An array FIELD of <see cref="SaveData"/>.</summary>
[Serializable]
public struct LedgerRow
{
public int ItemId;
public int Count;
}
/// <summary>One persisted per-class PERMANENT meta-upgrade tier (v6). ClassId = the normalized CharacterId
/// (Warrior=2/Ranger=3); UpgradeId = the append-only meta-catalog key (unknown ids round-trip preserved and are
/// skipped live); Tier clamps to the catalog's MaxTier at seed/shop/spend, never at rest.</summary>
[Serializable]
public struct MetaUpgradeSave
{
public byte ClassId;
public byte UpgradeId;
public byte Tier;
}
/// <summary>One serialized player-built structure. Flat scalars (JsonUtility has no int2).</summary>
[Serializable]
public struct StructureSave
{
public byte Type;
public int CellX;
public int CellZ;
public float HP; // EB-1: hit points at save time (0 -> restored to baked Max)
}
/// <summary>
/// Versioned, host-authoritative save slice: the shared resource ledger + player-built structures + the
/// permanent meta. JsonUtility-friendly — a class with flat fields and an array FIELD (never a root array).
/// The schema is ADDITIVE going forward, gated by <see cref="Version"/> migration.
/// </summary>
[Serializable]
public class SaveData
{
public const int CurrentVersion = 7; // v7: LANTERN fresh epoch — goal/core/outcome + conveyor/machine-I/O fields dropped
/// <summary>Oldest save schema the loader accepts. v7 is a FRESH EPOCH (operator-approved): older saves are ignored.</summary>
public const int MinLoadableVersion = 7;
public int Version = CurrentVersion;
// Permanent meta-progression:
public int RunsCompleted; // boss-cleared runs (the HUD counter + the HostSalt fold at restore)
public int MaxDepthReached; // deepest room actually CLEARED across all runs (honest depth, never planned)
public MetaUpgradeSave[] MetaUpgrades = Array.Empty<MetaUpgradeSave>(); // sparse per-class tiers
public LedgerRow[] Ledger = Array.Empty<LedgerRow>();
public StructureSave[] Structures = Array.Empty<StructureSave>();
public long SavedAtMs;
}
}