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:
@@ -148,7 +148,8 @@ namespace Content.Client.Lobby.UI
|
||||
foreach (var slot in slots)
|
||||
{
|
||||
var itemType = gear.GetGear(slot.Name, profile);
|
||||
if (invSystem.TryUnequip(dummy, slot.Name, out var unequippedItem, true, true))
|
||||
|
||||
if (invSystem.TryUnequip(dummy, slot.Name, out var unequippedItem, silent: true, force: true, reparent: false))
|
||||
{
|
||||
entMan.DeleteEntity(unequippedItem.Value);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user