Fix bug where placing items in PlaceableSurfaces didn't cause a… (#544)

* 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
This commit is contained in:
Víctor Aguilera Puerto
2020-01-22 23:09:36 +01:00
committed by Pieter-Jan Briers
parent 8f04ce894f
commit 83b2e59910
3 changed files with 10 additions and 12 deletions

View File

@@ -230,6 +230,10 @@ namespace Content.Server.GameObjects
var inventorySlot = hands[slot]; var inventorySlot = hands[slot];
var item = inventorySlot.ContainedEntity.GetComponent<ItemComponent>(); var item = inventorySlot.ContainedEntity.GetComponent<ItemComponent>();
if (!_entitySystemManager.GetEntitySystem<InteractionSystem>().TryDroppedInteraction(Owner, item.Owner))
return false;
if (!inventorySlot.Remove(inventorySlot.ContainedEntity)) if (!inventorySlot.Remove(inventorySlot.ContainedEntity))
{ {
return false; return false;

View File

@@ -685,9 +685,9 @@ namespace Content.Server.GameObjects.EntitySystems
/// </summary> /// </summary>
public void HandSelectedInteraction(IEntity user, IEntity item) public void HandSelectedInteraction(IEntity user, IEntity item)
{ {
var dropMsg = new HandSelectedMessage(user, item); var handSelectedMsg = new HandSelectedMessage(user, item);
RaiseEvent(dropMsg); RaiseEvent(handSelectedMsg);
if (dropMsg.Handled) if (handSelectedMsg.Handled)
{ {
return; return;
} }
@@ -707,9 +707,9 @@ namespace Content.Server.GameObjects.EntitySystems
/// </summary> /// </summary>
public void HandDeselectedInteraction(IEntity user, IEntity item) public void HandDeselectedInteraction(IEntity user, IEntity item)
{ {
var dropMsg = new HandDeselectedMessage(user, item); var handDeselectedMsg = new HandDeselectedMessage(user, item);
RaiseEvent(dropMsg); RaiseEvent(handDeselectedMsg);
if (dropMsg.Handled) if (handDeselectedMsg.Handled)
{ {
return; return;
} }

View File

@@ -125,12 +125,6 @@ namespace Content.Server.GameObjects.EntitySystems
if (handsComp.GetActiveHand == null) if (handsComp.GetActiveHand == null)
return false; return false;
if (!_entitySystemManager.GetEntitySystem<InteractionSystem>().TryDroppedInteraction(ent, handsComp.GetActiveHand.Owner))
return false;
if(handsComp.GetActiveHand != null && !_entitySystemManager.GetEntitySystem<InteractionSystem>().TryDroppedInteraction(ent, handsComp.GetActiveHand.Owner))
return false;
if (coords.InRange(_mapManager, ent.Transform.GridPosition, InteractionSystem.InteractionRange)) if (coords.InRange(_mapManager, ent.Transform.GridPosition, InteractionSystem.InteractionRange))
{ {
handsComp.Drop(handsComp.ActiveIndex, coords); handsComp.Drop(handsComp.ActiveIndex, coords);