refactor(runtime): own canonical entity and object lifetime
Introduce one presentation-free RuntimeEntityObjectLifetime for the exact entity directory and ClientObjectTable. Make GameWindow, graphical projections, retained UI, interaction, session routing, create/delete integration, and reset borrow that owner while preserving synchronous retail ordering, dormant retention, and retry semantics. Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
parent
d9bf4c4960
commit
5ef8b5371d
40 changed files with 712 additions and 170 deletions
|
|
@ -110,7 +110,7 @@ public sealed class DeferredLiveEntityRuntimeComponentLifecycleTests
|
|||
{
|
||||
const uint guid = 0x70000002u;
|
||||
var bridge = new DeferredLiveEntityRuntimeComponentLifecycle();
|
||||
var runtime = new LiveEntityRuntime(
|
||||
var runtime = LiveEntityRuntimeFixture.Create(
|
||||
new GpuWorldState(),
|
||||
new DelegateLiveEntityResourceLifecycle(_ => { }, _ => { }),
|
||||
bridge);
|
||||
|
|
@ -136,7 +136,7 @@ public sealed class DeferredLiveEntityRuntimeComponentLifecycleTests
|
|||
|
||||
private static LiveEntityRecord CreateRecord()
|
||||
{
|
||||
var runtime = new LiveEntityRuntime(
|
||||
var runtime = LiveEntityRuntimeFixture.Create(
|
||||
new GpuWorldState(),
|
||||
new DelegateLiveEntityResourceLifecycle(_ => { }, _ => { }));
|
||||
return runtime.RegisterAndMaterializeProjection(
|
||||
|
|
|
|||
|
|
@ -1828,7 +1828,8 @@ public sealed class LiveEntityHydrationControllerTests
|
|||
private sealed class Fixture : IDisposable
|
||||
{
|
||||
public readonly List<string> Operations = [];
|
||||
public readonly ClientObjectTable Objects = new();
|
||||
public readonly RuntimeEntityObjectLifetime EntityObjects = new();
|
||||
public ClientObjectTable Objects => EntityObjects.Objects;
|
||||
public readonly RecordingResources Resources;
|
||||
public readonly LiveEntityRuntime Runtime;
|
||||
public readonly RecordingMaterializer Materializer;
|
||||
|
|
@ -1861,7 +1862,8 @@ public sealed class LiveEntityHydrationControllerTests
|
|||
Runtime = new LiveEntityRuntime(
|
||||
spatial,
|
||||
Resources,
|
||||
Teardown);
|
||||
Teardown,
|
||||
EntityObjects);
|
||||
Materializer = new RecordingMaterializer(Runtime, Operations);
|
||||
Relationships = new RecordingRelationships(Operations);
|
||||
Ready = new RecordingReadyPublisher(Operations);
|
||||
|
|
@ -1887,13 +1889,13 @@ public sealed class LiveEntityHydrationControllerTests
|
|||
};
|
||||
var deletion = new LiveEntityDeletionController(
|
||||
Runtime,
|
||||
Objects,
|
||||
EntityObjects,
|
||||
Teardown,
|
||||
identity,
|
||||
Dormant);
|
||||
Controller = new LiveEntityHydrationController(
|
||||
Runtime,
|
||||
Objects,
|
||||
EntityObjects,
|
||||
new object(),
|
||||
Materializer,
|
||||
Relationships,
|
||||
|
|
|
|||
|
|
@ -328,7 +328,7 @@ public sealed class LiveEntityLifecycleStressTests
|
|||
randomUnit: () => 0.5,
|
||||
canAdvanceOwner: ownerId => _effects?.CanAdvanceOwner(ownerId) ?? true);
|
||||
|
||||
Runtime = new LiveEntityRuntime(
|
||||
Runtime = LiveEntityRuntimeFixture.Create(
|
||||
Spatial,
|
||||
new DelegateLiveEntityResourceLifecycle(
|
||||
entity =>
|
||||
|
|
@ -489,7 +489,7 @@ public sealed class LiveEntityLifecycleStressTests
|
|||
EntityEffectController? effects = null;
|
||||
LiveEntityPresentationController? presentation = null;
|
||||
RemoteTeleportController? teleport = null;
|
||||
Runtime = new LiveEntityRuntime(
|
||||
Runtime = LiveEntityRuntimeFixture.Create(
|
||||
Spatial,
|
||||
new DelegateLiveEntityResourceLifecycle(
|
||||
entity =>
|
||||
|
|
|
|||
|
|
@ -630,10 +630,10 @@ public sealed class LiveEntityPhysicsHostOwnershipTests
|
|||
|
||||
private static LiveEntityRuntime Runtime(Action<LiveEntityRecord>? teardown = null) =>
|
||||
teardown is null
|
||||
? new LiveEntityRuntime(
|
||||
? LiveEntityRuntimeFixture.Create(
|
||||
new GpuWorldState(),
|
||||
new DelegateLiveEntityResourceLifecycle(_ => { }, _ => { }))
|
||||
: new LiveEntityRuntime(
|
||||
: LiveEntityRuntimeFixture.Create(
|
||||
new GpuWorldState(),
|
||||
new DelegateLiveEntityResourceLifecycle(_ => { }, _ => { }),
|
||||
teardown);
|
||||
|
|
|
|||
|
|
@ -426,7 +426,7 @@ public sealed class LiveEntityPresentationControllerTests
|
|||
const uint pendingCell = 0x02020001u;
|
||||
var spatial = new GpuWorldState();
|
||||
var shadows = new ShadowObjectRegistry();
|
||||
var runtime = new LiveEntityRuntime(
|
||||
var runtime = LiveEntityRuntimeFixture.Create(
|
||||
spatial,
|
||||
new DelegateLiveEntityResourceLifecycle(_ => { }, _ => { }));
|
||||
runtime.RegisterLiveEntity(Fixture.Spawn(
|
||||
|
|
@ -487,7 +487,7 @@ public sealed class LiveEntityPresentationControllerTests
|
|||
const uint pendingCell = 0x02020001u;
|
||||
var spatial = new GpuWorldState();
|
||||
var shadows = new ShadowObjectRegistry();
|
||||
var runtime = new LiveEntityRuntime(
|
||||
var runtime = LiveEntityRuntimeFixture.Create(
|
||||
spatial,
|
||||
new DelegateLiveEntityResourceLifecycle(_ => { }, _ => { }));
|
||||
runtime.RegisterLiveEntity(Fixture.Spawn(
|
||||
|
|
@ -667,7 +667,7 @@ public sealed class LiveEntityPresentationControllerTests
|
|||
0x0101FFFFu,
|
||||
new LandBlock(),
|
||||
Array.Empty<WorldEntity>()));
|
||||
Runtime = new LiveEntityRuntime(
|
||||
Runtime = LiveEntityRuntimeFixture.Create(
|
||||
Spatial,
|
||||
new DelegateLiveEntityResourceLifecycle(_ => { }, _ => { }));
|
||||
WorldSession.EntitySpawn spawn = Spawn(initialState);
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ public sealed class LiveEntityProjectionWithdrawalControllerTests
|
|||
new LandBlock(),
|
||||
Array.Empty<WorldEntity>()));
|
||||
var lifecycle = new DeferredLiveEntityRuntimeComponentLifecycle();
|
||||
Live = new LiveEntityRuntime(
|
||||
Live = LiveEntityRuntimeFixture.Create(
|
||||
Spatial,
|
||||
new DelegateLiveEntityResourceLifecycle(_ => { }, _ => { }),
|
||||
lifecycle);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
public void RuntimeSlot_BindsExactlyOnceWithoutOwningEntityState()
|
||||
{
|
||||
var spatial = new GpuWorldState();
|
||||
var runtime = new LiveEntityRuntime(spatial, new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, new RecordingResources());
|
||||
var slot = new LiveEntityRuntimeSlot();
|
||||
|
||||
Assert.Null(slot.Current);
|
||||
|
|
@ -176,7 +176,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
spatial.AddLandblock(EmptyLandblock(0x0102FFFFu));
|
||||
var resources = new RecordingResources();
|
||||
var runtime = new LiveEntityRuntime(spatial, resources);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources);
|
||||
WorldSession.EntitySpawn spawn = Spawn(0x70000001u, 1, 1, 0x01010001u);
|
||||
|
||||
LiveEntityRegistrationResult registered = runtime.RegisterLiveEntity(spawn);
|
||||
|
|
@ -213,7 +213,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
const uint guid = 0x70000071u;
|
||||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var runtime = new LiveEntityRuntime(spatial, new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, new RecordingResources());
|
||||
WorldSession.EntitySpawn spawn = Spawn(
|
||||
guid,
|
||||
instance: 1,
|
||||
|
|
@ -325,7 +325,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
const uint guid = 0x70000074u;
|
||||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var runtime = new LiveEntityRuntime(spatial, new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, new RecordingResources());
|
||||
runtime.RegisterLiveEntity(Spawn(
|
||||
guid,
|
||||
instance: 1,
|
||||
|
|
@ -417,7 +417,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
const uint guid = 0x70000070u;
|
||||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var runtime = new LiveEntityRuntime(spatial, new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, new RecordingResources());
|
||||
WorldSession.EntitySpawn spawn = Spawn(guid, 1, 1, 0x01010001u);
|
||||
runtime.RegisterLiveEntity(spawn);
|
||||
WorldEntity entity = runtime.MaterializeLiveEntity(
|
||||
|
|
@ -476,7 +476,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
const uint guid = 0x70000071u;
|
||||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var runtime = new LiveEntityRuntime(spatial, new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, new RecordingResources());
|
||||
runtime.RegisterLiveEntity(Spawn(guid, 1, 1, 0x01010001u));
|
||||
WorldEntity entity = runtime.MaterializeLiveEntity(
|
||||
guid,
|
||||
|
|
@ -513,7 +513,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
const uint secondGuid = 0x70000074u;
|
||||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var runtime = new LiveEntityRuntime(spatial, new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, new RecordingResources());
|
||||
foreach (uint guid in new[] { firstGuid, secondGuid })
|
||||
{
|
||||
runtime.RegisterLiveEntity(Spawn(guid, 1, 1, 0x01010001u));
|
||||
|
|
@ -545,7 +545,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
const uint guid = 0x70000075u;
|
||||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var runtime = new LiveEntityRuntime(spatial, new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, new RecordingResources());
|
||||
runtime.RegisterLiveEntity(Spawn(guid, 1, 1, 0x01010001u));
|
||||
WorldEntity entity = runtime.MaterializeLiveEntity(
|
||||
guid,
|
||||
|
|
@ -580,7 +580,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
const uint guid = 0x70000072u;
|
||||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var runtime = new LiveEntityRuntime(spatial, new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, new RecordingResources());
|
||||
runtime.RegisterLiveEntity(Spawn(guid, 1, 1, 0x01010001u));
|
||||
WorldEntity oldEntity = runtime.MaterializeLiveEntity(
|
||||
guid,
|
||||
|
|
@ -617,7 +617,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
const uint guid = 0x70000073u;
|
||||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var runtime = new LiveEntityRuntime(spatial, new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, new RecordingResources());
|
||||
runtime.RegisterLiveEntity(Spawn(guid, 1, 1, 0x01010001u));
|
||||
runtime.MaterializeLiveEntity(
|
||||
guid,
|
||||
|
|
@ -672,7 +672,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
spatial.AddLandblock(EmptyLandblock(0x0102FFFFu));
|
||||
var runtime = new LiveEntityRuntime(spatial, new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, new RecordingResources());
|
||||
WorldSession.EntitySpawn spawn = Spawn(guid, 6, 1, 0x01010001u);
|
||||
LiveEntityRegistrationResult registration =
|
||||
runtime.RegisterLiveEntity(spawn);
|
||||
|
|
@ -702,7 +702,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
{
|
||||
const uint parentGuid = 0x70000020u;
|
||||
const uint childGuid = 0x70000021u;
|
||||
var runtime = new LiveEntityRuntime(new GpuWorldState(), new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(new GpuWorldState(), new RecordingResources());
|
||||
runtime.RegisterLiveEntity(Spawn(parentGuid, 9, 1, 0x01010001u));
|
||||
runtime.ParentAttachments.Enqueue(new ParentEvent.Parsed(
|
||||
parentGuid, childGuid, 1, 2, 9, 5));
|
||||
|
|
@ -725,7 +725,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
{
|
||||
const uint parentGuid = 0x70000022u;
|
||||
const uint childGuid = 0x70000023u;
|
||||
var runtime = new LiveEntityRuntime(new GpuWorldState(), new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(new GpuWorldState(), new RecordingResources());
|
||||
runtime.RegisterLiveEntity(Spawn(childGuid, 3, 4, 0x01010001u));
|
||||
runtime.ParentAttachments.AcceptCreateObjectRelation(new ParentAttachmentRelation(
|
||||
parentGuid, childGuid, 1, 2, 9, 4));
|
||||
|
|
@ -743,7 +743,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var resources = new RecordingResources();
|
||||
var runtime = new LiveEntityRuntime(spatial, resources);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources);
|
||||
WorldSession.EntitySpawn first = Spawn(0x70000002u, 4, 10, 0x01010001u);
|
||||
runtime.RegisterLiveEntity(first);
|
||||
WorldEntity original = runtime.MaterializeLiveEntity(
|
||||
|
|
@ -771,7 +771,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var resources = new RecordingResources();
|
||||
int runtimeTearDowns = 0;
|
||||
var runtime = new LiveEntityRuntime(
|
||||
var runtime = LiveEntityRuntimeFixture.Create(
|
||||
spatial,
|
||||
resources,
|
||||
_ => runtimeTearDowns++);
|
||||
|
|
@ -803,7 +803,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var resources = new RecordingResources();
|
||||
var runtime = new LiveEntityRuntime(spatial, resources);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources);
|
||||
WorldSession.EntitySpawn spawn = Spawn(0x70000004u, 2, 3, 0x01010001u);
|
||||
runtime.RegisterLiveEntity(spawn);
|
||||
WorldEntity entity = runtime.MaterializeLiveEntity(
|
||||
|
|
@ -833,7 +833,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var resources = new RecordingResources();
|
||||
var runtime = new LiveEntityRuntime(spatial, resources);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources);
|
||||
const uint guid = 0x70000005u;
|
||||
runtime.RegisterLiveEntity(Spawn(guid, 3, 1, 0x01010001u));
|
||||
WorldEntity first = runtime.MaterializeLiveEntity(
|
||||
|
|
@ -863,7 +863,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var resources = new RecordingResources();
|
||||
var runtime = new LiveEntityRuntime(spatial, resources);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources);
|
||||
WorldSession.EntitySpawn spawn = Spawn(0x70000006u, 3, 1, 0x01010001u);
|
||||
runtime.RegisterLiveEntity(spawn);
|
||||
|
||||
|
|
@ -900,7 +900,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
{
|
||||
var spatial = new GpuWorldState();
|
||||
var resources = new RecordingResources();
|
||||
var runtime = new LiveEntityRuntime(spatial, resources);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources);
|
||||
WorldSession.EntitySpawn spawn = Spawn(0x70000007u, 1, 1, 0x01020001u);
|
||||
runtime.RegisterLiveEntity(spawn);
|
||||
WorldEntity entity = runtime.MaterializeLiveEntity(
|
||||
|
|
@ -929,7 +929,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
const uint guid = 0x70000025u;
|
||||
var spatial = new GpuWorldState();
|
||||
var resources = new RecordingResources();
|
||||
var runtime = new LiveEntityRuntime(spatial, resources);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources);
|
||||
WorldSession.EntitySpawn spawn = Spawn(guid, 2, 1, 0x01010001u);
|
||||
runtime.RegisterLiveEntity(spawn);
|
||||
WorldEntity entity = runtime.MaterializeLiveEntity(
|
||||
|
|
@ -983,7 +983,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var resources = new RecordingResources();
|
||||
var runtime = new LiveEntityRuntime(spatial, resources);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources);
|
||||
WorldSession.EntitySpawn spawn = Spawn(guid, 4, 10, 0x01010001u);
|
||||
runtime.RegisterLiveEntity(spawn);
|
||||
WorldEntity entity = runtime.MaterializeLiveEntity(
|
||||
|
|
@ -1063,7 +1063,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
const uint guid = 0x70000027u;
|
||||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var runtime = new LiveEntityRuntime(spatial, new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, new RecordingResources());
|
||||
WorldSession.EntitySpawn spawn = Spawn(guid, 1, 1, 0x01010001u);
|
||||
runtime.RegisterLiveEntity(spawn);
|
||||
runtime.MaterializeLiveEntity(
|
||||
|
|
@ -1104,7 +1104,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
spatial.AddLandblock(EmptyLandblock(0x0102FFFFu));
|
||||
var runtime = new LiveEntityRuntime(spatial, new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, new RecordingResources());
|
||||
WorldSession.EntitySpawn spawn = Spawn(guid, 1, 1, 0x01010001u);
|
||||
LiveEntityRecord record = RegisterProjection(runtime, spawn);
|
||||
RetailObjectQuantumClock clock = record.ObjectClock;
|
||||
|
|
@ -1143,7 +1143,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
const uint guid = 0x70000049u;
|
||||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var runtime = new LiveEntityRuntime(spatial, new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, new RecordingResources());
|
||||
WorldSession.EntitySpawn spawn = Spawn(
|
||||
guid,
|
||||
1,
|
||||
|
|
@ -1166,7 +1166,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
const uint staticGuid = 0x70000051u;
|
||||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var runtime = new LiveEntityRuntime(spatial, new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, new RecordingResources());
|
||||
|
||||
LiveEntityRecord ordinary = RegisterProjection(
|
||||
runtime,
|
||||
|
|
@ -1204,7 +1204,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
const uint staticGuid = 0x70000054u;
|
||||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var runtime = new LiveEntityRuntime(spatial, new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, new RecordingResources());
|
||||
|
||||
LiveEntityRecord ordinary = RegisterProjection(
|
||||
runtime,
|
||||
|
|
@ -1279,7 +1279,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
{
|
||||
const uint parentGuid = 0x50000010u;
|
||||
const uint childGuid = 0x70000055u;
|
||||
var runtime = new LiveEntityRuntime(new GpuWorldState(), new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(new GpuWorldState(), new RecordingResources());
|
||||
runtime.RegisterLiveEntity(Spawn(parentGuid, 1, 1, 0x01010001u));
|
||||
LiveEntityRecord child = RegisterProjection(
|
||||
runtime,
|
||||
|
|
@ -1314,7 +1314,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
const uint guid = 0x70000048u;
|
||||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var runtime = new LiveEntityRuntime(spatial, new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, new RecordingResources());
|
||||
WorldSession.EntitySpawn firstSpawn = Spawn(guid, 1, 1, 0x01010001u);
|
||||
LiveEntityRecord first = RegisterProjection(runtime, firstSpawn);
|
||||
RetailObjectQuantumClock firstClock = first.ObjectClock;
|
||||
|
|
@ -1341,7 +1341,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
{
|
||||
const uint stateBeforeBindGuid = 0x70000037u;
|
||||
const uint bindBeforeStateGuid = 0x70000038u;
|
||||
var runtime = new LiveEntityRuntime(new GpuWorldState(), new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(new GpuWorldState(), new RecordingResources());
|
||||
runtime.RegisterLiveEntity(Spawn(stateBeforeBindGuid, 1, 1, 0x01010001u));
|
||||
runtime.RegisterLiveEntity(Spawn(bindBeforeStateGuid, 1, 1, 0x01010001u));
|
||||
|
||||
|
|
@ -1381,7 +1381,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
public void ParentDrivenChildNoDrawKeepsBoundBodyInCanonicalState()
|
||||
{
|
||||
const uint guid = 0x70000039u;
|
||||
var runtime = new LiveEntityRuntime(new GpuWorldState(), new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(new GpuWorldState(), new RecordingResources());
|
||||
runtime.RegisterLiveEntity(Spawn(guid, 1, 1, 0x01010001u));
|
||||
runtime.MaterializeLiveEntity(
|
||||
guid,
|
||||
|
|
@ -1401,7 +1401,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
public void InitiallyVisibleCreate_DoesNotManufactureUnHideTransition()
|
||||
{
|
||||
const uint guid = 0x70000040u;
|
||||
var runtime = new LiveEntityRuntime(new GpuWorldState(), new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(new GpuWorldState(), new RecordingResources());
|
||||
|
||||
LiveEntityRecord record = RegisterProjection(
|
||||
runtime,
|
||||
|
|
@ -1418,7 +1418,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
const uint guid = 0x70000041u;
|
||||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var runtime = new LiveEntityRuntime(spatial, new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, new RecordingResources());
|
||||
runtime.RegisterLiveEntity(Spawn(
|
||||
guid,
|
||||
1,
|
||||
|
|
@ -1448,7 +1448,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
const uint guid = 0x70000042u;
|
||||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var runtime = new LiveEntityRuntime(spatial, new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, new RecordingResources());
|
||||
runtime.RegisterLiveEntity(Spawn(guid, 1, 1, 0x01010001u));
|
||||
WorldEntity entity = runtime.MaterializeLiveEntity(
|
||||
guid,
|
||||
|
|
@ -1486,7 +1486,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
public void PositionAfterPickup_RequiresTeleportHookEvenWithEqualTeleportStamp()
|
||||
{
|
||||
const uint guid = 0x70000043u;
|
||||
var runtime = new LiveEntityRuntime(new GpuWorldState(), new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(new GpuWorldState(), new RecordingResources());
|
||||
WorldSession.EntitySpawn spawn = Spawn(guid, 1, 1, 0x01010001u);
|
||||
runtime.RegisterLiveEntity(spawn);
|
||||
Assert.True(runtime.TryApplyPickup(
|
||||
|
|
@ -1524,7 +1524,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
const uint guid = 0x70000044u;
|
||||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var runtime = new LiveEntityRuntime(spatial, new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, new RecordingResources());
|
||||
WorldSession.EntitySpawn spawn = Spawn(guid, 1, 1, 0x01010001u);
|
||||
runtime.RegisterLiveEntity(spawn);
|
||||
runtime.MaterializeLiveEntity(
|
||||
|
|
@ -1563,7 +1563,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var resources = new RecordingResources();
|
||||
var runtime = new LiveEntityRuntime(spatial, resources);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources);
|
||||
WorldSession.EntitySpawn spawn = Spawn(0x70000024u, 1, 1, 0x01010001u);
|
||||
runtime.RegisterLiveEntity(spawn);
|
||||
WorldEntity entity = runtime.MaterializeLiveEntity(
|
||||
|
|
@ -1593,7 +1593,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var resources = new RecordingResources();
|
||||
var runtime = new LiveEntityRuntime(spatial, resources);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources);
|
||||
WorldSession.EntitySpawn spawn = Spawn(0x70000009u, 1, 1, 0x01010001u);
|
||||
runtime.RegisterLiveEntity(spawn);
|
||||
WorldEntity entity = runtime.MaterializeLiveEntity(
|
||||
|
|
@ -1620,7 +1620,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var resources = new RecordingResources();
|
||||
int runtimeTearDowns = 0;
|
||||
var runtime = new LiveEntityRuntime(spatial, resources, _ => runtimeTearDowns++);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources, _ => runtimeTearDowns++);
|
||||
WorldSession.EntitySpawn spawn = Spawn(0x70000008u, 1, 1, 0x01010001u);
|
||||
runtime.RegisterLiveEntity(spawn);
|
||||
runtime.MaterializeLiveEntity(
|
||||
|
|
@ -1645,7 +1645,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var resources = new FailingRegisterResources();
|
||||
var runtime = new LiveEntityRuntime(spatial, resources);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources);
|
||||
WorldSession.EntitySpawn spawn = Spawn(0x7000000Au, 1, 1, 0x01010001u);
|
||||
runtime.RegisterLiveEntity(spawn);
|
||||
|
||||
|
|
@ -1671,7 +1671,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var resources = new FailingRegisterAndRollbackOnceResources();
|
||||
var runtime = new LiveEntityRuntime(spatial, resources);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources);
|
||||
runtime.RegisterLiveEntity(Spawn(guid, 1, 1, 0x01010001u));
|
||||
|
||||
Assert.Throws<AggregateException>(() => runtime.MaterializeLiveEntity(
|
||||
|
|
@ -1709,7 +1709,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var resources = new FailingRegisterAndRollbackOnceResources();
|
||||
var runtime = new LiveEntityRuntime(spatial, resources);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources);
|
||||
runtime.RegisterLiveEntity(Spawn(guid, 1, 1, 0x01010001u));
|
||||
Assert.Throws<AggregateException>(() => runtime.MaterializeLiveEntity(
|
||||
guid,
|
||||
|
|
@ -1736,7 +1736,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var resources = new FailingRegisterAndRollbackOnceResources();
|
||||
var runtime = new LiveEntityRuntime(spatial, resources);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources);
|
||||
WorldSession.EntitySpawn spawn = Spawn(guid, 1, 1, 0x01010001u);
|
||||
runtime.RegisterLiveEntity(spawn);
|
||||
Assert.Throws<AggregateException>(() => runtime.MaterializeLiveEntity(
|
||||
|
|
@ -1764,7 +1764,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var resources = new FailingUnregisterResources(0x7000000Bu);
|
||||
var runtime = new LiveEntityRuntime(spatial, resources);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources);
|
||||
foreach (uint guid in new[] { 0x7000000Bu, 0x7000000Cu })
|
||||
{
|
||||
WorldSession.EntitySpawn spawn = Spawn(guid, 1, 1, 0x01010001u);
|
||||
|
|
@ -1792,7 +1792,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var resources = new FailingOnceUnregisterResources(guid);
|
||||
var runtime = new LiveEntityRuntime(spatial, resources);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources);
|
||||
WorldSession.EntitySpawn spawn = Spawn(guid, 1, 1, 0x01010001u);
|
||||
runtime.RegisterLiveEntity(spawn);
|
||||
runtime.MaterializeLiveEntity(guid, 0x01010001u, id => Entity(id, guid));
|
||||
|
|
@ -1819,7 +1819,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var resources = new FailingOnceUnregisterResources(guid);
|
||||
var runtime = new LiveEntityRuntime(spatial, resources);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources);
|
||||
WorldSession.EntitySpawn spawn = Spawn(guid, 1, 1, 0x01010001u);
|
||||
runtime.RegisterLiveEntity(spawn);
|
||||
runtime.MaterializeLiveEntity(guid, 0x01010001u, id => Entity(id, guid));
|
||||
|
|
@ -1852,7 +1852,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
if (!adapter.OnRemove(entity))
|
||||
throw new InvalidOperationException("presentation owner was not registered");
|
||||
});
|
||||
var runtime = new LiveEntityRuntime(spatial, resources);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources);
|
||||
runtime.ProjectionVisibilityChanged += (record, visible) =>
|
||||
{
|
||||
if (record.WorldEntity is { } entity)
|
||||
|
|
@ -1887,7 +1887,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var resources = new FailingUnregisterResources(guid);
|
||||
var runtime = new LiveEntityRuntime(spatial, resources);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources);
|
||||
WorldSession.EntitySpawn first = Spawn(guid, 1, 1, 0x01010001u);
|
||||
runtime.RegisterLiveEntity(first);
|
||||
runtime.MaterializeLiveEntity(
|
||||
|
|
@ -1918,7 +1918,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
spatial.AddLandblock(EmptyLandblock(0x0102FFFFu));
|
||||
var runtime = new LiveEntityRuntime(spatial, new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, new RecordingResources());
|
||||
runtime.RegisterLiveEntity(Spawn(guid, 1, 1, 0x01010022u));
|
||||
runtime.MaterializeLiveEntity(guid, 0x01010022u, id => Entity(id, guid));
|
||||
|
||||
|
|
@ -1940,7 +1940,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
spatial.AddLandblock(EmptyLandblock(0x0102FFFFu));
|
||||
var resources = new RecordingResources();
|
||||
var runtime = new LiveEntityRuntime(spatial, resources);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources);
|
||||
runtime.RegisterLiveEntity(Spawn(guid, 1, 1, 0x01010001u));
|
||||
WorldEntity attached = runtime.MaterializeLiveEntity(
|
||||
guid,
|
||||
|
|
@ -1965,7 +1965,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
{
|
||||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var runtime = new LiveEntityRuntime(
|
||||
var runtime = LiveEntityRuntimeFixture.Create(
|
||||
spatial,
|
||||
new RecordingResources(),
|
||||
firstLocalEntityId: LiveEntityRuntime.LastLiveEntityId);
|
||||
|
|
@ -1984,7 +1984,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
Assert.NotEqual(0u, secondEntity.Id);
|
||||
Assert.True(runtime.TryGetLocalEntityId(second.Guid, out uint resolved));
|
||||
Assert.Equal(secondEntity.Id, resolved);
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => new LiveEntityRuntime(
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => LiveEntityRuntimeFixture.Create(
|
||||
new GpuWorldState(),
|
||||
new RecordingResources(),
|
||||
firstLocalEntityId: uint.MaxValue));
|
||||
|
|
@ -1996,7 +1996,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
const uint guid = 0x7000002Au;
|
||||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var runtime = new LiveEntityRuntime(spatial, new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, new RecordingResources());
|
||||
runtime.RegisterLiveEntity(Spawn(guid, 1, 1, 0x01010001u));
|
||||
runtime.MaterializeLiveEntity(
|
||||
guid,
|
||||
|
|
@ -2022,7 +2022,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
public void SessionClear_ForgetsPersistentClassificationWithoutMaterializedRecord()
|
||||
{
|
||||
var spatial = new GpuWorldState();
|
||||
var runtime = new LiveEntityRuntime(spatial, new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, new RecordingResources());
|
||||
spatial.MarkPersistent(0x7000002Bu);
|
||||
|
||||
runtime.Clear();
|
||||
|
|
@ -2037,7 +2037,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
const uint guid = 0x7000002Du;
|
||||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var runtime = new LiveEntityRuntime(spatial, new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, new RecordingResources());
|
||||
runtime.RegisterLiveEntity(Spawn(guid, 1, 1, 0x01010001u));
|
||||
runtime.MaterializeLiveEntity(
|
||||
guid,
|
||||
|
|
@ -2067,7 +2067,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
const uint guid = 0x70000040u;
|
||||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var runtime = new LiveEntityRuntime(spatial, new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, new RecordingResources());
|
||||
runtime.RegisterLiveEntity(Spawn(guid, 1, 1, 0x01010001u));
|
||||
WorldEntity entity = runtime.MaterializeLiveEntity(
|
||||
guid,
|
||||
|
|
@ -2096,7 +2096,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
const uint guid = 0x70000041u;
|
||||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var runtime = new LiveEntityRuntime(spatial, new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, new RecordingResources());
|
||||
runtime.RegisterLiveEntity(Spawn(guid, 1, 1, 0x01010001u));
|
||||
runtime.MaterializeLiveEntity(
|
||||
guid,
|
||||
|
|
@ -2127,7 +2127,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
const uint guid = 0x70000044u;
|
||||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var runtime = new LiveEntityRuntime(spatial, new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, new RecordingResources());
|
||||
runtime.RegisterLiveEntity(Spawn(guid, 1, 1, 0x01010001u));
|
||||
runtime.MaterializeLiveEntity(guid, 0x01010001u, id => Entity(id, guid));
|
||||
bool replaced = false;
|
||||
|
|
@ -2161,7 +2161,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
const uint guid = 0x70000045u;
|
||||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var runtime = new LiveEntityRuntime(spatial, new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, new RecordingResources());
|
||||
runtime.RegisterLiveEntity(Spawn(guid, 1, 1, 0x01010001u));
|
||||
WorldEntity original = runtime.MaterializeLiveEntity(
|
||||
guid,
|
||||
|
|
@ -2200,7 +2200,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
const uint guid = 0x70000046u;
|
||||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var runtime = new LiveEntityRuntime(spatial, new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, new RecordingResources());
|
||||
runtime.RegisterLiveEntity(Spawn(guid, 1, 1, 0x01010001u));
|
||||
runtime.MaterializeLiveEntity(guid, 0x01010001u, id => Entity(id, guid));
|
||||
bool reprojected = false;
|
||||
|
|
@ -2228,7 +2228,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
{
|
||||
const uint guid = 0x70000075u;
|
||||
var spatial = new GpuWorldState();
|
||||
var runtime = new LiveEntityRuntime(spatial, new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, new RecordingResources());
|
||||
runtime.RegisterLiveEntity(Spawn(guid, 1, 1, 0x01010001u));
|
||||
WorldEntity pending = runtime.MaterializeLiveEntity(
|
||||
guid,
|
||||
|
|
@ -2277,7 +2277,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var resources = new FailingOnceUnregisterResources(guid);
|
||||
var runtime = new LiveEntityRuntime(spatial, resources);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources);
|
||||
runtime.RegisterLiveEntity(Spawn(guid, 1, 1, 0x01010001u));
|
||||
WorldEntity? replacementEntity = null;
|
||||
bool replaced = false;
|
||||
|
|
@ -2318,7 +2318,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
spatial.AddLandblock(EmptyLandblock(0x0303FFFFu));
|
||||
var runtime = new LiveEntityRuntime(spatial, new RecordingResources());
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, new RecordingResources());
|
||||
runtime.RegisterLiveEntity(Spawn(guid, 1, 1, 0x01010001u));
|
||||
WorldEntity original = runtime.MaterializeLiveEntity(
|
||||
guid,
|
||||
|
|
@ -2352,7 +2352,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
const uint guid = 0x7000002Cu;
|
||||
var spatial = new GpuWorldState();
|
||||
var resources = new RecordingResources();
|
||||
var runtime = new LiveEntityRuntime(spatial, resources);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources);
|
||||
runtime.RegisterLiveEntity(Spawn(guid, 1, 1, 0x01010001u));
|
||||
runtime.MaterializeLiveEntity(
|
||||
guid,
|
||||
|
|
@ -2394,7 +2394,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
const uint guid = 0x7000002Eu;
|
||||
var spatial = new GpuWorldState();
|
||||
var resources = new RecordingResources();
|
||||
var runtime = new LiveEntityRuntime(spatial, resources);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources);
|
||||
runtime.RegisterLiveEntity(Spawn(guid, 1, 1, 0x01010001u));
|
||||
runtime.MaterializeLiveEntity(
|
||||
guid,
|
||||
|
|
@ -2434,7 +2434,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var resources = new RecordingResources();
|
||||
var runtime = new LiveEntityRuntime(spatial, resources);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources);
|
||||
runtime.RegisterLiveEntity(Spawn(guid, 1, 1, 0x01010001u));
|
||||
WorldEntity old = runtime.MaterializeLiveEntity(
|
||||
guid,
|
||||
|
|
@ -2477,7 +2477,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var resources = new CallbackResources();
|
||||
var runtime = new LiveEntityRuntime(spatial, resources);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources);
|
||||
runtime.RegisterLiveEntity(Spawn(guid, 1, 1, 0x01010001u));
|
||||
runtime.MaterializeLiveEntity(guid, 0x01010001u, id => Entity(id, guid));
|
||||
resources.OnUnregister = _ =>
|
||||
|
|
@ -2508,7 +2508,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var resources = new CallbackResources();
|
||||
var runtime = new LiveEntityRuntime(spatial, resources);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources);
|
||||
runtime.RegisterLiveEntity(Spawn(guid, 1, 1, 0x01010001u));
|
||||
runtime.MaterializeLiveEntity(guid, 0x01010001u, id => Entity(id, guid));
|
||||
resources.OnUnregister = _ =>
|
||||
|
|
@ -2538,7 +2538,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var resources = new CallbackResources();
|
||||
var runtime = new LiveEntityRuntime(spatial, resources);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources);
|
||||
runtime.RegisterLiveEntity(Spawn(guid, 1, 1, 0x01010001u));
|
||||
runtime.MaterializeLiveEntity(guid, 0x01010001u, id => Entity(id, guid));
|
||||
resources.OnUnregister = _ =>
|
||||
|
|
@ -2568,7 +2568,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var resources = new CallbackResources();
|
||||
var runtime = new LiveEntityRuntime(spatial, resources);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources);
|
||||
runtime.RegisterLiveEntity(Spawn(guid, 1, 1, 0x01010001u));
|
||||
runtime.MaterializeLiveEntity(guid, 0x01010001u, id => Entity(id, guid));
|
||||
resources.OnUnregister = _ =>
|
||||
|
|
@ -2600,7 +2600,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var resources = new CallbackResources();
|
||||
var runtime = new LiveEntityRuntime(spatial, resources);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources);
|
||||
runtime.RegisterLiveEntity(Spawn(guid, 1, 1, 0x01010001u));
|
||||
runtime.MaterializeLiveEntity(guid, 0x01010001u, id => Entity(id, guid));
|
||||
resources.OnUnregister = _ =>
|
||||
|
|
@ -2632,7 +2632,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var resources = new CallbackResources();
|
||||
var runtime = new LiveEntityRuntime(spatial, resources);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources);
|
||||
runtime.RegisterLiveEntity(Spawn(guid, 1, 1, 0x01010001u));
|
||||
runtime.MaterializeLiveEntity(guid, 0x01010001u, id => Entity(id, guid));
|
||||
resources.OnUnregister = _ =>
|
||||
|
|
@ -2660,7 +2660,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var resources = new CallbackResources();
|
||||
var runtime = new LiveEntityRuntime(spatial, resources);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources);
|
||||
runtime.RegisterLiveEntity(Spawn(guid, 1, 1, 0x01010001u));
|
||||
resources.OnRegister = _ =>
|
||||
runtime.RegisterLiveEntity(Spawn(guid, 2, 1, 0x01010001u));
|
||||
|
|
@ -2686,7 +2686,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var resources = new CallbackResources();
|
||||
var runtime = new LiveEntityRuntime(spatial, resources);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources);
|
||||
runtime.RegisterLiveEntity(Spawn(guid, 1, 1, 0x01010001u));
|
||||
resources.OnRegister = _ => runtime.Clear();
|
||||
|
||||
|
|
@ -2711,7 +2711,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var resources = new CallbackResources();
|
||||
var runtime = new LiveEntityRuntime(spatial, resources);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources);
|
||||
runtime.RegisterLiveEntity(Spawn(firstGuid, 1, 1, 0x01010001u));
|
||||
runtime.RegisterLiveEntity(Spawn(secondGuid, 1, 1, 0x01010001u));
|
||||
runtime.MaterializeLiveEntity(firstGuid, 0x01010001u, id => Entity(id, firstGuid));
|
||||
|
|
@ -2744,7 +2744,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var resources = new CallbackResources();
|
||||
var runtime = new LiveEntityRuntime(spatial, resources);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources);
|
||||
runtime.RegisterLiveEntity(Spawn(oldGuid, 1, 1, 0x01010001u));
|
||||
runtime.MaterializeLiveEntity(oldGuid, 0x01010001u, id => Entity(id, oldGuid));
|
||||
resources.OnUnregister = _ =>
|
||||
|
|
@ -2785,7 +2785,7 @@ public sealed class LiveEntityRuntimeTests
|
|||
var spatial = new GpuWorldState();
|
||||
spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
|
||||
var resources = new RecordingResources();
|
||||
var runtime = new LiveEntityRuntime(spatial, resources);
|
||||
var runtime = LiveEntityRuntimeFixture.Create(spatial, resources);
|
||||
WorldSession.EntitySpawn spawn = Spawn(0x7000000Du, 4, 1, 0x01010001u);
|
||||
runtime.RegisterLiveEntity(spawn);
|
||||
runtime.MaterializeLiveEntity(
|
||||
|
|
|
|||
|
|
@ -13,8 +13,19 @@ namespace AcDream.App.Tests.World;
|
|||
public sealed class RuntimeEntityOwnershipTests
|
||||
{
|
||||
[Fact]
|
||||
public void LiveEntityRuntime_ComposesCanonicalRuntimeDirectory()
|
||||
public void LiveEntityRuntime_BorrowsCanonicalRuntimeDirectory()
|
||||
{
|
||||
var lifetime = new RuntimeEntityObjectLifetime();
|
||||
var runtime = new LiveEntityRuntime(
|
||||
new GpuWorldState(),
|
||||
new DelegateLiveEntityResourceLifecycle(
|
||||
static _ => { },
|
||||
static _ => { }),
|
||||
lifetime);
|
||||
FieldInfo owner = typeof(LiveEntityRuntime).GetField(
|
||||
"_entityObjects",
|
||||
BindingFlags.Instance | BindingFlags.NonPublic)
|
||||
?? throw new InvalidOperationException("Missing Runtime lifetime root.");
|
||||
FieldInfo directory = typeof(LiveEntityRuntime).GetField(
|
||||
"_directory",
|
||||
BindingFlags.Instance | BindingFlags.NonPublic)
|
||||
|
|
@ -25,9 +36,62 @@ public sealed class RuntimeEntityOwnershipTests
|
|||
?? throw new InvalidOperationException("Missing App projection sidecar store.");
|
||||
|
||||
Assert.Equal(typeof(RuntimeEntityDirectory), directory.FieldType);
|
||||
Assert.Same(lifetime, owner.GetValue(runtime));
|
||||
Assert.Same(lifetime.Entities, directory.GetValue(runtime));
|
||||
Assert.Equal(typeof(LiveEntityProjectionStore), sidecars.FieldType);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ProductionComposition_HasOneRuntimeEntityObjectConstructionRoot()
|
||||
{
|
||||
string root = FindRepositoryRoot();
|
||||
string appRoot = Path.Combine(root, "src", "AcDream.App");
|
||||
string runtimeRoot = Path.Combine(root, "src", "AcDream.Runtime");
|
||||
string[] appSources = Directory.GetFiles(
|
||||
appRoot,
|
||||
"*.cs",
|
||||
SearchOption.AllDirectories);
|
||||
string[] runtimeSources = Directory.GetFiles(
|
||||
runtimeRoot,
|
||||
"*.cs",
|
||||
SearchOption.AllDirectories);
|
||||
|
||||
string[] appObjectAllocators = appSources
|
||||
.Where(path => !path.Contains(
|
||||
$"{Path.DirectorySeparatorChar}Studio{Path.DirectorySeparatorChar}",
|
||||
StringComparison.OrdinalIgnoreCase))
|
||||
.Where(path => File.ReadAllText(path).Contains(
|
||||
"new ClientObjectTable",
|
||||
StringComparison.Ordinal))
|
||||
.ToArray();
|
||||
string[] appDirectoryAllocators = appSources
|
||||
.Where(path => File.ReadAllText(path).Contains(
|
||||
"new RuntimeEntityDirectory",
|
||||
StringComparison.Ordinal))
|
||||
.ToArray();
|
||||
string[] runtimeObjectAllocators = runtimeSources
|
||||
.Where(path => File.ReadAllText(path).Contains(
|
||||
"new ClientObjectTable",
|
||||
StringComparison.Ordinal))
|
||||
.Select(path => Path.GetFileName(path)!)
|
||||
.ToArray();
|
||||
string[] runtimeDirectoryAllocators = runtimeSources
|
||||
.Where(path => File.ReadAllText(path).Contains(
|
||||
"new RuntimeEntityDirectory",
|
||||
StringComparison.Ordinal))
|
||||
.Select(path => Path.GetFileName(path)!)
|
||||
.ToArray();
|
||||
|
||||
Assert.Empty(appObjectAllocators);
|
||||
Assert.Empty(appDirectoryAllocators);
|
||||
Assert.Equal(
|
||||
["RuntimeEntityObjectLifetime.cs"],
|
||||
runtimeObjectAllocators);
|
||||
Assert.Equal(
|
||||
["RuntimeEntityObjectLifetime.cs"],
|
||||
runtimeDirectoryAllocators);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AppProjectionOwners_UseExactRuntimeKeysAndNoGuidDictionary()
|
||||
{
|
||||
|
|
@ -212,4 +276,18 @@ public sealed class RuntimeEntityOwnershipTests
|
|||
field.FieldType.IsGenericType
|
||||
&& field.FieldType.GetGenericTypeDefinition() == typeof(Dictionary<,>)
|
||||
&& field.FieldType.GetGenericArguments()[0] == keyType;
|
||||
|
||||
private static string FindRepositoryRoot()
|
||||
{
|
||||
DirectoryInfo? directory = new(AppContext.BaseDirectory);
|
||||
while (directory is not null)
|
||||
{
|
||||
if (File.Exists(Path.Combine(directory.FullName, "AcDream.slnx")))
|
||||
return directory.FullName;
|
||||
directory = directory.Parent;
|
||||
}
|
||||
|
||||
throw new DirectoryNotFoundException(
|
||||
$"Could not find AcDream.slnx above {AppContext.BaseDirectory}.");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue