refactor(world): extract live entity hydration

This commit is contained in:
Erik 2026-07-21 17:32:45 +02:00
parent 27dcd0ecb7
commit d10c5f2d54
17 changed files with 4310 additions and 1269 deletions

View file

@ -258,4 +258,43 @@ public sealed class ObjectTableWiringTests
Assert.Equal("Refreshed Name", table.Get(guid)!.Name);
Assert.Equal(456, table.Get(guid)!.Properties.Ints[123u]);
}
[Fact]
public void GenerationReplacement_InvalidatedByRemovalObserver_DoesNotInstallOuterQualities()
{
const uint guid = 0x80000500u;
var table = new ClientObjectTable();
table.Ingest(MinimalWeenie(guid));
bool accepting = true;
table.ObjectRemovalClassified += removal =>
{
if (removal.Reason is not ClientObjectRemovalReason.GenerationReplacement)
return;
table.Ingest(MinimalWeenie(guid) with { Name = "Nested Newer" });
accepting = false;
};
var outer = new WorldSession.EntitySpawn(
Guid: guid,
Position: null,
SetupTableId: null,
AnimPartChanges: [],
TextureChanges: [],
SubPalettes: [],
BasePaletteId: null,
ObjScale: null,
Name: "Outer Older",
ItemType: null,
MotionState: null,
MotionTableId: null);
bool applied = ObjectTableWiring.ApplyEntitySpawn(
table,
outer,
replaceGeneration: true,
accepting: () => accepting);
Assert.False(applied);
Assert.Equal("Nested Newer", table.Get(guid)!.Name);
}
}