improved compatibility with mutators that replace the KFPawn_Human class

This commit is contained in:
GenZmeY 2021-02-14 05:50:36 +03:00
parent 80fe8a5022
commit 337cc55b55
2 changed files with 15 additions and 30 deletions

View File

@ -12,8 +12,6 @@ simulated event PostBeginPlay()
if (bDeleteMe) if (bDeleteMe)
return; return;
WorldInfo.Game.DefaultPawnClass = class'TAWODPawn_Human';
`Log("[TAWOD] Loaded mutator."); `Log("[TAWOD] Loaded mutator.");
} }
@ -28,6 +26,21 @@ function AddMutator(Mutator Mut)
Super.AddMutator(Mut); Super.AddMutator(Mut);
} }
function bool PreventDeath(Pawn Killed, Controller Killer, class<DamageType> damageType, vector HitLocation)
{
local KFWeapon TempWeapon;
local KFPawn_Human KFP;
KFP = KFPawn_Human(Killed);
if (Role >= ROLE_Authority && KFP != None && KFP.InvManager != none)
foreach KFP.InvManager.InventoryActors(class'KFWeapon', TempWeapon)
if (TempWeapon != none && TempWeapon.bDropOnDeath && TempWeapon.CanThrow())
KFP.TossInventory(TempWeapon);
return Super.PreventDeath(Killed, Killer, damageType, HitLocation);
}
defaultproperties defaultproperties
{ {
} }

View File

@ -1,28 +0,0 @@
class TAWODPawn_Human extends KFPawn_Human;
function ThrowActiveWeapon( optional bool bDestroyWeap )
{
local KFWeapon TempWeapon;
if( Role < ROLE_Authority )
{
return;
}
if (Health <= 0)
{
if (InvManager != none)
foreach InvManager.InventoryActors(class'KFWeapon', TempWeapon)
if (TempWeapon.bDropOnDeath && TempWeapon.CanThrow())
if (TempWeapon != none)
TossInventory(TempWeapon);
}
else
{
super.ThrowActiveWeapon( bDestroyWeap );
}
}
defaultproperties
{
}