@@ -824,33 +824,23 @@ public virtual bool Update()
824824 var equipmentAnimation = EquipmentAnimations [ z ] ;
825825 if ( Equipment [ z ] != Guid . Empty && ( this != Globals . Me || MyEquipment [ z ] < Options . Instance . Player . MaxInventory ) )
826826 {
827- var itemId = Guid . Empty ;
828- if ( this == Globals . Me )
829- {
830- var slot = MyEquipment [ z ] ;
831- if ( slot > - 1 )
832- {
833- itemId = Inventory [ slot ] . ItemId ;
834- }
835- }
836- else
837- {
838- itemId = Equipment [ z ] ;
839- }
827+ var itemId = ( this == Globals . Me && MyEquipment [ z ] > - 1 )
828+ ? Inventory [ MyEquipment [ z ] ] . ItemId
829+ : Equipment [ z ] ;
840830
841- if ( ItemDescriptor . TryGet ( itemId , out var itemDescriptor ) &&
842- itemDescriptor . EquipmentAnimation is { } animationDescriptor )
831+ if ( ItemDescriptor . TryGet ( itemId , out var itemDescriptor ) && itemDescriptor . EquipmentAnimation is { } animationDescriptor )
843832 {
844- if ( equipmentAnimation != null &&
845- ( equipmentAnimation . Descriptor != animationDescriptor || equipmentAnimation . IsDisposed ) )
833+ if ( equipmentAnimation == null || equipmentAnimation . Descriptor != animationDescriptor || equipmentAnimation . IsDisposed )
846834 {
847- TryRemoveAnimation ( equipmentAnimation , dispose : true ) ;
848- EquipmentAnimations [ z ] = null ;
849- }
835+ if ( equipmentAnimation != null )
836+ {
837+ TryRemoveAnimation ( equipmentAnimation , dispose : true ) ;
838+ }
850839
851- equipmentAnimation = new Animation ( animationDescriptor , true , true , - 1 , this ) ;
852- EquipmentAnimations [ z ] = equipmentAnimation ;
853- _animations . Add ( equipmentAnimation ) ;
840+ var newAnimation = new Animation ( animationDescriptor , true , true , - 1 , this ) ;
841+ EquipmentAnimations [ z ] = newAnimation ;
842+ _animations . Add ( newAnimation ) ;
843+ }
854844 }
855845 else if ( equipmentAnimation != null )
856846 {
0 commit comments