Keep zone asteroid helpers on typed keys

This commit is contained in:
Meta Vens 2026-06-16 16:32:31 +01:00
commit 43655ca96d
5 changed files with 69 additions and 23 deletions

View file

@ -19,6 +19,7 @@ RequireTypedOrbitalEntityOrbitKeys(root);
RequireTypedOrbitConsumerKeys(root);
RequireKeyedOrbitRuntimeWrappers(root);
RequireNativeZoneKeyResolution(root);
RequireTypedAsteroidZoneApi(root);
RequireTypedFactionShellLinks(root);
RequireFactionKeyIdentity(root);
RequireEveRuntimeBootstrap(root);
@ -1262,6 +1263,54 @@ static void RequireNativeZoneKeyResolution(string root)
}
}
static void RequireTypedAsteroidZoneApi(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 typed asteroid Zone API; Zone source is missing.");
var forbiddenSymbols = new[]
{
"public int NearestAsteroid(Guid planetDataID, float2 position)",
"public bool AsteroidExists(Guid planetDataID, int asteroid)",
"public void MineAsteroid(Entity miner, Guid asteroidBelt, int asteroid, float damage, float efficiency, float penetration)",
"BeltUpdates.Add(Task.Run(() => UpdateAsteroidTransforms(belt.Key)));",
"private void UpdateAsteroidTransforms(Guid planetDataID)",
"MineAsteroid(miner, belt.ID, asteroid, damage, efficiency, penetration);"
};
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(
"Zone asteroid helpers must keep typed body-key or runtime-object authority rather than Guid overloads: " +
string.Join("; ", hits));
}
var requiredSymbols = new[]
{
"foreach (var belt in AsteroidBelts.Values)",
"BeltUpdates.Add(Task.Run(() => UpdateAsteroidTransforms(belt)));",
"public int NearestAsteroid(string asteroidBeltKey, float2 position)",
"if (!TryGetAsteroidBelt(asteroidBeltKey, out var belt))",
"public bool AsteroidExists(string asteroidBeltKey, int asteroid)",
"private void UpdateAsteroidTransforms(AsteroidBelt belt)",
"public void MineAsteroid(Entity miner, string asteroidBeltKey, int asteroid, float damage, float efficiency, float penetration)"
};
var missingSymbols = requiredSymbols
.Where(symbol => !zoneSource.Contains(symbol, StringComparison.Ordinal))
.ToArray();
if (missingSymbols.Length > 0)
{
throw new InvalidOperationException(
"Zone asteroid helpers must route through typed body keys or runtime belt objects: " +
string.Join(", ", missingSymbols));
}
}
static void RequireFactionKeyIdentity(string root)
{
var checkedFiles = new[]