Delete legacy loadout projector
This commit is contained in:
parent
2381b407ec
commit
3616b6a2df
3 changed files with 8 additions and 172 deletions
|
|
@ -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<EquippedItem> 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) ||
|
||||
|
|
|
|||
|
|
@ -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<int>(),
|
||||
WeaponGroups = blueprint?.WeaponGroups?.Select(group => (IReadOnlyList<int>)group).ToArray() ?? Array.Empty<IReadOnlyList<int>>(),
|
||||
Children = blueprint?.Children?.Select(ProjectEntityLoadout).ToArray() ?? Array.Empty<AetheriaRuntimeEntityLoadoutCommit>()
|
||||
};
|
||||
}
|
||||
|
||||
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<int>(),
|
||||
WeaponGroups = entity?.WeaponGroups?
|
||||
.Select(group => (IReadOnlyList<int>)group.items
|
||||
.Select(item => entity.Equipment.IndexOf(item))
|
||||
.ToArray())
|
||||
.ToArray() ?? Array.Empty<IReadOnlyList<int>>(),
|
||||
Children = entity?.Children?
|
||||
.Select(ProjectEntityLoadout)
|
||||
.ToArray() ?? Array.Empty<AetheriaRuntimeEntityLoadoutCommit>()
|
||||
};
|
||||
}
|
||||
|
||||
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<AetheriaRuntimeLoadoutItemSlotCommit>();
|
||||
}
|
||||
|
||||
private static AetheriaRuntimeLoadoutItemSlotCommit[] ProjectSlots(IEnumerable<EquippedItem> slots)
|
||||
{
|
||||
return slots?
|
||||
.Select(slot => new AetheriaRuntimeLoadoutItemSlotCommit
|
||||
{
|
||||
X = slot.Position.x,
|
||||
Y = slot.Position.y,
|
||||
Item = ProjectLoadoutItem(slot.EquippableItem, slot.Temperature)
|
||||
})
|
||||
.ToArray() ?? Array.Empty<AetheriaRuntimeLoadoutItemSlotCommit>();
|
||||
}
|
||||
|
||||
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<AetheriaRuntimeLoadoutItemSlotCommit>()
|
||||
})
|
||||
.ToArray() ?? Array.Empty<AetheriaRuntimeCargoBayLoadoutCommit>();
|
||||
}
|
||||
|
||||
private static AetheriaRuntimeCargoBayLoadoutCommit[] ProjectCargoBays(IEnumerable<EquippedCargoBay> 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<AetheriaRuntimeLoadoutItemSlotCommit>()
|
||||
})
|
||||
.ToArray() ?? Array.Empty<AetheriaRuntimeCargoBayLoadoutCommit>();
|
||||
}
|
||||
|
||||
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
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 59812ba0964c83444ba4389689548195
|
||||
Loading…
Reference in a new issue