Fix examine prediction (#36999)

If our current ID is different to the received one we should just discard it even if it's for the same entity.

Note that this doesn't quite fix my prediction issue as client and server are using slightly different timings for the event.
This commit is contained in:
metalgearsloth
2025-04-30 17:49:36 +10:00
committed by GitHub
parent 2ff8a45b58
commit feffbea9f9

View File

@@ -37,7 +37,6 @@ namespace Content.Client.Examine
public const string StyleClassEntityTooltip = "entity-tooltip";
private EntityUid _examinedEntity;
private EntityUid _lastExaminedEntity;
private Popup? _examineTooltipOpen;
private ScreenCoordinates _popupPos;
private CancellationTokenSource? _requestCancelTokenSource;
@@ -416,15 +415,14 @@ namespace Content.Client.Examine
if (!IsClientSide(entity))
{
// Ask server for extra examine info.
if (entity != _lastExaminedEntity)
unchecked
{
_idCounter += 1;
if (_idCounter == int.MaxValue)
_idCounter = 0;
}
RaiseNetworkEvent(new ExamineSystemMessages.RequestExamineInfoMessage(GetNetEntity(entity), _idCounter, true));
}
RaiseLocalEvent(entity, new ClientExaminedEvent(entity, playerEnt.Value));
_lastExaminedEntity = entity;
}
private void CloseTooltip()