wip
This commit is contained in:
parent
0cb47d2d0c
commit
5e0c9a3792
@ -1,4 +1,4 @@
|
||||
[Flags]
|
||||
AllowDownload=False
|
||||
AllowDownload=True
|
||||
ClientOptional=False
|
||||
ServerSideOnly=True
|
||||
ServerSideOnly=False
|
||||
|
@ -1,13 +1,45 @@
|
||||
class TAWODMut extends KFMutator;
|
||||
|
||||
var const E_LogLevel LogLevel;
|
||||
|
||||
var private TAWOD TAWOD;
|
||||
|
||||
public simulated function bool SafeDestroy()
|
||||
{
|
||||
`Log_Trace();
|
||||
|
||||
return (bPendingDelete || bDeleteMe || Destroy());
|
||||
}
|
||||
|
||||
public event PreBeginPlay()
|
||||
{
|
||||
`Log_Trace();
|
||||
|
||||
Super.PreBeginPlay();
|
||||
`log("Loaded.", true, 'TAWOD');
|
||||
|
||||
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.");
|
||||
}
|
||||
|
||||
public function AddMutator(Mutator Mut)
|
||||
{
|
||||
`Log_Trace();
|
||||
|
||||
if (Mut == Self) return;
|
||||
|
||||
if (Mut.Class == Class)
|
||||
@ -18,20 +50,33 @@ public function AddMutator(Mutator Mut)
|
||||
|
||||
public function bool PreventDeath(Pawn Killed, Controller Killer, class<DamageType> damageType, vector HitLocation)
|
||||
{
|
||||
local KFWeapon TempWeapon;
|
||||
local KFPawn_Human KFP;
|
||||
`Log_Trace();
|
||||
|
||||
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);
|
||||
if (Role >= ROLE_Authority)
|
||||
{
|
||||
DropAllWeapons(KFPawn_Human(Killed));
|
||||
}
|
||||
|
||||
return Super.PreventDeath(Killed, Killer, damageType, HitLocation);
|
||||
}
|
||||
|
||||
public static function DropAllWeapons(KFPawn_Human KFP)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
|
||||
LogLevel = LL_Info
|
||||
}
|
||||
|
11
TAWOD/Classes/TAWOD_PawnHuman.uc
Normal file
11
TAWOD/Classes/TAWOD_PawnHuman.uc
Normal file
@ -0,0 +1,11 @@
|
||||
class TAWOD_PawnHuman extends KFPawn_Human;
|
||||
|
||||
public function ThrowWeaponOnDeath()
|
||||
{
|
||||
class'TAWODMut'.static.DropAllWeapons(Self);
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
|
||||
}
|
11
TAWOD/Classes/TAWOD_PawnHuman_Versus.uc
Normal file
11
TAWOD/Classes/TAWOD_PawnHuman_Versus.uc
Normal file
@ -0,0 +1,11 @@
|
||||
class TAWOD_PawnHuman_Versus extends KFPawn_Human_Versus;
|
||||
|
||||
public function ThrowWeaponOnDeath()
|
||||
{
|
||||
class'TAWODMut'.static.DropAllWeapons(Self);
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
|
||||
}
|
20
TAWOD/Classes/_Logger.uc
Normal file
20
TAWOD/Classes/_Logger.uc
Normal file
@ -0,0 +1,20 @@
|
||||
class _Logger extends Object
|
||||
abstract;
|
||||
|
||||
enum E_LogLevel
|
||||
{
|
||||
LL_WrongLevel,
|
||||
LL_None,
|
||||
LL_Fatal,
|
||||
LL_Error,
|
||||
LL_Warning,
|
||||
LL_Info,
|
||||
LL_Debug,
|
||||
LL_Trace,
|
||||
LL_All
|
||||
};
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
|
||||
}
|
2
TAWOD/Constants.uci
Normal file
2
TAWOD/Constants.uci
Normal file
@ -0,0 +1,2 @@
|
||||
// Constants
|
||||
`define NO_CONFIG 0
|
3
TAWOD/Globals.uci
Normal file
3
TAWOD/Globals.uci
Normal file
@ -0,0 +1,3 @@
|
||||
// Imports
|
||||
`include(Logger.uci)
|
||||
`include(Constants.uci)
|
15
TAWOD/Logger.uci
Normal file
15
TAWOD/Logger.uci
Normal file
@ -0,0 +1,15 @@
|
||||
// Logger
|
||||
`define Log_Tag 'TAWOD'
|
||||
|
||||
`define LocationStatic "`{ClassName}::" $ GetFuncName()
|
||||
|
||||
`define Log_Base(msg, cond) `log(`msg `if(`cond), `cond`{endif}, `Log_Tag)
|
||||
|
||||
`define Log_Fatal(msg) `log("FATAL:" @ `msg, (LogLevel >= LL_Fatal), `Log_Tag)
|
||||
`define Log_Error(msg) `log("ERROR:" @ `msg, (LogLevel >= LL_Error), `Log_Tag)
|
||||
`define Log_Warn(msg) `log("WARN:" @ `msg, (LogLevel >= LL_Warning), `Log_Tag)
|
||||
`define Log_Info(msg) `log("INFO:" @ `msg, (LogLevel >= LL_Info), `Log_Tag)
|
||||
`define Log_Debug(msg) `log("DEBUG:" @ `msg, (LogLevel >= LL_Debug), `Log_Tag)
|
||||
|
||||
`define Log_Trace(msg) `log("TRACE:" @ `Location `if(`msg) @ `msg`{endif}, (LogLevel >= LL_Trace), `Log_Tag)
|
||||
`define Log_TraceStatic(msg) `log("TRACE:" @ `LocationStatic `if(`msg) @ `msg`{endif}, (LogLevel >= LL_Trace), `Log_Tag)
|
Loading…
Reference in New Issue
Block a user