Replace runtime union metadata
This commit is contained in:
parent
181a0d0a79
commit
d2c062c94d
10 changed files with 59 additions and 93 deletions
Binary file not shown.
|
|
@ -16,9 +16,40 @@ public interface IRuntimeItemCatalogReader
|
|||
public sealed class AetheriaRuntimeItemCatalog : IRuntimeItemCatalogReader
|
||||
{
|
||||
private readonly Dictionary<Guid, ItemData> _items;
|
||||
private static readonly IReadOnlyDictionary<int, Type> BehaviorTypesByUnionKey = typeof(BehaviorData)
|
||||
.GetCustomAttributes<UnionAttribute>()
|
||||
.ToDictionary(attribute => attribute.Key, attribute => attribute.SubType);
|
||||
private static readonly IReadOnlyDictionary<int, Type> BehaviorTypesByUnionKey = new Dictionary<int, Type>
|
||||
{
|
||||
{ 0, typeof(GuidedWeaponData) },
|
||||
{ 1, typeof(LauncherData) },
|
||||
{ 2, typeof(ReactorData) },
|
||||
{ 3, typeof(RadiatorData) },
|
||||
{ 4, typeof(StatModifierData) },
|
||||
{ 5, typeof(SensorData) },
|
||||
{ 6, typeof(ReflectorData) },
|
||||
{ 7, typeof(ShieldData) },
|
||||
{ 8, typeof(ThrusterData) },
|
||||
{ 9, typeof(WearData) },
|
||||
{ 10, typeof(VelocityConversionData) },
|
||||
{ 11, typeof(VelocityLimitData) },
|
||||
{ 12, typeof(AetherDriveData) },
|
||||
{ 15, typeof(CooldownData) },
|
||||
{ 16, typeof(HeatData) },
|
||||
{ 18, typeof(ItemUsageData) },
|
||||
{ 20, typeof(SwitchData) },
|
||||
{ 21, typeof(TriggerData) },
|
||||
{ 22, typeof(VisibilityData) },
|
||||
{ 23, typeof(ThermotoggleData) },
|
||||
{ 24, typeof(EnergyDrawData) },
|
||||
{ 26, typeof(MiningToolData) },
|
||||
{ 28, typeof(ResourceScannerData) },
|
||||
{ 31, typeof(CapacitorData) },
|
||||
{ 32, typeof(CockpitData) },
|
||||
{ 33, typeof(HeatStorageData) },
|
||||
{ 34, typeof(TurretControllerData) },
|
||||
{ 35, typeof(InstantWeaponData) },
|
||||
{ 36, typeof(ConstantWeaponData) },
|
||||
{ 37, typeof(ChargedWeaponData) },
|
||||
{ 38, typeof(AutoWeaponData) }
|
||||
};
|
||||
|
||||
public AetheriaRuntimeItemCatalog(AetheriaRuntimeCatalogSnapshot catalog)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,26 +3,16 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using MessagePack;
|
||||
[MessagePackObject,
|
||||
Union(0, typeof(StationTowing)),
|
||||
Union(1, typeof(Mining)),
|
||||
Union(2, typeof(Survey)),
|
||||
Union(3, typeof(HaulingTask))]
|
||||
|
||||
public abstract class AgentTask : DatabaseEntry
|
||||
{
|
||||
[Key(1)]
|
||||
public int Priority;
|
||||
|
||||
[Key(2)]
|
||||
public Guid Zone;
|
||||
|
||||
[Key(3)]
|
||||
public bool Reserved;
|
||||
|
||||
[IgnoreMember] public abstract TaskType Type { get; }
|
||||
public abstract TaskType Type { get; }
|
||||
}
|
||||
|
||||
public enum TaskType
|
||||
|
|
|
|||
|
|
@ -3,22 +3,16 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using MessagePack;
|
||||
|
||||
public class HaulingTask : AgentTask
|
||||
{
|
||||
public override TaskType Type => TaskType.Haul;
|
||||
|
||||
[Key(4)]
|
||||
public Entity Origin;
|
||||
|
||||
[Key(5)]
|
||||
public Entity Target;
|
||||
|
||||
[Key(6)]
|
||||
public Guid ItemType;
|
||||
|
||||
[Key(7)]
|
||||
public int Quantity;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,14 +3,10 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using MessagePack;
|
||||
[MessagePackObject]
|
||||
|
||||
public class Mining : AgentTask
|
||||
{
|
||||
[IgnoreMember] public override TaskType Type => TaskType.Mine;
|
||||
public override TaskType Type => TaskType.Mine;
|
||||
|
||||
[Key(4)]
|
||||
public Guid Asteroids;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,20 +3,14 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using MessagePack;
|
||||
[MessagePackObject]
|
||||
|
||||
public class StationTowing : AgentTask
|
||||
{
|
||||
[IgnoreMember] public override TaskType Type => TaskType.Tow;
|
||||
public override TaskType Type => TaskType.Tow;
|
||||
|
||||
[Key(4)]
|
||||
public OrbitalEntity Station;
|
||||
|
||||
[Key(5)]
|
||||
public Guid OrbitParent;
|
||||
|
||||
[Key(6)]
|
||||
public float OrbitDistance;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,14 +3,11 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using MessagePack;
|
||||
[MessagePackObject]
|
||||
|
||||
public class Survey : AgentTask
|
||||
{
|
||||
[IgnoreMember] public override TaskType Type => TaskType.Explore;
|
||||
public override TaskType Type => TaskType.Explore;
|
||||
|
||||
[Key(4)]
|
||||
public List<Guid> Planets;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,45 +145,7 @@ public abstract class PersistentBehaviorData
|
|||
{
|
||||
}
|
||||
|
||||
[Inspectable,
|
||||
Union(0, typeof(GuidedWeaponData)),
|
||||
Union(1, typeof(LauncherData)),
|
||||
Union(2, typeof(ReactorData)),
|
||||
Union(3, typeof(RadiatorData)),
|
||||
Union(4, typeof(StatModifierData)),
|
||||
Union(5, typeof(SensorData)),
|
||||
Union(6, typeof(ReflectorData)),
|
||||
Union(7, typeof(ShieldData)),
|
||||
Union(8, typeof(ThrusterData)),
|
||||
Union(9, typeof(WearData)),
|
||||
Union(10, typeof(VelocityConversionData)),
|
||||
Union(11, typeof(VelocityLimitData)),
|
||||
Union(12, typeof(AetherDriveData)),
|
||||
// Union(14, typeof(TowingControllerData)),
|
||||
Union(15, typeof(CooldownData)),
|
||||
Union(16, typeof(HeatData)),
|
||||
// Union(17, typeof(HitscanData)),
|
||||
Union(18, typeof(ItemUsageData)),
|
||||
//Union(19, typeof(RadianceData)),
|
||||
Union(20, typeof(SwitchData)),
|
||||
Union(21, typeof(TriggerData)),
|
||||
Union(22, typeof(VisibilityData)),
|
||||
Union(23, typeof(ThermotoggleData)),
|
||||
Union(24, typeof(EnergyDrawData)),
|
||||
// Union(25, typeof(MiningControllerData)),
|
||||
Union(26, typeof(MiningToolData)),
|
||||
// Union(27, typeof(SurveyControllerData)),
|
||||
Union(28, typeof(ResourceScannerData)),
|
||||
// Union(29, typeof(WanderControllerData)),
|
||||
// Union(30, typeof(HaulingControllerData)),
|
||||
Union(31, typeof(CapacitorData)),
|
||||
Union(32, typeof(CockpitData)),
|
||||
Union(33, typeof(HeatStorageData)),
|
||||
Union(34, typeof(TurretControllerData)),
|
||||
Union(35, typeof(InstantWeaponData)),
|
||||
Union(36, typeof(ConstantWeaponData)),
|
||||
Union(37, typeof(ChargedWeaponData)),
|
||||
Union(38, typeof(AutoWeaponData))]
|
||||
[Inspectable]
|
||||
public abstract class BehaviorData
|
||||
{
|
||||
[Inspectable, Key(0)]
|
||||
|
|
@ -196,4 +158,4 @@ public abstract class BehaviorData
|
|||
{
|
||||
return base.ToString().FormatTypeName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,12 +9,7 @@ using MessagePack;
|
|||
using Unity.Mathematics;
|
||||
using static Unity.Mathematics.math;
|
||||
|
||||
[Inspectable,
|
||||
Union(0, typeof(InstantWeaponData)),
|
||||
Union(1, typeof(LauncherData)),
|
||||
Union(2, typeof(ConstantWeaponData)),
|
||||
Union(3, typeof(ChargedWeaponData)),
|
||||
RuntimeInspectable]
|
||||
[Inspectable, RuntimeInspectable]
|
||||
public abstract class WeaponData : BehaviorData
|
||||
{
|
||||
[Inspectable, Key(1), RuntimeInspectable]
|
||||
|
|
|
|||
|
|
@ -215,7 +215,9 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
|
|||
plain runtime/session/config projections now, not MessagePack persistence
|
||||
shapes. The global scene-load MessagePack resolver hook is deleted. The slime
|
||||
compute settings path no longer serializes its local parameter struct for
|
||||
change detection.
|
||||
change detection. Agent task runtime shapes no longer carry MessagePack
|
||||
object, union, key, or ignore metadata. They remain plain in-memory AI task
|
||||
DTOs until a typed Verse task document exists.
|
||||
- The dead story compiled-JSON cache sketch and its SHA helper are deleted;
|
||||
story compilation currently reads Ink source directly until a typed Verse
|
||||
story/cache document exists.
|
||||
|
|
@ -258,9 +260,10 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
|
|||
owns simulation. The runtime no longer has a MessagePack catalog cache.
|
||||
`AetheriaRuntimeItemCatalog` materializes temporary `ItemData` DTOs from typed
|
||||
item records for the old simulation object model. `DatabaseEntry` no longer
|
||||
carries MessagePack union metadata; remaining item/behavior DTO MessagePack
|
||||
keys are temporary projection metadata until typed behavior factories replace
|
||||
reflection. Item properties
|
||||
carries MessagePack union metadata, and behavior type selection now uses an
|
||||
explicit runtime catalog map instead of `UnionAttribute` reflection.
|
||||
Remaining item/behavior DTO MessagePack keys are temporary projection metadata
|
||||
until typed behavior factories replace reflection. Item properties
|
||||
manufacturer display is a typed snapshot consumer; loadout generation is the
|
||||
remaining runtime single-ID item lookup bridge. The old trade debug UI and
|
||||
console `give` command have been deleted. No live caller can enumerate legacy
|
||||
|
|
@ -442,6 +445,10 @@ First Aetheria surfaces to publish:
|
|||
`LegacyItemCatalogCache`, and the runtime MessagePack deserializer path.
|
||||
- Done: demote `DatabaseEntry` and `DatabaseLink<T>` from MessagePack
|
||||
union/object shapes to plain runtime identity/link helpers.
|
||||
- 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
|
||||
metadata to plain in-memory DTOs.
|
||||
- Convert domain references from GUID/base-class patterns to typed record
|
||||
refs.
|
||||
- Remove runtime dependency on `ItemData` DTOs as item instance owners.
|
||||
|
|
|
|||
Loading…
Reference in a new issue