Advertisement
Guest User

Untitled

a guest
Dec 8th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class X2TargetingMethod_IRI_DynamicDeployment extends X2TargetingMethod_VoidRift;
  2.  
  3. //  when this targeting method is initiated, we request make an asynchronous request for soldiers that we could potentially dynamically deploy
  4. //  this should smooth out the lag when Dynamic Deployment is activated
  5.  
  6. function Init(AvailableAction InAction, int NewTargetIndex)
  7. {
  8.     local array<XComGameState_Unit> Units;
  9.     local XComGameState_Unit        Unit;
  10.     local array<string>             Resources;
  11.     local string                    Resource;
  12.     local XComContentManager        Content;
  13.     local StateObjectReference      ItemReference;
  14.     local XComGameState_Item        ItemState;
  15.     local XComGameStateHistory      History;
  16.  
  17.     super.Init(InAction, NewTargetIndex);
  18.  
  19.     Content = `CONTENT;
  20.     History = `XCOMHISTORY;
  21.    
  22.     //  Build a list of units we would deploy if Dynamic Deployment is activated
  23.     Units = class'X2Effect_IRI_SpawnSoldier'.static.ChooseStrategyUnits(`XCOMHISTORY, class'X2Effect_IRI_SpawnSoldier'.static.CalculateReinforcementsSize());
  24.    
  25.     foreach Units(Unit)
  26.     {
  27.         //  preload the unit
  28.         Unit.RequestResources(Resources);
  29.         foreach Resources(Resource)
  30.         {
  31.             Content.RequestGameArchetype(Resource,,, true);
  32.         }
  33.         //  preload unit's items
  34.         foreach Unit.InventoryItems(ItemReference)
  35.         {
  36.             ItemState = XComGameState_Item(History.GetGameStateForObjectID(ItemReference.ObjectID));
  37.             ItemState.RequestResources(Resources);
  38.  
  39.             foreach Resources(Resource)
  40.             {
  41.                 Content.RequestGameArchetype(Resource,,, true);
  42.             }
  43.         }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement