Storage CanInsert() tweaks (#21623)

This commit is contained in:
Leon Friedrich
2023-11-13 23:43:03 +11:00
committed by GitHub
parent dc5739a6c3
commit eb0c86f803
8 changed files with 142 additions and 162 deletions

View File

@@ -27,6 +27,20 @@ public abstract partial class SharedHandsSystem
RaiseLocalEvent(uid, didUnequip);
}
/// <summary>
/// Checks whether an entity can drop a given entity. Will return false if they are not holding the entity.
/// </summary>
public bool CanDrop(EntityUid uid, EntityUid entity, HandsComponent? handsComp = null, bool checkActionBlocker = true)
{
if (!Resolve(uid, ref handsComp))
return false;
if (!IsHolding(uid, entity, out var hand, handsComp))
return false;
return CanDropHeld(uid, hand, checkActionBlocker);
}
/// <summary>
/// Checks if the contents of a hand is able to be removed from its container.
/// </summary>