From 35f9de3366873b088e2f12cdbe51464ca5afce9a Mon Sep 17 00:00:00 2001 From: "L.E.D" <10257081+unusualcrow@users.noreply.github.com> Date: Sat, 23 Nov 2019 15:57:44 -0500 Subject: [PATCH] Make examination of items in hand possible (#459) --- .../GameObjects/EntitySystems/ExamineSystem.cs | 11 +++++++++-- Content.Client/UserInterface/HandsGui.cs | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Content.Client/GameObjects/EntitySystems/ExamineSystem.cs b/Content.Client/GameObjects/EntitySystems/ExamineSystem.cs index fe7008dc64..b2de94eaf3 100644 --- a/Content.Client/GameObjects/EntitySystems/ExamineSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/ExamineSystem.cs @@ -73,7 +73,9 @@ namespace Content.Client.GameObjects.EntitySystems { CloseTooltip(); - var mousePos = _inputManager.MouseScreenPosition; + var popupPos = _inputManager.MouseScreenPosition; + + // Actually open the tooltip. _examineTooltipOpen = new Popup(); @@ -100,7 +102,10 @@ namespace Content.Client.GameObjects.EntitySystems const float minWidth = 300; var size = Vector2.ComponentMax((minWidth, 0), panel.CombinedMinimumSize); - _examineTooltipOpen.Open(UIBox2.FromDimensions(mousePos, size)); + + popupPos += Vector2.ComponentMin(Vector2.Zero, _userInterfaceManager.StateRoot.Size - (size + popupPos)); + + _examineTooltipOpen.Open(UIBox2.FromDimensions(popupPos, size)); if (entity.Uid.IsClientSide()) { @@ -130,6 +135,8 @@ namespace Content.Client.GameObjects.EntitySystems var richLabel = new RichTextLabel(); richLabel.SetMessage(response.Message); vBox.AddChild(richLabel); + + _examineTooltipOpen.Position += Vector2.ComponentMin(Vector2.Zero,_userInterfaceManager.StateRoot.Size - (panel.Size + _examineTooltipOpen.Position)); } public void CloseTooltip() diff --git a/Content.Client/UserInterface/HandsGui.cs b/Content.Client/UserInterface/HandsGui.cs index 87b0b050ad..ea58a334b2 100644 --- a/Content.Client/UserInterface/HandsGui.cs +++ b/Content.Client/UserInterface/HandsGui.cs @@ -56,8 +56,6 @@ namespace Content.Client.UserInterface { IoCManager.InjectDependencies(this); - ToolTip = _loc.GetString("Your hands"); - _handR = new UIBox2i(0, 0, BoxSize, BoxSize); _handL = _handR.Translated((BoxSize + BoxSpacing, 0)); @@ -277,6 +275,15 @@ namespace Content.Client.UserInterface } } + else if (args.Function == ContentKeyFunctions.ExamineEntity) + { + var examine = IoCManager.Resolve().GetEntitySystem(); + if (leftHandContains) + examine.DoExamine(LeftHand); + else if (rightHandContains) + examine.DoExamine(RightHand); + } + else if (args.Function == ContentKeyFunctions.MouseMiddle) { SendSwitchHandTo(handIndex);