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

@ -72,38 +72,35 @@ public class SectorRenderer : MonoBehaviour, IBeginDragHandler, IDragHandler, IS
var mass = GameManager.Settings.ZoneSettings.ZoneMass.Evaluate(density);
Properties.AddProperty("Mass", () => ActionGameManager.PlayerSettings.Format(mass));
Properties.AddProperty("Radius", () => ActionGameManager.PlayerSettings.Format(radius));
if (!ActionGameManager.CurrentGalaxy.VisitedZones.Contains(zone))
// The map shows the zone the player is in live and every other zone as he last saw it (RegionClock.Seen).
var seen = RegionClock.Seen(zone, GameManager.Zone);
if (seen == null)
{
Properties.AddProperty(() => "Has not been visited");
return;
}
else
string Count(System.Func<BodyData, bool> where) => seen.Planets.Select(body => ActionGameManager.CultCache.Get(body)).Count(where).ToString();
string Hulls(HullType type) => seen.Entities
.Count(entity => ((HullData) GameManager.ItemManager.GetData(entity.Hull)).HullType == type).ToString();
var planetCount = Count(body => body is PlanetData);
Properties.AddProperty("Planets", () => planetCount);
var beltCount = Count(body => body is AsteroidBeltData);
Properties.AddProperty("Asteroid Belts", () => beltCount);
var giantCount = Count(body => body is GasGiantData && !(body is SunData));
Properties.AddProperty("Gas Giants", () => giantCount);
var starCount = Count(body => body is SunData);
Properties.AddProperty("Stars", () => starCount);
var stationCount = Hulls(HullType.Station);
Properties.AddProperty("Stations", () => stationCount);
var turretCount = Hulls(HullType.Turret);
Properties.AddProperty("Turrets", () => turretCount);
var shipCount = Hulls(HullType.Ship);
Properties.AddProperty("Ships", () => shipCount);
if (zone.Contents != GameManager.Zone)
{
var planetCount = zone.PackedContents.Planets.Count(body => ActionGameManager.CultCache.Get(body) is PlanetData).ToString();
Properties.AddProperty("Planets", () => planetCount);
var beltCount = zone.PackedContents.Planets.Count(body => ActionGameManager.CultCache.Get(body) is AsteroidBeltData).ToString();
Properties.AddProperty("Asteroid Belts", () => beltCount);
var giantCount = zone.PackedContents.Planets.Count(body => ActionGameManager.CultCache.Get(body) is GasGiantData && !(ActionGameManager.CultCache.Get(body) is SunData)).ToString();
Properties.AddProperty("Gas Giants", () => giantCount);
var starCount = zone.PackedContents.Planets.Count(body => ActionGameManager.CultCache.Get(body) is SunData).ToString();
Properties.AddProperty("Stars", () => starCount);
var stationCount = zone.PackedContents.Entities
.Count(entity => ((HullData) GameManager.ItemManager.GetData(entity.Hull)).HullType == HullType.Station)
.ToString();
Properties.AddProperty("Stations", () => stationCount);
var turretCount = zone.PackedContents.Entities
.Count(entity => ((HullData) GameManager.ItemManager.GetData(entity.Hull)).HullType == HullType.Turret)
.ToString();
Properties.AddProperty("Turrets", () => turretCount);
var shipCount = zone.PackedContents.Entities
.Count(entity => ((HullData) GameManager.ItemManager.GetData(entity.Hull)).HullType == HullType.Ship)
.ToString();
Properties.AddProperty("Ships", () => shipCount);
var age = System.TimeSpan.FromSeconds(System.Math.Max(0, GameManager.Zone.ExactTime - seen.Time));
var ago = age.TotalMinutes < 1 ? $"{age.Seconds} s" : age.TotalHours < 1 ? $"{age.Minutes} min" : $"{(int) age.TotalHours} h {age.Minutes} min";
Properties.AddProperty("Last seen", () => $"{ago} ago");
}
});
}