@@ -28,12 +28,11 @@ public PlayerHeldItemChangedProcessor(PlayerManager playerManager)
2828
2929 public Task Process ( ClientProcessorContext context , PlayerHeldItemChanged packet )
3030 {
31- if ( ! playerManager . TryFind ( packet . SessionId , out RemotePlayer opPlayer ) )
31+ if ( ! playerManager . TryFind ( packet . SessionId , out RemotePlayer player ) )
3232 {
3333 Log . Warn ( $ "[{ nameof ( PlayerHeldItemChangedProcessor ) } ] Could not find player with session id: { packet . SessionId } .") ;
3434 return Task . CompletedTask ;
3535 }
36-
3736 if ( ! NitroxEntity . TryGetObjectFrom ( packet . ItemId , out GameObject item ) )
3837 {
3938 Log . Warn ( $ "[{ nameof ( PlayerHeldItemChangedProcessor ) } ] Could not find entity with id: { packet . ItemId } .") ;
@@ -45,15 +44,15 @@ public Task Process(ClientProcessorContext context, PlayerHeldItemChanged packet
4544
4645 Validate . NotNull ( pickupable . inventoryItem ) ;
4746
48- ItemsContainer inventory = opPlayer . Inventory ;
47+ ItemsContainer inventory = player . Inventory ;
4948 PlayerTool tool = item . GetComponent < PlayerTool > ( ) ;
5049
5150 // Copied from QuickSlots
5251 switch ( packet . Type )
5352 {
5453 case PlayerHeldItemChanged . ChangeType . DRAW_AS_TOOL :
5554 Validate . IsTrue ( tool ) ;
56- ModelPlug . PlugIntoSocket ( tool , opPlayer . ItemAttachPoint ) ;
55+ ModelPlug . PlugIntoSocket ( tool , player . ItemAttachPoint ) ;
5756 Utils . SetLayerRecursively ( item , viewModelLayer ) ;
5857 foreach ( Animator componentsInChild in tool . GetComponentsInChildren < Animator > ( ) )
5958 {
@@ -70,8 +69,8 @@ public Task Process(ClientProcessorContext context, PlayerHeldItemChanged packet
7069 }
7170 item . SetActive ( true ) ;
7271 tool . SetHandIKTargetsEnabled ( true ) ;
73- SafeAnimator . SetBool ( opPlayer . ArmsController . GetComponent < Animator > ( ) , $ "holding_{ tool . animToolName } ", true ) ;
74- opPlayer . AnimationController [ "using_tool_first" ] = packet . IsFirstTime != null ;
72+ SafeAnimator . SetBool ( player . ArmsController . GetComponent < Animator > ( ) , $ "holding_{ tool . animToolName } ", true ) ;
73+ player . AnimationController [ "using_tool_first" ] = packet . IsFirstTime != null ;
7574
7675 if ( item . TryGetComponent ( out FPModel fpModelDraw ) ) //FPModel needs to be updated
7776 {
@@ -97,8 +96,8 @@ public Task Process(ClientProcessorContext context, PlayerHeldItemChanged packet
9796 {
9897 componentsInChild . cullingMode = AnimatorCullingMode . CullUpdateTransforms ;
9998 }
100- SafeAnimator . SetBool ( opPlayer . ArmsController . GetComponent < Animator > ( ) , $ "holding_{ tool . animToolName } ", false ) ;
101- opPlayer . AnimationController [ "using_tool_first" ] = false ;
99+ SafeAnimator . SetBool ( player . ArmsController . GetComponent < Animator > ( ) , $ "holding_{ tool . animToolName } ", false ) ;
100+ player . AnimationController [ "using_tool_first" ] = false ;
102101
103102 if ( item . TryGetComponent ( out FPModel fpModelHolster ) ) //FPModel needs to be updated
104103 {
@@ -108,7 +107,7 @@ public Task Process(ClientProcessorContext context, PlayerHeldItemChanged packet
108107 break ;
109108
110109 case PlayerHeldItemChanged . ChangeType . DRAW_AS_ITEM :
111- pickupable . inventoryItem . item . Reparent ( opPlayer . ItemAttachPoint ) ;
110+ pickupable . inventoryItem . item . Reparent ( player . ItemAttachPoint ) ;
112111 pickupable . inventoryItem . item . SetVisible ( true ) ;
113112 Utils . SetLayerRecursively ( pickupable . inventoryItem . item . gameObject , viewModelLayer ) ;
114113 break ;
0 commit comments