KF2-Server-Extension/ServerExt/Classes/Ext_TraitMedicPistol.uc
inklesspen1scripter 847c8b3cff Traits changes
Rack'em Up doesn't reducing when miss anymore
Trait "MedicPistol" replacing (don't removing) 9mm from default inventory so players with this trait will spawn with medic pistol in hands
Optimized code of Rack'em Up trait
2020-07-07 20:49:25 +03:00

32 lines
933 B
Ucode

Class Ext_TraitMedicPistol extends Ext_TraitBase;
static function AddDefaultInventory( KFPawn Player, Ext_PerkBase Perk, byte Level, optional Ext_TraitDataStore Data )
{
local int i;
i = Player.DefaultInventory.Find(class'ExtWeap_Pistol_9mm');
if(i != -1)
Player.DefaultInventory[i] = class'ExtWeap_Pistol_MedicS';
}
static function ApplyEffectOn( KFPawn_Human Player, Ext_PerkBase Perk, byte Level, optional Ext_TraitDataStore Data )
{
local Inventory Inv;
Inv = Player.FindInventoryType(class'ExtWeap_Pistol_9mm');
if( Inv!=None )
Inv.Destroy();
if( Player.FindInventoryType(class'ExtWeap_Pistol_MedicS')==None )
{
Inv = Player.CreateInventory(class'ExtWeap_Pistol_MedicS',Player.Weapon!=None);
if ( KFWeapon(Inv)!=None )
KFWeapon(Inv).bGivenAtStart = true;
}
}
defaultproperties
{
TraitName="Medic Pistol"
DefLevelCosts(0)=20
Description="Spawn with a medic pistol instead of standard 9mm."
}