BeardLib Class
Updated for version 4.0.
BeardLib class
Contains a few useful functions.
Variables
Parameter | Type | Description |
---|---|---|
Name | String | The name of mod which of course is "BeardLib" |
ModPath | String | Path to BeardLib's folder. Generally mods/BeardLib |
Frameworks | Table | A table holding all frameworks of BeardLib |
Managers | Table | A table holding all managers of BeardLib |
Menus | Table | A table holding the menus of BeardLib (mods manager and achievements) |
MusicMods | Table | A table holding music mods |
Modules | Table | holds all modules of BeardLib |
Functions
The BeardLib class inherits most of the functions found in ModCore
Usable functions
Function | Description |
---|---|
AddUpdater(String id, Function clbk, Boolean paused) | Adds an updater which is called after the update function is called. |
RemoveUpdater(String id) | Removes updater with id |
CallOnNextUpdate(Function func, Boolean only_unpaused, Boolean only_paused) | Adds a function to be called in the next update. After it's called once it won't be called again unless you run this again. |
RegisterModule(String key, Table module) | Registers a module with |
GetPath() | Returns the path of BeardLib. Should always be "mods/BeardLib" |
RegisterFramework(String name, Table clss) | Adds a framework class to the framweworks list (Called automatically even if you create a custom framework). Though, in extreme cases you may need to use it |
RegisterManager(String name, Table clss) | Registers a manager class for BeardLib |
RegisterMenu(String name, Table clss) | Registers a menu class for BeardLib. For example, the mods menu |
RegisterClass(String name, Any obj, Number typ) | Registers a class. |
ModError(ModCore mod, String str, ...) | Called usually by ModCore itself. This error is a little different than the regular Err function in that this will show a message to the user. |
Core functions
These functions are automatically called by BeardLib. Therefore, there's no point in calling them. Some are more BeardLib specific.
Function | Description |
---|---|
Init() | The initialization function of BeardLib |
LoadClasses(Table config, String prev_dir) | Loads the classes that BeardLib uses. |
LoadModules(String dir) | Loads BeardLib's modules by getting all files in /Modules/ or dir. |
LoadLocalization() | Loads the localization files from /Localization adds them to a LocalizationModule afterwards |
Update(Number t, Number dt) | The update function for BeardLib |
PausedUpdate(Number t, Number dt) | The update function that runs when the game is paused for BeardLib |
RegisterTweak() | Adds the mod global value and mod DLC to the tweakdata |
MigrateModSettings() | Migrates mod settings of BeardLib versions before 4.0 to the 4.0 format. The change involves moving DisabledMods and IgnoredUpdates to the ModSettings table which will hold configurations for mods. |
ShowErrorsDialog() | Gets automatically called by BeardLib when entering main menu and there are mod errors to show. Can be turned off by an option |
DevLog(String str, ...) | Used by BeardLib for debugging. Generally does nothin without editing the function |
Return functions
Function | Return Type | Description |
---|---|---|
ManagerClass(String name, Any inherit) | class() | Makes a new manager class. With |
MenuClass(String name, Any inherit) | class() | Same as ManagerClass just for menus |
ModuleClass(String name, Any inherit) | class() | Same as ManagerClass just for modules |
FrameworkClass(String name, Any inherit) | class() | Same as ManagerClass just for frameworks |
Last updated