DayZ 1.24
Loading...
Searching...
No Matches
SyncEvents.c
Go to the documentation of this file.
2{
3 static void RegisterEvents()
4 {
5 DayZGame dz_game = DayZGame.Cast(GetGame());
6
7 dz_game.Event_OnRPC.Insert(Event_OnRPC);
8 Print("SyncEvents -> RegisterEvents");
9 }
10
12 {
13 if (rpc_type == ERPCs.RPC_SYNC_EVENT && GetGame() && GetGame().IsMultiplayer() && GetGame().IsClient())
14 {
16
17 if (ctx.Read(event_data))
18 OnSyncEvent(event_data.param1, event_data.param2, target);
19 }
20 }
21
23 {
24 switch (event_type)
25 {
26 case ESyncEvent.PlayerList:
27 {
30 break;
31 }
32 case ESyncEvent.EntityKill:
33 {
35 break;
36 }
37 case ESyncEvent.PlayerIgnateFireplayce:
38 {
40 break;
41 }
42 }
43 }
44
45 static void SendPlayerList()
46 {
48 data.m_ServerPlayerList = new SyncPlayerList;
49 data.m_ServerPlayerList.CreatePlayerList();
50
51 SendSyncEvent(ERPCs.RPC_SYNC_EVENT, ESyncEvent.PlayerList, data, true);
52 }
53
55 {
56 if ((victim && victim.IsPlayer()) || (killer && killer.IsPlayer()))
57 {
59 data.m_EntityKill = new SyncEntityKillInfo;
60
61 data.m_EntityKill.m_EntityVictim = victim;
62 data.m_EntityKill.m_EntityKiller = killer;
63 data.m_EntityKill.m_EntitySource = source;
64 data.m_EntityKill.m_IsHeadShot = is_headshot;
65
66 Man recipient;
67
68 if (killer && killer.IsPlayer() && victim.GetID() != killer.GetID())
69 recipient = Man.Cast(killer);
70 else if (victim && victim.IsPlayer())
71 recipient = Man.Cast(victim);
72
73 SendSyncEventEx(ERPCs.RPC_SYNC_EVENT, ESyncEvent.EntityKill, data, true, recipient);
74 }
75 }
76
78 {
80 data.m_SyncInt = ignite_type;
81
82 SendSyncEvent(ERPCs.RPC_SYNC_EVENT, ESyncEvent.PlayerIgnateFireplayce, data, true, player.GetIdentity());
83 }
84
93
98}
EFireIgniteType
ERPCs
Definition ERPCs.c:2
ESyncEvent
Definition ESyncEvent.c:2
static void SyncEvent_PreprocessPlayerList(SyncPlayerList player_list)
Definition ClientData.c:35
static void SyncEvent_OnRecievedPlayerList(SyncPlayerList player_list)
Definition ClientData.c:51
static ref ScriptInvoker SyncEvent_OnPlayerIgnitedFireplace
Definition ClientData.c:5
static ref ScriptInvoker SyncEvent_OnEntityKilled
Definition ClientData.c:4
The class that will be instanced (moddable)
Definition gameplay.c:376
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
static void SendSyncEvent(ERPCs rpc_event_id, ESyncEvent sync_event_type, SyncData data=null, bool guaranteed=true, PlayerIdentity player_target=null)
Definition SyncEvents.c:85
static void SendPlayerList()
Definition SyncEvents.c:45
static void SendPlayerIgnatedFireplace(Man player, EFireIgniteType ignite_type)
Definition SyncEvents.c:77
static void SendEntityKilled(EntityAI victim, EntityAI killer, EntityAI source, bool is_headshot)
Definition SyncEvents.c:54
static void Event_OnRPC(PlayerIdentity sender, Object target, int rpc_type, ParamsReadContext ctx)
Definition SyncEvents.c:11
static void OnSyncEvent(ESyncEvent event_type, SyncData data, Object target)
Definition SyncEvents.c:22
static void RegisterEvents()
Definition SyncEvents.c:3
static void SendSyncEventEx(ERPCs rpc_event_id, ESyncEvent sync_event_type, SyncData data=null, bool guaranteed=true, Man recipient=null)
Definition SyncEvents.c:94
proto native CGame GetGame()
proto void Print(void var)
Prints content of variable to console/log.