Drop items on entering dead or crit states (#1082)

* Drop items on dead or crit
This commit is contained in:
Víctor Aguilera Puerto
2020-06-07 16:48:53 +02:00
committed by GitHub
parent 21c41f28ed
commit 952fa9f7ed
7 changed files with 36 additions and 24 deletions

View File

@@ -80,13 +80,15 @@ namespace Content.Server.Interfaces.GameObjects
/// 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>
/// <returns>True on success, false if something blocked the drop.</returns>
bool Drop(string slot);
bool Drop(string slot, bool doMobChecks = 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>
/// <returns>True on success, false if something blocked the drop.</returns>
/// <exception cref="ArgumentNullException">
/// Thrown if <see cref="entity"/> is null.
@@ -94,15 +96,16 @@ namespace Content.Server.Interfaces.GameObjects
/// <exception cref="ArgumentException">
/// Thrown if <see cref="entity"/> is not actually held in any hand.
/// </exception>
bool Drop(IEntity entity);
bool Drop(IEntity entity, bool doMobChecks = true);
/// <summary>
/// Drops the item in a slot.
/// </summary>
/// <param name="slot">The slot to drop the item from.</param>
/// <param name="coords"></param>
/// <param name="doMobChecks">Whether to check the <see cref="ActionBlockerSystem.CanDrop()"/> for the mob or not.</param>
/// <returns>True if an item was dropped, false otherwise.</returns>
bool Drop(string slot, GridCoordinates coords);
bool Drop(string slot, GridCoordinates coords, bool doMobChecks = true);
/// <summary>
/// Drop the specified entity in our hands to a certain position.
@@ -113,6 +116,7 @@ namespace Content.Server.Interfaces.GameObjects
/// </remarks>
/// <param name="entity">The entity to drop, must be held in one of the hands.</param>
/// <param name="coords">The coordinates to drop the entity at.</param>
/// <param name="doMobChecks">Whether to check the <see cref="ActionBlockerSystem.CanDrop()"/> for the mob or not.</param>
/// <returns>
/// True if the drop succeeded,
/// false if it failed (due to failing to eject from our hand slot, etc...)
@@ -123,26 +127,28 @@ namespace Content.Server.Interfaces.GameObjects
/// <exception cref="ArgumentException">
/// Thrown if <see cref="entity"/> is not actually held in any hand.
/// </exception>
bool Drop(IEntity entity, GridCoordinates coords);
bool Drop(IEntity entity, GridCoordinates coords, bool doMobChecks = true);
/// <summary>
/// Drop the item contained in a slot into another container.
/// </summary>
/// <param name="slot">The slot of which to drop the entity.</param>
/// <param name="targetContainer">The container to drop into.</param>
/// <param name="doMobChecks">Whether to check the <see cref="ActionBlockerSystem.CanDrop()"/> for the mob or not.</param>
/// <returns>True on success, false if something was blocked (insertion or removal).</returns>
/// <exception cref="InvalidOperationException">
/// Thrown if dry-run checks reported OK to remove and insert,
/// but practical remove or insert returned false anyways.
/// This is an edge-case that is currently unhandled.
/// </exception>
bool Drop(string slot, BaseContainer targetContainer);
bool Drop(string slot, BaseContainer targetContainer, bool doMobChecks = true);
/// <summary>
/// Drops an item in one of the hands into a container.
/// </summary>
/// <param name="entity">The item to drop.</param>
/// <param name="targetContainer">The container to drop into.</param>
/// <param name="doMobChecks">Whether to check the <see cref="ActionBlockerSystem.CanDrop()"/> for the mob or not.</param>
/// <returns>True on success, false if something was blocked (insertion or removal).</returns>
/// <exception cref="InvalidOperationException">
/// Thrown if dry-run checks reported OK to remove and insert,
@@ -155,7 +161,7 @@ namespace Content.Server.Interfaces.GameObjects
/// <exception cref="ArgumentException">
/// Thrown if <see cref="entity"/> is not actually held in any hand.
/// </exception>
bool Drop(IEntity entity, BaseContainer targetContainer);
bool Drop(IEntity entity, BaseContainer targetContainer, bool doMobChecks = true);
/// <summary>
/// Checks whether the item in the specified hand can be dropped.