Code: Select all
//=============================================================================
// Backpack.
//=============================================================================
class Backpack expands Pickup;
event float BotDesireability( pawn Bot )
{
return Super.BotDesireability(Bot);
}
auto state Pickup
{
function BeginState()
{
BecomePickup();
}
function Touch( actor Other )
{
local Ammo a;
if ( Pawn(Other)!=None && Pawn(Other).bIsPlayer) //Double each ammo type's max amount and add small amount to player inventory
{
a = ShellBox(Pawn(Other).FindInventoryType(class'ShellBox')); //Automag & Minigun
if(a == none){
a = Spawn(class'ShellBox');
a.AmmoAmount = 20;
a.MaxAmmo = a.Default.MaxAmmo * 2;
a.GiveTo(Pawn(Other));
}else{
a.MaxAmmo = a.Default.MaxAmmo * 2;
a.AddAmmo(20);
}
a = StingerAmmo(Pawn(Other).FindInventoryType(class'StingerAmmo')); //Stinger
if(a == none){
a = Spawn(class'StingerAmmo');
a.AmmoAmount = 20;
a.MaxAmmo = a.Default.MaxAmmo * 2;
a.GiveTo(Pawn(Other));
}else{
a.MaxAmmo = a.Default.MaxAmmo * 2;
a.AddAmmo(20);
}
a = ASMDAmmo(Pawn(Other).FindInventoryType(class'ASMDAmmo')); //ASMD
if(a == none){
a = Spawn(class'ASMDAmmo');
a.AmmoAmount = 10;
a.MaxAmmo = a.Default.MaxAmmo * 2;
a.GiveTo(Pawn(Other));
}else{
a.MaxAmmo = a.Default.MaxAmmo * 2;
a.AddAmmo(10);
}
a = RocketCan(Pawn(Other).FindInventoryType(class'RocketCan')); //Eightball
if(a == none){
a = Spawn(class'RocketCan');
a.AmmoAmount = 6;
a.MaxAmmo = a.Default.MaxAmmo * 2;
a.GiveTo(Pawn(Other));
}else{
a.MaxAmmo = a.Default.MaxAmmo * 2;
a.AddAmmo(6);
}
a = FlakBox(Pawn(Other).FindInventoryType(class'FlakBox')); //Flak Cannon
if(a == none){
a = Spawn(class'FlakBox');
a.AmmoAmount = 5;
a.MaxAmmo = a.Default.MaxAmmo * 2;
a.GiveTo(Pawn(Other));
}else{
a.MaxAmmo = a.Default.MaxAmmo * 2;
a.AddAmmo(5);
}
a = RazorAmmo(Pawn(Other).FindInventoryType(class'RazorAmmo')); //Razorjack
if(a == none){
a = Spawn(class'RazorAmmo');
a.AmmoAmount = 15;
a.MaxAmmo = a.Default.MaxAmmo * 2;
a.GiveTo(Pawn(Other));
}else{
a.MaxAmmo = a.Default.MaxAmmo * 2;
a.AddAmmo(15);
}
a = Sludge(Pawn(Other).FindInventoryType(class'Sludge')); //GES Bio Rifle
if(a == none){
a = Spawn(class'Sludge');
a.AmmoAmount = 10;
a.MaxAmmo = a.Default.MaxAmmo * 2;
a.GiveTo(Pawn(Other));
}else{
a.MaxAmmo = a.Default.MaxAmmo * 2;
a.AddAmmo(10);
}
a = RifleAmmo(Pawn(Other).FindInventoryType(class'RifleAmmo')); //Rifle
if(a == none){
a = Spawn(class'RifleAmmo');
a.AmmoAmount = 8;
a.MaxAmmo = a.Default.MaxAmmo * 2;
a.GiveTo(Pawn(Other));
}else{
a.MaxAmmo = a.Default.MaxAmmo * 2;
a.AddAmmo(8);
}
Pawn(Other).ClientMessage(PickupMessage, 'Pickup');
PlaySound (PickupSound,,2.0);
SetRespawn();
}
}
}