File tree Expand file tree Collapse file tree
Patches/Functions/Coroutines Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55using InventorySystem . Items . Usables . Scp244 . Hypothermia ;
66
7+ using LabExtended . API . Custom . Effects ;
8+
79using LabExtended . Core ;
10+ using LabExtended . Core . Pooling . Pools ;
11+
812using LabExtended . Events ;
913using LabExtended . Extensions ;
10- using LabExtended . Core . Pooling . Pools ;
1114
1215using NorthwoodLib . Pools ;
1316
1619using LabApi . Events . Arguments . PlayerEvents ;
1720
1821using UnityEngine ;
19- using LabExtended . API . Custom . Effects ;
20-
2122// ReSharper disable UnusedAutoPropertyAccessor.Local
2223
2324#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable.
Original file line number Diff line number Diff line change @@ -59,27 +59,11 @@ public ItemBase? this[ushort itemSerial]
5959 {
6060 if ( value != null )
6161 {
62- if ( value . Owner != null )
63- {
64- value . OwnerInventory . UserInventory . Items . Remove ( itemSerial ) ;
65- value . OwnerInventory . SendItemsNextFrame = true ;
66-
67- value . OnRemoved ( null ) ;
68- }
69-
70- value . Owner = Inventory . _hub ;
71- value . OnAdded ( null ) ;
72-
73- UserInventory . Items [ itemSerial ] = value ;
74-
75- Inventory . SendItemsNextFrame = true ;
62+ value . TransferItem ( Player . ReferenceHub ) ;
7663 }
77- else if ( UserInventory . Items . TryGetValue ( itemSerial , out var item )
78- && UserInventory . Items . Remove ( itemSerial ) )
64+ else if ( UserInventory . Items . TryGetValue ( itemSerial , out var item ) )
7965 {
80- item . OnRemoved ( null ) ;
81-
82- Inventory . SendItemsNextFrame = true ;
66+ item . DestroyItem ( ) ;
8367 }
8468 }
8569 }
@@ -587,9 +571,6 @@ public int RemoveItems(Predicate<ItemBase>? predicate = null)
587571 /// <returns>The amount of removed items.</returns>
588572 public int RemoveItems ( ItemType type , int count = 1 , bool throwIfNotEnough = false )
589573 {
590- if ( count is < 1 or > 8 )
591- throw new ArgumentOutOfRangeException ( nameof ( count ) ) ;
592-
593574 if ( type is ItemType . None )
594575 return 0 ;
595576
You can’t perform that action at this time.
0 commit comments