]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix examine prediction (#36999)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Wed, 30 Apr 2025 07:49:36 +0000 (17:49 +1000)
committerGitHub <noreply@github.com>
Wed, 30 Apr 2025 07:49:36 +0000 (17:49 +1000)
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.

Content.Client/Examine/ExamineSystem.cs

index 3aec394324d30565580010952d00519bab0eb468..9f0496e578c26d25d43d99450e64a94229c08061 100644 (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()