165 lines
3.9 KiB
Ucode
165 lines
3.9 KiB
Ucode
class a_WeaponTosser extends Actor;
|
|
|
|
var KFPlayerController PC;
|
|
var bool bPrintingMode, bSellingMode, bTossingMode;
|
|
var int minWeight;
|
|
|
|
|
|
function startTossWeapons(KFPlayerController inPC)
|
|
{
|
|
PC = inPC;
|
|
bTossingMode = true;
|
|
|
|
SetTimer(0.01, true);
|
|
}
|
|
|
|
|
|
function startPrinting(KFPlayerController inPC)
|
|
{
|
|
local inventory inv;
|
|
|
|
PC = inPC;
|
|
bPrintingMode = true;
|
|
minWeight = KFHumanPawn(inPC.pawn).CurrentWeight;
|
|
|
|
for(Inv = inPC.Pawn.Inventory; Inv != none; Inv = Inv.Inventory)
|
|
{
|
|
if (KFWeapon(Inv) != none)
|
|
{
|
|
if(KFWeapon(Inv).class == class'KFMod.DualMK23Pistol' ||
|
|
KFWeapon(Inv).class == class'KFMod.Dual44Magnum' ||
|
|
KFWeapon(Inv).class == class'KFMod.GoldenDualDeagle' ||
|
|
KFWeapon(Inv).class == class'KFMod.DualDeagle')
|
|
{
|
|
minWeight = minWeight - 4;
|
|
}
|
|
if(KFWeapon(Inv).class == class'KFMod.MK23Pistol' ||
|
|
KFWeapon(Inv).class == class'KFMod.Magnum44Pistol' ||
|
|
KFWeapon(Inv).class == class'KFMod.GoldenDeagle' ||
|
|
KFWeapon(Inv).class == class'KFMod.Deagle')
|
|
{
|
|
minWeight = minWeight - 2;
|
|
}
|
|
}
|
|
}
|
|
minWeight = minWeight + 1;
|
|
|
|
SetTimer(0.01, true);
|
|
}
|
|
|
|
|
|
function startSellWeapons(KFPlayerController inPC)
|
|
{
|
|
PC = inPC;
|
|
bSellingMode = true;
|
|
|
|
SetTimer(0.01, true);
|
|
}
|
|
|
|
|
|
function stopAnyActions()
|
|
{
|
|
SetTimer(0.00, false);
|
|
}
|
|
|
|
|
|
function Timer()
|
|
{
|
|
local KFPawn me;
|
|
local Inventory inv;
|
|
local int i;
|
|
local array<KFWeapon> sellingWeapons;
|
|
|
|
me = KFPawn(PC.pawn);
|
|
|
|
if (me == none)
|
|
return;
|
|
|
|
if (bPrintingMode)
|
|
{
|
|
if (KFHumanPawn(me).CurrentWeight < minWeight)
|
|
{
|
|
me.ServerBuyWeapon(class'DualMK23Pistol', 0);
|
|
me.ServerBuyWeapon(class'Dual44Magnum', 0);
|
|
me.ServerBuyWeapon(class'DualDeagle', 0);
|
|
}
|
|
|
|
for (Inv = me.Inventory; Inv != none; Inv = Inv.Inventory)
|
|
{
|
|
if (KFWeapon(Inv) != none)
|
|
{
|
|
if(!KFWeapon(Inv).bKFNeverThrow)
|
|
{
|
|
if(KFWeapon(Inv).class == class'KFMod.DualMK23Pistol' ||
|
|
KFWeapon(Inv).class == class'KFMod.MK23Pistol' ||
|
|
KFWeapon(Inv).class == class'KFMod.Dual44Magnum' ||
|
|
KFWeapon(Inv).class == class'KFMod.Magnum44Pistol' ||
|
|
KFWeapon(Inv).class == class'KFMod.GoldenDualDeagle' ||
|
|
KFWeapon(Inv).class == class'KFMod.GoldenDeagle' ||
|
|
KFWeapon(Inv).class == class'KFMod.DualDeagle' ||
|
|
KFWeapon(Inv).class == class'KFMod.Deagle')
|
|
{
|
|
me.PendingWeapon = Weapon(Inv);
|
|
me.ChangedWeapon();
|
|
PC.ThrowWeapon();
|
|
// return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (bSellingMode)
|
|
{
|
|
//PC.ToggleDuck();
|
|
|
|
for (Inv = me.Inventory; Inv != none; Inv = Inv.Inventory)
|
|
{
|
|
if (KFWeapon(Inv) != none)
|
|
{
|
|
if (!KFWeapon(Inv).bKFNeverThrow)
|
|
{
|
|
sellingWeapons[sellingWeapons.length] = KFWeapon(Inv);
|
|
}
|
|
}
|
|
}
|
|
|
|
for (i = sellingWeapons.length - 1; i > -1 ; i--)
|
|
{
|
|
me.ServerSellWeapon(sellingWeapons[i].class);
|
|
}
|
|
return;
|
|
}
|
|
|
|
if (bTossingMode)
|
|
{
|
|
for (Inv = me.Inventory; Inv != none; Inv = Inv.Inventory)
|
|
{
|
|
if (KFWeapon(Inv) != none)
|
|
{
|
|
if (!KFWeapon(Inv).bKFNeverThrow && KFWeapon(Inv).bCanThrow)
|
|
{
|
|
Inv.Velocity = me.Velocity;
|
|
Inv.DropFrom(me.Location + VRand() * 10);
|
|
// me.PendingWeapon = Weapon(Inv);
|
|
// me.ChangedWeapon();
|
|
// PC.ThrowWeapon();
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
simulated event Destroyed()
|
|
{
|
|
pc = none;
|
|
super.Destroyed();
|
|
}
|
|
|
|
|
|
defaultproperties
|
|
{
|
|
bHidden=True
|
|
} |