Adds mobCheck to a bunch of inventory/hands methods (#1704)

* Adds mobCheck to a bunch of inventory/hands methods, fix not being able to strip dead bodies

* Address review
This commit is contained in:
Víctor Aguilera Puerto
2020-08-16 16:30:52 +02:00
committed by GitHub
parent 1068269db0
commit d58d84096b
5 changed files with 70 additions and 54 deletions

View File

@@ -61,8 +61,9 @@ namespace Content.Server.Interfaces.GameObjects.Components.Items
/// Puts an item into any empty hand, preferring the active hand.
/// </summary>
/// <param name="item">The item to put in a hand.</param>
/// <param name="mobCheck">Whether to perform an ActionBlocker check to the entity.</param>
/// <returns>True if the item was inserted, false otherwise.</returns>
bool PutInHand(ItemComponent item);
bool PutInHand(ItemComponent item, bool mobCheck = true);
/// <summary>
/// Puts an item into a specific hand.
@@ -71,24 +72,27 @@ namespace Content.Server.Interfaces.GameObjects.Components.Items
/// <param name="index">The name of the hand to put the item into.</param>
/// <param name="fallback">
/// If true and the provided hand is full, the method will fall back to <see cref="PutInHand(ItemComponent)" />
/// <param name="mobCheck">Whether to perform an ActionBlocker check to the entity.</param>
/// </param>
/// <returns>True if the item was inserted into a hand, false otherwise.</returns>
bool PutInHand(ItemComponent item, string index, bool fallback=true);
bool PutInHand(ItemComponent item, string index, bool fallback=true, bool mobCheck = true);
/// <summary>
/// Checks to see if an item can be put in any hand.
/// </summary>
/// <param name="item">The item to check for.</param>
/// <param name="mobCheck">Whether to perform an ActionBlocker check to the entity.</param>
/// <returns>True if the item can be inserted, false otherwise.</returns>
bool CanPutInHand(ItemComponent item);
bool CanPutInHand(ItemComponent item, bool mobCheck = true);
/// <summary>
/// Checks to see if an item can be put in the specified hand.
/// </summary>
/// <param name="item">The item to check for.</param>
/// <param name="index">The name for the hand to check for.</param>
/// <param name="mobCheck">Whether to perform an ActionBlocker check to the entity.</param>
/// <returns>True if the item can be inserted, false otherwise.</returns>
bool CanPutInHand(ItemComponent item, string index);
bool CanPutInHand(ItemComponent item, string index, bool mobCheck = true);
/// <summary>
/// Finds the hand slot holding the specified entity, if any.
@@ -107,15 +111,15 @@ namespace Content.Server.Interfaces.GameObjects.Components.Items
/// Drops the item contained in the slot to the same position as our entity.
/// </summary>
/// <param name="slot">The slot of which to drop to drop the item.</param>
/// <param name="doMobChecks">Whether to check the <see cref="ActionBlockerSystem.CanDrop()"/> for the mob or not.</param>
/// <param name="mobChecks">Whether to check the <see cref="ActionBlockerSystem.CanDrop()"/> for the mob or not.</param>
/// <returns>True on success, false if something blocked the drop.</returns>
bool Drop(string slot, bool doMobChecks = true);
bool Drop(string slot, bool mobChecks = true);
/// <summary>
/// Drops an item held by one of our hand slots to the same position as our owning entity.
/// </summary>
/// <param name="entity">The item to drop.</param>
/// <param name="doMobChecks">Whether to check the <see cref="ActionBlockerSystem.CanDrop()"/> for the mob or not.</param>
/// <param name="mobChecks">Whether to check the <see cref="ActionBlockerSystem.CanDrop()"/> for the mob or not.</param>
/// <returns>True on success, false if something blocked the drop.</returns>
/// <exception cref="ArgumentNullException">
/// Thrown if <see cref="entity"/> is null.
@@ -123,7 +127,7 @@ namespace Content.Server.Interfaces.GameObjects.Components.Items
/// <exception cref="ArgumentException">
/// Thrown if <see cref="entity"/> is not actually held in any hand.
/// </exception>
bool Drop(IEntity entity, bool doMobChecks = true);
bool Drop(IEntity entity, bool mobChecks = true);
/// <summary>
/// Drops the item in a slot.
@@ -194,10 +198,11 @@ namespace Content.Server.Interfaces.GameObjects.Components.Items
/// Checks whether the item in the specified hand can be dropped.
/// </summary>
/// <param name="name">The hand to check for.</param>
/// <param name="mobCheck">Whether to perform an ActionBlocker check to the entity.</param>
/// <returns>
/// True if the item can be dropped, false if the hand is empty or the item in the hand cannot be dropped.
/// </returns>
bool CanDrop(string name);
bool CanDrop(string name, bool mobCheck = true);
/// <summary>
/// Adds a new hand to this hands component.