diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index cf7833bbe..8966cb30d 100644 Binary files a/.voidbot/state/aetheria.cc and b/.voidbot/state/aetheria.cc differ diff --git a/Assets/Scripts/ServerShared/Behaviors/Behaviors.cs b/Assets/Scripts/ServerShared/Behaviors/Behaviors.cs index 8db5376bc..99481c389 100644 --- a/Assets/Scripts/ServerShared/Behaviors/Behaviors.cs +++ b/Assets/Scripts/ServerShared/Behaviors/Behaviors.cs @@ -128,21 +128,11 @@ public interface IOrderedBehavior int Order { get; } } -public interface IPersistentBehavior// where T : IBehavior -{ - PersistentBehaviorData Store(); - void Restore(PersistentBehaviorData data); -} - public interface IPopulationAssignment { int AssignedPopulation { get; set; } } -public abstract class PersistentBehaviorData -{ -} - [Inspectable] public abstract class BehaviorData { diff --git a/Assets/Scripts/ServerShared/RuntimeEntityBlueprintProjector.cs b/Assets/Scripts/ServerShared/RuntimeEntityBlueprintProjector.cs index 4f3dac1cb..ec4dc2662 100644 --- a/Assets/Scripts/ServerShared/RuntimeEntityBlueprintProjector.cs +++ b/Assets/Scripts/ServerShared/RuntimeEntityBlueprintProjector.cs @@ -27,16 +27,6 @@ public static class RuntimeEntityBlueprintProjector blueprint.Settings = entity.Settings; - // Filter item behavior collections by those with any persistent behaviors - // For each item create an object containing the item position and a list of persistent behaviors - // Then turn that into a dictionary mapping from item position to an array of every behaviors persistent data - blueprint.PersistedBehaviors = entity.Equipment - .Where(item => item.Behaviors.Any(b=>b is IPersistentBehavior)) - .Select(item => new {equippable=item, behaviors = item.Behaviors - .Where(b=>b is IPersistentBehavior) - .Cast()}) - .ToDictionary(x=> x.equippable.Position, x=>x.behaviors.Select(b => b.Store()).ToArray()); - blueprint.Hull = entity.Hull; blueprint.Name = entity.Name; blueprint.Faction = entity.Faction?.ID ?? Guid.Empty; @@ -117,16 +107,6 @@ public static class RuntimeEntityBlueprintProjector foreach (var (position, item) in blueprint.DockingBayContents[bayIndex]) entity.DockingBays[bayIndex].TryStore(instantiate ? itemManager.Instantiate(item) : item, position); - // Iterate only over the behaviors of items which contain persistent data - // Filter the behaviors for each item to get the persistent ones, then cast them and combine with the persisted data array for that item - foreach (var persistentBehaviorData in entity.Equipment - .Where(item => blueprint.PersistedBehaviors.ContainsKey(item.Position)) - .SelectMany(item => item.Behaviors - .Where(b=> b is IPersistentBehavior) - .Cast() - .Zip(blueprint.PersistedBehaviors[item.Position], (behavior, data) => new{behavior, data}))) - persistentBehaviorData.behavior.Restore(persistentBehaviorData.data); - if(!instantiate) entity.Temperature = blueprint.Temperature; @@ -168,7 +148,6 @@ public abstract class RuntimeEntityBlueprint public (int2 position, EquippableItem item)[] Equipment; public (int2 position, EquippableItem item)[] CargoBays; public (int2 position, EquippableItem item)[] DockingBays; - public Dictionary PersistedBehaviors; public float[,] Temperature; public float[,] Armor; public bool2[,] Conductivity; diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index b45295e23..bdf5a6cbf 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -122,7 +122,9 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. rather than durable file formats. Runtime blueprint restore now iterates typed hull shape rows when restoring saved conductivity, and blueprint price aggregation uses typed runtime item prices through `ItemManager` instead of - hydrating `HullData.Shape` or `ItemData.Price`. + hydrating `HullData.Shape` or `ItemData.Price`. Runtime blueprints no longer + capture or restore behavior-private `PersistentBehaviorData` blobs; that dead + save-shape hook and its `IPersistentBehavior` interface are deleted. - `Aetheria.State` now defines `AetheriaLoadoutTemplate` as the typed Verse replacement for bespoke `.loadout` files. It stores structured hull, equipment, cargo bay, docking bay, child-entity, assignment, and weapon-group @@ -775,6 +777,10 @@ First Aetheria surfaces to publish: typed runtime item rows; `ItemManager.Instantiate` now clones simple commodities, crafted items, consumables, and equippables from `AetheriaRuntimeCatalogItem` identity and facets. + - Done: delete dead runtime blueprint behavior-private persistence: + `PersistedBehaviors`, `IPersistentBehavior`, and `PersistentBehaviorData` + no longer exist, so behavior state cannot smuggle itself through the + blueprint projection path. - Done: delete the runtime item DTO hydration bridge; `ItemManager.GetData`, `ItemManager.Hydrate`, `IRuntimeItemProjectionReader.Get`, the `AetheriaRuntimeItemCatalog` whole-item DTO cache, and