Delete dead behavior persistence hook

This commit is contained in:
Meta Vens 2026-06-14 08:52:31 +01:00
commit b059ab4a10
4 changed files with 7 additions and 32 deletions

Binary file not shown.

View file

@ -128,21 +128,11 @@ public interface IOrderedBehavior
int Order { get; }
}
public interface IPersistentBehavior//<T> 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
{

View file

@ -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<IPersistentBehavior>()})
.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<IPersistentBehavior>()
.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<int2, PersistentBehaviorData[]> PersistedBehaviors;
public float[,] Temperature;
public float[,] Armor;
public bool2[,] Conductivity;

View file

@ -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