Split entity blueprint materialization names
This commit is contained in:
parent
7259bca77b
commit
2381b407ec
6 changed files with 31 additions and 23 deletions
|
|
@ -1083,7 +1083,7 @@ static void RequireTypedRuntimeFactionKeys(string root)
|
|||
{
|
||||
var checkedFiles = new[]
|
||||
{
|
||||
Path.Combine(root, "Assets", "Scripts", "ServerShared", "EntityConstructionBlueprintProjector.cs"),
|
||||
Path.Combine(root, "Assets", "Scripts", "ServerShared", "EntityConstructionBlueprintMaterializer.cs"),
|
||||
Path.Combine(root, "Assets", "Scripts", "Gameplay", "ActionGameManager.cs")
|
||||
};
|
||||
|
||||
|
|
@ -1585,7 +1585,7 @@ static void RequireTypedOrbitalEntityOrbitKeys(string root)
|
|||
var checkedFiles = new[]
|
||||
{
|
||||
Path.Combine(root, "Assets", "Scripts", "ServerShared", "OrbitalEntity.cs"),
|
||||
Path.Combine(root, "Assets", "Scripts", "ServerShared", "EntityConstructionBlueprintProjector.cs"),
|
||||
Path.Combine(root, "Assets", "Scripts", "ServerShared", "EntityConstructionBlueprintMaterializer.cs"),
|
||||
Path.Combine(root, "Assets", "Scripts", "ServerShared", "LoadoutGenerator.cs"),
|
||||
Path.Combine(root, "Assets", "Scripts", "ServerShared", "ZoneGenerator.cs"),
|
||||
Path.Combine(root, "Assets", "Scripts", "Gameplay", "ActionGameManager.cs"),
|
||||
|
|
@ -1628,7 +1628,7 @@ static void RequireTypedOrbitalEntityOrbitKeys(string root)
|
|||
"Zone.GetOrbitPosition(OrbitKey)",
|
||||
"Zone.GetOrbitVelocity(OrbitKey)"
|
||||
},
|
||||
[Path.Combine(root, "Assets", "Scripts", "ServerShared", "EntityConstructionBlueprintProjector.cs")] = new[]
|
||||
[Path.Combine(root, "Assets", "Scripts", "ServerShared", "EntityConstructionBlueprintMaterializer.cs")] = new[]
|
||||
{
|
||||
"OrbitKey = orbital.OrbitKey,",
|
||||
"blueprint.OrbitKey",
|
||||
|
|
@ -12436,7 +12436,7 @@ static void RequireMainMenuContinueRunState(string root)
|
|||
"public sealed class AetheriaUnityObservedEntityRestorer",
|
||||
"public bool TryApplyInPlace(",
|
||||
"public void Replace(",
|
||||
"EntityConstructionBlueprintProjector.ProjectObservedFromBlueprint(_itemManager, zone, blueprint)",
|
||||
"EntityConstructionBlueprintMaterializer.MaterializeObservedFromBlueprint(_itemManager, zone, blueprint)",
|
||||
"entity.RestoreStatGrids(entitySnapshot.StatGrids)",
|
||||
"entity.RestoreThermalExposure((float)entitySnapshot.Heatstroke, (float)entitySnapshot.Hypothermia)",
|
||||
"RestoreActiveConsumables(entity, entitySnapshot)",
|
||||
|
|
@ -12467,7 +12467,7 @@ static void RequireMainMenuContinueRunState(string root)
|
|||
"private void RestoreRuntimeBehaviorStateFromTypedSnapshot(",
|
||||
"private static Behavior ResolveRuntimeBehavior(",
|
||||
"private static IReadOnlyList<Behavior> ResolveRuntimeBehaviorList(",
|
||||
"EntityConstructionBlueprintProjector.ProjectObservedFromBlueprint(ItemManager, Zone, blueprint)",
|
||||
"EntityConstructionBlueprintMaterializer.MaterializeObservedFromBlueprint(ItemManager, Zone, blueprint)",
|
||||
"entity.RestoreStatGrids(entitySnapshot.StatGrids)",
|
||||
"RestoreActiveConsumablesFromTypedEntitySnapshot(entity, entitySnapshot)",
|
||||
"RestoreRuntimeBehaviorStateFromTypedSnapshot(entity, entitySnapshot, restoredEntities)"
|
||||
|
|
@ -13408,7 +13408,7 @@ static void RequireUnityObserverDoesNotTickLocalSimulation(string root)
|
|||
|
||||
if (!observedEntityRestorer.Contains("public bool TryApplyInPlace(", StringComparison.Ordinal) ||
|
||||
!observedEntityRestorer.Contains("public void Replace(", StringComparison.Ordinal) ||
|
||||
!observedEntityRestorer.Contains("EntityConstructionBlueprintProjector.ProjectObservedFromBlueprint(_itemManager, zone, blueprint)", StringComparison.Ordinal) ||
|
||||
!observedEntityRestorer.Contains("EntityConstructionBlueprintMaterializer.MaterializeObservedFromBlueprint(_itemManager, zone, blueprint)", StringComparison.Ordinal) ||
|
||||
!observedEntityRestorer.Contains("RestoreRuntimeBehaviorState(entity, entitySnapshot, restoredEntities)", StringComparison.Ordinal))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
|
|
@ -13840,7 +13840,8 @@ static void RequireUnityObserverDoesNotTickLocalSimulation(string root)
|
|||
string.Join(", ", missingDaemonControlValidationSymbols));
|
||||
}
|
||||
|
||||
if (actionGameManager.Contains("EntityConstructionBlueprintProjector.InstantiateAuthoritativeFromBlueprint", StringComparison.Ordinal) ||
|
||||
if (actionGameManager.Contains("EntityConstructionBlueprintMaterializer.InstantiateAuthoritativeFromBlueprint", StringComparison.Ordinal) ||
|
||||
actionGameManager.Contains("EntityConstructionBlueprintProjector.InstantiateAuthoritativeFromBlueprint", StringComparison.Ordinal) ||
|
||||
actionGameManager.Contains("EntityConstructionBlueprintProjector.InstantiateFromBlueprint", StringComparison.Ordinal))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
|
|
@ -13917,22 +13918,25 @@ static void RequireUnityObserverDoesNotTickLocalSimulation(string root)
|
|||
var zoneSource = File.Exists(zonePath)
|
||||
? File.ReadAllText(zonePath)
|
||||
: throw new InvalidOperationException("Cannot verify Unity observer authority; Zone.cs is missing.");
|
||||
var projectorPath = Path.Combine(root, "Assets", "Scripts", "ServerShared", "EntityConstructionBlueprintProjector.cs");
|
||||
var projectorSource = File.Exists(projectorPath)
|
||||
? File.ReadAllText(projectorPath)
|
||||
: throw new InvalidOperationException("Cannot verify Unity observer authority; EntityConstructionBlueprintProjector.cs is missing.");
|
||||
var materializerPath = Path.Combine(root, "Assets", "Scripts", "ServerShared", "EntityConstructionBlueprintMaterializer.cs");
|
||||
var materializerSource = File.Exists(materializerPath)
|
||||
? File.ReadAllText(materializerPath)
|
||||
: throw new InvalidOperationException("Cannot verify Unity observer authority; EntityConstructionBlueprintMaterializer.cs is missing.");
|
||||
|
||||
var requiredProjectionBoundarySymbols = new[]
|
||||
{
|
||||
"public static Galaxy ProjectObservedDaemonRun",
|
||||
"private Galaxy(",
|
||||
"AetheriaRuntimeRunCheckpointCommit run,",
|
||||
"public static class EntityConstructionBlueprintCapture",
|
||||
"public static EntityConstructionBlueprint Capture(Entity entity)",
|
||||
"public static class EntityConstructionBlueprintMaterializer",
|
||||
"public static Entity InstantiateAuthoritativeFromBlueprint",
|
||||
"public static Entity ProjectObservedFromBlueprint",
|
||||
"public static Entity MaterializeObservedFromBlueprint",
|
||||
"private static Entity BuildFromBlueprint",
|
||||
"EntityConstructionBlueprintProjector.InstantiateAuthoritativeFromBlueprint(_itemManager, this, entityBlueprint)"
|
||||
"EntityConstructionBlueprintMaterializer.InstantiateAuthoritativeFromBlueprint(_itemManager, this, entityBlueprint)"
|
||||
};
|
||||
var projectionBoundaryCorpus = projectorSource + "\n" + zoneSource + "\n" + galaxy;
|
||||
var projectionBoundaryCorpus = materializerSource + "\n" + zoneSource + "\n" + galaxy;
|
||||
var missingProjectionBoundarySymbols = requiredProjectionBoundarySymbols
|
||||
.Where(symbol => !projectionBoundaryCorpus.Contains(symbol, StringComparison.Ordinal))
|
||||
.ToArray();
|
||||
|
|
@ -17328,6 +17332,7 @@ static void RequireInventoryLoadoutSaveRequestAuthority(string root)
|
|||
|
||||
if (!inventoryPanel.Contains("RequestLoadoutTemplateSave(_displayedEntity)", StringComparison.Ordinal) ||
|
||||
inventoryPanel.Contains("GameManager.RequestLoadoutTemplateSave(_displayedEntity)", StringComparison.Ordinal) ||
|
||||
inventoryPanel.Contains("EntityConstructionBlueprintCapture.Capture(_displayedEntity)", StringComparison.Ordinal) ||
|
||||
inventoryPanel.Contains("EntityConstructionBlueprintProjector.CaptureBlueprint(_displayedEntity)", StringComparison.Ordinal))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ public sealed class AetheriaUnityObservedEntityRestorer
|
|||
continue;
|
||||
}
|
||||
|
||||
var entity = EntityConstructionBlueprintProjector.ProjectObservedFromBlueprint(_itemManager, zone, blueprint);
|
||||
var entity = EntityConstructionBlueprintMaterializer.MaterializeObservedFromBlueprint(_itemManager, zone, blueprint);
|
||||
if (entity == null)
|
||||
continue;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@ using float2 = Unity.Mathematics.float2;
|
|||
using float3 = Unity.Mathematics.float3;
|
||||
using int2 = Unity.Mathematics.int2;
|
||||
|
||||
public static class EntityConstructionBlueprintProjector
|
||||
public static class EntityConstructionBlueprintCapture
|
||||
{
|
||||
public static EntityConstructionBlueprint CaptureBlueprint(Entity entity)
|
||||
public static EntityConstructionBlueprint Capture(Entity entity)
|
||||
{
|
||||
EntityConstructionBlueprint blueprint;
|
||||
if (entity is OrbitalEntity orbital)
|
||||
|
|
@ -36,17 +36,20 @@ public static class EntityConstructionBlueprintProjector
|
|||
blueprint.DockingBayAssignments = entity.DockingBays.Select(x => entity.Children.IndexOf(x.DockedShip)).ToArray();
|
||||
blueprint.CargoContents = entity.CargoBays.Select(b => b.Cargo.Select(i => (i.Value, i.Key)).ToArray()).ToArray();
|
||||
blueprint.DockingBayContents = entity.DockingBays.Select(b => b.Cargo.Select(i => (i.Value, i.Key)).ToArray()).ToArray();
|
||||
blueprint.Children = entity.Children.Select(CaptureBlueprint).ToArray();
|
||||
blueprint.Children = entity.Children.Select(Capture).ToArray();
|
||||
blueprint.WeaponGroups = entity.WeaponGroups.Select(wg => wg.items.Select(item => entity.Equipment.IndexOf(item)).ToArray()).ToArray();
|
||||
return blueprint;
|
||||
}
|
||||
}
|
||||
|
||||
public static class EntityConstructionBlueprintMaterializer
|
||||
{
|
||||
public static Entity InstantiateAuthoritativeFromBlueprint(ItemManager itemManager, Zone zone, EntityConstructionBlueprint blueprint)
|
||||
{
|
||||
return BuildFromBlueprint(itemManager, zone, blueprint, false);
|
||||
}
|
||||
|
||||
public static Entity ProjectObservedFromBlueprint(ItemManager itemManager, Zone zone, EntityConstructionBlueprint blueprint)
|
||||
public static Entity MaterializeObservedFromBlueprint(ItemManager itemManager, Zone zone, EntityConstructionBlueprint blueprint)
|
||||
{
|
||||
return BuildFromBlueprint(itemManager, zone, blueprint, true);
|
||||
}
|
||||
|
|
@ -67,7 +67,7 @@ public class LoadoutGenerator
|
|||
var entity = new Ship(ItemManager, null, hull, ItemManager.GameplaySettings.DefaultEntitySettings);
|
||||
entity.Faction = Faction;
|
||||
OutfitEntity(entity);
|
||||
return EntityConstructionBlueprintProjector.CaptureBlueprint(entity);
|
||||
return EntityConstructionBlueprintCapture.Capture(entity);
|
||||
}
|
||||
|
||||
public OrbitalEntityConstructionBlueprint GenerateTurretLoadout()
|
||||
|
|
@ -82,7 +82,7 @@ public class LoadoutGenerator
|
|||
var entity = new OrbitalEntity(ItemManager, null, hull, "", ItemManager.GameplaySettings.DefaultEntitySettings);
|
||||
entity.Faction = Faction;
|
||||
OutfitEntity(entity);
|
||||
return EntityConstructionBlueprintProjector.CaptureBlueprint(entity) as OrbitalEntityConstructionBlueprint;
|
||||
return EntityConstructionBlueprintCapture.Capture(entity) as OrbitalEntityConstructionBlueprint;
|
||||
}
|
||||
|
||||
public OrbitalEntityConstructionBlueprint GenerateStationLoadout()
|
||||
|
|
@ -128,7 +128,7 @@ public class LoadoutGenerator
|
|||
|
||||
entity.CanTow = hullRow.HullCanTow;
|
||||
|
||||
return EntityConstructionBlueprintProjector.CaptureBlueprint(entity) as OrbitalEntityConstructionBlueprint;
|
||||
return EntityConstructionBlueprintCapture.Capture(entity) as OrbitalEntityConstructionBlueprint;
|
||||
}
|
||||
|
||||
public AetheriaRuntimeCatalogItem RandomHull(HullType type, Predicate<AetheriaRuntimeCatalogItem> hullFilter = null)
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public class Zone
|
|||
|
||||
foreach (var entityBlueprint in blueprint.Entities)
|
||||
{
|
||||
var entity = EntityConstructionBlueprintProjector.InstantiateAuthoritativeFromBlueprint(_itemManager, this, entityBlueprint);
|
||||
var entity = EntityConstructionBlueprintMaterializer.InstantiateAuthoritativeFromBlueprint(_itemManager, this, entityBlueprint);
|
||||
Entities.Add(entity);
|
||||
entity.Activate();
|
||||
if (entity is Ship {IsPlayerShip: false} ship)
|
||||
|
|
|
|||
Loading…
Reference in a new issue