-
Notifications
You must be signed in to change notification settings - Fork 0
/
DmgRep.uc
64 lines (57 loc) · 1.33 KB
/
DmgRep.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
Class DmgRep extends ReplicationInfo
transient;
var repnotify PlayerController PlayerOwner;
var transient PlayerController LocalOwner;
var transient DmgHUD ClientHUD;
replication
{
if( bNetOwner )
PlayerOwner;
}
function PostBeginPlay()
{
InitOwner(PlayerController(Owner));
}
simulated function InitOwner( PlayerController PC )
{
if( PC==None )
{
Destroy();
return;
}
PlayerOwner = PC;
if( WorldInfo.NetMode==NM_DedicatedServer || (WorldInfo.NetMode!=NM_Client && LocalPlayer(PC.Player)==None) )
return;
LocalOwner = PC;
ClientHUD = new(PC) class'DmgHUD';
ClientHUD.LocalOwner = PC;
PC.Interactions.Insert(0,1);
PC.Interactions[0] = ClientHUD;
}
simulated function Destroyed()
{
if( ClientHUD!=None )
{
LocalOwner.Interactions.RemoveItem(ClientHUD);
ClientHUD.LocalOwner = None;
ClientHUD = None;
LocalOwner = None;
}
}
simulated event ReplicatedEvent(name VarName)
{
if( VarName=='PlayerOwner' && PlayerOwner!=None )
InitOwner(PlayerOwner);
}
simulated unreliable client function ClientPopupMessage( int A, vector Pos)
{
if( ClientHUD!=None )
ClientHUD.AddNumberMsg(A,Pos);
}
defaultproperties
{
bOnlyRelevantToOwner=True
bAlwaysRelevant=False
Name="Default__DmgRep"
ObjectArchetype=ReplicationInfo'Engine.Default__ReplicationInfo'
}