Merge pull request #2 from GenZmeY/short-name

add short alias for mutator
This commit is contained in:
GenZmeY 2024-03-08 23:23:45 +03:00 committed by GitHub
commit 131e4db937
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 44 additions and 38 deletions

View File

@ -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): [*]Add the following string to the [b][OnlineSubsystemSteamworks.KFWorkshopSteamworks][/b] section (create one if it doesn't exist):
[b]ServerSubscribedWorkshopItems=2379769040[/b] [b]ServerSubscribedWorkshopItems=2379769040[/b]
[*]Start the server and wait while the mutator is downloading; [*]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] [/olist]
[h1]Sources:[/h1] [h1]Sources:[/h1]

42
TAWOD/Classes/Mut.uc Normal file
View File

@ -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
{
}

View File

@ -1,37 +1 @@
class TAWODMut extends KFMutator; class TAWODMut extends Mut; // backward compatibility
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
{
}