From 3616b6a2df996710d114faabef15f7a993b37e76 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 28 Jun 2026 15:27:16 +0100 Subject: [PATCH] Delete legacy loadout projector --- Aetheria.State.Verify/Program.cs | 27 +--- .../AetheriaRuntimeLoadoutProjector.cs | 151 ------------------ .../AetheriaRuntimeLoadoutProjector.cs.meta | 2 - 3 files changed, 8 insertions(+), 172 deletions(-) delete mode 100644 Assets/Scripts/ServerShared/AetheriaRuntimeLoadoutProjector.cs delete mode 100644 Assets/Scripts/ServerShared/AetheriaRuntimeLoadoutProjector.cs.meta diff --git a/Aetheria.State.Verify/Program.cs b/Aetheria.State.Verify/Program.cs index 10c30b453..7cdb9b1e8 100644 --- a/Aetheria.State.Verify/Program.cs +++ b/Aetheria.State.Verify/Program.cs @@ -17150,7 +17150,13 @@ static void RequireInventoryLoadoutSaveRequestAuthority(string root) var dragObjectsPath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "AetheriaUnityDragObjects.cs"); var gameplaySceneWiringPath = Path.Combine(root, "Assets", "Scripts", "Gameplay", "AetheriaUnityGameplaySceneWiring.cs"); - var requiredFiles = new[] { eveCommandDocumentPath, loadoutCommandsPath, eveBridgePath, runtimeStateMapperPath, inventoryPanelPath, loadoutProjectorPath, loadoutSnapshotProjectorPath, clientStatePath, dragSessionPath, gameplaySceneWiringPath }; + if (File.Exists(loadoutProjectorPath)) + { + throw new InvalidOperationException( + "Legacy AetheriaRuntimeLoadoutProjector must stay deleted; loadout-template saves should compose typed commits from managed daemon-frame documents."); + } + + var requiredFiles = new[] { eveCommandDocumentPath, loadoutCommandsPath, eveBridgePath, runtimeStateMapperPath, inventoryPanelPath, loadoutSnapshotProjectorPath, clientStatePath, dragSessionPath, gameplaySceneWiringPath }; var missingFiles = requiredFiles.Where(path => !File.Exists(path)).ToArray(); if (missingFiles.Length > 0) { @@ -17164,7 +17170,6 @@ static void RequireInventoryLoadoutSaveRequestAuthority(string root) var eveBridge = File.ReadAllText(eveBridgePath); var runtimeStateMapper = File.ReadAllText(runtimeStateMapperPath); var inventoryPanel = File.ReadAllText(inventoryPanelPath); - var loadoutProjector = File.ReadAllText(loadoutProjectorPath); var loadoutSnapshotProjector = File.ReadAllText(loadoutSnapshotProjectorPath); var clientState = File.ReadAllText(clientStatePath); var dragSession = File.ReadAllText(dragSessionPath); @@ -17173,27 +17178,11 @@ static void RequireInventoryLoadoutSaveRequestAuthority(string root) ? File.ReadAllText(dragObjectsPath) : throw new InvalidOperationException("Cannot verify inventory drag/drop authority; AetheriaUnityDragObjects.cs is missing."); - var requiredProjectorSymbols = new[] - { - "public static class AetheriaRuntimeLoadoutProjector", - "ProjectLoadoutTemplate(Entity entity)", - "ProjectSlots(IEnumerable slots)", - }; - var missingProjectorSymbols = requiredProjectorSymbols - .Where(symbol => !loadoutProjector.Contains(symbol, StringComparison.Ordinal)) - .ToArray(); - if (missingProjectorSymbols.Length > 0) - { - throw new InvalidOperationException( - "The typed loadout-template projection used by loadout save is missing from the shared projector: " + - string.Join(", ", missingProjectorSymbols)); - } - if (actionGameManager.Contains("ProjectLoadoutTemplate(Entity entity)", StringComparison.Ordinal) || inventoryPanel.Contains("ActionGameManager.ProjectLoadoutTemplate", StringComparison.Ordinal)) { throw new InvalidOperationException( - "Loadout-template projection must not live on ActionGameManager; callers should use AetheriaRuntimeLoadoutProjector."); + "Loadout-template projection must not live on ActionGameManager; callers should use the managed daemon-frame snapshot path."); } if (actionGameManager.Contains("public DragObject DragObject", StringComparison.Ordinal) || diff --git a/Assets/Scripts/ServerShared/AetheriaRuntimeLoadoutProjector.cs b/Assets/Scripts/ServerShared/AetheriaRuntimeLoadoutProjector.cs deleted file mode 100644 index a8a8b2d1c..000000000 --- a/Assets/Scripts/ServerShared/AetheriaRuntimeLoadoutProjector.cs +++ /dev/null @@ -1,151 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using GameCult.Aetheria.State.Verse; -using Unity.Mathematics; - -public static class AetheriaRuntimeLoadoutProjector -{ - public static AetheriaRuntimeLoadoutTemplateCommit ProjectLoadoutTemplate(EntityConstructionBlueprint blueprint) - { - return new AetheriaRuntimeLoadoutTemplateCommit - { - Name = blueprint?.Name ?? "", - OwnerPlayerKey = "global:aetheria.player_settings.v1", - RootEntity = ProjectEntityLoadout(blueprint) - }; - } - - public static AetheriaRuntimeLoadoutTemplateCommit ProjectLoadoutTemplate(Entity entity) - { - return new AetheriaRuntimeLoadoutTemplateCommit - { - Name = entity?.Name ?? "", - OwnerPlayerKey = "global:aetheria.player_settings.v1", - RootEntity = ProjectEntityLoadout(entity) - }; - } - - private static AetheriaRuntimeEntityLoadoutCommit ProjectEntityLoadout(EntityConstructionBlueprint blueprint) - { - return new AetheriaRuntimeEntityLoadoutCommit - { - Name = blueprint?.Name ?? "", - Kind = blueprint is ShipConstructionBlueprint ? "ship" : blueprint is OrbitalEntityConstructionBlueprint ? "orbital" : "entity", - FactionKey = blueprint?.FactionKey ?? "", - Hull = ProjectLoadoutItem(blueprint?.Hull), - Equipment = ProjectSlots(blueprint?.Equipment), - CargoBays = ProjectSlots(blueprint?.CargoBays), - DockingBays = ProjectSlots(blueprint?.DockingBays), - CargoContents = ProjectCargoBays(blueprint?.CargoContents), - DockingBayContents = ProjectCargoBays(blueprint?.DockingBayContents), - DockingBayAssignments = blueprint?.DockingBayAssignments ?? Array.Empty(), - WeaponGroups = blueprint?.WeaponGroups?.Select(group => (IReadOnlyList)group).ToArray() ?? Array.Empty>(), - Children = blueprint?.Children?.Select(ProjectEntityLoadout).ToArray() ?? Array.Empty() - }; - } - - private static AetheriaRuntimeEntityLoadoutCommit ProjectEntityLoadout(Entity entity) - { - return new AetheriaRuntimeEntityLoadoutCommit - { - Name = entity?.Name ?? "", - Kind = entity is Ship ? "ship" : entity is OrbitalEntity ? "orbital" : "entity", - FactionKey = entity?.Faction?.FactionKey ?? "", - Hull = ProjectLoadoutItem(entity?.Hull), - Equipment = ProjectSlots(entity?.Equipment), - CargoBays = ProjectSlots(entity?.CargoBays), - DockingBays = ProjectSlots(entity?.DockingBays), - CargoContents = ProjectCargoBays(entity?.CargoBays), - DockingBayContents = ProjectCargoBays(entity?.DockingBays), - DockingBayAssignments = entity?.DockingBays? - .Select(dockingBay => entity.Children.IndexOf(dockingBay.DockedShip)) - .ToArray() ?? Array.Empty(), - WeaponGroups = entity?.WeaponGroups? - .Select(group => (IReadOnlyList)group.items - .Select(item => entity.Equipment.IndexOf(item)) - .ToArray()) - .ToArray() ?? Array.Empty>(), - Children = entity?.Children? - .Select(ProjectEntityLoadout) - .ToArray() ?? Array.Empty() - }; - } - - private static AetheriaRuntimeLoadoutItemSlotCommit[] ProjectSlots((int2 position, EquippableItem item)[] slots) - { - return slots? - .Select(slot => new AetheriaRuntimeLoadoutItemSlotCommit - { - X = slot.position.x, - Y = slot.position.y, - Item = ProjectLoadoutItem(slot.item) - }) - .ToArray() ?? Array.Empty(); - } - - private static AetheriaRuntimeLoadoutItemSlotCommit[] ProjectSlots(IEnumerable slots) - { - return slots? - .Select(slot => new AetheriaRuntimeLoadoutItemSlotCommit - { - X = slot.Position.x, - Y = slot.Position.y, - Item = ProjectLoadoutItem(slot.EquippableItem, slot.Temperature) - }) - .ToArray() ?? Array.Empty(); - } - - private static AetheriaRuntimeCargoBayLoadoutCommit[] ProjectCargoBays((int2 position, ItemInstance item)[][] bays) - { - return bays? - .Select(bay => new AetheriaRuntimeCargoBayLoadoutCommit - { - Items = bay? - .Select(slot => new AetheriaRuntimeLoadoutItemSlotCommit - { - X = slot.position.x, - Y = slot.position.y, - Item = ProjectLoadoutItem(slot.item) - }) - .ToArray() ?? Array.Empty() - }) - .ToArray() ?? Array.Empty(); - } - - private static AetheriaRuntimeCargoBayLoadoutCommit[] ProjectCargoBays(IEnumerable bays) - { - return bays? - .Select(bay => new AetheriaRuntimeCargoBayLoadoutCommit - { - Items = bay.Cargo? - .Select(slot => new AetheriaRuntimeLoadoutItemSlotCommit - { - X = slot.Value.x, - Y = slot.Value.y, - Item = ProjectLoadoutItem(slot.Key) - }) - .ToArray() ?? Array.Empty() - }) - .ToArray() ?? Array.Empty(); - } - - private static AetheriaRuntimeLoadoutItemCommit ProjectLoadoutItem( - ItemInstance item, - double temperature = 0) - { - if (item == null) - return new AetheriaRuntimeLoadoutItemCommit(); - - return new AetheriaRuntimeLoadoutItemCommit - { - ItemKey = item.ItemKey, - Quality = item is CraftedItemInstance crafted ? crafted.Quality : 1.0, - Durability = item is EquippableItem equippable ? equippable.Durability : 1.0, - Quantity = item is SimpleCommodity commodity ? commodity.Quantity : 1, - Enabled = true, - OverrideShutdown = item is EquippableItem overrideable && overrideable.OverrideShutdown, - Temperature = temperature - }; - } -} diff --git a/Assets/Scripts/ServerShared/AetheriaRuntimeLoadoutProjector.cs.meta b/Assets/Scripts/ServerShared/AetheriaRuntimeLoadoutProjector.cs.meta deleted file mode 100644 index f648aeede..000000000 --- a/Assets/Scripts/ServerShared/AetheriaRuntimeLoadoutProjector.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 59812ba0964c83444ba4389689548195 \ No newline at end of file