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 )
2021-02-14 05:50:36 +03:00
{
2023-05-14 10:55:38 +03:00
` Log_Trace();
2021-02-14 05:50:36 +03:00
2023-05-14 10:55:38 +03:00
if ( Role >= ROLE _Authority )
{
DropAllWeapons ( KFPawn _Human ( Killed ) ) ;
}
2021-02-14 05:50:36 +03:00
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
}