rott/kf_sources/ScrnStoryGame/Classes/FragPickup_SE.uc
2026-07-14 20:27:09 +07:00

44 lines
930 B
Ucode

// if player already has nades, it gives +1 ammo
class FragPickup_SE extends FragPickup;
auto state pickup
{
function bool GiveAmmo(KFHumanPawn Receiver)
{
local Inventory Inv;
local KFWeapon W;
if ( Receiver == none )
return false;
for ( Inv=Receiver.Inventory; Inv!=none; Inv=Inv.Inventory ) {
W = KFWeapon(Inv);
if ( W != none && ClassIsChildOf(Inv.class, InventoryType) ) {
if ( !W.AmmoMaxed(0) ) {
KFWeapon(Inv).AddAmmo(AmmoAmount[0], 0);
PlaySound( PickupSound,SLOT_Interact );
SetRespawn();
}
return true;
}
}
return false;
}
function Touch(Actor Other)
{
// if player have nades (weapon) - give him weapon
// otherwise - give weapon
if ( KFHumanPawn(Other) != none && !GiveAmmo(KFHumanPawn(Other)) )
super.Touch(Other);
}
}
defaultproperties
{
cost=40
BuyClipSize=1
AmmoAmount(0)=1
}