fix examine bug (#5205)

This commit is contained in:
Leon Friedrich
2021-11-07 23:33:52 +13:00
committed by GitHub
parent e7c919bd2e
commit 2ac059c37a

View File

@@ -73,19 +73,19 @@ namespace Content.Client.Examine
private bool HandleExamine(ICommonSession? session, EntityCoordinates coords, EntityUid uid) private bool HandleExamine(ICommonSession? session, EntityCoordinates coords, EntityUid uid)
{ {
if (!uid.IsValid() || !EntityManager.TryGetEntity(uid, out _examinedEntity)) if (!uid.IsValid() || !EntityManager.TryGetEntity(uid, out var entity))
{ {
return false; return false;
} }
_playerEntity = _playerManager.LocalPlayer?.ControlledEntity; _playerEntity = _playerManager.LocalPlayer?.ControlledEntity;
if (_playerEntity == null || !CanExamine(_playerEntity, _examinedEntity)) if (_playerEntity == null || !CanExamine(_playerEntity, entity))
{ {
return false; return false;
} }
DoExamine(_examinedEntity); DoExamine(entity);
return true; return true;
} }
@@ -107,6 +107,9 @@ namespace Content.Client.Examine
// Close any examine tooltip that might already be opened // Close any examine tooltip that might already be opened
CloseTooltip(); CloseTooltip();
// cache entity for Update function
_examinedEntity = entity;
const float minWidth = 300; const float minWidth = 300;
var popupPos = _userInterfaceManager.MousePositionScaled; var popupPos = _userInterfaceManager.MousePositionScaled;