Fixed client console flooding with warnings on RGB color slider changes (#21333)

added reparent bool for this kinds of unequips

Co-authored-by: Yurii Kis <yurii.kis@smartteksas.com>
This commit is contained in:
KISS
2024-01-05 07:04:11 +02:00
committed by GitHub
parent a2cdbda019
commit 920d7068e5
2 changed files with 53 additions and 12 deletions

View File

@@ -276,18 +276,58 @@ public abstract partial class InventorySystem
return true;
}
public bool TryUnequip(EntityUid uid, string slot, bool silent = false, bool force = false, bool predicted = false,
InventoryComponent? inventory = null, ClothingComponent? clothing = null) => TryUnequip(uid, uid, slot, silent, force, predicted, inventory, clothing);
public bool TryUnequip(
EntityUid uid,
string slot,
bool silent = false,
bool force = false,
bool predicted = false,
InventoryComponent? inventory = null,
ClothingComponent? clothing = null,
bool reparent = true)
{
return TryUnequip(uid, uid, slot, silent, force, predicted, inventory, clothing, reparent);
}
public bool TryUnequip(EntityUid actor, EntityUid target, string slot, bool silent = false,
bool force = false, bool predicted = false, InventoryComponent? inventory = null, ClothingComponent? clothing = null) =>
TryUnequip(actor, target, slot, out _, silent, force, predicted, inventory, clothing);
public bool TryUnequip(
EntityUid actor,
EntityUid target,
string slot,
bool silent = false,
bool force = false,
bool predicted = false,
InventoryComponent? inventory = null,
ClothingComponent? clothing = null,
bool reparent = true)
{
return TryUnequip(actor, target, slot, out _, silent, force, predicted, inventory, clothing, reparent);
}
public bool TryUnequip(EntityUid uid, string slot, [NotNullWhen(true)] out EntityUid? removedItem, bool silent = false, bool force = false, bool predicted = false,
InventoryComponent? inventory = null, ClothingComponent? clothing = null) => TryUnequip(uid, uid, slot, out removedItem, silent, force, predicted, inventory, clothing);
public bool TryUnequip(
EntityUid uid,
string slot,
[NotNullWhen(true)] out EntityUid? removedItem,
bool silent = false,
bool force = false,
bool predicted = false,
InventoryComponent? inventory = null,
ClothingComponent? clothing = null,
bool reparent = true)
{
return TryUnequip(uid, uid, slot, out removedItem, silent, force, predicted, inventory, clothing, reparent);
}
public bool TryUnequip(EntityUid actor, EntityUid target, string slot, [NotNullWhen(true)] out EntityUid? removedItem, bool silent = false,
bool force = false, bool predicted = false, InventoryComponent? inventory = null, ClothingComponent? clothing = null)
public bool TryUnequip(
EntityUid actor,
EntityUid target,
string slot,
[NotNullWhen(true)] out EntityUid? removedItem,
bool silent = false,
bool force = false,
bool predicted = false,
InventoryComponent? inventory = null,
ClothingComponent? clothing = null,
bool reparent = true)
{
removedItem = null;
@@ -329,11 +369,11 @@ public abstract partial class InventorySystem
if (slotDef != slotDefinition && slotDef.DependsOn == slotDefinition.Name)
{
//this recursive call might be risky
TryUnequip(actor, target, slotDef.Name, true, true, predicted, inventory);
TryUnequip(actor, target, slotDef.Name, true, true, predicted, inventory, reparent: reparent);
}
}
if (!_containerSystem.Remove(removedItem.Value, slotContainer, force: force))
if (!_containerSystem.Remove(removedItem.Value, slotContainer, force: force, reparent: reparent))
return false;
// TODO: Inventory needs a hot cleanup hoo boy