Add typed loadout template state
This commit is contained in:
parent
21a319a67d
commit
f45c22abf3
7 changed files with 183 additions and 12 deletions
Binary file not shown.
|
|
@ -10,6 +10,7 @@ var itemLegacyId = "smoke:aether-drive";
|
|||
var factionLegacyId = "smoke:faction";
|
||||
var nameFileLegacyId = "smoke:name-file";
|
||||
var runKey = new CultRecordKey("run:smoke");
|
||||
var loadoutKey = new CultRecordKey("loadout:smoke:aether-runner");
|
||||
|
||||
await using (var node = await AetheriaStateNode.OpenAsync(statePath, "aetheria-state-smoke"))
|
||||
{
|
||||
|
|
@ -87,6 +88,40 @@ await using (var node = await AetheriaStateNode.OpenAsync(statePath, "aetheria-s
|
|||
await node.PutCatalogSurfaceAsync(
|
||||
AetheriaCatalogSurfaceProjector.Build(node.ReadCatalogSnapshot(), now));
|
||||
|
||||
await node.PutLoadoutTemplateAsync(loadoutKey, new AetheriaLoadoutTemplate
|
||||
{
|
||||
Name = "Smoke Aether Runner",
|
||||
OwnerPlayerKey = "player:smoke",
|
||||
CreatedAtUtc = now,
|
||||
UpdatedAtUtc = now,
|
||||
RootEntity = new AetheriaEntityLoadout
|
||||
{
|
||||
Name = "Smoke Aether Runner",
|
||||
Kind = "ship",
|
||||
FactionKey = AetheriaCatalogKeys.CorporationFromLegacyId(factionLegacyId).ToString(),
|
||||
Hull = new AetheriaLoadoutItem
|
||||
{
|
||||
ItemKey = AetheriaCatalogKeys.ItemDefinitionFromLegacyId(itemLegacyId).ToString(),
|
||||
Quality = 1.0,
|
||||
Durability = 1.0
|
||||
},
|
||||
Equipment =
|
||||
[
|
||||
new AetheriaLoadoutItemSlot
|
||||
{
|
||||
Position = new AetheriaGridCoord { X = 0, Y = 0 },
|
||||
Item = new AetheriaLoadoutItem
|
||||
{
|
||||
ItemKey = AetheriaCatalogKeys.ItemDefinitionFromLegacyId(itemLegacyId).ToString(),
|
||||
Quality = 0.95,
|
||||
Durability = 0.8
|
||||
}
|
||||
}
|
||||
],
|
||||
WeaponGroups = [[0]]
|
||||
}
|
||||
});
|
||||
|
||||
await node.PutRunStateAsync(runKey, new AetheriaRunState
|
||||
{
|
||||
RunId = "smoke",
|
||||
|
|
@ -125,6 +160,7 @@ await using (var reopened = await AetheriaStateNode.OpenAsync(statePath, "aether
|
|||
var quarantine = await reopened.GetLegacyCatalogQuarantineAsync();
|
||||
var catalogSurface = await reopened.GetCatalogSurfaceAsync();
|
||||
var playerSettings = await reopened.GetPlayerSettingsAsync();
|
||||
var loadout = await reopened.GetLoadoutTemplateAsync(loadoutKey);
|
||||
var runState = await reopened.GetRunStateAsync(runKey);
|
||||
|
||||
if (world?.WorldId != "aetheria")
|
||||
|
|
@ -163,6 +199,13 @@ await using (var reopened = await AetheriaStateNode.OpenAsync(statePath, "aether
|
|||
throw new InvalidOperationException("Player settings did not survive flush/reopen.");
|
||||
}
|
||||
|
||||
if (loadout?.RootEntity.Hull.ItemKey != AetheriaCatalogKeys.ItemDefinitionFromLegacyId(itemLegacyId).ToString() ||
|
||||
loadout.RootEntity.Equipment.Length != 1 ||
|
||||
loadout.RootEntity.WeaponGroups.Length != 1)
|
||||
{
|
||||
throw new InvalidOperationException("Loadout template did not survive flush/reopen.");
|
||||
}
|
||||
|
||||
if (runState?.RunId != "smoke" || runState.ActionBarBindings.Length != 1)
|
||||
{
|
||||
throw new InvalidOperationException("Run state did not survive flush/reopen.");
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ public static class AetheriaDocumentRegistry
|
|||
CultNetDocumentBinding.ForDocument<AetheriaMigrationLedger>(registry),
|
||||
CultNetDocumentBinding.ForDocument<AetheriaLegacyCatalogQuarantine>(registry),
|
||||
CultNetDocumentBinding.ForDocument<AetheriaPlayerSettings>(registry),
|
||||
CultNetDocumentBinding.ForDocument<AetheriaLoadoutTemplate>(registry),
|
||||
CultNetDocumentBinding.ForDocument<AetheriaRunState>(registry),
|
||||
CultNetDocumentBinding.ForDocument<AetheriaZoneState>(registry),
|
||||
CultNetDocumentBinding.ForDocument<AetheriaEntitySnapshot>(registry),
|
||||
|
|
@ -51,6 +52,7 @@ public static class AetheriaDocumentRegistry
|
|||
typeof(AetheriaMigrationLedger),
|
||||
typeof(AetheriaLegacyCatalogQuarantine),
|
||||
typeof(AetheriaPlayerSettings),
|
||||
typeof(AetheriaLoadoutTemplate),
|
||||
typeof(AetheriaRunState),
|
||||
typeof(AetheriaZoneState),
|
||||
typeof(AetheriaEntitySnapshot),
|
||||
|
|
|
|||
|
|
@ -183,6 +183,18 @@ public sealed class AetheriaStateNode : IAsyncDisposable, IDisposable
|
|||
return Database.GetAsync<AetheriaPlayerSettings>(new CultRecordKey("global:aetheria.player_settings.v1"));
|
||||
}
|
||||
|
||||
public Task<CultRecordHandle<AetheriaLoadoutTemplate>> PutLoadoutTemplateAsync(
|
||||
CultRecordKey key,
|
||||
AetheriaLoadoutTemplate loadout)
|
||||
{
|
||||
return Database.PutAsync(key, loadout);
|
||||
}
|
||||
|
||||
public Task<AetheriaLoadoutTemplate?> GetLoadoutTemplateAsync(CultRecordKey key)
|
||||
{
|
||||
return Database.GetAsync<AetheriaLoadoutTemplate>(key);
|
||||
}
|
||||
|
||||
public Task<CultRecordHandle<AetheriaRunState>> PutRunStateAsync(CultRecordKey key, AetheriaRunState run)
|
||||
{
|
||||
return Database.PutAsync(key, run);
|
||||
|
|
|
|||
|
|
@ -20,6 +20,102 @@ public sealed class AetheriaPlayerSettings
|
|||
public string LastUpdatedAtUtc { get; set; } = "";
|
||||
}
|
||||
|
||||
[CultDocument("aetheria.loadout_template", "aetheria.loadout_template.v1")]
|
||||
[MessagePackObject]
|
||||
public sealed class AetheriaLoadoutTemplate
|
||||
{
|
||||
[Key(0)]
|
||||
[CultName]
|
||||
public string Name { get; set; } = "";
|
||||
|
||||
[Key(1)]
|
||||
public string OwnerPlayerKey { get; set; } = "";
|
||||
|
||||
[Key(2)]
|
||||
public AetheriaEntityLoadout RootEntity { get; set; } = new();
|
||||
|
||||
[Key(3)]
|
||||
public string CreatedAtUtc { get; set; } = "";
|
||||
|
||||
[Key(4)]
|
||||
public string UpdatedAtUtc { get; set; } = "";
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
public sealed class AetheriaEntityLoadout
|
||||
{
|
||||
[Key(0)]
|
||||
[CultName]
|
||||
public string Name { get; set; } = "";
|
||||
|
||||
[Key(1)]
|
||||
public string Kind { get; set; } = "";
|
||||
|
||||
[Key(2)]
|
||||
public string FactionKey { get; set; } = "";
|
||||
|
||||
[Key(3)]
|
||||
public AetheriaLoadoutItem Hull { get; set; } = new();
|
||||
|
||||
[Key(4)]
|
||||
public AetheriaLoadoutItemSlot[] Equipment { get; set; } = [];
|
||||
|
||||
[Key(5)]
|
||||
public AetheriaLoadoutItemSlot[] CargoBays { get; set; } = [];
|
||||
|
||||
[Key(6)]
|
||||
public AetheriaLoadoutItemSlot[] DockingBays { get; set; } = [];
|
||||
|
||||
[Key(7)]
|
||||
public AetheriaCargoBayLoadout[] CargoContents { get; set; } = [];
|
||||
|
||||
[Key(8)]
|
||||
public AetheriaCargoBayLoadout[] DockingBayContents { get; set; } = [];
|
||||
|
||||
[Key(9)]
|
||||
public int[] DockingBayAssignments { get; set; } = [];
|
||||
|
||||
[Key(10)]
|
||||
public int[][] WeaponGroups { get; set; } = [];
|
||||
|
||||
[Key(11)]
|
||||
public AetheriaEntityLoadout[] Children { get; set; } = [];
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
public sealed class AetheriaLoadoutItem
|
||||
{
|
||||
[Key(0)]
|
||||
[CultReference(typeof(AetheriaItemDefinition))]
|
||||
public string ItemKey { get; set; } = "";
|
||||
|
||||
[Key(1)]
|
||||
public double Quality { get; set; } = 1.0;
|
||||
|
||||
[Key(2)]
|
||||
public double Durability { get; set; } = 1.0;
|
||||
|
||||
[Key(3)]
|
||||
public int Quantity { get; set; } = 1;
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
public sealed class AetheriaLoadoutItemSlot
|
||||
{
|
||||
[Key(0)]
|
||||
public AetheriaGridCoord Position { get; set; } = new();
|
||||
|
||||
[Key(1)]
|
||||
public AetheriaLoadoutItem Item { get; set; } = new();
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
public sealed class AetheriaCargoBayLoadout
|
||||
{
|
||||
[Key(0)]
|
||||
public AetheriaLoadoutItemSlot[] Items { get; set; } = [];
|
||||
}
|
||||
|
||||
[CultDocument("aetheria.run_state", "aetheria.run_state.v1")]
|
||||
[MessagePackObject]
|
||||
public sealed class AetheriaRunState
|
||||
|
|
|
|||
|
|
@ -11,18 +11,20 @@ The first live state file is `GameData/aetheria-world.cc`. It is generated by
|
|||
machine-local absolute paths. Legacy files such as `GameData/AetherDB.msgpack`
|
||||
are migration inputs only.
|
||||
|
||||
The typed runtime state model is split into player settings, run state, zone
|
||||
state, entity snapshots, item slots, weapon groups, action-bar bindings, and
|
||||
stat grids. Do not preserve `SavedGame` or `EntityPack` as opaque payloads in
|
||||
the new store; they are source shapes for migration, not portable state
|
||||
authority.
|
||||
The typed runtime state model is split into player settings, loadout templates,
|
||||
run state, zone state, entity snapshots, item slots, weapon groups, action-bar
|
||||
bindings, and stat grids. Do not preserve `SavedGame` or `EntityPack` as opaque
|
||||
payloads in the new store; they are source shapes for migration, not portable
|
||||
state authority.
|
||||
|
||||
The Unity client no longer writes `PlayerSettings.msgpack`, `.loadout`, or
|
||||
`.zone` files. Until `Aetheria.State` is available to Unity as a runtime Verse
|
||||
package, player settings and loadout edits are session-local and run saving is
|
||||
disabled. That is intentional: the missing runtime package is the owner gap, and
|
||||
the old bespoke file formats must not keep acting as durable truth while the
|
||||
state spine is being rebuilt.
|
||||
`.zone` files. `AetheriaLoadoutTemplate` is now the typed Verse replacement for
|
||||
bespoke loadout files, with structured hull/equipment/cargo/docking item slots,
|
||||
nested child-entity loadouts, and weapon groups. Until `Aetheria.State` is
|
||||
available to Unity as a runtime Verse package, Unity loadout edits are still
|
||||
session-local and run saving is disabled. That is intentional: the missing
|
||||
runtime package is the owner gap, and the old bespoke file formats must not keep
|
||||
acting as durable truth while the state spine is being rebuilt.
|
||||
The old `SavedGame`/`SavedZone` DTOs and `Galaxy` loader constructor have also
|
||||
been deleted; the new document family is live Verse run/zone state, not a
|
||||
bespoke save-file format.
|
||||
|
|
@ -81,6 +83,11 @@ published Eve catalog surface. It does not deserialize legacy `DatabaseEntry`
|
|||
objects and does not write state. Unity can use this as the first package
|
||||
boundary once CultLib/Eve runtime packaging is available.
|
||||
|
||||
`Aetheria.State.Smoke` writes and reopens a typed loadout template in addition
|
||||
to world, catalog, player settings, and run state. That smoke is the current
|
||||
proof that loadouts have a durable Verse state shape without reviving `.loadout`
|
||||
serialization.
|
||||
|
||||
`Aetheria.State.Verify` opens a materialized state file and checks that the
|
||||
typed migration ledger matches the actual item, corporation, and name-file
|
||||
records in the `.cc` store. It also verifies the canonical legacy-ID lookup API
|
||||
|
|
|
|||
|
|
@ -39,6 +39,13 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
|
|||
deleted. The dead `SavedStory` JSON DTO is deleted. `ZonePack` and
|
||||
`EntityPack` remain as runtime construction/loadout snapshots, but no longer
|
||||
declare themselves as MessagePack persistence documents.
|
||||
- `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
|
||||
state through record-key references and typed value slots instead of opaque
|
||||
`EntityPack` serialization. Unity has not wired its save/loadout UI to this
|
||||
document yet, so the old in-memory `EntityPack` path is still a runtime
|
||||
construction helper, not durable authority.
|
||||
- `LegacyCatalogBoundary` opens `LegacyCatalogCache` as the only concrete
|
||||
pull-only catalog cache. Runtime consumers receive `ILegacyCatalogReader`,
|
||||
so old MessagePack backing stores may hydrate in-memory domain objects for
|
||||
|
|
@ -157,7 +164,9 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
|
|||
catalog reads emit in-memory domain objects only; the old local save and
|
||||
editor catalog write paths have been cut. Migrated catalog documents are
|
||||
addressed through `AetheriaCatalogKeys` and `AetheriaStateNode` legacy-ID
|
||||
methods, not importer-local string concatenation. The catalog operator UI is
|
||||
methods, not importer-local string concatenation. Loadout templates have a
|
||||
typed state document and node put/get path; Unity's save button still needs
|
||||
to call it through the runtime Verse package. The catalog operator UI is
|
||||
emitted as a typed Eve surface document derived from the catalog snapshot.
|
||||
- Derived state: UI panels, generated keyboard layouts, editor rows, and
|
||||
serialized legacy payloads are projections, migration inputs, or disabled
|
||||
|
|
@ -269,6 +278,8 @@ First Aetheria surfaces to publish:
|
|||
- Done: import recursive typed behavior payloads so future behavior
|
||||
factories no longer have to depend on legacy `BehaviorData` objects just
|
||||
to see authored behavior fields.
|
||||
- Done: add typed `AetheriaLoadoutTemplate` documents and smoke coverage so
|
||||
`.loadout` no longer lacks a durable Verse replacement.
|
||||
- Remaining: add typed documents/mappers for runtime object graphs,
|
||||
typed behavior factory construction, simulation state, and any catalog
|
||||
fields not covered by the stable scalar/fingerprint/payload pass.
|
||||
|
|
@ -326,7 +337,7 @@ First Aetheria surfaces to publish:
|
|||
- `dotnet list package --vulnerable --include-transitive` is clean for active
|
||||
maintained projects.
|
||||
- CultCache smoke proves write, flush, reopen, query, and typed reference
|
||||
resolution.
|
||||
resolution, including loadout templates as the `.loadout` replacement.
|
||||
- CultMesh smoke proves node start, typed put/get, subscription, flush, and
|
||||
reopen.
|
||||
- Eve surface smoke proves provider-owned surface documents are generated from
|
||||
|
|
|
|||
Loading…
Reference in a new issue