Spill hand contents when dropping them in a fall (#3304)
* Spill hand contents when dropping them due to falling down * Better approach * cleanup * grammar * stupid
This commit is contained in:
@@ -252,18 +252,19 @@ namespace Content.Server.GameObjects.Components.GUI
|
||||
/// </summary>
|
||||
/// <param name="item">The itemcomponent of the item to be dropped</param>
|
||||
/// <param name="doMobChecks">Check if the item can be dropped</param>
|
||||
/// <param name="intentional">If the item was dropped intentionally</param>
|
||||
/// <returns>True if IDropped.Dropped was called, otherwise false</returns>
|
||||
private bool DroppedInteraction(ItemComponent item, bool doMobChecks)
|
||||
private bool DroppedInteraction(ItemComponent item, bool doMobChecks, bool intentional)
|
||||
{
|
||||
var interactionSystem = _entitySystemManager.GetEntitySystem<InteractionSystem>();
|
||||
if (doMobChecks)
|
||||
{
|
||||
if (!interactionSystem.TryDroppedInteraction(Owner, item.Owner))
|
||||
if (!interactionSystem.TryDroppedInteraction(Owner, item.Owner, intentional))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
interactionSystem.DroppedInteraction(Owner, item.Owner);
|
||||
interactionSystem.DroppedInteraction(Owner, item.Owner, intentional);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -284,7 +285,7 @@ namespace Content.Server.GameObjects.Components.GUI
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool Drop(string slot, EntityCoordinates coords, bool doMobChecks = true, bool doDropInteraction = true)
|
||||
public bool Drop(string slot, EntityCoordinates coords, bool doMobChecks = true, bool doDropInteraction = true, bool intentional = true)
|
||||
{
|
||||
var hand = GetHand(slot);
|
||||
if (!CanDrop(slot, doMobChecks) || hand?.Entity == null)
|
||||
@@ -302,7 +303,7 @@ namespace Content.Server.GameObjects.Components.GUI
|
||||
_entitySystemManager.GetEntitySystem<InteractionSystem>().UnequippedHandInteraction(Owner, item.Owner,
|
||||
ToSharedHand(hand));
|
||||
|
||||
if (doDropInteraction && !DroppedInteraction(item, false))
|
||||
if (doDropInteraction && !DroppedInteraction(item, false, intentional))
|
||||
return false;
|
||||
|
||||
item.RemovedFromSlot();
|
||||
@@ -325,7 +326,7 @@ namespace Content.Server.GameObjects.Components.GUI
|
||||
}
|
||||
|
||||
|
||||
public bool Drop(string slot, BaseContainer targetContainer, bool doMobChecks = true, bool doDropInteraction = true)
|
||||
public bool Drop(string slot, BaseContainer targetContainer, bool doMobChecks = true, bool doDropInteraction = true, bool intentional = true)
|
||||
{
|
||||
if (slot == null)
|
||||
{
|
||||
@@ -363,7 +364,7 @@ namespace Content.Server.GameObjects.Components.GUI
|
||||
_entitySystemManager.GetEntitySystem<InteractionSystem>().UnequippedHandInteraction(Owner, item.Owner,
|
||||
ToSharedHand(hand));
|
||||
|
||||
if (doDropInteraction && !DroppedInteraction(item, doMobChecks))
|
||||
if (doDropInteraction && !DroppedInteraction(item, doMobChecks, intentional))
|
||||
return false;
|
||||
|
||||
item.RemovedFromSlot();
|
||||
@@ -379,7 +380,7 @@ namespace Content.Server.GameObjects.Components.GUI
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Drop(IEntity entity, EntityCoordinates coords, bool doMobChecks = true, bool doDropInteraction = true)
|
||||
public bool Drop(IEntity entity, EntityCoordinates coords, bool doMobChecks = true, bool doDropInteraction = true, bool intentional = true)
|
||||
{
|
||||
if (entity == null)
|
||||
{
|
||||
@@ -391,15 +392,15 @@ namespace Content.Server.GameObjects.Components.GUI
|
||||
throw new ArgumentException("Entity must be held in one of our hands.", nameof(entity));
|
||||
}
|
||||
|
||||
return Drop(slot, coords, doMobChecks, doDropInteraction);
|
||||
return Drop(slot, coords, doMobChecks, doDropInteraction, intentional);
|
||||
}
|
||||
|
||||
public bool Drop(string slot, bool mobChecks = true, bool doDropInteraction = true)
|
||||
public bool Drop(string slot, bool mobChecks = true, bool doDropInteraction = true, bool intentional = true)
|
||||
{
|
||||
return Drop(slot, Owner.Transform.Coordinates, mobChecks, doDropInteraction);
|
||||
return Drop(slot, Owner.Transform.Coordinates, mobChecks, doDropInteraction, intentional);
|
||||
}
|
||||
|
||||
public bool Drop(IEntity entity, bool mobChecks = true, bool doDropInteraction = true)
|
||||
public bool Drop(IEntity entity, bool mobChecks = true, bool doDropInteraction = true, bool intentional = true)
|
||||
{
|
||||
if (entity == null)
|
||||
{
|
||||
@@ -411,10 +412,10 @@ namespace Content.Server.GameObjects.Components.GUI
|
||||
throw new ArgumentException("Entity must be held in one of our hands.", nameof(entity));
|
||||
}
|
||||
|
||||
return Drop(slot, Owner.Transform.Coordinates, mobChecks, doDropInteraction);
|
||||
return Drop(slot, Owner.Transform.Coordinates, mobChecks, doDropInteraction, intentional);
|
||||
}
|
||||
|
||||
public bool Drop(IEntity entity, BaseContainer targetContainer, bool doMobChecks = true, bool doDropInteraction = true)
|
||||
public bool Drop(IEntity entity, BaseContainer targetContainer, bool doMobChecks = true, bool doDropInteraction = true, bool intentional = true)
|
||||
{
|
||||
if (entity == null)
|
||||
{
|
||||
@@ -426,7 +427,7 @@ namespace Content.Server.GameObjects.Components.GUI
|
||||
throw new ArgumentException("Entity must be held in one of our hands.", nameof(entity));
|
||||
}
|
||||
|
||||
return Drop(slot, targetContainer, doMobChecks, doDropInteraction);
|
||||
return Drop(slot, targetContainer, doMobChecks, doDropInteraction, intentional);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user