Collapse runtime item catalog links
This commit is contained in:
parent
8315d4cc67
commit
c38be9ee5c
8 changed files with 55 additions and 50 deletions
Binary file not shown.
|
|
@ -60,6 +60,9 @@ Dead legacy catalog roots for user records and galaxy map-layer resources have
|
|||
been deleted from live Unity source. Surviving runtime DTOs no longer carry
|
||||
legacy catalog group/table annotations; their remaining metadata is projection
|
||||
and inspection metadata for the typed runtime bridge.
|
||||
Item instances now carry `RuntimeItemReference`, a narrow item-id/value holder.
|
||||
The old generic `RuntimeCatalogLink<T>` abstraction has been deleted; item data
|
||||
projection is routed through `ItemManager` and the typed runtime catalog reader.
|
||||
|
||||
`Aetheria.State.Import` captures the legacy catalog files into typed quarantine
|
||||
state: path, size, and SHA-256 fingerprint for `AetherDB.msgpack` plus
|
||||
|
|
|
|||
|
|
@ -377,7 +377,7 @@ public abstract class Entity
|
|||
public void GenerateWeaponGroups()
|
||||
{
|
||||
foreach (var group in Weapons
|
||||
.GroupBy(w => w.Item.EquippableItem.Data.LinkID)
|
||||
.GroupBy(w => w.Item.EquippableItem.Data.ItemId)
|
||||
.OrderBy(wg=>wg.Average(w=>w.Range))
|
||||
.Select((weapons, index) => (weapons, index)))
|
||||
{
|
||||
|
|
@ -1523,9 +1523,9 @@ public class EquippedCargoBay : EquippedItem
|
|||
}
|
||||
Cargo[item] = cargoCoord;
|
||||
|
||||
if(!ItemsOfType.ContainsKey(item.Data.LinkID))
|
||||
ItemsOfType[item.Data.LinkID] = new List<ItemInstance>();
|
||||
ItemsOfType[item.Data.LinkID].Add(item);
|
||||
if(!ItemsOfType.ContainsKey(item.Data.ItemId))
|
||||
ItemsOfType[item.Data.ItemId] = new List<ItemInstance>();
|
||||
ItemsOfType[item.Data.ItemId].Add(item);
|
||||
}
|
||||
else if (Occupancy[cargoCoord.x, cargoCoord.y] is SimpleCommodity cargoCommodity && cargoCommodity.Data == item.Data)
|
||||
{
|
||||
|
|
@ -1567,9 +1567,9 @@ public class EquippedCargoBay : EquippedItem
|
|||
}
|
||||
Cargo[item] = cargoCoord;
|
||||
|
||||
if(!ItemsOfType.ContainsKey(item.Data.LinkID))
|
||||
ItemsOfType[item.Data.LinkID] = new List<ItemInstance>();
|
||||
ItemsOfType[item.Data.LinkID].Add(item);
|
||||
if(!ItemsOfType.ContainsKey(item.Data.ItemId))
|
||||
ItemsOfType[item.Data.ItemId] = new List<ItemInstance>();
|
||||
ItemsOfType[item.Data.ItemId].Add(item);
|
||||
|
||||
Mass += ItemManager.GetMass(item);
|
||||
ThermalMass += ItemManager.GetThermalMass(item);
|
||||
|
|
@ -1592,9 +1592,9 @@ public class EquippedCargoBay : EquippedItem
|
|||
Occupancy[v.x, v.y] = null;
|
||||
|
||||
Cargo.Remove(item);
|
||||
ItemsOfType[item.Data.LinkID].Remove(item);
|
||||
if (!ItemsOfType[item.Data.LinkID].Any())
|
||||
ItemsOfType.Remove(item.Data.LinkID);
|
||||
ItemsOfType[item.Data.ItemId].Remove(item);
|
||||
if (!ItemsOfType[item.Data.ItemId].Any())
|
||||
ItemsOfType.Remove(item.Data.ItemId);
|
||||
|
||||
Mass -= ItemManager.GetMass(item);
|
||||
ThermalMass -= ItemManager.GetThermalMass(item);
|
||||
|
|
@ -1621,9 +1621,9 @@ public class EquippedCargoBay : EquippedItem
|
|||
Occupancy[v.x, v.y] = null;
|
||||
|
||||
Cargo.Remove(item);
|
||||
ItemsOfType[item.Data.LinkID].Remove(item);
|
||||
if (!ItemsOfType[item.Data.LinkID].Any())
|
||||
ItemsOfType.Remove(item.Data.LinkID);
|
||||
ItemsOfType[item.Data.ItemId].Remove(item);
|
||||
if (!ItemsOfType[item.Data.ItemId].Any())
|
||||
ItemsOfType.Remove(item.Data.ItemId);
|
||||
|
||||
Mass -= ItemManager.GetMass(item);
|
||||
ThermalMass -= ItemManager.GetThermalMass(item);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ using static Unity.Mathematics.math;
|
|||
|
||||
public abstract class ItemInstance
|
||||
{
|
||||
public RuntimeCatalogLink<ItemData> Data;
|
||||
public RuntimeItemReference Data;
|
||||
public ItemRotation Rotation;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,9 +57,9 @@ public class ItemManager
|
|||
return _itemData.Get<T>(id);
|
||||
}
|
||||
|
||||
public RuntimeCatalogLink<ItemData> CreateLink(ItemData item)
|
||||
public RuntimeItemReference CreateReference(ItemData item)
|
||||
{
|
||||
return new RuntimeCatalogLink<ItemData>(item);
|
||||
return new RuntimeItemReference(item);
|
||||
}
|
||||
|
||||
public ItemData GetData(ItemInstance item)
|
||||
|
|
@ -75,10 +75,10 @@ public class ItemManager
|
|||
return;
|
||||
}
|
||||
|
||||
var data = _itemData.Get(item.Data.LinkID);
|
||||
var data = _itemData.Get(item.Data.ItemId);
|
||||
if (data == null)
|
||||
{
|
||||
_logger($"Attempted to hydrate missing item id {item.Data.LinkID}");
|
||||
_logger($"Attempted to hydrate missing item id {item.Data.ItemId}");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -155,7 +155,7 @@ public class ItemManager
|
|||
{
|
||||
var newItem = new SimpleCommodity
|
||||
{
|
||||
Data = CreateLink(item),
|
||||
Data = CreateReference(item),
|
||||
Quantity = count
|
||||
};
|
||||
//ItemData.Add(newItem);
|
||||
|
|
@ -190,13 +190,13 @@ public class ItemManager
|
|||
{
|
||||
return new EquippableItem
|
||||
{
|
||||
Data = CreateLink(item), Quality = quality, Durability = equippableItemData.Durability
|
||||
Data = CreateReference(item), Quality = quality, Durability = equippableItemData.Durability
|
||||
};
|
||||
}
|
||||
|
||||
var newCommodity = new CompoundCommodity
|
||||
{
|
||||
Data = CreateLink(item),
|
||||
Data = CreateReference(item),
|
||||
Quality = quality
|
||||
};
|
||||
return newCommodity;
|
||||
|
|
|
|||
|
|
@ -26,31 +26,27 @@ public abstract class RuntimeCatalogEntry
|
|||
}
|
||||
}
|
||||
|
||||
public class RuntimeCatalogLink<T> : RuntimeCatalogLinkBase where T : ItemData
|
||||
public class RuntimeItemReference
|
||||
{
|
||||
public T Value { get; private set; }
|
||||
public ItemData Value { get; private set; }
|
||||
public Guid ItemId;
|
||||
|
||||
public RuntimeCatalogLink()
|
||||
public RuntimeItemReference()
|
||||
{
|
||||
}
|
||||
|
||||
public RuntimeCatalogLink(T value)
|
||||
public RuntimeItemReference(ItemData value)
|
||||
{
|
||||
SetValue(value);
|
||||
}
|
||||
|
||||
public void SetValue(T value)
|
||||
public void SetValue(ItemData value)
|
||||
{
|
||||
Value = value;
|
||||
LinkID = value?.ID ?? Guid.Empty;
|
||||
ItemId = value?.ID ?? Guid.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public class RuntimeCatalogLinkBase
|
||||
{
|
||||
public Guid LinkID;
|
||||
}
|
||||
|
||||
public interface ITintInspector
|
||||
{
|
||||
float3 TintColor { get; }
|
||||
|
|
|
|||
|
|
@ -289,7 +289,7 @@ public class TradeMenu : MonoBehaviour
|
|||
x => () =>
|
||||
{
|
||||
if (x.data is HullData)
|
||||
return GameManager.DockedEntity.Children.Count(s => s.Hull.Data.LinkID == x.data.ID && s is Ship {IsPlayerShip: true}).ToString();
|
||||
return GameManager.DockedEntity.Children.Count(s => s.Hull.Data.ItemId == x.data.ID && s is Ship {IsPlayerShip: true}).ToString();
|
||||
if(x.data is SimpleCommodityData)
|
||||
return (_targetCargo.ItemsOfType.ContainsKey(x.data.ID) ? _targetCargo.ItemsOfType[x.data.ID].Cast<SimpleCommodity>().Sum(s=>s.Quantity) : 0).ToString();
|
||||
return (_targetCargo.ItemsOfType.ContainsKey(x.data.ID) ? _targetCargo.ItemsOfType[x.data.ID].Count : 0).ToString();
|
||||
|
|
@ -297,7 +297,7 @@ public class TradeMenu : MonoBehaviour
|
|||
data =>
|
||||
{
|
||||
if (data is HullData)
|
||||
return GameManager.DockedEntity.Children.Count(s => s.Hull.Data.LinkID == data.ID && s is Ship {IsPlayerShip: true});
|
||||
return GameManager.DockedEntity.Children.Count(s => s.Hull.Data.ItemId == data.ID && s is Ship {IsPlayerShip: true});
|
||||
if(data is SimpleCommodityData)
|
||||
return _targetCargo.ItemsOfType.ContainsKey(data.ID) ? _targetCargo.ItemsOfType[data.ID].Cast<SimpleCommodity>().Sum(s=>s.Quantity) : 0;
|
||||
return _targetCargo.ItemsOfType.ContainsKey(data.ID) ? _targetCargo.ItemsOfType[data.ID].Count : 0;
|
||||
|
|
|
|||
|
|
@ -92,13 +92,14 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
|
|||
in-memory list remains a UI/session cache, not durable authority.
|
||||
- `ActionGameManager` opens `AetheriaRuntimeCatalogStore` over
|
||||
`aetheria-world.cc`, projects it through `AetheriaRuntimeItemCatalog`, and
|
||||
gives `ItemManager` explicit item lookup authority. `RuntimeCatalogLink<T>`
|
||||
is now a hydrated identifier/value holder, not a process-global catalog
|
||||
resolver. The old `LegacyItemCatalogBoundary`, `LegacyItemCatalogCache`, and
|
||||
runtime MessagePack deserializer path have been deleted. The old
|
||||
`DatabaseEntry`/`DatabaseLink<T>` names have been demoted to
|
||||
`RuntimeCatalogEntry`/`RuntimeCatalogLink<T>` runtime projection helpers, not
|
||||
MessagePack objects or a global union root.
|
||||
gives `ItemManager` explicit item lookup authority. Item instances carry
|
||||
`RuntimeItemReference`, a hydrated item-id/value holder, not a process-global
|
||||
catalog resolver. The old `LegacyItemCatalogBoundary`,
|
||||
`LegacyItemCatalogCache`, and runtime MessagePack deserializer path have been
|
||||
deleted. The old `DatabaseEntry` name has been demoted to
|
||||
`RuntimeCatalogEntry` for surviving runtime DTOs, and the old generic
|
||||
`DatabaseLink<T>`/`RuntimeCatalogLink<T>` path has collapsed into the
|
||||
item-specific runtime reference.
|
||||
- `ItemManager` no longer exposes the raw runtime item catalog reader as public
|
||||
gameplay/UI API. Temporary item instantiation bridges now go through the
|
||||
narrow `ItemManager.GetCatalogEntry<T>` method. `ItemManager` no longer
|
||||
|
|
@ -123,10 +124,11 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
|
|||
`Faction` DTOs, including allegiance edges, for the existing simulation shape
|
||||
and resolves full name arrays from `aetheria.name_file.v2` records. The
|
||||
runtime no longer opens the old `GameData/NameFile/*.msgpack` directory.
|
||||
- `RuntimeCatalogLink<T>.Value` can resolve legacy links only after
|
||||
`ActionGameManager` binds the typed runtime item catalog projected from
|
||||
`aetheria-world.cc`. MessagePack catalog construction no longer grabs global
|
||||
link-resolution authority.
|
||||
- Item instances carry `RuntimeItemReference`, a narrow item-id/value holder
|
||||
resolved by `ItemManager` against the typed runtime item catalog projected
|
||||
from `aetheria-world.cc`. MessagePack catalog construction no longer grabs
|
||||
global link-resolution authority, and the old generic `RuntimeCatalogLink<T>`
|
||||
abstraction is gone.
|
||||
- `Economy.Server` now starts the modern `Aetheria.State` CultMesh node, drains
|
||||
pending Unity runtime commits through the typed state applicator, and no
|
||||
longer owns RethinkDB/LiteNetLib state.
|
||||
|
|
@ -333,7 +335,7 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
|
|||
typed state file path plus the boot-time state-file probe, and is the landing
|
||||
zone for future typed catalog boot.
|
||||
`ActionGameManager` opens the package-owned typed runtime catalog snapshot
|
||||
and binds `RuntimeCatalogLink<T>` resolution through `AetheriaRuntimeItemCatalog`.
|
||||
and binds item reference resolution through `AetheriaRuntimeItemCatalog`.
|
||||
Runtime code receives narrow `ItemManager` catalog methods where gameplay
|
||||
only needs item lookups. `Galaxy`, entity restore, and faction-distance
|
||||
loadout weighting have been moved off legacy faction catalog reads.
|
||||
|
|
@ -539,10 +541,9 @@ First Aetheria surfaces to publish:
|
|||
- Done: demote `DatabaseEntry` and `DatabaseLink<T>` from MessagePack
|
||||
union/object shapes to plain runtime identity/link helpers.
|
||||
- Done: rename live Unity projection helpers from `DatabaseEntry`,
|
||||
`DatabaseLink<T>`, and `InspectableDatabaseLinkAttribute` to
|
||||
`RuntimeCatalogEntry`, `RuntimeCatalogLink<T>`, and
|
||||
`InspectableRuntimeCatalogLinkAttribute`, and move the old
|
||||
`ServerShared/CultCache` folder to `ServerShared/RuntimeProjection`.
|
||||
`DatabaseLink<T>`, and `InspectableDatabaseLinkAttribute` to runtime
|
||||
projection names, and move the old `ServerShared/CultCache` folder to
|
||||
`ServerShared/RuntimeProjection`.
|
||||
- Done: replace behavior union reflection with an explicit runtime catalog
|
||||
behavior map and remove all live `Union(...)` annotations.
|
||||
- Done: demote agent task runtime shapes from MessagePack object/key/union
|
||||
|
|
@ -644,6 +645,9 @@ First Aetheria surfaces to publish:
|
|||
- Done: delete the process-global runtime catalog resolver from
|
||||
`RuntimeCatalogLink<T>`; item instances now carry hydrated identifiers and
|
||||
`ItemManager` owns resolution through the typed runtime catalog reader.
|
||||
- Done: collapse the old generic `RuntimeCatalogLink<T>` abstraction into
|
||||
`RuntimeItemReference`, an item-specific runtime projection reference owned
|
||||
by `ItemManager`.
|
||||
- Done: quarantine the vendored Unity `MessagePack` assembly by disabling
|
||||
asmdef auto-reference; only explicit state-spine assemblies should see it
|
||||
while the Unity CultCache bridge still needs a low-level `.cc` codec.
|
||||
|
|
@ -699,6 +703,8 @@ First Aetheria surfaces to publish:
|
|||
error hits.
|
||||
- `rg ".Data.Value|BindRuntimeItemCatalog|ResolveRuntimeItemCatalog|private static IRuntimeItemCatalogReader"` in
|
||||
`Assets/Scripts` now finds only `ItemManager` checking its own hydrated value.
|
||||
- Live Unity source has no `RuntimeCatalogLink<T>` or `RuntimeCatalogLinkBase`;
|
||||
item instances use `RuntimeItemReference` and expose `Data.ItemId`.
|
||||
- Unity batchmode compile also returned cleanly after disabling `MessagePack`
|
||||
auto-reference; `Assets/Scripts` and `Assets/Editor` have no `using
|
||||
MessagePack`, `MessagePackSerializer`, `[MessagePackObject]`, or
|
||||
|
|
|
|||
Loading…
Reference in a new issue