2020-01-10 13:14:11 +00:00
|
|
|
class ClassicHUD extends KFMutator;
|
|
|
|
|
|
|
|
var KFPawn LastHitZed;
|
|
|
|
var int LastHitHP;
|
|
|
|
var KFPlayerController LastDamageDealer;
|
|
|
|
var vector LastDamagePosition;
|
|
|
|
var class<KFDamageType> LastDamageDMGType;
|
|
|
|
|
|
|
|
struct RepInfoS
|
|
|
|
{
|
|
|
|
var DamageReplicationInfo DRI;
|
|
|
|
var KFPlayerController KFPC;
|
|
|
|
};
|
|
|
|
var array<RepInfoS> DamageReplicationInfos;
|
|
|
|
|
2020-01-18 01:54:24 +00:00
|
|
|
function PostBeginPlay()
|
2020-01-10 13:14:11 +00:00
|
|
|
{
|
|
|
|
Super.PostBeginPlay();
|
2020-01-18 01:54:24 +00:00
|
|
|
WorldInfo.Game.HUDType = class'ClassicKFHUD';
|
2020-01-10 13:14:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function NetDamage(int OriginalDamage, out int Damage, Pawn Injured, Controller InstigatedBy, vector HitLocation, out vector Momentum, class<DamageType> DamageType, Actor DamageCauser)
|
|
|
|
{
|
|
|
|
Super.NetDamage(OriginalDamage, Damage, Injured, InstigatedBy, HitLocation, Momentum, DamageType, DamageCauser);
|
|
|
|
|
|
|
|
if( LastDamageDealer!=None )
|
|
|
|
{
|
|
|
|
ClearTimer('CheckDamageDone');
|
|
|
|
CheckDamageDone();
|
|
|
|
}
|
|
|
|
|
|
|
|
if( Damage>0 && InstigatedBy != None )
|
|
|
|
{
|
|
|
|
if( KFPawn_Monster(Injured) != None && KFPlayerController(InstigatedBy) != None )
|
|
|
|
{
|
|
|
|
LastDamageDealer = KFPlayerController(InstigatedBy);
|
|
|
|
|
|
|
|
LastHitZed = KFPawn(Injured);
|
|
|
|
LastHitHP = LastHitZed.Health;
|
|
|
|
LastDamagePosition = HitLocation;
|
|
|
|
LastDamageDMGType = class<KFDamageType>(DamageType);
|
|
|
|
SetTimer(0.1,false,'CheckDamageDone');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
final function CheckDamageDone()
|
|
|
|
{
|
|
|
|
local int Damage, i;
|
|
|
|
|
|
|
|
if( LastDamageDealer!=None && LastHitZed!=None && LastHitHP!=LastHitZed.Health )
|
|
|
|
{
|
|
|
|
Damage = LastHitHP-Max(LastHitZed.Health,0);
|
|
|
|
if( Damage>0 )
|
|
|
|
{
|
|
|
|
i = DamageReplicationInfos.Find('KFPC', LastDamageDealer);
|
|
|
|
if( i != INDEX_NONE )
|
|
|
|
DamageReplicationInfos[i].DRI.ClientNumberMsg(Damage,LastDamagePosition,LastDamageDMGType);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
LastDamageDealer = None;
|
|
|
|
}
|
|
|
|
|
|
|
|
function NotifyLogin(Controller C)
|
|
|
|
{
|
|
|
|
if( KFPlayerController(C) != None )
|
|
|
|
CreateReplicationInfo(KFPlayerController(C));
|
|
|
|
|
|
|
|
Super.NotifyLogin(C);
|
|
|
|
}
|
|
|
|
|
|
|
|
function NotifyLogout(Controller C)
|
|
|
|
{
|
|
|
|
if( KFPlayerController(C) != None )
|
|
|
|
DestroyReplicationInfo(KFPlayerController(C));
|
|
|
|
|
|
|
|
Super.NotifyLogout(C);
|
|
|
|
}
|
|
|
|
|
|
|
|
function CreateReplicationInfo(KFPlayerController C)
|
|
|
|
{
|
|
|
|
local RepInfoS Info;
|
|
|
|
|
|
|
|
Info.DRI = Spawn(class'DamageReplicationInfo', C);
|
|
|
|
Info.KFPC = C;
|
|
|
|
|
|
|
|
Info.DRI.KFPC = C;
|
|
|
|
|
|
|
|
DamageReplicationInfos.AddItem(Info);
|
|
|
|
}
|
|
|
|
|
|
|
|
function DestroyReplicationInfo(KFPlayerController C)
|
|
|
|
{
|
|
|
|
local int i;
|
|
|
|
|
|
|
|
i = DamageReplicationInfos.Find('KFPC', C);
|
|
|
|
if( i != INDEX_NONE )
|
|
|
|
{
|
|
|
|
DamageReplicationInfos[i].DRI.Destroy();
|
|
|
|
DamageReplicationInfos.RemoveItem(DamageReplicationInfos[i]);
|
|
|
|
}
|
2020-01-17 18:46:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
defaultproperties
|
|
|
|
{
|
2020-01-10 13:14:11 +00:00
|
|
|
}
|