From bb2aa2bfdb5ee74ea5ffef0caeb3d23eb72cc4d9 Mon Sep 17 00:00:00 2001 From: kalane15 <118661099+kalane15@users.noreply.github.com> Date: Tue, 22 Aug 2023 07:28:45 +0300 Subject: [PATCH] Dropping stops examination (#19398) Dropping stops examination (#19398) --- Content.Client/Examine/ExamineSystem.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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;