diff --git a/PublicationContent/description.txt b/PublicationContent/description.txt index 3588e4a..85b21a8 100644 --- a/PublicationContent/description.txt +++ b/PublicationContent/description.txt @@ -16,7 +16,7 @@ No. This mod is not whitelisted and will de-rank your server. Any XP gained will [*]Add the following string to the [b][OnlineSubsystemSteamworks.KFWorkshopSteamworks][/b] section (create one if it doesn't exist): [b]ServerSubscribedWorkshopItems=2379769040[/b] [*]Start the server and wait while the mutator is downloading; -[*]Add mutator to server start parameters: [b]?Mutator=TAWOD.TAWODMut[/b] and restart the server. +[*]Add mutator to server start parameters: [b]?Mutator=TAWOD.Mut[/b] and restart the server. [/olist] [h1]Sources:[/h1] diff --git a/TAWOD/Classes/Mut.uc b/TAWOD/Classes/Mut.uc new file mode 100644 index 0000000..239c2fa --- /dev/null +++ b/TAWOD/Classes/Mut.uc @@ -0,0 +1,42 @@ +class Mut extends KFMutator; + +public simulated function bool SafeDestroy() +{ + return (bPendingDelete || bDeleteMe || Destroy()); +} + +public event PreBeginPlay() +{ + Super.PreBeginPlay(); + `log("Loaded.", true, 'TAWOD'); +} + +public function AddMutator(Mutator M) +{ + if (M == Self) return; + + if (M.Class == Class) + Mut(M).SafeDestroy(); + else + Super.AddMutator(M); +} + +public 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/TAWODMut.uc b/TAWOD/Classes/TAWODMut.uc index 3b3c541..7c153bb 100644 --- a/TAWOD/Classes/TAWODMut.uc +++ b/TAWOD/Classes/TAWODMut.uc @@ -1,37 +1 @@ -class TAWODMut extends KFMutator; - -public event PreBeginPlay() -{ - Super.PreBeginPlay(); - `log("Loaded.", true, 'TAWOD'); -} - -public function AddMutator(Mutator Mut) -{ - if (Mut == Self) return; - - if (Mut.Class == Class) - Mut.Destroy(); - else - Super.AddMutator(Mut); -} - -public 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 -{ - -} +class TAWODMut extends Mut; // backward compatibility