@@ -44,7 +44,8 @@ public bool OnEquip(CCSPlayerController player, Dictionary<string, string> item)
4444 {
4545 if ( ! item . TryGetValue ( "slot" , out var slotStr ) || ! int . TryParse ( slotStr , out var slot ) || slot < 0 )
4646 return false ;
47- EquipWings ( player , item [ "model" ] , slot ) ;
47+ var animation = item . TryGetValue ( "animation" , out var anim ) ? anim : string . Empty ;
48+ EquipWings ( player , item [ "model" ] , slot , animation ) ;
4849 return true ;
4950 }
5051
@@ -56,12 +57,12 @@ public bool OnUnequip(CCSPlayerController player, Dictionary<string, string> ite
5657 return true ;
5758 }
5859
59- public static void EquipWings ( CCSPlayerController player , string model , int slot )
60+ public static void EquipWings ( CCSPlayerController player , string model , int slot , string animation = "" )
6061 {
6162 UnEquipWings ( player , slot ) ;
6263 Server . NextFrame ( ( ) =>
6364 {
64- var entity = CreateWings ( player , model ) ;
65+ var entity = CreateWings ( player , model , animation ) ;
6566 if ( entity != null && entity . IsValid )
6667 {
6768 if ( ! PlayerWingsEntities . ContainsKey ( player ) )
@@ -83,7 +84,7 @@ public static void UnEquipWings(CCSPlayerController player, int slot)
8384 PlayerWingsEntities . Remove ( player ) ;
8485 }
8586
86- public static CDynamicProp ? CreateWings ( CCSPlayerController player , string model )
87+ public static CDynamicProp ? CreateWings ( CCSPlayerController player , string model , string animation = "" )
8788 {
8889 var pawn = player . PlayerPawn . Value ;
8990 if ( pawn == null ) return null ;
@@ -93,6 +94,10 @@ public static void UnEquipWings(CCSPlayerController player, int slot)
9394 entity . SetModel ( model ) ;
9495 entity . DispatchSpawn ( ) ;
9596 entity . AcceptInput ( "FollowEntity" , pawn , pawn , "!activator" ) ;
97+ if ( ! string . IsNullOrEmpty ( animation ) )
98+ {
99+ entity . AcceptInput ( "SetAnimation" , value : animation ) ;
100+ }
96101 var origin = pawn . AbsOrigin ;
97102 if ( origin != null )
98103 {
@@ -112,7 +117,8 @@ public HookResult OnPlayerSpawn(EventPlayerSpawn @event, GameEventInfo info)
112117 var item = Item . GetItem ( equip . UniqueId ) ;
113118 if ( item != null && item . TryGetValue ( "model" , out var model ) )
114119 {
115- EquipWings ( player , model , equip . Slot ) ;
120+ var animation = item . TryGetValue ( "animation" , out var anim ) ? anim : string . Empty ;
121+ EquipWings ( player , model , equip . Slot , animation ) ;
116122 }
117123 }
118124 return HookResult . Continue ;
0 commit comments