From 83b2e599105a467ef0a5c54138b5bb2b3cbe2bd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Aguilera=20Puerto?= <6766154+Zumorica@users.noreply.github.com> Date: Wed, 22 Jan 2020 23:09:36 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20bug=20where=20placing=20items=20in=20Plac?= =?UTF-8?q?eableSurfaces=20didn't=20cause=20a=E2=80=A6=20(#544)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Change variable name in some interactions I definitely didn't copy-paste some stuff back then, absolutely not. * Fix bug where dropping items in tables didn't cause the drop interaction --- .../Components/GUI/ServerHandsComponent.cs | 4 ++++ .../EntitySystems/Click/InteractionSystem.cs | 12 ++++++------ .../GameObjects/EntitySystems/HandsSystem.cs | 6 ------ 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/Content.Server/GameObjects/Components/GUI/ServerHandsComponent.cs b/Content.Server/GameObjects/Components/GUI/ServerHandsComponent.cs index 16c511b242..8a8d748b02 100644 --- a/Content.Server/GameObjects/Components/GUI/ServerHandsComponent.cs +++ b/Content.Server/GameObjects/Components/GUI/ServerHandsComponent.cs @@ -230,6 +230,10 @@ namespace Content.Server.GameObjects var inventorySlot = hands[slot]; var item = inventorySlot.ContainedEntity.GetComponent(); + + if (!_entitySystemManager.GetEntitySystem().TryDroppedInteraction(Owner, item.Owner)) + return false; + if (!inventorySlot.Remove(inventorySlot.ContainedEntity)) { return false; diff --git a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs index bcc6405590..f3d19d7b56 100644 --- a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs @@ -685,9 +685,9 @@ namespace Content.Server.GameObjects.EntitySystems /// public void HandSelectedInteraction(IEntity user, IEntity item) { - var dropMsg = new HandSelectedMessage(user, item); - RaiseEvent(dropMsg); - if (dropMsg.Handled) + var handSelectedMsg = new HandSelectedMessage(user, item); + RaiseEvent(handSelectedMsg); + if (handSelectedMsg.Handled) { return; } @@ -707,9 +707,9 @@ namespace Content.Server.GameObjects.EntitySystems /// public void HandDeselectedInteraction(IEntity user, IEntity item) { - var dropMsg = new HandDeselectedMessage(user, item); - RaiseEvent(dropMsg); - if (dropMsg.Handled) + var handDeselectedMsg = new HandDeselectedMessage(user, item); + RaiseEvent(handDeselectedMsg); + if (handDeselectedMsg.Handled) { return; } diff --git a/Content.Server/GameObjects/EntitySystems/HandsSystem.cs b/Content.Server/GameObjects/EntitySystems/HandsSystem.cs index fd654de435..d4682cfddf 100644 --- a/Content.Server/GameObjects/EntitySystems/HandsSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/HandsSystem.cs @@ -125,12 +125,6 @@ namespace Content.Server.GameObjects.EntitySystems if (handsComp.GetActiveHand == null) return false; - if (!_entitySystemManager.GetEntitySystem().TryDroppedInteraction(ent, handsComp.GetActiveHand.Owner)) - return false; - - if(handsComp.GetActiveHand != null && !_entitySystemManager.GetEntitySystem().TryDroppedInteraction(ent, handsComp.GetActiveHand.Owner)) - return false; - if (coords.InRange(_mapManager, ent.Transform.GridPosition, InteractionSystem.InteractionRange)) { handsComp.Drop(handsComp.ActiveIndex, coords);