![]() |
FrameworkZ 10.8.3
Provides a framework for Project Zomboid with various systems.
|
Foundation for FrameworkZ. More...
Data Structures | |
| class | Events |
| class | Modules |
| Modules for FrameworkZ. Extends the framework with additional functionality. More... | |
Public Member Functions | |
| void | AddAllHookHandlers (hookName) |
| Add a new hook handler to the list for all categories. | |
| void | AddChannel (key) |
| Add a new channel to the network system. Channels are used to subscribe to; changes in values, or fire events. | |
| void | AddHookHandler (hookName, category) |
| Add a new hook handler to the list. | |
| void | Broadcast (namespace, key, remove) |
| Broadcasts updated or removed data to all clients. | |
| void | CleanupConfirmations (timeout) |
| Cleans up pending confirmations that have not been confirmed within a timeout period. | |
| void | ClearBatchSyncQueue (isoPlayer) |
| Clear the sync queue for a player. | |
| void | EveryDays () |
| TODO move to shared timer hook. | |
| void | ExecuteAllHooks (hookName,...) |
| Execute all of the hooks. | |
| void | ExecuteFrameworkHooks (hookName,...) |
| Execute the framework hooks. | |
| void | ExecuteGamemodeHooks (hookName,...) |
| Execute the gamemode hooks. | |
| void | ExecuteGenericHooks (hookName,...) |
| Execute generic hooks. | |
| void | ExecuteHook (hookName, category,...) |
| Execute a given hook by its hook name for its given category. | |
| void | ExecuteModuleHooks (hookName,...) |
| Execute module hooks. | |
| void | ExecutePluginHooks (hookName,...) |
| Execute plugin hooks. | |
| table | Fire (key, data, arguments) |
| Fires a callback for a key. This will call the callback for the key with the value supplied. | |
| table | GetChannel (key) |
| Get the channel for a key. This will return the channel data for the key. | |
| table | GetChannelMeta (key) |
| Get the meta data for a channel. This will return the meta data for the key. | |
| any | GetData (isoPlayer, namespace, keys, subscriptionID, callback) |
| Gets a value from a namespace by key(s). | |
| void | GetLocalData (namespace, keys) |
| object | GetModule (moduleName) |
| Get a module by name. | |
| object | GetModuleMetaObject (moduleName) |
| Get a module's 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. | |
| void | GetNamespace (namespace) |
| Retrieves the entire namespace table. | |
| mixed | GetNestedValue (root, path) |
| Get a nested value from a table using a path. This is used to get values from nested tables. | |
| table | GetSubscribers (key) |
| Get the subscribers for a key. This will return the subscribers for the key. | |
| string | GetVersion () |
| Get the version of FrameworkZ Foundation. | |
| boolean | HasChannel (key) |
| Check if a channel exists for a key. This will return true if the channel exists, false otherwise. | |
| boolean | HasSubscription (key, id) |
| Check if a subscription exists for a key. This will return true if the subscription exists, false otherwise. | |
| void | Initialize () |
| Initializes the framework foundation. | |
| void | InitializeClient (isoPlayer) |
| void | InitializePlayer (isoPlayer, playerData, charactersData) |
| void | LogChannels () |
| Log all channels and their subscribers to the console. This is useful for debugging and understanding the network system. | |
| table | New () |
| Create a new instance of the FrameworkZ framework. | |
| object | NewModule (moduleObject, moduleName) |
| Create a new module for the FrameworkZ framework. | |
| void | OnClientCommand (module, command, isoPlayer, arguments) |
| Handles incoming commands from the client on the server. | |
| void | OnGameStart () |
| Called when the game starts. Executes the OnGameStart function for all modules. | |
| void | OnGetData (data, namespace, keys, subscriptionID) |
| void | OnInitializePlayer (data) |
| void | OnRemoveData (data) |
| Client receives key removal broadcast. | |
| void | OnSaveData (data) |
| void | OnSaveData (data) |
| void | OnSaveNamespace (data) |
| void | OnSaveNamespace (data, namespace) |
| void | OnServerCommand (module, command, arguments) |
| Handles incoming commands from the server on the client. | |
| void | OnServerStarted () |
| void | OnSetData (data, namespace, keys, value, subscriptionID, broadcast) |
| void | OnSync (data) |
| Server-side response to client sync request. | |
| void | OnSyncBroadcast (data) |
| Client receives sync data from broadcast. | |
| void | OnTeleportToLimbo (data) |
| string | PathToString (path) |
| Convert a path to a string. This is used to convert a table path to a string path. | |
| void | PostInitializeClient (player) |
| void | PreInitializeClient (isoPlayer) |
| void | ProcessSaveableData (object, ignoreList, encodeList) |
| void | QueueBatchSync (isoPlayer, namespace, key) |
| Queue a key in a namespace for sync. | |
| void | RegisterFramework () |
| Register FrameworkZ. This is called after framework definition. | |
| void | RegisterFrameworkHandler () |
| Register hook handlers for the framework. | |
| void | RegisterGamemodeHandler (gamemode) |
| Register hook handlers for the gamemode. | |
| void | RegisterGenericHandler () |
| Register hook handlers for a plugin. | |
| void | RegisterHandler (hookName, handler, object, functionName, category) |
| Register a handler for a hook. | |
| void | RegisterHandlers (objectOrHandlers, category) |
| Register handlers for a specific category. | |
| void | RegisterModule (module) |
| Register a module for FrameworkZ. This is called after module definition. | |
| void | RegisterModuleHandler (module) |
| Register hook handlers for a module. | |
| void | RegisterNamespace (name) |
| Registers a storage namespace, e.g., "Players". | |
| void | RegisterPluginHandler (plugin) |
| Register hook handlers for a plugin. | |
| void | RemoveChannel (key) |
| Remove a channel from the network system. This will remove all subscribers and meta data for the channel. | |
| void | RemoveData (namespace, key) |
| Removes a key from a namespace and broadcasts removal. | |
| void | RemoveHookHandler (hookName, category) |
| Remove a hook handler from the list. | |
| void | RestoreData (isoPlayer, command, namespace, keys, callback) |
| void | RestorePlayer (isoPlayer, player, username, playerData, charactersData) |
| void | SaveData (isoPlayer) |
| void | SaveNamespace (isoPlayer, namespace) |
| string | SendFire (isoPlayer, subscriptionID, callback,...) |
| Sends a fire event to the server or client. This is used to send events to subscribers. | |
| void | SendGet (key, callback, callbackID, broadcast,...) |
| Sends a get request to the server. | |
| void | SendSet (key, value, callback, callbackID, broadcast) |
| Sends a set request to the server. | |
| void | ServerTick () |
| boolean | SetData (isoPlayer, namespace, keys, value, subscriptionID, broadcast, callback) |
| Sets a value in a namespace and (optionally) broadcasts to all clients. | |
| void | SetLocalData (namespace, keys, value) |
| mixed | SetNestedValue (root, path, value) |
| Set a nested value in a table using a path. This is used to set values in nested tables. | |
| void | StartBatchSync (isoPlayer, interval, onComplete) |
| Begin processing the queued keys for a player. | |
| void | StartServerTick () |
| function | Subscribe (key, idOrCallback, maybeCallback) |
| Subscribes to a key to listen for changes with the first three arguments supplied, or can be used for sending/receiving fire events with the first two arguments supplied. | |
| void | SyncToPlayer (isoPlayer, namespace, key) |
| Sends a specific key to a specific player. | |
| void | TeleportToLimbo (isoPlayer) |
| void | UnregisterFrameworkHandler () |
| Unregister hook handlers for the framework. | |
| void | UnregisterGamemodeHandler (gamemode) |
| Unregister hook handlers for the gamemode. | |
| void | UnregisterGenericHandler () |
| Unregister hook handlers for a plugin. | |
| void | UnregisterHandler (hookName, handler, object, functionName, category) |
| Unregister a handler from a hook. | |
| void | UnregisterHandlers (objectOrHandlers, category) |
| Unregister handlers for a specific category. | |
| void | UnregisterModuleHandler (module) |
| Unregister hook handlers for a module. | |
| void | UnregisterPluginHandler (plugin) |
| Unregister hook handlers for a plugin. | |
| void | Unsubscribe (key, id) |
| Unsubscribes from a key. This will remove the callback from the channel. | |
| void | Watch (key, id, callback) |
| Subscribes and fires callback immediately if the value is already set. Useful for UIs. | |
Data Fields | |
| FrameworkZ Foundation | Events |
Foundation for FrameworkZ.
Definition at line 85 of file __Foundation.lua.
| void AddAllHookHandlers | ( | hookName | ) |
Add a new hook handler to the list for all categories.
| hookName | string The name of the hook handler to add. |
Add a new channel to the network system. Channels are used to subscribe to; changes in values, or fire events.
| key | string or table The key to use for the channel. Use a table to create nested channels. |
| void CleanupConfirmations | ( | timeout | ) |
Cleans up pending confirmations that have not been confirmed within a timeout period.
| timeout | \number The timeout in seconds to clean up pending confirmations. Default: 300 seconds (5 minutes). |
Clear the sync queue for a player.
References command(), isoPlayer(), module(), and OnConnected().
| void EveryDays | ( | ) |
TODO move to shared timer hook.
| void ExecuteAllHooks | ( | hookName | , |
| ... ) |
Execute all of the hooks.
| hookName | string The name of the hook. |
| ... | \vararg Additional arguments to pass to the hook functions. |
| void ExecuteFrameworkHooks | ( | hookName | , |
| ... ) |
Execute the framework hooks.
| hookName | string The name of the hook. |
| ... | \vararg Additional arguments to pass to the hook functions. |
| void ExecuteGamemodeHooks | ( | hookName | , |
| ... ) |
Execute the gamemode hooks.
| hookName | string The name of the hook. |
| ... | \vararg Additional arguments to pass to the hook functions. |
| void ExecuteGenericHooks | ( | hookName | , |
| ... ) |
Execute generic hooks.
| hookName | string The name of the hook. |
| ... | \vararg Additional arguments to pass to the hook functions. |
Execute a given hook by its hook name for its given category.
| void ExecuteModuleHooks | ( | hookName | , |
| ... ) |
Execute module hooks.
| hookName | string The name of the hook. |
| ... | \vararg Additional arguments to pass to the hook functions. |
| void ExecutePluginHooks | ( | hookName | , |
| ... ) |
Execute plugin hooks.
| hookName | string The name of the hook. |
| ... | \vararg Additional arguments to pass to the hook functions. |
Fires a callback for a key. This will call the callback for the key with the value supplied.
| key | string The key to fire the callback for. Use a table to fire the callback for nested values. |
| data | table The standard data to pass to the callback. Generally contains diagnostic information. |
| arguments | table The values to pass to the callback. This can be any type of values stored in the table. |
| table GetChannel | ( | key | ) |
Get the channel for a key. This will return the channel data for the key.
| key | string or table The key to use for the channel. Use a table to create nested channels. |
| table GetChannelMeta | ( | key | ) |
Get the meta data for a channel. This will return the meta data for the key.
| key | string or table The key to use for the channel. Use a table to create nested channels. |
| any GetData | ( | isoPlayer | , |
| namespace | , | ||
| keys | , | ||
| subscriptionID | , | ||
| callback | ) |
Gets a value from a namespace by key(s).
| isoPlayer | object (Optional) The player to get the value for. This is only used on the client to send a request to the server. |
| namespace | string The namespace to get the value from. |
| keys | string or table The key(s) to get the value for. Supplying a table will do a lookup through all keys and get value at the last index. |
| subscriptionID | string (Optional) A unique identifier for the subscription to be fired server-side after the value has been retrieved. |
| callback | function (Optional) A callback function to call after the value is retrieved. This is only used on the client to handle the response from the server. |
| void GetLocalData | ( | namespace | , |
| keys | ) |
| object GetModule | ( | moduleName | ) |
| object GetModuleMetaObject | ( | moduleName | ) |
Get a module's 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.
| moduleName | string The name of the module. |
| void GetNamespace | ( | namespace | ) |
Retrieves the entire namespace table.
| mixed GetNestedValue | ( | root | , |
| path | ) |
Get a nested value from a table using a path. This is used to get values from nested tables.
| root | table The root table to get the value from. |
| path | table The path to the value. This is a table of keys to traverse the nested tables. |
| table GetSubscribers | ( | key | ) |
Get the subscribers for a key. This will return the subscribers for the key.
| key | string The key to get the subscribers for. Use a table to get the subscribers for nested values. |
| string GetVersion | ( | ) |
Get the version of FrameworkZ Foundation.
| boolean HasChannel | ( | key | ) |
Check if a channel exists for a key. This will return true if the channel exists, false otherwise.
| key | string or table The key to use for the channel. Use a table to create nested channels. |
Check if a subscription exists for a key. This will return true if the subscription exists, false otherwise.
| id | string The ID of the function callback being checked. |
| void Initialize | ( | ) |
Initializes the framework foundation.
| void LogChannels | ( | ) |
Log all channels and their subscribers to the console. This is useful for debugging and understanding the network system.
| table New | ( | ) |
Create a new instance of the FrameworkZ framework.
| object NewModule | ( | moduleObject | , |
| moduleName | ) |
Create a new module for the FrameworkZ framework.
| moduleObject | object The object to use as the module. |
| moduleName | string The name of the module. |
Handles incoming commands from the client on the server.
| module | string The name of the module that sent the command. This should match the NetworksName defined in FrameworkZ.Foundation.NetworksName. |
| command | string The command that was sent by the client. |
| isoPlayer | object The player that sent the command. This is the player object that sent the command. |
| arguments | table The arguments that were sent with the command. This contains the data needed to process the command. |
| void OnGameStart | ( | ) |
Called when the game starts. Executes the OnGameStart function for all modules.
| void OnGetData | ( | data | , |
| namespace | , | ||
| keys | , | ||
| subscriptionID | ) |
Handles incoming commands from the server on the client.
| module | string The name of the module that sent the command. This should match the NetworksName defined in FrameworkZ.Foundation.NetworksName. |
| command | string The command that was sent by the server. |
| arguments | table The arguments that were sent with the command. This contains the data needed to process the command. |
| void OnServerStarted | ( | ) |
| void OnSetData | ( | data | , |
| namespace | , | ||
| keys | , | ||
| value | , | ||
| subscriptionID | , | ||
| broadcast | ) |
| string PathToString | ( | path | ) |
| void RegisterFramework | ( | ) |
Register FrameworkZ. This is called after framework definition.
| void RegisterFrameworkHandler | ( | ) |
Register hook handlers for the framework.
| framework | table The framework table containing the functions. |
Register hook handlers for the gamemode.
| module | table The module table containing the functions. |
| void RegisterGenericHandler | ( | ) |
Register hook handlers for a plugin.
| plugin | table The plugin table containing the functions. |
Register a handler for a hook.
| hookName | string The name of the hook. |
| handler | function The function to call when the hook is executed. |
| object | table (Optional) The object containing the function. |
| functionName | string (Optional) The name of the function to call. |
| category | string The category of the hook (framework, module, plugin, generic). |
| void RegisterHandlers | ( | objectOrHandlers | , |
| category | ) |
Register a module for FrameworkZ. This is called after module definition.
| module | object The module to register. |
Register hook handlers for a module.
| module | table The module table containing the functions. |
Registers a storage namespace, e.g., "Players".
| name | string The name of the namespace to register. |
Register hook handlers for a plugin.
| plugin | table The plugin table containing the functions. |
| string SendFire | ( | isoPlayer | , |
| subscriptionID | , | ||
| callback | , | ||
| ... ) |
Sends a fire event to the server or client. This is used to send events to subscribers.
| isoPlayer | object The player sending the fire event. If nil, the event will be fired but no confirmation will be sent back (send and forget). |
| subscriptionID | string The ID of the subscription to fire. This is the key used to subscribe to the event. It's recommended to use a string matching your function's callback name in a unique way when adding a subscription. |
| callback | function The callback to call when the server confirms the fire event. This is optional and can be nil if you don't need confirmation. |
| ... | multiple Additional arguments of any amount to pass to the subscription. These can be any type of values except functions as they do not get networked. |
| void SendGet | ( | key | , |
| callback | , | ||
| callbackID | , | ||
| broadcast | , | ||
| ... ) |
Sends a get request to the server.
| key | mixed The key to get. Does not support getting functions. |
| callback | function The callback to call on the client when the server returns the value. |
| callbackID | string The key to use for the callback on the server after getting the value. |
| broadcast | boolean Whether to broadcast the get callback to all clients. |
Sends a set request to the server.
| value | mixed The value to set. Does not support functions. |
| callback | function The callback to call on the client when the server confirms the set. |
| callbackID | string The key to use for the callback on the server after setting the value. |
| broadcast | boolean Whether to broadcast the set callback to all clients. |
| void ServerTick | ( | ) |
| boolean SetData | ( | isoPlayer | , |
| namespace | , | ||
| keys | , | ||
| value | , | ||
| subscriptionID | , | ||
| broadcast | , | ||
| callback | ) |
Sets a value in a namespace and (optionally) broadcasts to all clients.
| isoPlayer | object (Optional when called server-side only) The player to set the value for. This is only used on the client to send a request to the server. |
| namespace | string The namespace to set the value in. |
| keys | string or table The key(s) to set the value for. Supplying a table will do a lookup through all keys and set value at the last index. |
| value | any (except function) The value to set. |
| subscriptionID | string (Optional) A unique identifier for the subscription to be fired server-side after the value has been set. |
| broadcast | boolean (Optional) Whether or not to broadcast the value to all clients. |
| callback | function (Optional) A callback function to call after the value is set. This is only used on the client to handle the response from the server. |
| mixed SetNestedValue | ( | root | , |
| path | , | ||
| value | ) |
Set a nested value in a table using a path. This is used to set values in nested tables.
| root | table The root table to set the value in. |
| path | table The path to the value. This is a table of keys to traverse the nested tables. |
| value | mixed The value to set at the end of the path. |
Begin processing the queued keys for a player.
| void StartServerTick | ( | ) |
| function Subscribe | ( | key | , |
| idOrCallback | , | ||
| maybeCallback | ) |
Subscribes to a key to listen for changes with the first three arguments supplied, or can be used for sending/receiving fire events with the first two arguments supplied.
| idOrCallback | string or function The ID of the function callback being added, or the callback function itself. If a string is supplied, it will be used as the ID for the callback. |
| maybeCallback | function The callback function to call when the key changes. This is optional if the first argument is a function. |
| void UnregisterFrameworkHandler | ( | ) |
Unregister hook handlers for the framework.
| framework | table The framework table containing the functions. |
Unregister hook handlers for the gamemode.
| module | table The module table containing the functions. |
| void UnregisterGenericHandler | ( | ) |
Unregister hook handlers for a plugin.
| plugin | table The plugin table containing the functions. |
Unregister a handler from a hook.
| void UnregisterHandlers | ( | objectOrHandlers | , |
| category | ) |
Unregister hook handlers for a module.
| module | table The module table containing the functions. |
Unregister hook handlers for a plugin.
| plugin | table The plugin table containing the functions. |
Unsubscribes from a key. This will remove the callback from the channel.
| id | \sting The ID of the function callback being removed. Default for fire events: "__default" |
Subscribes and fires callback immediately if the value is already set. Useful for UIs.
| FrameworkZ Foundation Events |
Definition at line 87 of file __Foundation.lua.