ModuleBase
Parameters that all modules use.
Updated for version 3.38.
ModuleBase
XML Structure
<ModuleName file name post_init_clbk ...>
<ModuleName file name post_init_clbk ...>
Parameter | Type | Description |
---|---|---|
ModuleName | Meta | The registered key or class name of the module |
name | String | [OPTIONAL] unique name which is used as the key when it is being placed in the mod's table. Only really required if you wish to have a different name than the Modules |
init_clbk | String | Path/name to the function which is called when the init function is called (after the config has loaded of course) |
post_init | String | Path/name to the function which is called when the PostInit function is called |
file | String | String file path to an individual file which will be used as the module configuration |
file_type | String | Type of file to load if using |
Head variables
Variable | Type | Description |
---|---|---|
type_name | String | The name of the module. This is used when the module is registered with |
required_params | Table | Required parameters for the module to have. For example ItemModuleBase has "id" as a required parameter |
auto_load | Boolean | Should the :Load() function be automatically called? This is set to true in this class but not in ItemModuleBase (doesn't use it actually) and not in some select few modules |
_loose | Boolean | Decides if the module can be used a few times in the same mod. True by default for ItemModuleBase |
Functions
Function | Description |
---|---|
init(ModCore mod, Table config) | Initializes the module |
Load() | Loads the module. This is called after the mod has been initialized and is ready to load the modules' code. Note: Not all modules use this function to load. |
PostInit | A function called after all modules of the mod were loaded. This is useful when you need a little late point to load the module |
Log(String str, ...) | A log function. The parameters act like string.format |
Err(String str, ...) | Logs an error message to the console ([ERROR] + message). The parameters are like in string.format. The errors get logged and shown in errors dialog if developer mode is active |
Warn(String str, ...) | Logs a warning message to the console ([WARN] + message). The parameters are like in string.format |
LogErr(...) | Same as |
GetPath(String directory, String prev_dir) | A simple function used by some modules to join paths. if prev_dir is null it will use ModPath instead. |
ItemModuleBase
Inherits ModuleBase
The class is used to load "item" type modules, such as weapons. Also when you need to add something to the tweak_data as it doesn't fully load if you try to call it from Load() or PostInit().
XML Structure
Like ModuleBase but adds the following:
Parameter | Type | Description |
---|---|---|
register_hook | String | Path/name to the function which is called before calling RegisterHook |
post_register_hook | String | Path/name to the function which is called after calling RgisterHook |
Head variables
Variable | Type | Description |
---|---|---|
clean_table | Table | Set of rules for cleaning the table. See |
Functions
Function | Description |
---|---|
DoRegisterHook | Called by the framework's RegisterHooks function. Calls |
RegisterHook | Loads the module. In most modules of this type we are adding hooks to bunch of tweakdata classes to add our stuff |
DoCleanTable(Table config) | Cleans the configuration of the module depending on the |
Last updated