DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
PluginDiagMenuServer.c
См. документацию.
1// For modding, see PluginDiagMenuModding.c
2// !!! MODDING DISCLAIMER: These are debug functionality files, if you are thinking about modding the vanilla ones, do so at your own risk
3// These files will not be maintained with the thought of "what if a modder modded this" (Excluding the modding functionality of course)
4// Which is why the modding functionality was developed with the thought of the modded ones having their own isolated safe space
5
7{
8#ifdef DIAG_DEVELOPER
9 static ref map<Man, int> m_Subscribers = new map<Man, int>;
10
11 // A bit of a hack, because SP creates both Client and Server Plugins
12 override private void RegisterDiags()
13 {
14 if (GetGame().IsMultiplayer())
15 {
16 super.RegisterDiags();
17 }
18 }
19
20 //---------------------------------------------
21 override void OnRPC(PlayerBase player, int rpc_type, ParamsReadContext ctx)
22 {
23 super.OnRPC(player, rpc_type, ctx);
24
25 switch (rpc_type)
26 {
27 case ERPCs.DEV_DIAGMENU_SUBSCRIBE:
28 {
30 {
31 int newMask = CachedObjectsParams.PARAM1_INT.param1;
32 int currentMask = m_Subscribers.Get(player);
33
34 if (newMask != currentMask)
35 {
36 if (newMask == 0)
37 {
38 m_Subscribers.Remove(player);
39 }
40 else
41 {
42 m_Subscribers.Set(player, newMask);
43 }
44 }
45 }
46 break;
47 }
48 }
49 }
50
51 //---------------------------------------------
52 static void SendDataToSubscribersServer(Object target, ESubscriberSystems system, int rpc_type, Param data, bool guaranteed = true)
53 {
54 for (int i = 0; i < m_Subscribers.Count(); ++i)
55 {
56 Man man = m_Subscribers.GetKey(i);
57 if (man)
58 {
59 int subscribedSystems = m_Subscribers.Get(man);
60 if (system & subscribedSystems)
61 {
62 GetGame().RPCSingleParam( target, rpc_type, data, guaranteed, man.GetIdentity() );
63 }
64 }
65 else
66 {
67 m_Subscribers.RemoveElement(i);
68 i--;
69 }
70 }
71 }
72#endif
73}
map
Определения ControlsXboxNew.c:4
ERPCs
Определения ERPCs.c:2
proto native void RPCSingleParam(Object target, int rpc_type, Param param, bool guaranteed, PlayerIdentity recipient=null)
see CGame.RPC
static ref Param1< int > PARAM1_INT
Определения UtilityClasses.c:11
Определения ObjectTyped.c:2
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Определения param.c:12
Определения PlayerBaseClient.c:2
void OnRPC(PlayerBase player, int rpc_type, ParamsReadContext ctx)
Определения PluginDeveloper.c:61
Определения PluginDiagMenu.c:30
proto bool Read(void value_in)
Serializer ParamsReadContext
Определения gameplay.c:15
proto native CGame GetGame()