FrameworkZ 4.4.2
Provides a framework for Project Zomboid with various systems.
Loading...
Searching...
No Matches
2000_Foundation.lua
Go to the documentation of this file.
1--! \mainpage Main Page
2--! Created By RJ_RayJay
3--! \section Introduction
4--! FrameworkZ is a roleplay framework for the game Project Zomboid. This framework is designed to be a base for roleplay servers, providing a variety of features and systems to help server owners create a unique and enjoyable roleplay experience for their players.
5--! \section Features
6--! FrameworkZ includes a variety of features and systems to help server owners create a unique and enjoyable roleplay experience for their players. Some of the features and systems include:
7--! - Characters
8--! - Factions
9--! - Entities
10--! - Items
11--! - Inventories
12--! - Modules
13--! - Plugins
14--! - Hooks
15--! - Notifications
16--! - ...and more!
17--! \section Installation
18--! To install the FrameworkZ framework, simply download the latest release from the Steam Workshop and add the Workshop ID/Mod ID into your Project Zomboid server's config file. After installing, you can start your server and the framework will be ready to use. Typically you would also install a gamemode alongside the framework for additional functionality. Refer to your gamemode of choice for additional installation instructions.
19--! \section Usage
20--! The FrameworkZ framework is designed to be easy to use and extend. The framework is built using Lua, a lightweight, multi-paradigm programming language designed primarily for embedded use in applications. The framework is designed to be modular, allowing server owners to easily add, remove, and modify features and systems to suit their needs. The framework also includes extensive documentation to help server owners understand how to use and extend the framework.
21--! \section Contributing
22--! The FrameworkZ framework is an open-source project and we welcome contributions from the community. If you would like to contribute to the framework, you can do so by forking the GitHub repository, making your changes, and submitting a pull request. We also welcome bug reports, feature requests, and feedback from the community. If you have any questions or need help with the framework, you can join the FrameworkZ Discord server and ask for assistance in the #support channel.
23--! \section License
24--! The FrameworkZ framework is licensed under the MIT License, a permissive open-source license that allows you to use, modify, and distribute the framework for free. You can find the full text of the MIT License in the LICENSE file included with the framework. We chose the MIT License because we believe in the power of open-source software and want to encourage collaboration and innovation in the Project Zomboid community.
25--! \section Support
26--! If you need help with the FrameworkZ framework, you can join the FrameworkZ Discord server and ask for assistance in the #support channel. We have a friendly and knowledgeable community that is always willing to help with any questions or issues you may have. We also have a variety of resources available to help you get started with the framework, including documentation, tutorials, and example code.
27--! \section Conclusion
28--! The FrameworkZ framework is a powerful and flexible tool for creating roleplay servers in Project Zomboid. Whether you are a server owner looking to create a unique roleplay experience for your players or a developer looking to contribute to an open-source project, the FrameworkZ framework has something for everyone. We hope you enjoy using the framework and look forward to seeing the amazing roleplay experiences you create with it.
29--! \section Links
30--! - Steam Workshop: Coming Soon(tm)
31--! - GitHub Repository: https://github.com/Project-Zomboid-FrameworkZ/Framework
32--! - Bug Reports: https://github.com/Project-Zomboid-FrameworkZ/Framework/issues
33--! - Discord Server: https://discord.gg/PgNTyva3xk
34--! - Documentation: https://frameworkz.projectzomboid.life/documentation/
35
36--! \page global_variables Global Variables
37--! \section FrameworkZ FrameworkZ
38--! FrameworkZ
39--! The global table that contains all of the framework.
40--! [table]: /variable_types.html#table "table"
41--! \page variable_types Variable Types
42--! \section string string
43--! A string is a sequence of characters. Strings are used to represent text and are enclosed in double quotes or single quotes.
44--! \section boolean boolean
45--! A boolean is a value that can be either true or false. Booleans are used to represent logical values.
46--! \section integer integer
47--! A integer is a numerical value without any decimal points.
48--! \section float float
49--! A float is a numerical value with decimal points.
50--! \section table table
51--! A table is a collection of key-value pairs. It is the only data structure available in Lua that allows you to store data with arbitrary keys and values. Tables are used to represent arrays, sets, records, and other data structures.
52--! \section function function
53--! A function is a block of code that can be called and executed. Functions are used to encapsulate and reuse code.
54--! \section nil nil
55--! Nil is a special value that represents the absence of a value. Nil is used to indicate that a variable has no value.
56--! \section any any
57--! Any is a placeholder that represents any type of value. It is used to indicate that a variable can hold any type of value.
58--! \section mixed mixed
59--! Mixed is a placeholder that represents a combination of different types of values. It is used to indicate that a variable can hold a variety of different types of values.
60--! \section class class
61--! Class is a placeholder that represents a class of objects by a table set to a metatable.
62--! \section object object
63--! Object is a placeholder that represents an instance of a class.
64
65local Events = Events
66local isClient = isClient
67
68--! \brief FrameworkZ global table.
69--! \class FrameworkZ
70FrameworkZ = FrameworkZ or {}
71
72--! \brief Foundation for FrameworkZ.
73--! \class FrameworkZ.Foundation
74FrameworkZ.Foundation = {}
75
76--FrameworkZ.Foundation.__index = FrameworkZ.Foundation
77
78--! \brief Modules for FrameworkZ. Extends the framework with additional functionality.
79--! \class FrameworkZ.Modules
80FrameworkZ.Modules = {}
82--! \brief Create a new instance of the FrameworkZ Framework.
83--! \return \table The new instance of the FrameworkZ Framework.
84function FrameworkZ.Foundation.New()
85 local object = {
86 version = FrameworkZ.Config.Version
87 }
88 object.__index = FrameworkZ.Foundation
89
90 setmetatable(object, FrameworkZ.Foundation)
91
92 return object
93end
95--! \brief Create a new module for the FrameworkZ Framework.
96--! \param MODULE_TABLE \table The table to use as the module.
97--! \param moduleName \string The name of the module.
98--! \return \table The new module.
99function FrameworkZ.Foundation:NewModule(moduleObject, moduleName)
100 if (not FrameworkZ.Modules[moduleName]) then
101 local object = {}
102 moduleObject.__index = moduleObject
103 setmetatable(object, moduleObject)
104 FrameworkZ.Modules[moduleName] = object
105 --FrameworkZ.Foundation:RegisterModuleHandler(object)
106 end
107
108 return FrameworkZ.Modules[moduleName]
109end
110
111function FrameworkZ.Foundation:GetModule(moduleName)
112 return FrameworkZ.Modules[moduleName]
113end
114
115--! \brief Get the meta object stored on a module. Not every module will have a meta object. This is a very specific use case and is used for getting instantiable objects such as PLAYER objects or CHARACTER objects.
116--! \param moduleName \string The name of the module.
117--! \return \table The meta object stored on the module or \nil if nothing was found.
118function FrameworkZ.Foundation:GetModuleMetaObject(moduleName)
119 if FrameworkZ.Modules[moduleName] and FrameworkZ.Modules[moduleName].Meta then
120 return FrameworkZ.Modules[moduleName].Meta
121 end
122
123 return nil
124end
125
126function FrameworkZ.Foundation:RegisterFramework()
127 FrameworkZ.Foundation:RegisterFrameworkHandler()
128end
129
130function FrameworkZ.Foundation:RegisterModule(module)
131 FrameworkZ.Foundation:RegisterModuleHandler(module)
132end
133
134--! \brief Get the version of the FrameworkZ Framework.
135--! \return \string The version of the FrameworkZ Framework.
136function FrameworkZ.Foundation:GetVersion()
137 return self.version
138end
139
140FrameworkZ.Foundation = FrameworkZ.Foundation.New()
141
142--[[
143 PROJECT FRAMEWORK
144 HOOKS SYSTEM
145--]]
146
147HOOK_CATEGORY_FRAMEWORK = "framework"
148HOOK_CATEGORY_MODULE = "module"
149HOOK_CATEGORY_GAMEMODE = "gamemode"
150HOOK_CATEGORY_PLUGIN = "plugin"
151HOOK_CATEGORY_GENERIC = "generic"
152
153FrameworkZ.Foundation.HookHandlers = {
154 framework = {},
155 module = {},
156 gamemode = {},
157 plugin = {},
158 generic = {}
159}
160
161FrameworkZ.Foundation.RegisteredHooks = {
162 framework = {},
163 module = {},
164 gamemode = {},
165 plugin = {},
166 generic = {}
167}
168
169--! \brief Add a new hook handler to the list.
170--! \param hookName \string The name of the hook handler to add.
171--! \param category \string The category of the hook (framework, module, plugin, generic).
172function FrameworkZ.Foundation:AddHookHandler(hookName, category)
173 category = category or HOOK_CATEGORY_GENERIC
174 self.HookHandlers[category][hookName] = true
175end
176
177--! \brief Add a new hook handler to the list for all categories.
178--! \param hookName \string The name of the hook handler to add.
179function FrameworkZ.Foundation:AddAllHookHandlers(hookName)
180 FrameworkZ.Foundation:AddHookHandler(hookName, HOOK_CATEGORY_FRAMEWORK)
181 FrameworkZ.Foundation:AddHookHandler(hookName, HOOK_CATEGORY_MODULE)
182 FrameworkZ.Foundation:AddHookHandler(hookName, HOOK_CATEGORY_GAMEMODE)
183 FrameworkZ.Foundation:AddHookHandler(hookName, HOOK_CATEGORY_PLUGIN)
184 FrameworkZ.Foundation:AddHookHandler(hookName, HOOK_CATEGORY_GENERIC)
185end
186
187--! \brief Remove a hook handler from the list.
188--! \param hookName \string The name of the hook handler to remove.
189--! \param category \string The category of the hook (framework, module, plugin, generic).
190function FrameworkZ.Foundation:RemoveHookHandler(hookName, category)
191 category = category or HOOK_CATEGORY_GENERIC
192 self.HookHandlers[category][hookName] = nil
193end
194
195--! \brief Register hook handlers for the framework.
196--! \param framework \table The framework table containing the functions.
197function FrameworkZ.Foundation:RegisterFrameworkHandler()
198 self:RegisterHandlers(self, HOOK_CATEGORY_FRAMEWORK)
199end
201--! \brief Unregister hook handlers for the framework.
202--! \param framework \table The framework table containing the functions.
203function FrameworkZ.Foundation:UnregisterFrameworkHandler()
204 self:UnregisterHandlers(self, HOOK_CATEGORY_FRAMEWORK)
205end
206
207--! \brief Register hook handlers for a module.
208--! \param module \table The module table containing the functions.
209function FrameworkZ.Foundation:RegisterModuleHandler(module)
210 self:RegisterHandlers(module, HOOK_CATEGORY_MODULE)
211end
212
213--! \brief Unregister hook handlers for a module.
214--! \param module \table The module table containing the functions.
215function FrameworkZ.Foundation:UnregisterModuleHandler(module)
216 self:UnregisterHandlers(module, HOOK_CATEGORY_MODULE)
217end
218
219--! \brief Register hook handlers for the gamemode.
220--! \param module \table The module table containing the functions.
221function FrameworkZ.Foundation:RegisterGamemodeHandler(gamemode)
222 self:RegisterHandlers(gamemode, HOOK_CATEGORY_GAMEMODE)
223end
224
225--! \brief Unregister hook handlers for the gamemode.
226--! \param module \table The module table containing the functions.
227function FrameworkZ.Foundation:UnregisterGamemodeHandler(gamemode)
228 self:UnregisterHandlers(gamemode, HOOK_CATEGORY_GAMEMODE)
229end
230
231--! \brief Register hook handlers for a plugin.
232--! \param plugin \table The plugin table containing the functions.
233function FrameworkZ.Foundation:RegisterPluginHandler(plugin)
234 self:RegisterHandlers(plugin, HOOK_CATEGORY_PLUGIN)
235end
236
237--! \brief Unregister hook handlers for a plugin.
238--! \param plugin \table The plugin table containing the functions.
239function FrameworkZ.Foundation:UnregisterPluginHandler(plugin)
240 self:UnregisterHandlers(plugin, HOOK_CATEGORY_PLUGIN)
241end
242
243--! \brief Register hook handlers for a plugin.
244--! \param plugin \table The plugin table containing the functions.
245function FrameworkZ.Foundation:RegisterGenericHandler()
246 self:RegisterHandlers(nil, HOOK_CATEGORY_GENERIC)
247end
248
249--! \brief Unregister hook handlers for a plugin.
250--! \param plugin \table The plugin table containing the functions.
251function FrameworkZ.Foundation:UnregisterGenericHandler()
252 self:UnregisterHandlers(nil, HOOK_CATEGORY_GENERIC)
253end
254
255--! \brief Register handlers for a specific category.
256--! \param object \table The object containing the functions.
257--! \param category \string The category of the hook (framework, module, plugin, generic).
258function FrameworkZ.Foundation:RegisterHandlers(objectOrHandlers, category)
259 category = category or HOOK_CATEGORY_GENERIC
260 if not self.HookHandlers[category] then
261 error("Invalid category: " .. tostring(category))
262 end
264 -- Iterate over the hook names using pairs since HookHandlers is now a dictionary
265 for hookName, _ in pairs(self.HookHandlers[category]) do
266 if objectOrHandlers and type(objectOrHandlers) == "table" then
267 -- Check if the object/table has a function for the hookName
268 local handlerFunction = objectOrHandlers[hookName]
269 if handlerFunction and type(handlerFunction) == "function" then
270 self:RegisterHandler(hookName, handlerFunction, objectOrHandlers, hookName, category)
271 end
272 else
273 -- objectOrHandlers is nil or not a table
274 -- Try to get the function from the global environment
275 local handler = _G[hookName]
276 if handler and type(handler) == "function" then
277 self:RegisterHandler(hookName, handler, nil, nil, category)
278 end
279 end
280 end
281end
282
283--! \brief Unregister handlers for a specific category.
284--! \param object \table The object containing the functions.
285--! \param category \string The category of the hook (framework, module, plugin, generic).
286function FrameworkZ.Foundation:UnregisterHandlers(objectOrHandlers, category)
287 category = category or HOOK_CATEGORY_GENERIC
288 if not self.HookHandlers[category] then
289 error("Invalid category: " .. tostring(category))
290 end
291
292 for hookName, _ in pairs(self.HookHandlers[category]) do
293 if objectOrHandlers and type(objectOrHandlers) == "table" then
294 local handlerFunction = objectOrHandlers[hookName]
295 if handlerFunction and type(handlerFunction) == "function" then
296 self:UnregisterHandler(hookName, handlerFunction, objectOrHandlers, hookName, category)
297 end
298 else
299 local handler = _G[hookName]
300 if handler and type(handler) == "function" then
301 self:UnregisterHandler(hookName, handler, nil, nil, category)
302 end
303 end
304 end
305end
306
307--! \brief Register a handler for a hook.
308--! \param hookName \string The name of the hook.
309--! \param handler \function The function to call when the hook is executed.
310--! \param object \table (Optional) The object containing the function.
311--! \param functionName \string (Optional) The name of the function to call.
312--! \param category \string The category of the hook (framework, module, plugin, generic).
313function FrameworkZ.Foundation:RegisterHandler(hookName, handler, object, functionName, category)
314 category = category or HOOK_CATEGORY_GENERIC
315 self.RegisteredHooks[category][hookName] = self.RegisteredHooks[category][hookName] or {}
316
317 if object and functionName then
318 table.insert(self.RegisteredHooks[category][hookName], {
319 handler = function(...)
320 object[functionName](object, ...)
321 end,
322 object = object,
323 functionName = functionName
324 })
325 else
326 table.insert(self.RegisteredHooks[category][hookName], handler)
327 end
328end
329
330
331--! \brief Unregister a handler from a hook.
332--! \param hookName \string The name of the hook.
333--! \param handler \function The function to unregister.
334--! \param object \table (Optional) The object containing the function.
335--! \param functionName \string (Optional) The name of the function to unregister.
336--! \param category \string The category of the hook (framework, module, plugin, generic).
337function FrameworkZ.Foundation:UnregisterHandler(hookName, handler, object, functionName, category)
338 category = category or HOOK_CATEGORY_GENERIC
339 local hooks = self.RegisteredHooks[category] and self.RegisteredHooks[category][hookName]
340 if hooks then
341 for i = #hooks, 1, -1 do
342 if object and functionName then
343 if hooks[i].object == object and hooks[i].functionName == functionName then
344 table.remove(hooks, i)
345 break
346 end
347 else
348 if hooks[i] == handler then
349 table.remove(hooks, i)
350 break
351 end
352 end
353 end
354 end
355end
356
357--! \brief Execute hooks.
358--! \param hookName \string The name of the hook.
359--! \param category \string The category of the hook (framework, module, plugin, generic).
360--! \param ... \vararg Additional arguments to pass to the hook functions.
361function FrameworkZ.Foundation.ExecuteHook(hookName, category, ...)
362 category = category or HOOK_CATEGORY_GENERIC
363 if FrameworkZ.Foundation.RegisteredHooks[category] and FrameworkZ.Foundation.RegisteredHooks[category][hookName] then
364 for _, func in ipairs(FrameworkZ.Foundation.RegisteredHooks[category][hookName]) do
365 if type(func) == "table" and func.handler then
366 if select("#", ...) == 0 then
367 func.handler()
368 else
369 func.handler(...)
370 end
371 else
372 if select("#", ...) == 0 then
373 func()
374 else
375 func(...)
376 end
377 end
378 end
379 end
380end
381
382--! \brief Execute all of the hooks.
383--! \param hookName \string The name of the hook.
384--! \param ... \vararg Additional arguments to pass to the hook functions.
385function FrameworkZ.Foundation.ExecuteAllHooks(hookName, ...)
386 for category, _ in pairs(FrameworkZ.Foundation.RegisteredHooks) do
387 FrameworkZ.Foundation.ExecuteHook(hookName, category, ...)
388 end
389end
390
391--! \brief Execute the framework hooks.
392--! \param hookName \string The name of the hook.
393--! \param ... \vararg Additional arguments to pass to the hook functions.
394function FrameworkZ.Foundation.ExecuteFrameworkHooks(hookName, ...)
395 local category = HOOK_CATEGORY_FRAMEWORK
396 if FrameworkZ.Foundation.RegisteredHooks[category] and FrameworkZ.Foundation.RegisteredHooks[category][hookName] then
397 for _, func in ipairs(FrameworkZ.Foundation.RegisteredHooks[category][hookName]) do
398 if type(func) == "table" and func.handler then
399 if select("#", ...) == 0 then
400 func.handler()
401 else
402 func.handler(...)
403 end
404 else
405 if select("#", ...) == 0 then
406 func()
407 else
408 func(...)
409 end
410 end
411 end
412 end
413end
414
415--! \brief Execute module hooks.
416--! \param hookName \string The name of the hook.
417--! \param ... \vararg Additional arguments to pass to the hook functions.
418function FrameworkZ.Foundation.ExecuteModuleHooks(hookName, ...)
419 local category = HOOK_CATEGORY_MODULE
420 if FrameworkZ.Foundation.RegisteredHooks[category] and FrameworkZ.Foundation.RegisteredHooks[category][hookName] then
421 for _, func in ipairs(FrameworkZ.Foundation.RegisteredHooks[category][hookName]) do
422 if type(func) == "table" and func.handler then
423 if select("#", ...) == 0 then
424 func.handler()
425 else
426 func.handler(...)
427 end
428 else
429 if select("#", ...) == 0 then
430 func()
431 else
432 func(...)
433 end
434 end
435 end
436 end
437end
438
439--! \brief Execute the gamemode hooks.
440--! \param hookName \string The name of the hook.
441--! \param ... \vararg Additional arguments to pass to the hook functions.
442function FrameworkZ.Foundation.ExecuteGamemodeHooks(hookName, ...)
443 local category = HOOK_CATEGORY_GAMEMODE
444 if FrameworkZ.Foundation.RegisteredHooks[category] and FrameworkZ.Foundation.RegisteredHooks[category][hookName] then
445 for _, func in ipairs(FrameworkZ.Foundation.RegisteredHooks[category][hookName]) do
446 if type(func) == "table" and func.handler then
447 if select("#", ...) == 0 then
448 func.handler()
449 else
450 func.handler(...)
451 end
452 else
453 if select("#", ...) == 0 then
454 func()
455 else
456 func(...)
457 end
458 end
459 end
460 end
461end
462
463--! \brief Execute plugin hooks.
464--! \param hookName \string The name of the hook.
465--! \param ... \vararg Additional arguments to pass to the hook functions.
466function FrameworkZ.Foundation.ExecutePluginHooks(hookName, ...)
467 local category = HOOK_CATEGORY_PLUGIN
468 if FrameworkZ.Foundation.RegisteredHooks[category] and FrameworkZ.Foundation.RegisteredHooks[category][hookName] then
469 for _, func in ipairs(FrameworkZ.Foundation.RegisteredHooks[category][hookName]) do
470 if type(func) == "table" and func.handler then
471 if select("#", ...) == 0 then
472 func.handler()
473 else
474 func.handler(...)
475 end
476 else
477 if select("#", ...) == 0 then
478 func()
479 else
480 func(...)
481 end
482 end
483 end
484 end
485end
486
487--! \brief Execute generic hooks.
488--! \param hookName \string The name of the hook.
489--! \param ... \vararg Additional arguments to pass to the hook functions.
490function FrameworkZ.Foundation.ExecuteGenericHooks(hookName, ...)
491 local category = HOOK_CATEGORY_GENERIC
492 if FrameworkZ.Foundation.RegisteredHooks[category] and FrameworkZ.Foundation.RegisteredHooks[category][hookName] then
493 for _, func in ipairs(FrameworkZ.Foundation.RegisteredHooks[category][hookName]) do
494 if type(func) == "table" and func.handler then
495 if select("#", ...) == 0 then
496 func.handler()
497 else
498 func.handler(...)
499 end
500 else
501 if select("#", ...) == 0 then
502 func()
503 else
504 func(...)
505 end
506 end
507 end
508 end
509end
510
511--[[
512 PROJECT FRAMEWORK
513 HOOKS ADDITIONS
514--]]
515
516
517--! \brief Called when the game starts. Executes the OnGameStart function for all modules.
518function FrameworkZ.Foundation:OnGameStart()
519 FrameworkZ.Foundation.ExecuteFrameworkHooks("PreInitializeClient", getPlayer())
520end
521
522function FrameworkZ.Foundation:PreInitializeClient()
523 FrameworkZ.Foundation.ExecuteModuleHooks("PreInitializeClient", getPlayer())
524 FrameworkZ.Foundation.ExecuteGamemodeHooks("PreInitializeClient", getPlayer())
525 FrameworkZ.Foundation.ExecutePluginHooks("PreInitializeClient", getPlayer())
526
527 FrameworkZ.Foundation.ExecuteFrameworkHooks("InitializeClient", getPlayer())
528end
529FrameworkZ.Foundation:AddAllHookHandlers("PreInitializeClient")
530
531function FrameworkZ.Foundation:InitializeClient()
532 FrameworkZ.Timers:Simple(FrameworkZ.Config.InitializationDuration, function()
533 FrameworkZ.Foundation.ExecuteModuleHooks("InitializeClient", getPlayer())
534 FrameworkZ.Foundation.ExecuteGamemodeHooks("InitializeClient", getPlayer())
535 FrameworkZ.Foundation.ExecutePluginHooks("InitializeClient", getPlayer())
536
537 FrameworkZ.Foundation.ExecuteFrameworkHooks("PostInitializeClient", getPlayer())
538 end)
539end
540FrameworkZ.Foundation:AddAllHookHandlers("InitializeClient")
541
542function FrameworkZ.Foundation:PostInitializeClient()
543 FrameworkZ.Foundation.ExecuteModuleHooks("PostInitializeClient", getPlayer())
544 FrameworkZ.Foundation.ExecuteGamemodeHooks("PostInitializeClient", getPlayer())
545 FrameworkZ.Foundation.ExecutePluginHooks("PostInitializeClient", getPlayer())
546end
547FrameworkZ.Foundation:AddAllHookHandlers("PostInitializeClient")
548
549function FrameworkZ.Foundation:OnMainMenuEnter()
550 FrameworkZ.Foundation.ExecuteFrameworkHooks("OnOpenEscapeMenu", getPlayer())
551end
552
553function FrameworkZ.Foundation:OnOpenEscapeMenu()
554 FrameworkZ.Foundation.ExecuteModuleHooks("OnOpenEscapeMenu", getPlayer())
555 FrameworkZ.Foundation.ExecuteGamemodeHooks("OnOpenEscapeMenu", getPlayer())
556 FrameworkZ.Foundation.ExecutePluginHooks("OnOpenEscapeMenu", getPlayer())
557end
558FrameworkZ.Foundation:AddAllHookHandlers("OnOpenEscapeMenu")
559
560if not isClient() then
561
562 --! \brief Called when the server starts. Executes the OnServerStarted function for all modules.
563 function FrameworkZ.Foundation.OnServerStarted()
564 for k, v in pairs(FrameworkZ.Modules) do
565 if v.OnServerStarted then
566 v.OnServerStarted(v)
567 end
568 end
569 end
570 Events.OnServerStarted.Add(FrameworkZ.Foundation.OnServerStarted)
571
572end
void Factions()
void local isClient()
void HOOK_CATEGORY_FRAMEWORK()
void local Events()
void HOOK_CATEGORY_GAMEMODE()
void HOOK_CATEGORY_PLUGIN()
void gamemode()
void module()
void HOOK_CATEGORY_MODULE()
void HOOK_CATEGORY_GENERIC()
void if objectOrHandlers and type objectOrHandlers()
void plugin()
void local handlerFunction()
void framework()
void if hooks()
void local handler()
void if select("#",...)()
void for i()
void category()
void type()
void processingNotification backgroundColor a()
Foundation for FrameworkZ.
void UnregisterGamemodeHandler(gamemode)
Unregister hook handlers for the gamemode.
table GetModuleMetaObject(moduleName)
Get the meta object stored on a module. Not every module will have a meta object. This is a very spec...
void RegisterGamemodeHandler(gamemode)
Register hook handlers for the gamemode.
void RegisterHandler(hookName, handler, object, functionName, category)
Register a handler for a hook.
void RegisterHandlers(objectOrHandlers, category)
Register handlers for a specific category.
void ExecuteGamemodeHooks(hookName,...)
Execute the gamemode hooks.
string GetVersion()
Get the version of the FrameworkZ Framework.
void AddAllHookHandlers(hookName)
Add a new hook handler to the list for all categories.
table NewModule(moduleObject, moduleName)
Create a new module for the FrameworkZ Framework.
void UnregisterGenericHandler()
Unregister hook handlers for a plugin.
void ExecuteHook(hookName, category,...)
Execute hooks.
void RegisterModuleHandler(module)
Register hook handlers for a module.
void RegisterPluginHandler(plugin)
Register hook handlers for a plugin.
void RegisterFrameworkHandler()
Register hook handlers for the framework.
void ExecuteFrameworkHooks(hookName,...)
Execute the framework hooks.
void RegisterGenericHandler()
Register hook handlers for a plugin.
void UnregisterPluginHandler(plugin)
Unregister hook handlers for a plugin.
void OnServerStarted()
Called when the server starts. Executes the OnServerStarted function for all modules.
void UnregisterHandler(hookName, handler, object, functionName, category)
Unregister a handler from a hook.
table New()
Create a new instance of the FrameworkZ Framework.
void ExecuteAllHooks(hookName,...)
Execute all of the hooks.
void GetModule(moduleName)
void UnregisterModuleHandler(module)
Unregister hook handlers for a module.
void ExecutePluginHooks(hookName,...)
Execute plugin hooks.
void ExecuteGenericHooks(hookName,...)
Execute generic hooks.
void RemoveHookHandler(hookName, category)
Remove a hook handler from the list.
void UnregisterFrameworkHandler()
Unregister hook handlers for the framework.
void UnregisterHandlers(objectOrHandlers, category)
Unregister handlers for a specific category.
void AddHookHandler(hookName, category)
Add a new hook handler to the list.
void ExecuteModuleHooks(hookName,...)
Execute module hooks.
void OnGameStart()
Called when the game starts. Executes the OnGameStart function for all modules.
void RegisterModule(module)
FrameworkZ global table.