From 337cc55b559199f548fe8a59f212a291f74ab093 Mon Sep 17 00:00:00 2001 From: GenZmeY Date: Sun, 14 Feb 2021 05:50:36 +0300 Subject: [PATCH] improved compatibility with mutators that replace the KFPawn_Human class --- TAWOD/Classes/TAWODMut.uc | 17 +++++++++++++++-- TAWOD/Classes/TAWODPawn_Human.uc | 28 ---------------------------- 2 files changed, 15 insertions(+), 30 deletions(-) delete mode 100644 TAWOD/Classes/TAWODPawn_Human.uc diff --git a/TAWOD/Classes/TAWODMut.uc b/TAWOD/Classes/TAWODMut.uc index 13ffade..d50d0d0 100644 --- a/TAWOD/Classes/TAWODMut.uc +++ b/TAWOD/Classes/TAWODMut.uc @@ -12,8 +12,6 @@ simulated event PostBeginPlay() if (bDeleteMe) return; - WorldInfo.Game.DefaultPawnClass = class'TAWODPawn_Human'; - `Log("[TAWOD] Loaded mutator."); } @@ -28,6 +26,21 @@ function AddMutator(Mutator Mut) Super.AddMutator(Mut); } +function bool PreventDeath(Pawn Killed, Controller Killer, class 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 { } diff --git a/TAWOD/Classes/TAWODPawn_Human.uc b/TAWOD/Classes/TAWODPawn_Human.uc deleted file mode 100644 index aff78b4..0000000 --- a/TAWOD/Classes/TAWODPawn_Human.uc +++ /dev/null @@ -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 -{ -}