Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class WeightAbility extends X2Ability config(SlotOptions);
- var config bool DisableWeightForPrimarySlot, DisableWeightForSecondarySlot;
- var config bool DisableWeightForAmmoSlot, DisableWeightForGrenadeSlot;
- var config bool DisableWeightForSparkGrenadeSlot, DisableWeightForAuxiliarySlot;
- var config bool bShowAsPassiveIcon;
- static function array<X2DataTemplate> CreateTemplates()
- {
- local array<X2DataTemplate> Templates;
- Templates.AddItem(Create_IgnoreSlotWeight());
- return Templates;
- }
- static function X2AbilityTemplate Create_IgnoreSlotWeight()
- {
- local X2AbilityTemplate Template;
- local X2Effect_ReverseUtilityMobilityPenalites Effect;
- // create ability
- `CREATE_X2ABILITY_TEMPLATE(Template, 'IgnoreSlotWeight');
- Template.IconImage = "img:///UILibrary_XPerkIconPack.UIPerk_star_box";
- // basic setup
- Template.AbilitySourceName = 'eAbilitySource_Item';
- Template.eAbilityIconBehaviorHUD = EAbilityIconBehavior_NeverShow;
- Template.Hostility = eHostility_Neutral;
- Template.AbilityToHitCalc = default.DeadEye;
- Template.AbilityTargetStyle = default.SelfTarget;
- Template.AbilityTriggers.AddItem(default.UnitPostBeginPlayTrigger);
- // effect setup
- // This effect will grant +1 Mobility for each equipped item that grants -1 Mobility because of the SmallItemWeight ability
- Effect = new class'X2Effect_ReverseUtilityMobilityPenalites';
- Effect.EffectName = 'IgnoreSlotWeight_Passive';
- //normally I abhor in-line if statements but in some cases like this it makes the code so much cleaner to read
- if (default.DisableWeightForPrimarySlot) { Effect.SlotsToCheck.AddItem(eInvSlot_PrimaryWeapon); }
- if (default.DisableWeightForSecondarySlot) { Effect.SlotsToCheck.AddItem(eInvSlot_SecondaryWeapon); }
- if (default.DisableWeightForAmmoSlot) { Effect.SlotsToCheck.AddItem(eInvSlot_AmmoPocket); }
- if (default.DisableWeightForGrenadeSlot) { Effect.SlotsToCheck.AddItem(eInvSlot_GrenadePocket); }
- if (default.DisableWeightForSparkGrenadeSlot) { Effect.SlotsToCheck.AddItem(eInvSlot_SparkGrenadePocket); }
- if (default.DisableWeightForAuxiliarySlot) { Effect.SlotsToCheck.AddItem(eInvSlot_AuxiliaryWeapon); }
- Effect.BuildPersistentEffect(1, true, false, false);
- Effect.SetDisplayInfo(ePerkBuff_Passive, Template.LocFriendlyName, Template.LocLongDescription, Template.IconImage, default.bShowAsPassiveIcon,,Template.AbilitySourceName);
- Template.AddTargetEffect(Effect);
- //gamestate and visibility
- Template.BuildNewGameStateFn = TypicalAbility_BuildGameState;
- // NOTE: No visualization on purpose!
- Template.bCrossClassEligible = false;
- Template.bDisplayInUITooltip = false;
- Template.bDisplayInUITacticalText = false;
- return Template;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement