Drop wrapper orbit guid fields from zone runtime
This commit is contained in:
parent
be3db3d734
commit
d7ad15c35c
5 changed files with 66 additions and 13 deletions
Binary file not shown.
|
|
@ -17,6 +17,7 @@ RequireTypedBehaviorBodyKeys(root);
|
|||
RequireTypedOrbitTaskKeys(root);
|
||||
RequireTypedOrbitalEntityOrbitKeys(root);
|
||||
RequireTypedOrbitConsumerKeys(root);
|
||||
RequireKeyedOrbitRuntimeWrappers(root);
|
||||
RequireTypedFactionShellLinks(root);
|
||||
RequireFactionKeyIdentity(root);
|
||||
RequireEveRuntimeBootstrap(root);
|
||||
|
|
@ -1119,6 +1120,53 @@ static void RequireTypedOrbitConsumerKeys(string root)
|
|||
}
|
||||
}
|
||||
|
||||
static void RequireKeyedOrbitRuntimeWrappers(string root)
|
||||
{
|
||||
var zoneSourcePath = Path.Combine(root, "Assets", "Scripts", "ServerShared", "Zone.cs");
|
||||
var zoneSource = File.Exists(zoneSourcePath)
|
||||
? File.ReadAllText(zoneSourcePath)
|
||||
: throw new InvalidOperationException("Cannot verify keyed orbit runtime wrappers; Zone source is missing.");
|
||||
|
||||
var forbiddenSymbols = new[]
|
||||
{
|
||||
"public Guid OrbitId { get; }",
|
||||
"public Guid Orbit { get; }",
|
||||
"OrbitId = data.Orbit;",
|
||||
"Orbit = data.Orbit;",
|
||||
"AsteroidBelts[belt.ID] = new AsteroidBelt(belt);",
|
||||
"var orbit = Orbits[belt.Orbit];"
|
||||
};
|
||||
var hits = forbiddenSymbols
|
||||
.Where(symbol => zoneSource.Contains(symbol, StringComparison.Ordinal))
|
||||
.Select(symbol => $"Assets/Scripts/ServerShared/Zone.cs: contains {symbol}")
|
||||
.ToArray();
|
||||
if (hits.Length > 0)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Planet and asteroid-belt runtime wrappers must not publish wrapper orbit GUID fields once keyed/object orbit surfaces exist: " +
|
||||
string.Join("; ", hits));
|
||||
}
|
||||
|
||||
var requiredSymbols = new[]
|
||||
{
|
||||
"public Orbit Orbit;",
|
||||
"public Orbit Orbit { get; }",
|
||||
"AsteroidBelts[belt.ID] = new AsteroidBelt(belt, Orbits[belt.Orbit]);",
|
||||
"belt.NewOrbitPosition = GetOrbitPosition(belt.Orbit.ParentOrbitKey);",
|
||||
"public AsteroidBelt(AsteroidBeltConstructionData data, Orbit orbit)",
|
||||
"Orbit = orbit;"
|
||||
};
|
||||
var missingSymbols = requiredSymbols
|
||||
.Where(symbol => !zoneSource.Contains(symbol, StringComparison.Ordinal))
|
||||
.ToArray();
|
||||
if (missingSymbols.Length > 0)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Planet and asteroid-belt runtime wrappers must keep orbit authority on Orbit objects plus OrbitKey surfaces: " +
|
||||
string.Join(", ", missingSymbols));
|
||||
}
|
||||
}
|
||||
|
||||
static void RequireTypedFactionShellLinks(string root)
|
||||
{
|
||||
var checkedFiles = new[]
|
||||
|
|
|
|||
|
|
@ -142,6 +142,10 @@ intro-cutscene planet selection, zone planet/belt loading, gas-giant parent
|
|||
lighting, asteroid-belt UI setup, and `ResourceScanner` planet range checks all
|
||||
read `OrbitKey` from runtime wrappers and ask `Zone` to resolve it instead of
|
||||
reading wrapper GUID orbit fields directly.
|
||||
`Planet` and `AsteroidBelt` runtime wrappers no longer publish separate wrapper
|
||||
orbit GUID fields either: they keep `OrbitKey` plus their `Orbit` runtime
|
||||
object, and `Zone` lowers asteroid transforms through `belt.Orbit.ParentOrbitKey`
|
||||
instead of reading a raw wrapper orbit GUID.
|
||||
The package runtime catalog snapshot indexes items by canonical item key; Unity
|
||||
gameplay, HUD, inventory, trade, ship, and zone helper lookups use `ItemKey`
|
||||
directly instead of deriving `ItemId` and searching by legacy GUID.
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ public class Zone
|
|||
switch (planet)
|
||||
{
|
||||
case AsteroidBeltConstructionData belt:
|
||||
AsteroidBelts[belt.ID] = new AsteroidBelt(belt);
|
||||
AsteroidBelts[belt.ID] = new AsteroidBelt(belt, Orbits[belt.Orbit]);
|
||||
break;
|
||||
case SunConstructionData sun:
|
||||
PlanetInstances.Add(sun.ID, new Sun(settings, sun, Orbits[planet.Orbit]));
|
||||
|
|
@ -280,8 +280,7 @@ public class Zone
|
|||
{
|
||||
var belt = AsteroidBelts[planetDataID];
|
||||
|
||||
var orbit = Orbits[belt.Orbit];
|
||||
belt.NewOrbitPosition = GetOrbitPosition(orbit.Parent);
|
||||
belt.NewOrbitPosition = GetOrbitPosition(belt.Orbit.ParentOrbitKey);
|
||||
for (var i = 0; i < belt.AsteroidCount; i++)
|
||||
{
|
||||
var asteroid = belt.GetAsteroid(i);
|
||||
|
|
@ -455,7 +454,6 @@ public class Planet
|
|||
public Guid ID { get; }
|
||||
public string BodyKey { get; }
|
||||
public string Name { get; }
|
||||
public Guid OrbitId { get; }
|
||||
public string OrbitKey { get; }
|
||||
public float Mass { get; }
|
||||
public IReadOnlyDictionary<string, float> Resources { get; }
|
||||
|
|
@ -474,7 +472,6 @@ public class Planet
|
|||
ID = data.ID;
|
||||
BodyKey = Zone.BodyKey(data.ID);
|
||||
Name = data.Name ?? "";
|
||||
OrbitId = data.Orbit;
|
||||
OrbitKey = Zone.OrbitKey(data.Orbit);
|
||||
Mass = data.Mass;
|
||||
Resources = data.Resources;
|
||||
|
|
@ -561,10 +558,10 @@ public class Sun : GasGiant
|
|||
public class AsteroidBelt
|
||||
{
|
||||
private readonly Asteroid[] _asteroids;
|
||||
public Orbit Orbit { get; }
|
||||
public Guid ID { get; }
|
||||
public string BodyKey { get; }
|
||||
public string Name { get; }
|
||||
public Guid Orbit { get; }
|
||||
public string OrbitKey { get; }
|
||||
public float Mass { get; }
|
||||
public IReadOnlyDictionary<string, float> Resources { get; }
|
||||
|
|
@ -581,13 +578,13 @@ public class AsteroidBelt
|
|||
public Dictionary<int, float> Damage = new Dictionary<int, float>();
|
||||
public Dictionary<(Entity, int), float> MiningAccumulator = new Dictionary<(Entity, int), float>();
|
||||
|
||||
public AsteroidBelt(AsteroidBeltConstructionData data)
|
||||
public AsteroidBelt(AsteroidBeltConstructionData data, Orbit orbit)
|
||||
{
|
||||
_asteroids = data.Asteroids;
|
||||
Orbit = orbit;
|
||||
ID = data.ID;
|
||||
BodyKey = Zone.BodyKey(data.ID);
|
||||
Name = data.Name ?? "";
|
||||
Orbit = data.Orbit;
|
||||
OrbitKey = Zone.OrbitKey(data.Orbit);
|
||||
Mass = data.Mass;
|
||||
Resources = data.Resources;
|
||||
|
|
|
|||
|
|
@ -1198,9 +1198,10 @@ First Aetheria surfaces to publish:
|
|||
- Done: move orbit phase evaluation off `OrbitConstructionData`; runtime zone updates,
|
||||
asteroid transforms, and generator rosette spacing now use `Orbit.Evaluate`,
|
||||
leaving `OrbitConstructionData` as a construction input only.
|
||||
- Done: rename `OrbitalEntity.OrbitData` to `OrbitId` and delete the unused
|
||||
`Zone.CreateOrbit` construction-row writer; runtime entities no longer
|
||||
expose an orbit id through DTO-shaped naming.
|
||||
- Done: move orbital runtime entity ownership from the old DTO-shaped
|
||||
`OrbitData` scar all the way onto `OrbitKey`; the obsolete `OrbitId`
|
||||
intermediate field is gone, and runtime entities now resolve through
|
||||
`Zone` instead of exposing wrapper orbit GUID authority.
|
||||
- Done: move patrol/tow orbit targets onto typed orbit keys: `PatrolOrbitsTask`,
|
||||
`MoveToOrbitState`, and `StationTowing` now retain keyed orbit references,
|
||||
and `Zone` owns orbit-key parsing/resolution for agent orbit movement.
|
||||
|
|
@ -1372,8 +1373,11 @@ First Aetheria surfaces to publish:
|
|||
`OrbitKey` values, with `Zone` owning orbital movement and dock-camera
|
||||
parent-orbit resolution for that seam. Renderer, intro-cutscene, and
|
||||
`ResourceScanner` orbit readers now also consume the wrapper `OrbitKey`
|
||||
edge instead of wrapper GUID orbit fields. Remaining broader simulation
|
||||
paths still derive legacy GUIDs until those structures move to typed keys.
|
||||
edge instead of wrapper GUID orbit fields. `Planet` and `AsteroidBelt`
|
||||
runtime wrappers no longer publish separate wrapper orbit GUID fields
|
||||
either; they retain `OrbitKey` plus their runtime `Orbit` object. Remaining
|
||||
broader simulation paths still derive legacy GUIDs until those structures
|
||||
move to typed keys.
|
||||
- Done: delete the `ItemInstance.ItemId` legacy-GUID projection; diagnostics
|
||||
now report `ItemKey` so item instances expose only typed item-key identity.
|
||||
- Done: delete `Entity`/`EquippedCargoBay` cargo and consumable GUID lookup
|
||||
|
|
|
|||
Loading…
Reference in a new issue