Persist entity visibility state in typed snapshots
This commit is contained in:
parent
6deea479dd
commit
cb9c5ca21f
10 changed files with 45 additions and 5 deletions
Binary file not shown.
|
|
@ -231,6 +231,8 @@ await using (var node = await AetheriaStateNode.OpenAsync(statePath, "aetheria-s
|
|||
}
|
||||
],
|
||||
DockingBayAssignments = [-1],
|
||||
Visibility = 12.75,
|
||||
VisibilitySourceCount = 3,
|
||||
WeaponGroups =
|
||||
[
|
||||
new AetheriaWeaponGroupSnapshot
|
||||
|
|
@ -623,6 +625,8 @@ await using (var reopened = await AetheriaStateNode.OpenAsync(statePath, "aether
|
|||
entitySnapshot.CargoContents[0].Items[0].Item.Quantity != 7 ||
|
||||
entitySnapshot.DockingBayAssignments.Length != 1 ||
|
||||
entitySnapshot.DockingBayAssignments[0] != -1 ||
|
||||
entitySnapshot.Visibility != 12.75 ||
|
||||
entitySnapshot.VisibilitySourceCount != 3 ||
|
||||
entitySnapshot.WeaponGroups.Length != 1 ||
|
||||
entitySnapshot.WeaponStates.Length != 1 ||
|
||||
entitySnapshot.WeaponStates[0].BehaviorKind != "LockWeapon" ||
|
||||
|
|
|
|||
|
|
@ -357,6 +357,8 @@ try
|
|||
}
|
||||
},
|
||||
DockingBayAssignments = new[] { -1 },
|
||||
Visibility = 12.75,
|
||||
VisibilitySourceCount = 3,
|
||||
WeaponGroups = new[] { new[] { 0 } },
|
||||
ActiveConsumables = new[]
|
||||
{
|
||||
|
|
@ -689,6 +691,8 @@ try
|
|||
entity.CargoContents[0].Items[0].Item.Quantity == 7 &&
|
||||
entity.DockingBayAssignments.Length == 1 &&
|
||||
entity.DockingBayAssignments[0] == -1 &&
|
||||
entity.Visibility == 12.75 &&
|
||||
entity.VisibilitySourceCount == 3 &&
|
||||
entity.ActiveConsumables[0].ItemKey == "aetheria.item_definition:legacy:smoke:consumable" &&
|
||||
entity.ActiveConsumables[0].RemainingDuration == 3.0 &&
|
||||
entity.BehaviorProgress.Length == 2 &&
|
||||
|
|
@ -812,6 +816,8 @@ try
|
|||
packageEntities[0].CargoContents[0].Items[0].Item.Quantity != 7 ||
|
||||
packageEntities[0].DockingBayAssignments.Count != 1 ||
|
||||
packageEntities[0].DockingBayAssignments[0] != -1 ||
|
||||
packageEntities[0].Visibility != 12.75 ||
|
||||
packageEntities[0].VisibilitySourceCount != 3 ||
|
||||
packageEntities[0].ActiveConsumables[0].ItemKey != "aetheria.item_definition:legacy:smoke:consumable" ||
|
||||
packageEntities[0].BehaviorProgress.Count != 2 ||
|
||||
packageEntities[0].WeaponStates.Count != 4 ||
|
||||
|
|
|
|||
|
|
@ -458,7 +458,9 @@ public static class AetheriaRuntimeCommitLogApplier
|
|||
BehaviorStates = ToBehaviorStates(entity.BehaviorStates),
|
||||
CargoContents = ToCargoBays(entity.CargoContents),
|
||||
DockingBayContents = ToCargoBays(entity.DockingBayContents),
|
||||
DockingBayAssignments = ToIntArray(entity.DockingBayAssignments)
|
||||
DockingBayAssignments = ToIntArray(entity.DockingBayAssignments),
|
||||
Visibility = entity.Visibility,
|
||||
VisibilitySourceCount = entity.VisibilitySourceCount
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -503,6 +503,12 @@ public sealed class AetheriaEntitySnapshot
|
|||
|
||||
[Key(26)]
|
||||
public int[] DockingBayAssignments { get; set; } = [];
|
||||
|
||||
[Key(27)]
|
||||
public double Visibility { get; set; }
|
||||
|
||||
[Key(28)]
|
||||
public int VisibilitySourceCount { get; set; }
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
|
|
|
|||
|
|
@ -785,6 +785,8 @@ public class ActionGameManager : MonoBehaviour
|
|||
DockingBayAssignments = entity.DockingBays?
|
||||
.Select(bay => entity.Children.IndexOf(bay.DockedShip))
|
||||
.ToArray() ?? Array.Empty<int>(),
|
||||
Visibility = entity.Visibility,
|
||||
VisibilitySourceCount = entity.VisibilitySources.Count,
|
||||
ChildEntityIndices = entity.Children?
|
||||
.Select(child => zone.Entities.IndexOf(child))
|
||||
.Where(index => index >= 0)
|
||||
|
|
|
|||
|
|
@ -786,7 +786,9 @@ namespace GameCult.Aetheria.State.Unity
|
|||
IReadOnlyList<AetheriaRuntimeBehaviorStateSnapshot> behaviorStates,
|
||||
IReadOnlyList<AetheriaRuntimeCargoBayLoadoutSnapshot> cargoContents,
|
||||
IReadOnlyList<AetheriaRuntimeCargoBayLoadoutSnapshot> dockingBayContents,
|
||||
IReadOnlyList<int> dockingBayAssignments)
|
||||
IReadOnlyList<int> dockingBayAssignments,
|
||||
double visibility,
|
||||
int visibilitySourceCount)
|
||||
{
|
||||
Name = name;
|
||||
Kind = kind;
|
||||
|
|
@ -819,6 +821,8 @@ namespace GameCult.Aetheria.State.Unity
|
|||
CargoContents = cargoContents;
|
||||
DockingBayContents = dockingBayContents;
|
||||
DockingBayAssignments = dockingBayAssignments;
|
||||
Visibility = visibility;
|
||||
VisibilitySourceCount = visibilitySourceCount;
|
||||
}
|
||||
|
||||
public string Name { get; }
|
||||
|
|
@ -852,6 +856,8 @@ namespace GameCult.Aetheria.State.Unity
|
|||
public IReadOnlyList<AetheriaRuntimeCargoBayLoadoutSnapshot> CargoContents { get; }
|
||||
public IReadOnlyList<AetheriaRuntimeCargoBayLoadoutSnapshot> DockingBayContents { get; }
|
||||
public IReadOnlyList<int> DockingBayAssignments { get; }
|
||||
public double Visibility { get; }
|
||||
public int VisibilitySourceCount { get; }
|
||||
}
|
||||
|
||||
public sealed class AetheriaRuntimeActionBarBindingSnapshot
|
||||
|
|
|
|||
|
|
@ -535,7 +535,9 @@ namespace GameCult.Aetheria.State.Unity
|
|||
var cargoContents = ReadFieldCargoBayLoadouts(ref reader, fields, 24);
|
||||
var dockingBayContents = ReadFieldCargoBayLoadouts(ref reader, fields, 25);
|
||||
var dockingBayAssignments = ReadFieldInt32Array(ref reader, fields, 26);
|
||||
SkipRemaining(ref reader, fields, 27);
|
||||
var visibility = ReadFieldDouble(ref reader, fields, 27);
|
||||
var visibilitySourceCount = ReadFieldInt32(ref reader, fields, 28);
|
||||
SkipRemaining(ref reader, fields, 29);
|
||||
return new AetheriaRuntimeEntitySnapshot(
|
||||
name,
|
||||
kind,
|
||||
|
|
@ -567,7 +569,9 @@ namespace GameCult.Aetheria.State.Unity
|
|||
behaviorStates,
|
||||
cargoContents,
|
||||
dockingBayContents,
|
||||
dockingBayAssignments);
|
||||
dockingBayAssignments,
|
||||
visibility,
|
||||
visibilitySourceCount);
|
||||
}
|
||||
|
||||
private static Vector2Value ReadFieldVector2(ref MessagePackReader reader, int fields, int index)
|
||||
|
|
|
|||
|
|
@ -579,6 +579,12 @@ namespace GameCult.Aetheria.State.Unity
|
|||
|
||||
[Key(31)]
|
||||
public IReadOnlyList<int> DockingBayAssignments { get; set; } = Array.Empty<int>();
|
||||
|
||||
[Key(32)]
|
||||
public double Visibility { get; set; }
|
||||
|
||||
[Key(33)]
|
||||
public int VisibilitySourceCount { get; set; }
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
|
|
|
|||
|
|
@ -152,7 +152,8 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
|
|||
temperature, thermal mass, armor, max armor, and hull-conductivity axes.
|
||||
They also carry public runtime session state: velocity, target entity
|
||||
reference, active flag, heatsink toggle, shutdown override, tractor power,
|
||||
heatstroke/hypothermia accumulators, and active consumable item/timer rows.
|
||||
heatstroke/hypothermia accumulators, aggregate visibility/source-count state,
|
||||
and active consumable item/timer rows.
|
||||
Entity equipment, cargo-bay, and docking-bay slot rows preserve item-instance
|
||||
facts needed for restore: item key, quality, durability, and quantity. Those
|
||||
facts are no longer discarded when pending checkpoint commands become
|
||||
|
|
@ -846,6 +847,9 @@ First Aetheria surfaces to publish:
|
|||
quantity now survive canonical state and Unity package readback.
|
||||
- Done: preserve cargo bay contents, docking bay contents, and docking bay
|
||||
child assignments in typed entity snapshots.
|
||||
- Done: preserve aggregate entity visibility and visibility-source count in
|
||||
typed entity snapshots, so `Entity.VisibilitySources` no longer hides
|
||||
untyped session pressure.
|
||||
- Remaining: add typed documents/mappers for runtime object graphs,
|
||||
typed behavior factory construction, remaining behavior-private state not
|
||||
covered by progress, weapon, sensor, radiator, reactor, or capacitor rows,
|
||||
|
|
|
|||
Loading…
Reference in a new issue