diff --git a/Content.Client/Examine/ExamineSystem.cs b/Content.Client/Examine/ExamineSystem.cs index 180777f374..89a9486483 100644 --- a/Content.Client/Examine/ExamineSystem.cs +++ b/Content.Client/Examine/ExamineSystem.cs @@ -20,6 +20,8 @@ using Content.Shared.Eye.Blinding.Components; using Robust.Client; using static Content.Shared.Interaction.SharedInteractionSystem; using static Robust.Client.UserInterface.Controls.BoxContainer; +using Content.Shared.Interaction.Events; +using Content.Shared.Item; namespace Content.Client.Examine { @@ -50,6 +52,8 @@ namespace Content.Client.Examine SubscribeNetworkEvent(OnExamineInfoResponse); + SubscribeLocalEvent(OnExaminedItemDropped); + CommandBinds.Builder .Bind(ContentKeyFunctions.ExamineEntity, new PointerInputCmdHandler(HandleExamine, outsidePrediction: true)) .Register(); @@ -57,6 +61,19 @@ namespace Content.Client.Examine _idCounter = 0; } + private void OnExaminedItemDropped(EntityUid item, ItemComponent comp, DroppedEvent args) + { + if (!args.User.Valid) + return; + if (_playerManager.LocalPlayer == null) + return; + if (_examineTooltipOpen == null) + return; + + if (item == _examinedEntity && args.User == _playerManager.LocalPlayer.ControlledEntity) + CloseTooltip(); + } + public override void Update(float frameTime) { if (_examineTooltipOpen is not {Visible: true}) return;