Advertisement
Drakten

Untitled

Sep 16th, 2020
1,515
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class X2Item_DroneWeapons extends X2Item_HeavyWeapons config(DronesSetup);
  2.  
  3. var config array<int> SB_WPN_RANGE_CV;
  4. var config WeaponDamageValue SB_WPN_DMG_CV;
  5. var config int SB_WPN_CRIT_CV;
  6. var config int SB_WPN_WORLD_DMG_CV;
  7. var config int SKULLBIT_WPN_CHARGES;
  8.  
  9. static function array<X2DataTemplate> CreateTemplates()
  10. {
  11.     local array<X2DataTemplate> Weapons;
  12.  
  13.     Weapons.AddItem(SkullBITWpn_CV());
  14.        
  15.     return Weapons;
  16. }
  17.  
  18. // **************************************************************************
  19. // ***                       Heavy Weapons Slot                           ***
  20. // **************************************************************************
  21.  
  22. //SetUIStatMarkup(String InLabel, optional ECharStatType InStatType = eStat_Invalid, optional int Amount = 0, optional bool ForceShow = false, optional delegate<X2StrategyGameRulesetDataStructures.SpecialRequirementsDelegate> ShowUIStatFn, optional String InUnit)
  23.  
  24. static function X2WeaponTemplate SkullBITWpn_CV()
  25. {
  26.     local X2WeaponTemplate      Template;
  27.     local AltGameArchetypeUse   GameArch;
  28.  
  29.     `CREATE_X2TEMPLATE(class'X2WeaponTemplate', Template, 'SkullBITWpn_CV');
  30.    
  31.     Template.ItemCat = 'weapon';
  32.     Template.WeaponCat = 'droneweapon';
  33.     Template.WeaponTech = 'conventional';
  34.     Template.strImage = "img:///DrakNetRun.InventoryIcons.Inv_SBWPN_CV";
  35.     Template.Tier = 0;
  36.     Template.EquipSound = "StrategyUI_Heavy_Weapon_Equip";
  37.     Template.OnEquippedFn = SBWpnEquipped;
  38.     Template.Aim = 0;
  39.     Template.BaseDamage = default.SB_WPN_DMG_CV;            //modeled after the bullpup
  40.     Template.RangeAccuracy = default.SB_WPN_RANGE_CV;   //modeled after the shotgun array more or less
  41.     Template.CritChance = default.SB_WPN_CRIT_CV;       //modeled after the shotgun
  42.     Template.iClipSize = 99;
  43.     Template.InfiniteAmmo = true;
  44.     Template.bHideClipSizeStat = true;
  45.     Template.iSoundRange = 15;
  46.     Template.iEnvironmentDamage = default.SB_WPN_WORLD_DMG_CV;
  47.     Template.PointsToComplete = 0;
  48.     Template.InventorySlot = eInvSlot_HeavyWeapon;
  49.     Template.StowedLocation = eSlot_HeavyWeapon;
  50.     Template.GameArchetype = "DrakNetRun.Weapons.WP_HWslot_SkullBIT_CV";
  51.     GameArch.UseGameArchetypeFn = SoldierHeavyWeaponCheck;
  52.     GameArch.ArchetypeString = "DrakNetRun.Weapons.WP_Empty";
  53.     AddAltGameArchetype(GameArch, 'SoldierEmpty')   ;
  54.     Template.bMergeAmmo = true;
  55.     Template.DamageTypeTemplateName = 'Electrical';
  56.     Template.Abilities.AddItem('SbWpnAbility');
  57.     Template.Abilities.AddItem('HotLoadAmmo');
  58.     Template.Abilities.AddItem('Reload');
  59.     Template.CanBeBuilt = false;
  60.     Template.StartingItem = true;
  61.     Template.bInfiniteItem = true;
  62.            
  63.     Template.SetUIStatMarkup(class'XLocalizedData'.default.ChargesLabel, , default.SKULLBIT_WPN_CHARGES);
  64.            
  65.     return Template;
  66. }
  67.  
  68. function SBWpnEquipped(XComGameState_Item ItemState, XComGameState_Unit UnitState, XComGameState NewGameState)
  69. {
  70.     local XComGameState_Item                DroneHeavyWeapon;
  71.     local array<XComGameState_Unit>     AttachedUnits;
  72.    
  73.     UnitState.GetAttachedUnits(AttachedUnits);
  74.    
  75.     if (AttachedUnits.Length > 0)
  76.         {
  77.             DroneHeavyWeapon = ItemState.GetMyTemplate().CreateInstanceFromTemplate(NewGameState);
  78.             AttachedUnits[0].bIgnoreItemEquipRestrictions = true;
  79.             AttachedUnits[0].AddItemToInventory(DroneHeavyWeapon, eInvSlot_HeavyWeapon, NewGameState);
  80.             AttachedUnits[0].bIgnoreItemEquipRestrictions = false;
  81.  
  82.             XGUnit(AttachedUnits[0].GetVisualizer()).ApplyLoadoutFromGameState(AttachedUnits[0], NewGameState);
  83.         }  
  84. }
  85.  
  86. static function bool SparkHeavyWeaponCheck(XComGameState_Item ItemState, XComGameState_Unit UnitState, string ConsiderArchetype)
  87. {
  88.     switch(UnitState.GetMyTemplateName())
  89.     {
  90.     case 'DRAKTEN_SkullRipper':
  91.         return true;
  92.     }
  93.     return false;
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement