KF2-Server-Extension/ServerExt/Classes/ExtInventoryManager.uc

64 lines
1.4 KiB
Ucode
Raw Normal View History

2017-10-20 02:00:49 +00:00
class ExtInventoryManager extends KFInventoryManager;
// Dosh spamming barrier.
var transient float MoneyTossTime;
var transient byte MoneyTossCount;
reliable server function ServerThrowMoney()
{
2020-11-28 20:12:58 +00:00
if (MoneyTossTime>WorldInfo.TimeSeconds)
2017-10-20 02:00:49 +00:00
{
2020-11-28 20:12:58 +00:00
if (MoneyTossCount>=10)
2017-10-20 02:00:49 +00:00
return;
++MoneyTossCount;
MoneyTossTime = FMax(MoneyTossTime,WorldInfo.TimeSeconds+0.5);
}
else
{
MoneyTossCount = 0;
MoneyTossTime = WorldInfo.TimeSeconds+1;
}
Super.ServerThrowMoney();
}
simulated function Inventory CreateInventory(class<Inventory> NewInventoryItemClass, optional bool bDoNotActivate)
{
local KFWeapon Wep;
local Inventory SupClass;
SupClass = Super.CreateInventory(NewInventoryItemClass, bDoNotActivate);
Wep = KFWeapon(SupClass);
2020-11-28 20:12:58 +00:00
if (Wep != none)
{
2020-11-28 20:12:58 +00:00
if (KFWeap_Pistol_Dual9mm(Wep) != None && ExtWeap_Pistol_Dual9mm(Wep) == None)
{
Wep.Destroy();
return Super.CreateInventory(class'ExtWeap_Pistol_Dual9mm', bDoNotActivate);
}
return Wep;
}
return SupClass;
}
simulated function CheckForExcessRemoval(KFWeapon NewWeap)
{
local Inventory RemoveInv, Inv;
2020-11-28 20:12:58 +00:00
if (KFWeap_Pistol_Dual9mm(NewWeap) != None)
{
for (Inv = InventoryChain; Inv != None; Inv = Inv.Inventory)
{
if (Inv.Class == class'ExtWeap_Pistol_9mm')
{
RemoveInv = Inv;
Inv = Inv.Inventory;
RemoveFromInventory(RemoveInv);
}
}
}
Super.CheckForExcessRemoval(NewWeap);
}