fix(interaction): bind selection to live incarnations

Carry local WorldEntity identity through render hits, lighting pulses, and deferred movement actions so GUID reuse cannot target a replacement. Reset all session-owned selection and ItemHolder state and prevent combat auto-target during teardown.
This commit is contained in:
Erik 2026-07-21 07:07:58 +02:00
parent c271383714
commit 047a4c83b5
19 changed files with 374 additions and 42 deletions

View file

@ -20,6 +20,7 @@ public sealed record RetailSelectionPolygon(
/// <summary>One part which survived the normal world-render visibility traversal.</summary>
public readonly record struct RetailSelectionPart(
uint ServerGuid,
uint LocalEntityId,
int PartIndex,
Matrix4x4 LocalToWorld,
RetailSelectionMesh Mesh);
@ -27,6 +28,7 @@ public readonly record struct RetailSelectionPart(
/// <summary>Retail picker result, including which physics part supplied the hit.</summary>
public readonly record struct RetailSelectionHit(
uint ServerGuid,
uint LocalEntityId,
int PartIndex,
double Distance,
bool PolygonHit);

View file

@ -53,7 +53,7 @@ public static class RetailWorldPicker
if (closestSphere is null || sphereT < closestSphere.Value.Distance)
closestSphere = new RetailSelectionHit(
part.ServerGuid, part.PartIndex, sphereT, PolygonHit: false);
part.ServerGuid, part.LocalEntityId, part.PartIndex, sphereT, PolygonHit: false);
// Retail stops at the FIRST hit polygon in this part's stored flat order.
foreach (var polygon in part.Mesh.Polygons)
@ -63,7 +63,7 @@ public static class RetailWorldPicker
if (closestPolygon is null || polygonT < closestPolygon.Value.Distance)
closestPolygon = new RetailSelectionHit(
part.ServerGuid, part.PartIndex, polygonT, PolygonHit: true);
part.ServerGuid, part.LocalEntityId, part.PartIndex, polygonT, PolygonHit: true);
break;
}
}