Fix Slipping not calling Dropped (#1632)
This commit is contained in:
@@ -188,6 +188,25 @@ namespace Content.Server.GameObjects.Components.GUI
|
|||||||
return GetHand(index)?.Container.CanInsert(item.Owner) == true;
|
return GetHand(index)?.Container.CanInsert(item.Owner) == true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Calls the Dropped Interaction with the item.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item">The itemcomponent of the item to be dropped</param>
|
||||||
|
/// <param name="doMobChecks">Check if the item can be dropped</param>
|
||||||
|
/// <returns>True if IDropped.Dropped was called, otherwise false</returns>
|
||||||
|
private bool DroppedInteraction(ItemComponent item, bool doMobChecks)
|
||||||
|
{
|
||||||
|
var interactionSystem = _entitySystemManager.GetEntitySystem<InteractionSystem>();
|
||||||
|
if (doMobChecks)
|
||||||
|
{
|
||||||
|
if (!interactionSystem.TryDroppedInteraction(Owner, item.Owner))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
interactionSystem.DroppedInteraction(Owner, item.Owner);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public bool TryHand(IEntity entity, [MaybeNullWhen(false)] out string handName)
|
public bool TryHand(IEntity entity, [MaybeNullWhen(false)] out string handName)
|
||||||
{
|
{
|
||||||
handName = null;
|
handName = null;
|
||||||
@@ -219,11 +238,8 @@ namespace Content.Server.GameObjects.Components.GUI
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (doMobChecks &&
|
if (!DroppedInteraction(item, doMobChecks))
|
||||||
!_entitySystemManager.GetEntitySystem<InteractionSystem>().TryDroppedInteraction(Owner, item.Owner))
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
item.RemovedFromSlot();
|
item.RemovedFromSlot();
|
||||||
item.Owner.Transform.GridPosition = coords;
|
item.Owner.Transform.GridPosition = coords;
|
||||||
@@ -262,11 +278,8 @@ namespace Content.Server.GameObjects.Components.GUI
|
|||||||
|
|
||||||
var item = hand.Entity.GetComponent<ItemComponent>();
|
var item = hand.Entity.GetComponent<ItemComponent>();
|
||||||
|
|
||||||
if (doMobChecks &&
|
if (!DroppedInteraction(item, doMobChecks))
|
||||||
!_entitySystemManager.GetEntitySystem<InteractionSystem>().TryDroppedInteraction(Owner, item.Owner))
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
if (!hand.Container.Remove(hand.Entity))
|
if (!hand.Container.Remove(hand.Entity))
|
||||||
{
|
{
|
||||||
@@ -325,10 +338,8 @@ namespace Content.Server.GameObjects.Components.GUI
|
|||||||
|
|
||||||
var item = hand.Entity.GetComponent<ItemComponent>();
|
var item = hand.Entity.GetComponent<ItemComponent>();
|
||||||
|
|
||||||
if (doMobChecks && !_entitySystemManager.GetEntitySystem<InteractionSystem>().TryDroppedInteraction(Owner, item.Owner))
|
if (!DroppedInteraction(item, doMobChecks))
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
if (!hand.Container.CanRemove(hand.Entity))
|
if (!hand.Container.CanRemove(hand.Entity))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user