Frameworks
Updated for version 4.0.
Frameworks in BeardLib are a major part in BeardLib's mod loading, this is what loads the mods and gives them a place to stay in.
There are 3 frameworks in BeardLib: FrameworkBase, AddFramework and MapFramework.
Each framework gets added to this table: BeardLib.Frameworks. Each framework key is the type_name of the framework so: BeardLib.Frameworks.Base, BeardLib.Frameworks.Add, and BeardLib.Frameworks.Map. These are the classes you'd want to call to use functions such as GetModByName
.
FrameworkBase
The base framework, all other frameworks inherit this framework. By itself, the framework loads any main.xml it finds inside BLT mods.
Access with BeardLib.Frameworks.Base
Variables
_directory
String
The directory of the mods that the framework should load. In this case it's set to "mods/"
_mod_core
Class
main_file_name
String
The main file that the framework should load. All frameworks use "main.xml"
auto_init_module
Boolean
Automatically initialize the modules in this framework?
_ignore_folders
Table
A table of folders that the framework should ignore. The values inside are folder = true
_ignore_detection_errors
Boolean
Determines if the framework should not log about folders it could not find a main.xml in the directory of the framework. Defaults to true (Except map framework)
menu_color
Color
The default color of mods that are inside this framework (Shown in the BeardLib mods manager)
Functions
init()
The init function. Registers the framework to BeardLib using BeardLib:RegisterFramework and sets up stuff. Creates a hook that runs every time require is called and in that hook CheckModQueue is called
CheckModQueue(Booolean post, String file)
Called a few times to check for mods that are waiting to load through a post or pre hook
Load()
Called after init finished the setup process
FindMods
Searches for mods to load. Loads each mod using LoadMod
SortMods
Sorts the mods based on priority
InitMods
Calls PreInitModules on mods to start loading the modules. Mods with post_hook
or pre_hook
will load be added to self._waiting_to_load
RegisterHooks()
Called automatically by a BeardLib hook for each framework from some point in tweakdata. This calls DoRegisterHook
for modules and some modules use this point to add hooks for tweakdata
log(s, ...)
A log function. Parameters act like string.format
DevLog(s, ...)
Same as log but only logs when BeardLib has developer mode on (mods folder needs to have mod.txt file and you need to turn on the option in BeardLib options)
LoadMod(String folder_name, String directory, String main_file)
Instantiates a mod.
AddMod(String dir, ModCore mod)
Adds the mod to the mod lists
RemoveMod(String dir)
Removes the mod from the mod lists
Get
GetModByDir(String dir)
ModCore
Returns a mod based on a directory. For example mods/Holo will return HoloUI if exists
GetModByName(String name)
ModCore
Returns a mod based on a name. For example Sora HUD Reborn will return the Sora's HUD mod
AddFramework
The framework for mod overrides mods and add.xml.
Access with BeardLib.Frameworks.Add
Variables
add_configs
Table
The table that holds all add.xml configs. Each config is stored in a mod path key.
Inherits BaseFramework and does the following things:
Allows loading a file named "add.xml" which is a quick and dirty way of loading AddFiles by modifying the
FindMods
function to pickup these files.Sets
_directory
to assets/mod_overrides
MapFramework
The framework for custom maps basically your "Maps" folder.
Access with BeardLib.Frameworks.Map
Inherits BaseFramework and does the following things: Sets _directory
to "Maps" Sets _ignored_folders
to {"backups", "prefabs"} to ignore the default editor folders
Modules of interest
Functions
AddCustomContact()
A function called from a modified RegisterHooks
to create a default contact for custom maps
Get
GetMapByJobId(String job_id)
ModCore
Searches for a mod that has a narrative/job with id job_id
and returns it
Last updated