diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index 24c46fd7b..dade458d4 100644 Binary files a/.voidbot/state/aetheria.cc and b/.voidbot/state/aetheria.cc differ diff --git a/Assets/Scripts/ServerShared/Galaxy.cs b/Assets/Scripts/ServerShared/Galaxy.cs index b697dd53d..af7742a46 100644 --- a/Assets/Scripts/ServerShared/Galaxy.cs +++ b/Assets/Scripts/ServerShared/Galaxy.cs @@ -32,7 +32,7 @@ public class Galaxy private HashSet _containedFactions; private GalaxyZone[] _exitPath; private Dictionary _nameGenerators = new Dictionary(); - private readonly ILegacyCatalogReader _catalog; + private readonly ItemManager _itemManager; public GalaxyZone[] ExitPath { @@ -48,16 +48,16 @@ public class Galaxy SectorGenerationSettings settings, SectorBackgroundSettings background, NameGeneratorSettings nameGeneratorSettings, - ILegacyCatalogReader catalog, + ItemManager itemManager, Action log, Action progressCallback = null, uint seed = 0) { - _catalog = catalog; + _itemManager = itemManager; IsPrelude = false; Background = background; Log = log; - var factions = catalog.GetAll(); + var factions = itemManager.GetCatalogEntries(); var random = new Random(seed == 0 ? (uint) (DateTime.Now.Ticks % uint.MaxValue) : seed); Factions = factions.OrderBy(x => random.NextFloat()).Take(settings.MegaCount).ToArray(); foreach (var f in Factions) FactionRelationships[f] = FactionRelationship.Neutral; @@ -81,7 +81,7 @@ public class Galaxy CalculateFactionInfluence(progressCallback); - GenerateNames(catalog, nameGeneratorSettings, ref random, progressCallback); + GenerateNames(itemManager, nameGeneratorSettings, ref random, progressCallback); progressCallback?.Invoke("Done!"); if(progressCallback!=null) Thread.Sleep(500); // Inserting Delay to make it seem like it's doing more work lmao @@ -89,21 +89,21 @@ public class Galaxy public Faction ResolveFaction(string name) { - return _catalog.GetAll().FirstOrDefault(f => f.Name.StartsWith(name, StringComparison.InvariantCultureIgnoreCase)); + return _itemManager.GetCatalogEntries().FirstOrDefault(f => f.Name.StartsWith(name, StringComparison.InvariantCultureIgnoreCase)); } public Galaxy( TutorialGenerationSettings settings, SectorBackgroundSettings background, NameGeneratorSettings nameGeneratorSettings, - ILegacyCatalogReader catalog, + ItemManager itemManager, PlayerSettings playerSettings, DirectoryInfo narrativeDirectory, Action log, Action progressCallback = null, uint seed = 0) { - _catalog = catalog; + _itemManager = itemManager; IsPrelude = true; Background = background; @@ -189,7 +189,7 @@ public class Galaxy CalculateFactionInfluence(progressCallback); - GenerateNames(catalog, nameGeneratorSettings, ref random, progressCallback); + GenerateNames(itemManager, nameGeneratorSettings, ref random, progressCallback); // progressCallback?.Invoke("Weaving Narrative"); // var processor = new StoryProcessor(playerSettings, narrativeDirectory, this, ref random, Log); @@ -280,7 +280,7 @@ public class Galaxy } } - private void GenerateNames(ILegacyCatalogReader catalog, + private void GenerateNames(ItemManager itemManager, NameGeneratorSettings nameGeneratorSettings, ref Random random, Action progressCallback = null) @@ -290,7 +290,7 @@ public class Galaxy progressCallback?.Invoke($"Feeding Markov Chains: {i + 1} / {Factions.Length}"); //if(progressCallback!=null) Thread.Sleep(250); // Inserting Delay to make it seem like it's doing more work lmao var faction = Factions[i]; - _nameGenerators[faction] = new MarkovNameGenerator(ref random, catalog.Get(faction.GeonameFile).Names, nameGeneratorSettings); + _nameGenerators[faction] = new MarkovNameGenerator(ref random, itemManager.GetCatalogEntry(faction.GeonameFile).Names, nameGeneratorSettings); } // Generate zone name using the owner's name generator, otherwise assign catalogue ID diff --git a/Assets/Scripts/UI/MainMenu.cs b/Assets/Scripts/UI/MainMenu.cs index b4361293c..5c4e4172b 100644 --- a/Assets/Scripts/UI/MainMenu.cs +++ b/Assets/Scripts/UI/MainMenu.cs @@ -117,7 +117,7 @@ public class MainMenu : MonoBehaviour Settings.SectorGenerationSettings, Settings.SectorBackgroundSettings, Settings.NameGeneratorSettings, - ActionGameManager.LegacyCatalog, + ActionGameManager.ItemManager, Debug.Log, setState); Observable.NextFrame().Subscribe(_ => @@ -143,7 +143,7 @@ public class MainMenu : MonoBehaviour Settings.TutorialGenerationSettings, Settings.TutorialBackgroundSettings, Settings.NameGeneratorSettings, - ActionGameManager.LegacyCatalog, + ActionGameManager.ItemManager, ActionGameManager.PlayerSettings, ActionGameManager.GameDataDirectory.CreateSubdirectory("Narrative"), Debug.Log, diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index b16929714..3b2333ff1 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -77,6 +77,11 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. `GetCatalogEntries` methods. This does not remove the legacy reader under the hood; it prevents old catalog authority from leaking into every caller that only needs a domain lookup. +- `Galaxy` generation no longer accepts `ILegacyCatalogReader`. Sector and + tutorial generation receive `ItemManager` and use the same narrow catalog + lookup port for factions and name files. `ActionGameManager.LegacyCatalog` + now feeds only `ItemManager` boot; menu/generation paths no longer receive + the legacy reader directly. - `DatabaseLink.Value` can resolve legacy links only after `LegacyCatalogBoundary` binds the pull-only catalog cache. Legacy catalog construction no longer grabs global `DatabaseLinkBase` authority. @@ -183,11 +188,12 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. old MessagePack catalog reads, and `LegacyCatalogBoundary` is the only named owner for opening the old catalog and binding legacy `DatabaseLink` resolution until catalog migration lands. Runtime code receives narrow - `ItemManager` catalog methods where gameplay only needs lookups; `ItemManager` - and `Galaxy` still receive `ILegacyCatalogReader` until typed runtime catalog - boot replaces them. `Aetheria.State.Unity` owns a read-only typed catalog - facade for future Unity consumers; it does not write state or own simulation. - The legacy cache no longer has a public mutation surface. + `ItemManager` catalog methods where gameplay only needs lookups. `ItemManager` + still receives `ILegacyCatalogReader` until typed runtime catalog boot + replaces it; `Galaxy` has been moved off the legacy reader and now consumes + `ItemManager`. `Aetheria.State.Unity` owns a read-only typed catalog facade + for future Unity consumers; it does not write state or own simulation. The + legacy cache no longer has a public mutation surface. - Inputs: Unity gameplay code, legacy catalog files, typed state documents, and CultMesh server state. - Outputs: `Aetheria.State` emits `.cc` state and CultMesh documents. Legacy @@ -228,8 +234,8 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. - Shared paths: gameplay input, editor edits, import/deep-load, replication, simulation ticks, and tests all call the same typed state service. - Deletion line: after catalog migration smokes pass, replace - `ActionGameManager.LegacyCatalog`/`ItemManager`/`Galaxy` boot with the typed - runtime catalog package, then delete or quarantine the remaining + `ActionGameManager.LegacyCatalog`/`ItemManager` boot with the typed runtime + catalog package, then delete or quarantine the remaining `LegacyCatalogCache`/`DatabaseEntry` runtime catalog dependency and remove old MessagePack backing store classes from live Unity source.