KF2-TAWOD/TAWOD/Classes/TAWODMut.uc

83 lines
1.7 KiB
Ucode
Raw Permalink Normal View History

2022-06-10 15:25:54 +03:00
class TAWODMut extends KFMutator;
2021-01-31 13:13:35 +03:00
2023-05-14 10:55:38 +03:00
var const E_LogLevel LogLevel;
var private TAWOD TAWOD;
public simulated function bool SafeDestroy()
{
`Log_Trace();
return (bPendingDelete || bDeleteMe || Destroy());
}
2022-06-10 15:25:54 +03:00
public event PreBeginPlay()
2021-01-31 13:13:35 +03:00
{
2023-05-14 10:55:38 +03:00
`Log_Trace();
2022-06-10 15:25:54 +03:00
Super.PreBeginPlay();
2023-05-14 10:55:38 +03:00
if (WorldInfo.Game.DefaultPawnClass != WorldInfo.Game.default.DefaultPawnClass)
{
`Log_Warn("Custom 'DefaultPawnClass' (" $ WorldInfo.Game.DefaultPawnClass $ ") detected, possible compatibility issues. Turn off TAWOD if there are problems");
}
if (ClassIsChildOf(WorldInfo.Game.DefaultPawnClass, class'KFGameInfo_VersusSurvival'.default.DefaultPawnClass))
{
WorldInfo.Game.DefaultPawnClass = class'TAWOD_PawnHuman_Versus';
`Log_Info("TAWOD_PawnHuman_Versus");
}
else
{
WorldInfo.Game.DefaultPawnClass = class'TAWOD_PawnHuman';
`Log_Info("TAWOD_PawnHuman");
}
`Log_Info("Loaded.");
2021-01-31 13:13:35 +03:00
}
2022-06-10 15:25:54 +03:00
public function AddMutator(Mutator Mut)
2021-01-31 13:13:35 +03:00
{
2023-05-14 10:55:38 +03:00
`Log_Trace();
2022-06-10 15:25:54 +03:00
if (Mut == Self) return;
2021-01-31 13:13:35 +03:00
if (Mut.Class == Class)
Mut.Destroy();
else
Super.AddMutator(Mut);
}
2022-06-10 15:25:54 +03:00
public function bool PreventDeath(Pawn Killed, Controller Killer, class<DamageType> damageType, vector HitLocation)
{
2023-05-14 10:55:38 +03:00
`Log_Trace();
2023-05-14 10:55:38 +03:00
if (Role >= ROLE_Authority)
{
DropAllWeapons(KFPawn_Human(Killed));
}
return Super.PreventDeath(Killed, Killer, damageType, HitLocation);
}
2023-05-14 10:55:38 +03:00
public static function DropAllWeapons(KFPawn_Human KFP)
2021-01-31 13:13:35 +03:00
{
2023-05-14 10:55:38 +03:00
local KFWeapon KFW;
if (KFP != None && KFP.InvManager != None)
{
foreach KFP.InvManager.InventoryActors(class'KFWeapon', KFW)
{
if (KFW != None && KFW.bDropOnDeath && KFW.CanThrow())
{
KFP.TossInventory(KFW);
}
}
}
}
2022-06-10 15:25:54 +03:00
2023-05-14 10:55:38 +03:00
defaultproperties
{
LogLevel = LL_Info
2021-01-31 13:13:35 +03:00
}