Advertisement
Guest User

Untitled

a guest
Aug 11th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Class WFA extends KFMutator
  2.     config(WFA);
  3.  
  4. var config array<string> CustomItems;
  5.  
  6. var array<FCustomTraderItem> CustomItemList;
  7. var KFGFxObject_TraderItems CustomTrader;
  8.  
  9. function PostBeginPlay()
  10. {
  11.     local int i;
  12.     local FCustomTraderItem CI;
  13.  
  14.     Super.PostBeginPlay();
  15.    
  16.     if( WorldInfo.Game.BaseMutator==None )
  17.         WorldInfo.Game.BaseMutator = Self;
  18.     else WorldInfo.Game.BaseMutator.AddMutator(Self);
  19.    
  20.     if( bDeleteMe ) // This was a duplicate instance of the mutator.
  21.         return;
  22.    
  23.     WorldInfo.Game.PlayerReplicationInfoClass = class'WFARepInfo'
  24.    
  25.     KFGameReplicationInfo(WorldInfo.GRI).TraderItems=class'WFARepInfo'.Default.MyTraderItems;  
  26.  
  27.     //we use solid archetype but I keep it just for debug
  28.     for( i=0; i<CustomItems.Length; ++i )
  29.     {
  30.         CI.WeaponDef = class<KFWeaponDefinition>(DynamicLoadObject(CustomItems[i],class'Class'));
  31.         if( CI.WeaponDef==None )
  32.         {
  33.             `log("[WFA] FAILED TO LOAD CUSTOM WEAPON"@CustomItems[i]);
  34.             continue;
  35.         }
  36.        
  37.         CI.WeaponClass = class<KFWeapon>(DynamicLoadObject(CI.WeaponDef.Default.WeaponClassPath,class'Class'));
  38.         if( CI.WeaponClass==None )
  39.         {
  40.             `log("[WFA] FAILED TO LOAD CUSTOM WEAPON"@CustomItems[i]);
  41.             continue;
  42.         }
  43.            
  44.         `log("[WFA] SUCCESSED TO LOAD CUSTOM WEAPON"@CustomItems[i]);
  45.        
  46.         CustomItemList.AddItem(CI);
  47.  
  48. function AddMutator(Mutator M)
  49. {
  50.     if( M!=Self ) // Make sure we don't get added twice.
  51.     {
  52.         if( M.Class==Class )
  53.             M.Destroy();
  54.         else Super.AddMutator(M);
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement