Dropping stops examination (#19398)

Dropping stops examination (#19398)
This commit is contained in:
kalane15
2023-08-22 07:28:45 +03:00
committed by GitHub
parent b0dad9ef32
commit bb2aa2bfdb

View File

@@ -20,6 +20,8 @@ using Content.Shared.Eye.Blinding.Components;
using Robust.Client; using Robust.Client;
using static Content.Shared.Interaction.SharedInteractionSystem; using static Content.Shared.Interaction.SharedInteractionSystem;
using static Robust.Client.UserInterface.Controls.BoxContainer; using static Robust.Client.UserInterface.Controls.BoxContainer;
using Content.Shared.Interaction.Events;
using Content.Shared.Item;
namespace Content.Client.Examine namespace Content.Client.Examine
{ {
@@ -50,6 +52,8 @@ namespace Content.Client.Examine
SubscribeNetworkEvent<ExamineSystemMessages.ExamineInfoResponseMessage>(OnExamineInfoResponse); SubscribeNetworkEvent<ExamineSystemMessages.ExamineInfoResponseMessage>(OnExamineInfoResponse);
SubscribeLocalEvent<ItemComponent, DroppedEvent>(OnExaminedItemDropped);
CommandBinds.Builder CommandBinds.Builder
.Bind(ContentKeyFunctions.ExamineEntity, new PointerInputCmdHandler(HandleExamine, outsidePrediction: true)) .Bind(ContentKeyFunctions.ExamineEntity, new PointerInputCmdHandler(HandleExamine, outsidePrediction: true))
.Register<ExamineSystem>(); .Register<ExamineSystem>();
@@ -57,6 +61,19 @@ namespace Content.Client.Examine
_idCounter = 0; _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) public override void Update(float frameTime)
{ {
if (_examineTooltipOpen is not {Visible: true}) return; if (_examineTooltipOpen is not {Visible: true}) return;