Fix FixAmmoSelling causing invisible pickups

Non-default value of pickup class was used to
spawn pickup when player drops a weapon.
But since we've replaced that class and it doesn't
(or might not) exist on the client - dropped weapons
appeared as invisible.

Catch the moment our custom pickup is spawned and
replace it back with default one.
This commit is contained in:
Anton Tarasenko 2020-02-19 00:38:51 +07:00
commit 1a58ba0620
2 changed files with 68 additions and 0 deletions

View file

@ -170,6 +170,21 @@ public function OnDisabled()
}
}
// Checks if given class is a one of our pickup replacer classes.
public static final function bool IsReplacer(class<Actor> pickupClass)
{
local int i;
if (pickupClass == none) return false;
for (i = 0; i < default.rules.length; i += 1)
{
if (pickupClass == default.rules[i].pickupReplacement)
{
return true;
}
}
return false;
}
// 1. Checks if weapon can be abused and if it can, - fixes the problem.
// 2. Starts tracking abusable weapon to detect when player buys ammo for it.
public final function FixWeapon(KFWeapon potentialAbuser)