-
Notifications
You must be signed in to change notification settings - Fork 0
/
KF2DamageMessage.uc
76 lines (65 loc) · 3.85 KB
/
KF2DamageMessage.uc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
Class KF2DamageMessage extends LocalMessage;
var localized string HPString;
var localized float MessageShowTime;
static function string GetNameOf( class<Monster> M )
{
if( Len(M.Default.MenuName)==0 )
return string(M.Name);
return M.Default.MenuName;
}
static function ClientReceive(PlayerController P, optional int Switch, optional PlayerReplicationInfo RelatedPRI_1, optional PlayerReplicationInfo RelatedPRI_2, optional Object OptionalObject)
{
local KF2HUD H;
if( Class<Monster>(OptionalObject)==None || HudBase(P.myHud)==None || (RelatedPRI_1==None && Switch==1) )
return;
// Change this to the proper class
H = KF2HUD(P.myHud);
if(H != none)
{
if (!H.UpdateDamageMessage(OptionalObject,RelatedPRI_1,Switch))
H.LocalizedMessage(Default.Class,Switch,RelatedPRI_1,,OptionalObject);
}
}
static function float GetLifeTime(int Switch)
{
return default.MessageShowTime;
}
static function string GetString(
optional int Switch,
optional PlayerReplicationInfo RelatedPRI_1,
optional PlayerReplicationInfo RelatedPRI_2,
optional Object OptionalObject
)
{
return GetNameOf(Class<Monster>(OptionalObject))@"-"[email protected];
}
// Fade color: Green (0-99 damage) > Yellow (100-499 damage) > Red (500-999 damage) > Dark Red (999+ damage).
static function color GetColor(
optional int Switch,
optional PlayerReplicationInfo RelatedPRI_1,
optional PlayerReplicationInfo RelatedPRI_2
)
{
local color C;
C.A = 255;
if( Switch<800 )
{
C.G = Clamp(512-Switch,0,255);
C.R = Clamp((Switch * 2.5f),0,255);
}
else C.R = Clamp(1256-Switch,150,255);
return C;
}
defaultproperties
{
HPString="HP"
MessageShowTime=4.000000
bIsConsoleMessage=False
bFadeMessage=True
DrawColor=(B=0,G=0,R=150)
DrawPivot=DP_UpperLeft
StackMode=SM_Down
PosX=0.020000
PosY=0.650000
FontSize=-2
}