GDScript API
GDPatch registers a GDScript autoload named GDPatch that can be used in your scripts. If you include a scene or script in your mod’s pack file, it will be loaded as a child of the autoload.
API reference
Section titled “API reference”These are available under the GDPatch global in GDScript, or at /root/GDPatch in the scene tree. Be careful not to confuse it with the Lua patchers.
GDPatch.get_mod()
Section titled “GDPatch.get_mod()”- Arguments:
mod_id:string
Returns the node loaded by a specific mod ID, if it exists.
var node = GDPatch.get_mod("example_mod")GDPatch.get_mods()
Section titled “GDPatch.get_mods()”Returns an array containing all loaded mod manifests. You can access the mod ID via the id field.
var mods = GDPatch.get_mods()print("Loaded mods: ", mods)GDPatch.get_config_option()
Section titled “GDPatch.get_config_option()”- Arguments:
mod_id:stringsection:stringoption:string
Returns the value saved in the config file, or the default value specified in the manifest if set.
var option = GDPatch.get_config_option("example_mod", "section_id", "option_id")print(option)GDPatch.set_config_option()
Section titled “GDPatch.set_config_option()”- Arguments:
mod_id:stringsection:stringoption:stringvalue:any
Saves the specified value to the config file, or removes it if value is null.
var value = "meow"GDPatch.set_config_option("example_mod", "section_id", "option_id", value)