Reimplement smart equipping (#22815)
* Reimplement smart equipping * inv prediction fix * oops
This commit is contained in:
@@ -277,7 +277,7 @@ namespace Content.Shared.Containers.ItemSlots
|
||||
/// Tries to insert item into a specific slot.
|
||||
/// </summary>
|
||||
/// <returns>False if failed to insert item</returns>
|
||||
public bool TryInsert(EntityUid uid, string id, EntityUid item, EntityUid? user, ItemSlotsComponent? itemSlots = null)
|
||||
public bool TryInsert(EntityUid uid, string id, EntityUid item, EntityUid? user, ItemSlotsComponent? itemSlots = null, bool excludeUserAudio = false)
|
||||
{
|
||||
if (!Resolve(uid, ref itemSlots))
|
||||
return false;
|
||||
@@ -285,19 +285,19 @@ namespace Content.Shared.Containers.ItemSlots
|
||||
if (!itemSlots.Slots.TryGetValue(id, out var slot))
|
||||
return false;
|
||||
|
||||
return TryInsert(uid, slot, item, user);
|
||||
return TryInsert(uid, slot, item, user, excludeUserAudio: excludeUserAudio);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to insert item into a specific slot.
|
||||
/// </summary>
|
||||
/// <returns>False if failed to insert item</returns>
|
||||
public bool TryInsert(EntityUid uid, ItemSlot slot, EntityUid item, EntityUid? user)
|
||||
public bool TryInsert(EntityUid uid, ItemSlot slot, EntityUid item, EntityUid? user, bool excludeUserAudio = false)
|
||||
{
|
||||
if (!CanInsert(uid, item, user, slot))
|
||||
return false;
|
||||
|
||||
Insert(uid, slot, item, user);
|
||||
Insert(uid, slot, item, user, excludeUserAudio: excludeUserAudio);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -306,12 +306,12 @@ namespace Content.Shared.Containers.ItemSlots
|
||||
/// Does not check action blockers.
|
||||
/// </summary>
|
||||
/// <returns>False if failed to insert item</returns>
|
||||
public bool TryInsertFromHand(EntityUid uid, ItemSlot slot, EntityUid user, HandsComponent? hands = null)
|
||||
public bool TryInsertFromHand(EntityUid uid, ItemSlot slot, EntityUid user, HandsComponent? hands = null, bool excludeUserAudio = false)
|
||||
{
|
||||
if (!Resolve(user, ref hands, false))
|
||||
return false;
|
||||
|
||||
if (hands.ActiveHand?.HeldEntity is not EntityUid held)
|
||||
if (hands.ActiveHand?.HeldEntity is not { } held)
|
||||
return false;
|
||||
|
||||
if (!CanInsert(uid, held, user, slot))
|
||||
@@ -321,7 +321,7 @@ namespace Content.Shared.Containers.ItemSlots
|
||||
if (!_handsSystem.TryDrop(user, hands.ActiveHand))
|
||||
return false;
|
||||
|
||||
Insert(uid, slot, held, user);
|
||||
Insert(uid, slot, held, user, excludeUserAudio: excludeUserAudio);
|
||||
return true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user