Run Re-Do
This commit is contained in:
@@ -62,6 +62,15 @@ namespace ProjectM.Server
|
||||
// spawn like CycleRuntime/ThreatState (never on the ghost serializer). RunOutcome is baked on the prefab.
|
||||
ecb.AddComponent(director, new RunPhase { Value = RunPhaseId.Normal });
|
||||
|
||||
// Expedition redesign: run-FSM working state + the co-op route first-commit latch + the persisted
|
||||
// meta counters — ALL added UNCONDITIONALLY at spawn (the CycleRuntime/ThreatState/RunPhase idiom;
|
||||
// D-F2: a New-Game boot must have the components the bank block reads; Continue restores VALUES only,
|
||||
// inside the HasData block — Step 12b). HostSalt starts a fixed non-tick seed lineage (bumped per
|
||||
// launch); SaveData v6 folds persisted RunsCompleted in at restore so cross-session runs diverge.
|
||||
ecb.AddComponent(director, new RunRuntime { HostSalt = 0x5EED0001u });
|
||||
ecb.AddComponent(director, default(RouteCommand));
|
||||
ecb.AddComponent(director, default(MetaCounters));
|
||||
|
||||
// Born-correct load: if the menu staged a save (Continue), apply it AT SPAWN so the director
|
||||
// DR-042 C6c: a NEW game seeds starting Ore below; a restored save (Continue) keeps its ledger.
|
||||
bool restoredLedger = false;
|
||||
@@ -98,6 +107,33 @@ namespace ProjectM.Server
|
||||
// save / New Game = 0 -> InProgress). Independent of the Core -> NOT nested in the CoreIntegrity guard.
|
||||
ecb.SetComponent(director, new RunOutcome { Value = pending.RunOutcome });
|
||||
|
||||
// v6: restore the permanent meta — counters (VALUES only; the component was added
|
||||
// unconditionally above, D-F2), the tier record (SetBuffer replaces the baked-empty
|
||||
// [GhostField] buffer pre-Playback — the StorageEntry idiom — rows VERBATIM incl. unknown
|
||||
// ids), the born-correct RunInfo HUD mirror (the spawn-time exception to RunDirector's
|
||||
// sole-writer rule, like CycleState/RunOutcome above), and the HostSalt fold (cross-session
|
||||
// first-run maps diverge once you've banked clears — the promise at the RunRuntime add).
|
||||
ecb.SetComponent(director, new MetaCounters
|
||||
{
|
||||
RunsCompleted = pending.RunsCompleted,
|
||||
MaxDepthReached = pending.MaxDepthReached,
|
||||
});
|
||||
var metaSrc = SystemAPI.GetBuffer<PendingMetaRow>(pendingEntity);
|
||||
var metaDst = ecb.SetBuffer<MetaTierState>(director);
|
||||
for (int mi = 0; mi < metaSrc.Length; mi++)
|
||||
metaDst.Add(new MetaTierState { ClassId = metaSrc[mi].ClassId, UpgradeId = metaSrc[mi].UpgradeId, Tier = metaSrc[mi].Tier });
|
||||
if (SystemAPI.HasComponent<RunInfo>(spawner.Prefab))
|
||||
{
|
||||
var runInfo = SystemAPI.GetComponent<RunInfo>(spawner.Prefab); // baked Lifecycle=Staging
|
||||
runInfo.RunsCompleted = pending.RunsCompleted;
|
||||
runInfo.MaxDepthReached = pending.MaxDepthReached;
|
||||
ecb.SetComponent(director, runInfo);
|
||||
}
|
||||
ecb.SetComponent(director, new RunRuntime
|
||||
{
|
||||
HostSalt = RunMapMath.Hash(0x5EED0001u, (uint)pending.RunsCompleted + 1u),
|
||||
});
|
||||
|
||||
}
|
||||
ecb.DestroyEntity(pendingEntity);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user