RegionClock: the player's zone steps, every other zone's facilities advance by 60 s spans, entering settles the zone and records what the player saw leaving

RegionClock.Step is a run's one driver (ActionGameManager no longer calls Zone.Update); Zone.AdvanceTo runs the off-screen facilities by the span a zone missed and places its orbits at the new time. RegionClock.Enter is the one writer of VisitedZones and GalaxyZone.LastSeen (SavedZone Key 7). PackedContents is a Zone's construction input, cleared by RunStart.Live. The sector map reads RegionClock.Seen. Galaxy's save constructor copies the pack it builds a Zone from, so a Continue in the same process reads the save as written.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
soul 2026-11-28 20:43:11 +01:00
commit fb1f1df869
10 changed files with 156 additions and 53 deletions

View file

@ -849,9 +849,15 @@ public class ActionGameManager : MonoBehaviour
{
if (galaxyZone == null) throw new ArgumentNullException(nameof(galaxyZone));
// RunStart.Materialize owns every zone's existence; entering only reads it.
CurrentGalaxy.VisitedZones.Add(galaxyZone);
Zone = galaxyZone.Contents ?? throw new InvalidOperationException($"Zone {galaxyZone.Name} has no live contents.");
// RunStart.Materialize owns every zone's existence; RegionClock.Enter settles the zone entered, records the sighting
// of the zone left and writes the visit. The traveller leaves first, so the sighting holds no player.
var leaving = Zone;
if (CurrentEntity != null)
{
CurrentEntity.Deactivate();
CurrentEntity.Zone.Remove(CurrentEntity);
}
Zone = RegionClock.Enter(CurrentGalaxy, leaving, galaxyZone);
_zoneEntered = true; // the clock forgets its lead between frames, never inside a step
PlayMusic(MusicType.Overworld);
_music = MusicType.Overworld;
@ -860,8 +866,6 @@ public class ActionGameManager : MonoBehaviour
if (CurrentEntity != null)
{
CurrentEntity.Deactivate();
CurrentEntity.Zone.Remove(CurrentEntity);
CurrentEntity.Zone = Zone;
Zone.Admit(CurrentEntity, piloted: false);
}
@ -1624,7 +1628,7 @@ public class ActionGameManager : MonoBehaviour
Clock.Advance(_paused ? 0f : Time.deltaTime, delta =>
{
if (Zone != steppedZone) return;
steppedZone.Update(delta);
RegionClock.Step(steppedZone, delta);
// A warning lives one tick, so sweeps are collected per tick, never read per frame.
if (CurrentEntity != null && CurrentEntity.Zone == steppedZone)
foreach (var warning in CurrentEntity.IncomingPaints)