Dropping stops examination (#19398)
Dropping stops examination (#19398)
This commit is contained in:
parent
b0dad9ef32
commit
bb2aa2bfdb
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue