Fix inventory transform bug (#21144)

This commit is contained in:
Leon Friedrich
2023-10-22 16:54:30 +11:00
committed by GitHub
parent a5f1683f54
commit e3eaba1ebb

View File

@@ -27,6 +27,7 @@ public abstract partial class InventorySystem
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly INetManager _netMan = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
private void InitializeEquip()
{
@@ -372,20 +373,10 @@ public abstract partial class InventorySystem
}
}
if (force)
{
slotContainer.ForceRemove(removedItem.Value);
}
else
{
if (!slotContainer.Remove(removedItem.Value))
{
//should never happen bc of the canremove lets just keep in just in case
return false;
}
}
if (!slotContainer.Remove(removedItem.Value, force: force))
return false;
Transform(removedItem.Value).Coordinates = Transform(target).Coordinates;
_transform.DropNextTo(removedItem.Value, target);
if (!silent && Resolve(removedItem.Value, ref clothing, false) && clothing.UnequipSound != null && _gameTiming.IsFirstTimePredicted)
{
@@ -405,8 +396,7 @@ public abstract partial class InventorySystem
SoundSystem.Play(clothing.UnequipSound.GetSound(), filter, target, clothing.UnequipSound.Params.WithVolume(-2f));
}
inventory.Dirty();
Dirty(target, inventory);
_movementSpeed.RefreshMovementSpeedModifiers(target);
return true;