Skip to content

Commit

Permalink
add short alias for mutator
Browse files Browse the repository at this point in the history
  • Loading branch information
GenZmeY committed Dec 31, 2023
1 parent e3a2a1b commit 87697f6
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 38 deletions.
2 changes: 1 addition & 1 deletion PublicationContent/description.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
42 changes: 42 additions & 0 deletions TAWOD/Classes/Mut.uc
Original file line number Diff line number Diff line change
@@ -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> 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
{

}
38 changes: 1 addition & 37 deletions TAWOD/Classes/TAWODMut.uc
Original file line number Diff line number Diff line change
@@ -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> 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

0 comments on commit 87697f6

Please sign in to comment.