2017-10-20 02:00:49 +00:00
|
|
|
Class Ext_TraitWeapons extends Ext_TraitBase
|
|
|
|
abstract;
|
|
|
|
|
|
|
|
struct FLevelFX
|
|
|
|
{
|
|
|
|
var array< class<Inventory> > LoadoutClasses;
|
|
|
|
};
|
|
|
|
var array<FLevelFX> LevelEffects;
|
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
static function bool MeetsRequirements(byte Lvl, Ext_PerkBase Perk)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
if (Lvl>=3 && (Perk.CurrentLevel<50 || !HasMaxCarry(Perk)))
|
2017-10-20 02:00:49 +00:00
|
|
|
return false;
|
|
|
|
return Super.MeetsRequirements(Lvl,Perk);
|
|
|
|
}
|
2020-11-28 21:54:57 +00:00
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
static final function bool HasMaxCarry(Ext_PerkBase Perk)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
local int i;
|
|
|
|
|
|
|
|
i = Perk.PerkTraits.Find('TraitType',Class'Ext_TraitCarryCap');
|
|
|
|
return (i==-1 || Perk.PerkTraits[i].CurrentLevel>=3);
|
|
|
|
}
|
2020-11-28 21:54:57 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
static function string GetPerkDescription()
|
|
|
|
{
|
|
|
|
return Super.GetPerkDescription()$"|- Level 4 requires perk level 50 and level 3 carry capacity trait!";
|
|
|
|
}
|
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
static function TraitActivate(Ext_PerkBase Perk, byte Level, optional Ext_TraitDataStore Data)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
Perk.PrimaryWeapon = None; // Give a new primary weapon.
|
|
|
|
}
|
2020-11-28 21:54:57 +00:00
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
static function TraitDeActivate(Ext_PerkBase Perk, byte Level, optional Ext_TraitDataStore Data)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
Perk.PrimaryWeapon = Perk.Default.PrimaryWeapon;
|
|
|
|
}
|
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
static function ApplyEffectOn(KFPawn_Human Player, Ext_PerkBase Perk, byte Level, optional Ext_TraitDataStore Data)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
local class<Inventory> IC;
|
|
|
|
local KFInventoryManager M;
|
|
|
|
local Inventory Inv;
|
|
|
|
|
|
|
|
Level = Min(Level-1,Default.LevelEffects.Length-1);
|
|
|
|
M = KFInventoryManager(Player.InvManager);
|
2020-11-28 20:12:58 +00:00
|
|
|
if (M!=None)
|
2017-10-20 02:00:49 +00:00
|
|
|
M.bInfiniteWeight = true;
|
|
|
|
foreach Default.LevelEffects[Level].LoadoutClasses(IC)
|
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
if (Player.FindInventoryType(IC)==None)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
Inv = Player.CreateInventory(IC,Player.Weapon!=None);
|
2020-11-28 20:04:55 +00:00
|
|
|
if (KFWeapon(Inv)!=None)
|
2020-11-28 19:53:57 +00:00
|
|
|
KFWeapon(Inv).bGivenAtStart = true;
|
2017-10-20 02:00:49 +00:00
|
|
|
}
|
|
|
|
}
|
2020-11-28 20:12:58 +00:00
|
|
|
if (M!=None)
|
2017-10-20 02:00:49 +00:00
|
|
|
M.bInfiniteWeight = false;
|
|
|
|
}
|
2020-11-28 21:54:57 +00:00
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
static function CancelEffectOn(KFPawn_Human Player, Ext_PerkBase Perk, byte Level, optional Ext_TraitDataStore Data)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
local class<Inventory> IC;
|
|
|
|
local Inventory Inv;
|
|
|
|
|
2020-11-28 20:12:58 +00:00
|
|
|
if (Level==0)
|
2017-10-20 02:00:49 +00:00
|
|
|
return;
|
|
|
|
Level = Min(Level-1,Default.LevelEffects.Length-1);
|
|
|
|
foreach Default.LevelEffects[Level].LoadoutClasses(IC)
|
|
|
|
{
|
|
|
|
Inv = Player.FindInventoryType(IC);
|
2020-11-28 20:12:58 +00:00
|
|
|
if (Inv!=None)
|
2017-10-20 02:00:49 +00:00
|
|
|
Inv.Destroy();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
defaultproperties
|
|
|
|
{
|
|
|
|
NumLevels=4
|
|
|
|
DefLevelCosts(0)=10
|
|
|
|
DefLevelCosts(1)=15
|
|
|
|
DefLevelCosts(2)=20
|
|
|
|
DefLevelCosts(3)=40
|
|
|
|
LoadPriority=1 // Make sure Carry Cap trait gets loaded first.
|
|
|
|
}
|