Rename RegionClock.AdvanceFacilities to AdvanceInstalled: what the span runs is installed plant, not only facilities (cut habitation-gear)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
725d8235c3
commit
ce2fb80e7c
4 changed files with 7 additions and 7 deletions
|
|
@ -19,7 +19,7 @@ public class FacilityData : BehaviorData
|
|||
}
|
||||
|
||||
// The installed facility (ruling demand-consumed-inputs-processed-by-facilities). It ticks once per zone step, from EquippedItem.Update
|
||||
// while the item is active, on screen; off screen RegionClock.AdvanceFacilities calls Execute with the span the zone missed. Its recipes are the run list of its design, fixed for a run because the catalog is.
|
||||
// while the item is active, on screen; off screen RegionClock.AdvanceInstalled calls Execute with the span the zone missed. Its recipes are the run list of its design, fixed for a run because the catalog is.
|
||||
public class Facility : Behavior
|
||||
{
|
||||
private IReadOnlyList<RecipeData> _runList;
|
||||
|
|
|
|||
|
|
@ -49,10 +49,10 @@ public static class RegionClock
|
|||
public static ZonePack Seen(GalaxyZone zone, Zone current) =>
|
||||
zone.Contents != null && zone.Contents == current ? current.PackZone() : zone.LastSeen;
|
||||
|
||||
// Every facility of the entity runs `seconds`, as EquippedItem.Update runs it each step: a unit that is enabled and not
|
||||
// The entity's installed plant runs `seconds`, as EquippedItem.Update runs it each step: a unit that is enabled and not
|
||||
// destroyed (Active also needs ThermalOnline, which only a stepped entity sets, so it is not the off-screen gate). The
|
||||
// units in Equipment order, each unit's Facility behaviours in order.
|
||||
public static void AdvanceFacilities(Entity entity, double seconds)
|
||||
public static void AdvanceInstalled(Entity entity, double seconds)
|
||||
{
|
||||
foreach (var unit in entity.Equipment)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -363,14 +363,14 @@ public class Zone
|
|||
|
||||
private bool IsExpired(ChunkWear wear) => wear.Damage <= 0f && (!wear.BrokenUntil.HasValue || wear.BrokenUntil.Value <= _time);
|
||||
|
||||
// A zone the player is not in, brought to `time` (RegionClock.Step and Enter only): its facilities run the span it missed,
|
||||
// A zone the player is not in, brought to `time` (RegionClock.Step and Enter only): its installed plant runs the span it missed,
|
||||
// its clock moves, and every orbit is placed at the new time so the next Update differences from it, not from where the
|
||||
// zone was left.
|
||||
public void AdvanceTo(double time)
|
||||
{
|
||||
var span = time - _time;
|
||||
if (!(span > 0)) return;
|
||||
foreach (var entity in Entities.ToArray()) RegionClock.AdvanceFacilities(entity, span);
|
||||
foreach (var entity in Entities.ToArray()) RegionClock.AdvanceInstalled(entity, span);
|
||||
_time = time;
|
||||
_updatedOrbits.Clear();
|
||||
foreach (var orbit in Orbits) GetOrbitPosition(orbit.Key);
|
||||
|
|
|
|||
|
|
@ -387,7 +387,7 @@ public static class EconomyDrain
|
|||
entity.Equipment.SelectMany(unit => unit.Behaviors.OfType<Facility>().Select(facility => (unit, facility)));
|
||||
|
||||
// The copy's facilities, each advanced through `seconds` of sim time in spans of RegionClock.Span by the off-screen step the
|
||||
// game ships (RegionClock.AdvanceFacilities), in equipment order. Returns the Stall each ended in; each sees the sim time and
|
||||
// game ships (RegionClock.AdvanceInstalled), in equipment order. Returns the Stall each ended in; each sees the sim time and
|
||||
// the stalls after every span.
|
||||
public Stall[] Spans(Entity copy, double seconds, Action<double, Stall[]> each = null)
|
||||
{
|
||||
|
|
@ -396,7 +396,7 @@ public static class EconomyDrain
|
|||
for (var at = 0.0; at < seconds - 1e-9;)
|
||||
{
|
||||
var span = Math.Min(RegionClock.Span, seconds - at);
|
||||
RegionClock.AdvanceFacilities(copy, span);
|
||||
RegionClock.AdvanceInstalled(copy, span);
|
||||
for (var i = 0; i < facilities.Length; i++) last[i] = facilities[i].Stall;
|
||||
at += span;
|
||||
each?.Invoke(at, last);
|
||||
|
|
|
|||
Loading…
Reference in a new issue