Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
plugindiagmenuserver.c
Go to the documentation of this file.
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
6
class
PluginDiagMenuServer
:
PluginDiagMenu
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
(
g_Game
.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
{
29
if
(ctx.
Read
(
CachedObjectsParams
.
PARAM1_INT
))
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
g_Game
.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
}
CachedObjectsParams
Definition
utilityclasses.c:10
CachedObjectsParams::PARAM1_INT
static ref Param1< int > PARAM1_INT
Definition
utilityclasses.c:11
Object
Definition
objecttyped.c:2
Param
Base Param Class with no parameters.
Definition
param.c:12
PlayerBase
Definition
playerbaseclient.c:2
PluginBase::OnRPC
void OnRPC(PlayerBase player, int rpc_type, ParamsReadContext ctx)
Definition
plugindeveloper.c:61
PluginDiagMenu
Definition
plugindiagmenu.c:30
PluginDiagMenuServer
Definition
plugindiagmenuserver.c:7
Serializer::Read
proto bool Read(void value_in)
map
Definition
cachedequipmentstorage.c:4
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
ERPCs
ERPCs
Definition
erpcs.c:2
ParamsReadContext
Serializer ParamsReadContext
Definition
gameplay.c:15
Games
Dayz
scripts
4_world
plugins
pluginbase
plugindiagmenu
plugindiagmenuserver.c
Generated by
1.17.0