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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 0 deletions

View File

@ -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<ExamineSystemMessages.ExamineInfoResponseMessage>(OnExamineInfoResponse);
SubscribeLocalEvent<ItemComponent, DroppedEvent>(OnExaminedItemDropped);
CommandBinds.Builder
.Bind(ContentKeyFunctions.ExamineEntity, new PointerInputCmdHandler(HandleExamine, outsidePrediction: true))
.Register<ExamineSystem>();
@ -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;