new ModManager()
the main mod manager that handles loading and unloading all mods
Extends
Members
-
_modsDict :Object.<string, Mod>
-
a dictionary of all mods
-
_path :string
-
the current path that the mod loader is looking at
-
forceModdedSaves
-
a control variable for whether the engine will force modded saves to be used or not
- Default Value:
- false
- Current Value:
-
forceVanillaSaves
-
a control variable for whether the engine will force vanilla saves to be used or not
- Default Value:
- false
- Current Value:
Methods
-
addModEntry(name, args)
-
add a mod entry to the list of mods
Parameters:
Name Type Description name
* the name of the mod
args
* any other args that this mod might have
-
addOffloadScriptToMod(name, cb)
-
add a offload script that will be called when a mod is deactivated to a mod
Parameters:
Name Type Description name
String the name of the mod
cb
function the call back to be called
-
addOnloadScriptToMod(name, cb)
-
add a offload script that will be called when a mod is activated to a mod
Parameters:
Name Type Description name
String cb
function -
callOnLoadModScript(modName)
-
this will check the _modsDict and see if this mod has an offload script
Parameters:
Name Type Description modName
string the name of the mod to call the off load script of
-
callOnOffloadModScript(modName)
-
this will check the _modsDict and see if this mod has an offload script
Parameters:
Name Type Description modName
string the name of the mod to call the off load script of
-
checkForceModdedSaves()
-
check if the force modded saves option is set to true
-
checkForceVanillaSaves()
-
check if the force vanilla saves option is set to true
-
checkMod(name) → {boolean}
-
Parameters:
Name Type Description name
* the name of the mod
Returns:
boolean -is the mod enabled
-
checkModHasChanged() → {boolean}
-
check if a mod have changed their status
Returns:
boolean -
checkModded()
-
check if any mods are enabled
-
checkModsChanged() → {boolean}
-
check if any mods have changed their status
Returns:
boolean -
checkSaveDanger()
-
check if any dangerous mods are enabled
-
checkVanilla()
-
check if no mods are enabled
-
disableAndReload()
-
disable all mods and reload the game as vanilla
-
generateDefaultJSONForMod(modName)
-
write a default json file for the mod name
Parameters:
Name Type Description modName
string the file name to write not including .json
-
generateDefaultJsonForModsWithoutJsons()
-
generate the default json file for all mods without jsons
-
getActiveRealDangerMods()
-
get a list of all active real mods (not dependencies) that are marked as dangerous.
Returns:
-a list of all real danger mods
-
getActiveRealMods() → {array}
-
get a list of all mods, not including preReqs from file system
Returns:
array -mod info array
-
getAllMods()
-
Returns:
-all mods
-
getModArr() → {Array.<Mod>}
-
convert the mods dict into an arr and return
Returns:
Array.<Mod> -
getModConfigFile(name) → {string}
-
get the html config file for the mod
Parameters:
Name Type Description name
string the name of the mod
Returns:
string -the path to the html file for this mod
-
getModInfo(path, modName)
-
get mod info about a mod
Parameters:
Name Type Description path
* path to the file
modName
* the name of the file
Returns:
-a modinfo obj
-
getModsFolder() → {Array.<String>}
-
get a list of all files in the mods dir
Returns:
Array.<String> -an array of all file names in the mods folder
-
getModsWithoutJson()
-
find all files in the mods folder that do not have a json file attached to them
-
getPath() → {string}
-
get the path of the mods folder, checking if we are in dev or prod mode and adding the appropriate prefix
Returns:
string -proper path
-
parseMod(path, modName)
-
Add a mod to the list of mods that setup will initialize. All mod dependencies (Defined in its mod.json) will be loaded before that mod.
Parameters:
Name Type Description path
* the path to the folder
modName
* the name of the json file containing the mod info
-
parseMods(path)
-
finds all mod in a folder
Parameters:
Name Type Description path
String the path of the folder inside www/ to load mods from
Returns:
-a list of mods
-
reloadGame()
-
reload the window
-
reloadIfChangedGame()
-
reload the game if changes were made to the mod jsons
-
setEnabled(modName, bool)
-
disable the s
Parameters:
Name Type Description modName
String the mod name to change
bool
boolean whether to set the mod as enabled or disabled
-
setNonDanger()
-
toggle off all mods that are dangerous
-
setVanilla()
-
toggle off all mods
-
setupMods(mods)
-
load all mods from a list that are not already loaded
Parameters:
Name Type Description mods
Array.<Mod> a list of mods to load
Returns:
-a promise that will resolve once all scripts are loaded
- Deprecated:
- we just use the inherited method setup from plugin manager see top of file
-
switchForceModdedSaves()
-
switch the value of the force modded saves option
-
switchForceVanillaSaves()
-
switch the value of the force vanilla saves option