Skip to content

Commit ad462f1

Browse files
authored
fix overflow (#1254)
1 parent d6d8204 commit ad462f1

File tree

3 files changed

+3
-14
lines changed

3 files changed

+3
-14
lines changed

Assets/Scripts/SS3D/Systems/Inventory/Containers/Hand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public void PlaceHeldItemOutOfHand(Vector3 position, Quaternion rotation)
129129
}
130130
ItemInHand.GiveOwnership(null);
131131
Item item = ItemInHand;
132-
item.SetContainer(null);
132+
item.Container.RemoveItem(item);
133133
ItemUtility.Place(item, position, rotation, transform);
134134
}
135135

Assets/Scripts/SS3D/Systems/Inventory/Containers/HumanInventory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ private void CmdDropItem(GameObject gameObject)
275275
return;
276276
}
277277

278-
item.SetContainer(null);
278+
attachedTo.RemoveItem(item);
279279
}
280280

281281

Assets/Scripts/SS3D/Systems/Inventory/Items/Item.cs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ private Sprite InventorySprite()
136136
[Server]
137137
public void Delete()
138138
{
139-
SetContainer(null);
139+
Container.RemoveItem(this);
140140

141141
if (GameObject != null)
142142
{
@@ -256,17 +256,6 @@ public void SetContainer(AttachedContainer newContainer)
256256
{
257257
return;
258258
}
259-
260-
if (_container != null && _container.ContainsItem(this))
261-
{
262-
Container.RemoveItem(this);
263-
}
264-
265-
if (newContainer != null && !newContainer.ContainsItem(this))
266-
{
267-
newContainer.AddItem(this);
268-
}
269-
270259
_container = newContainer;
271260
}
272261

0 commit comments

Comments
 (0)