DayZ 1.24
Loading...
Searching...
No Matches
PluginManager Class Reference
Collaboration diagram for PluginManager:
[legend]

Protected Member Functions

void RegisterPlugin (string plugin_class_name, bool reg_on_client, bool reg_on_server, bool reg_on_release=true)
 Register new PluginBase to PluginManager for storing and handling plugin.
 
void RegisterPluginDebug (string plugin_class_name, bool reg_on_client, bool reg_on_server)
 Register new PluginBase to PluginManager for storing and handling plugin.
 
void RegisterPluginDiag (string plugin_class_name, bool reg_on_client, bool reg_on_server)
 
bool UnregisterPlugin (string plugin_class_name)
 

Private Member Functions

void PluginManager ()
 
void ~PluginManager ()
 
void Init ()
 
void PluginsInit ()
 
void MainOnUpdate (float delta_time)
 
PluginBase GetPluginByType (typename plugin_type)
 Returns registred plugin by class type, better is to use global funtion GetPlugin(typename plugin_type)
 

Private Attributes

ref array< typenamem_PluginRegister
 
ref map< typename, ref PluginBasem_PluginsPtrs
 

Detailed Description

Definition at line 1 of file PluginManager.c.

Constructor & Destructor Documentation

◆ PluginManager()

void PluginManager::PluginManager ( )
inlineprivate

Definition at line 9 of file PluginManager.c.

10 {
13 }
ref map< typename, ref PluginBase > m_PluginsPtrs
ref array< typename > m_PluginRegister

References m_PluginRegister, and m_PluginsPtrs.

◆ ~PluginManager()

void PluginManager::~PluginManager ( )
inlineprivate

Definition at line 18 of file PluginManager.c.

19 {
20 int i;
22
23 for (i = 0; i < m_PluginsPtrs.Count(); ++i)
24 {
25 plugin = m_PluginsPtrs.GetElement(i);
26 if (plugin != NULL)
27 {
28 plugin.OnDestroy();
29 delete plugin;
30 }
31 }
32
33 GetGame().GetUpdateQueue(CALL_CATEGORY_GAMEPLAY).Remove(this.MainOnUpdate);
34 }
void MainOnUpdate(float delta_time)
proto native CGame GetGame()
const int CALL_CATEGORY_GAMEPLAY
Definition tools.c:10

References CALL_CATEGORY_GAMEPLAY, GetGame(), m_PluginsPtrs, and MainOnUpdate().

Member Function Documentation

◆ GetPluginByType()

PluginBase PluginManager::GetPluginByType ( typename plugin_type )
inlineprivate

Returns registred plugin by class type, better is to use global funtion GetPlugin(typename plugin_type)

Parameters
module_tpyetypename class type of plugin
Returns
PluginBase
PluginManager GetPluginManager()
Returns registred plugin by class type, better is to use global funtion GetPlugin(typename plugin_typ...
PluginBase GetPluginByType(typename plugin_type)
Returns registred plugin by class type, better is to use global funtion GetPlugin(typename plugin_typ...

Definition at line 151 of file PluginManager.c.

152 {
153 if (m_PluginsPtrs.Contains(plugin_type))
154 return m_PluginsPtrs.Get(plugin_type);
155
156 return null;
157 }

References m_PluginsPtrs.

Referenced by GetPlugin(), and PluginsInit().

◆ Init()

void PluginManager::Init ( )
inlineprivate

Definition at line 39 of file PluginManager.c.

40 {
41 //----------------------------------------------------------------------
42 // Register modules
43 //----------------------------------------------------------------------
44 // Module Class Name Client Server
45 //----------------------------------------------------------------------
46 RegisterPlugin("PluginHorticulture", true, true);
47 RegisterPlugin("PluginRepairing", true, true);
48 RegisterPlugin("PluginPlayerStatus", true, true);
49 RegisterPlugin("PluginMessageManager", true, true);
50 RegisterPlugin("PluginLifespan", true, true);
51 RegisterPlugin("PluginVariables", true, true);
52 RegisterPlugin("PluginObjectsInteractionManager", false, true);
53 RegisterPlugin("PluginRecipesManager", true, true);
54 RegisterPlugin("PluginTransmissionAgents", true, true);
55 RegisterPlugin("PluginAdditionalInfo", true, true); //TODO clean up after Gamescom
56 RegisterPlugin("PluginConfigEmotesProfile", true, true);
57 RegisterPlugin("PluginPresenceNotifier", true, false);
58 RegisterPlugin("PluginAdminLog", false, true);
59
60 // Developer + Diag
61 RegisterPluginDiag("PluginKeyBinding", true, false);
62 RegisterPluginDiag("PluginDeveloper", true, true);
63 RegisterPluginDiag("PluginDeveloperSync", true, true);
64 RegisterPluginDiag("PluginDiagMenuClient", true, false);
65 RegisterPluginDiag("PluginDiagMenuServer", false, true);
66 RegisterPluginDiag("PluginPermanentCrossHair", true, false);
67 RegisterPluginDiag("PluginRemotePlayerDebugClient", true, false);
68 RegisterPluginDiag("PluginRemotePlayerDebugServer", false, true);
69 RegisterPluginDiag("PluginUniversalTemperatureSourceClient", true, false);
70 RegisterPluginDiag("PluginUniversalTemperatureSourceServer", false, true);
71 RegisterPluginDiag("PluginDrawCheckerboard", true, false);
72 RegisterPluginDiag("PluginItemDiagnostic", true, true);
73 RegisterPluginDiag("PluginDayZCreatureAIDebug", true, true);
74
75 // Only In Debug / Internal
76 RegisterPluginDebug("PluginConfigViewer", true, true);
77 RegisterPluginDebug("PluginLocalEnscriptHistory", true, true);
78 RegisterPluginDebug("PluginLocalEnscriptHistoryServer", true, true);
79
80 RegisterPluginDebug("PluginSceneManager", true, true);
81 RegisterPluginDebug("PluginConfigScene", true, true);
82 RegisterPluginDebug("PluginMissionConfig", true, true);
83 RegisterPluginDebug("PluginConfigEmotesProfile", true, true);
84 RegisterPluginDebug("PluginConfigDebugProfile", true, true);
85 RegisterPluginDebug("PluginConfigDebugProfileFixed", true, true);
86
87 RegisterPluginDebug("PluginDayzPlayerDebug", true, true);
88 RegisterPluginDebug("PluginDayZInfectedDebug", true, true);
89 RegisterPluginDebug("PluginDoorRuler", true, false);
90 RegisterPluginDebug("PluginCharPlacement", true, false);
91 //RegisterPluginDebug( "PluginSoundDebug", false, false );
92 RegisterPluginDebug("PluginCameraTools", true, true);
93 RegisterPluginDebug("PluginNutritionDumper", true, false);
94
95 GetGame().GetUpdateQueue(CALL_CATEGORY_GAMEPLAY).Insert(MainOnUpdate);
96 }
void RegisterPluginDebug(string plugin_class_name, bool reg_on_client, bool reg_on_server)
Register new PluginBase to PluginManager for storing and handling plugin.
void RegisterPluginDiag(string plugin_class_name, bool reg_on_client, bool reg_on_server)
void RegisterPlugin(string plugin_class_name, bool reg_on_client, bool reg_on_server, bool reg_on_release=true)
Register new PluginBase to PluginManager for storing and handling plugin.

References CALL_CATEGORY_GAMEPLAY, GetGame(), MainOnUpdate(), RegisterPlugin(), RegisterPluginDebug(), and RegisterPluginDiag().

◆ MainOnUpdate()

void PluginManager::MainOnUpdate ( float delta_time)
inlineprivate

Definition at line 130 of file PluginManager.c.

131 {
132 for (int i = 0; i < m_PluginsPtrs.Count(); ++i)
133 {
134 PluginBase plugin = m_PluginsPtrs.GetElement(i);
135 if (plugin != NULL)
136 plugin.OnUpdate(delta_time);
137 }
138 }

References m_PluginsPtrs.

Referenced by Init(), and ~PluginManager().

◆ PluginsInit()

void PluginManager::PluginsInit ( )
inlineprivate

Definition at line 101 of file PluginManager.c.

102 {
103 int i = 0;
104 int regCount = m_PluginRegister.Count();
105
107 pluginPtrs.Reserve(regCount);
108
109 foreach (typename pluginType : m_PluginRegister)
110 {
112 if (moduleExist)
114
117 pluginPtrs.Insert(moduleNew);
118 }
119
120 foreach (PluginBase plugin : pluginPtrs)
121 {
122 if (plugin)
123 plugin.OnInit();
124 }
125 }

References GetPluginByType(), m_PluginRegister, and m_PluginsPtrs.

◆ RegisterPlugin()

void PluginManager::RegisterPlugin ( string plugin_class_name,
bool reg_on_client,
bool reg_on_server,
bool reg_on_release = true )
inlineprotected

Register new PluginBase to PluginManager for storing and handling plugin.

Parameters
module_tpyetypename class type of plugin
Returns
void

Definition at line 175 of file PluginManager.c.

176 {
177 if (!reg_on_client)
178 {
179 if (GetGame().IsMultiplayer() && GetGame().IsClient())
180 return;
181 }
182
183 if (!reg_on_server)
184 {
185 if (GetGame().IsMultiplayer())
186 {
187 if (GetGame().IsServer())
188 return;
189 }
190 }
191
192 if (!reg_on_release)
193 {
194 if (!GetGame().IsDebug())
195 return;
196 }
197
198 m_PluginRegister.Insert(plugin_class_name.ToType());
199 }

References GetGame(), and m_PluginRegister.

Referenced by Init(), RegisterPluginDebug(), and RegisterPluginDiag().

◆ RegisterPluginDebug()

void PluginManager::RegisterPluginDebug ( string plugin_class_name,
bool reg_on_client,
bool reg_on_server )
inlineprotected

Register new PluginBase to PluginManager for storing and handling plugin.

Parameters
module_tpyetypename class type of plugin
Returns
void

Definition at line 217 of file PluginManager.c.

References RegisterPlugin().

Referenced by Init().

◆ RegisterPluginDiag()

void PluginManager::RegisterPluginDiag ( string plugin_class_name,
bool reg_on_client,
bool reg_on_server )
inlineprotected

Definition at line 224 of file PluginManager.c.

225 {
226#ifdef DIAG_DEVELOPER
228#else
229 return;
230#endif
231 }

References RegisterPlugin().

Referenced by Init().

◆ UnregisterPlugin()

bool PluginManager::UnregisterPlugin ( string plugin_class_name)
inlineprotected

Definition at line 236 of file PluginManager.c.

237 {
238 typename plugin_type = plugin_class_name.ToType();
239
240 if (m_PluginRegister.Find(plugin_type) != -1)
241 {
242 m_PluginRegister.RemoveItem(plugin_type);
243 return true;
244 }
245
246 return false;
247 }

References m_PluginRegister.

Member Data Documentation

◆ m_PluginRegister

ref array<typename> PluginManager::m_PluginRegister
private

Definition at line 3 of file PluginManager.c.

Referenced by PluginManager(), PluginsInit(), RegisterPlugin(), and UnregisterPlugin().

◆ m_PluginsPtrs

ref map<typename, ref PluginBase> PluginManager::m_PluginsPtrs
private

The documentation for this class was generated from the following file: