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>
This commit is contained in:
@@ -7,11 +7,9 @@ namespace ProjectM.Server
|
||||
{
|
||||
/// <summary>
|
||||
/// Host-only autosave writer. A managed <see cref="SystemBase"/> (file IO => NO Burst) that reacts to the
|
||||
/// <see cref="SaveRequest"/> flag the Bursted <c>CyclePhaseSystem</c> raises on the Siege->Calm checkpoint:
|
||||
/// reads the authoritative <see cref="GoalProgress"/> + shared resource ledger off the CycleDirector ghost,
|
||||
/// writes the JSON save (<see cref="SaveService"/>), then clears the flag. ServerSimulation-only, so a pure
|
||||
/// (Join) client never writes. Deliberately carries NO <c>[UpdateAfter(CyclePhaseSystem)]</c> (that would risk
|
||||
/// a sort-cycle); a one-tick-late autosave is irrelevant.
|
||||
/// <see cref="SaveRequest"/> flag <c>RunDirectorSystem</c> raises on the terminal bank: reads the shared
|
||||
/// resource ledger + permanent meta off the director ghost, writes the JSON save (<see cref="SaveService"/>),
|
||||
/// then clears the flag. ServerSimulation-only, so a pure (Join) client never writes.
|
||||
/// </summary>
|
||||
[WorldSystemFilter(WorldSystemFilterFlags.ServerSimulation)]
|
||||
public partial class SaveWriteSystem : SystemBase
|
||||
@@ -32,46 +30,26 @@ namespace ProjectM.Server
|
||||
req.Pending = 0;
|
||||
SystemAPI.SetComponent(dir, req);
|
||||
|
||||
var goal = SystemAPI.HasComponent<GoalProgress>(dir)
|
||||
? SystemAPI.GetComponent<GoalProgress>(dir)
|
||||
: default;
|
||||
|
||||
// END-1: persist the Engine Core integrity (a wounded base stays wounded across save/quit).
|
||||
var core = SystemAPI.HasComponent<CoreIntegrity>(dir)
|
||||
? SystemAPI.GetComponent<CoreIntegrity>(dir)
|
||||
: default;
|
||||
// END-2: persist the terminal run outcome so a won/lost run loads finished (no re-arm on Continue).
|
||||
var outcome = SystemAPI.HasComponent<RunOutcome>(dir)
|
||||
? SystemAPI.GetComponent<RunOutcome>(dir)
|
||||
: default;
|
||||
|
||||
|
||||
// The shared ledger lives on this same CycleDirector ghost (ResourceLedger-tagged StorageEntry buffer).
|
||||
// The shared ledger lives on this same director ghost (ResourceLedger-tagged StorageEntry buffer).
|
||||
var buffer = SystemAPI.GetBuffer<StorageEntry>(dir);
|
||||
var rows = new LedgerRow[buffer.Length];
|
||||
for (int i = 0; i < buffer.Length; i++)
|
||||
rows[i] = new LedgerRow { ItemId = buffer[i].ItemId, Count = buffer[i].Count };
|
||||
|
||||
// M7: also persist player-built structures + their production tick-state / inventory (single shared scan).
|
||||
// Persist player-built structures (single shared scan; drift-proof vs the quit-to-menu writer).
|
||||
uint nowTick = SystemAPI.GetSingleton<NetworkTime>().ServerTick.TickIndexForValidTick;
|
||||
SaveStructureScan.Collect(EntityManager, nowTick, out var structures, out var structureIo);
|
||||
// v6: the permanent-meta slice via the ONE shared collector (drift-proof vs the quit-to-menu writer).
|
||||
SaveStructureScan.Collect(EntityManager, nowTick, out var structures);
|
||||
// v6: the permanent-meta slice via the ONE shared collector.
|
||||
MetaSaveScan.Collect(EntityManager, dir, out var metaRows, out var runsCompleted, out var maxDepth);
|
||||
|
||||
|
||||
SaveService.Save(new SaveData
|
||||
{
|
||||
GoalCharge = goal.Charge,
|
||||
GoalTarget = goal.Target,
|
||||
CoreCurrent = core.Current,
|
||||
RunOutcome = outcome.Value,
|
||||
RunsCompleted = runsCompleted,
|
||||
MaxDepthReached = maxDepth,
|
||||
MetaUpgrades = metaRows,
|
||||
|
||||
Ledger = rows,
|
||||
Structures = structures,
|
||||
StructureIo = structureIo,
|
||||
SavedAtMs = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user