Restore faction-aware loadout generation

This commit is contained in:
Meta Vens 2026-07-11 20:32:33 +01:00
commit 99e4f1d3e7
5 changed files with 380 additions and 146 deletions

View file

@ -1217,6 +1217,7 @@ static void RequireDaemonPlayableRunGenerationAuthority(string root)
{
var daemonProgramPath = Path.Combine(root, "Aetheria.State.Daemon", "Program.cs");
var daemonZoneGeneratorPath = Path.Combine(root, "Aetheria.State.Daemon", "AetheriaDaemonZoneGenerator.cs");
var daemonLoadoutGeneratorPath = Path.Combine(root, "Aetheria.State.Daemon", "AetheriaDaemonLoadoutGenerator.cs");
var sharedLoadoutGeneratorPath = Path.Combine(root, "Assets", "Scripts", "ServerShared", "LoadoutGenerator.cs");
var daemonProgram = File.Exists(daemonProgramPath)
@ -1225,6 +1226,9 @@ static void RequireDaemonPlayableRunGenerationAuthority(string root)
var daemonZoneGenerator = File.Exists(daemonZoneGeneratorPath)
? File.ReadAllText(daemonZoneGeneratorPath)
: throw new InvalidOperationException("Cannot verify daemon playable-run generation authority; daemon zone generator is missing.");
var daemonLoadoutGenerator = File.Exists(daemonLoadoutGeneratorPath)
? File.ReadAllText(daemonLoadoutGeneratorPath)
: throw new InvalidOperationException("Cannot verify daemon playable-run generation authority; daemon loadout generator is missing.");
var sharedLoadoutGenerator = File.Exists(sharedLoadoutGeneratorPath)
? File.ReadAllText(sharedLoadoutGeneratorPath)
: throw new InvalidOperationException("Cannot verify daemon playable-run generation authority; legacy Unity LoadoutGenerator.cs is missing.");
@ -1233,12 +1237,15 @@ static void RequireDaemonPlayableRunGenerationAuthority(string root)
{
"await AetheriaDaemonZoneGenerator.WritePlayableRunAsync(",
"internal static class AetheriaDaemonZoneGenerator",
"private sealed class DaemonLoadoutGenerator",
"var loadouts = new DaemonLoadoutGenerator(catalog);",
"GenerateEntities(loadouts)"
"new AetheriaDaemonLoadoutGenerator(",
"GenerateEntities(loadouts, availabilityFactions)",
"Math.Pow(item.Price, _priceExponent)",
"Distance(_zoneIndex, _homeZones[item.ManufacturerKey])",
"FitsHardpoint(candidate, hardpoint)",
"HasBehavior(candidate, controllerKind)"
};
var daemonText = daemonProgram + "\n" + daemonZoneGenerator;
var daemonText = daemonProgram + "\n" + daemonZoneGenerator + "\n" + daemonLoadoutGenerator;
var missingDaemonSymbols = requiredDaemonSymbols
.Where(symbol => !daemonText.Contains(symbol, StringComparison.Ordinal))
.ToArray();
@ -1254,7 +1261,9 @@ static void RequireDaemonPlayableRunGenerationAuthority(string root)
"new LoadoutGenerator(",
"ZoneGenerator.Generate(",
"Assets.Scripts.ServerShared",
"ServerShared.LoadoutGenerator"
"ServerShared.LoadoutGenerator",
"ManufacturerScore(",
"FallbackHull("
};
var survivingDaemonSymbols = forbiddenDaemonSymbols
.Where(symbol => daemonText.Contains(symbol, StringComparison.Ordinal))