-
Notifications
You must be signed in to change notification settings - Fork 39
Mod Files
Mods you create must have the following 2 files:
- mod_main.gd - The init file for your mod
- manifest.json - Meta data for your mod
See API Methods for more info.
extends Node
const MYMODNAME_MOD_DIR = "AuthorName-ModName/"
const MYMODNAME_LOG = "AuthorName-ModName"
var dir = ""
var ext_dir = ""
var trans_dir = ""
func _init(modLoader = ModLoader):
ModLoaderUtils.log_info("Init", MYMODNAME_LOG)
dir = modLoader.UNPACKED_DIR + MYMODNAME_MOD_DIR
ext_dir = dir + "extensions/"
trans_dir = dir + "translations/"
# Add extensions
modLoader.install_script_extension(ext_dir + "main.gd")
# Add translations
modLoader.add_translation_from_resource(trans_dir + "modname_text.en.translation")
func _ready():
ModLoaderUtils.log_info("Done", MYMODNAME_LOG)
⚠ Warning: The const variable you use to log (
MYMODNAME_LOG
in the example above) should always be unique to your own mod, in every file you use it. Otherwise, if another mod uses that same variable, you'll get an error.
{
"name": "ModName",
"namespace": "AuthorName",
"version_number": "1.0.0",
"description": "Mod description goes here",
"website_url": "https://github.com/example/repo",
"dependencies": [
"Add IDs of other mods here, if your mod needs them to work"
],
"extra": {
"godot": {
"incompatibilities": [
"Add IDs of other mods here, if your mod conflicts with them"
],
"authors": ["AuthorName"],
"compatible_mod_loader_version": "3.0.0",
"compatible_game_version": ["0.6.1.6"],
"config_defaults": {}
}
}
}
💡 Tip: This uses the structure of Thunderstore packages, which means you can use the same manifest.json for both your mod and your Thunderstore package.
GDScript has a style guide you can read here. Following the guide will help your code be more consistent, and make it easier to maintain and expand by other modders.
When naming files, use snake_case, and only use the characters A-z
, 0-9
, and _
.
Note: ModLoader mods use hyphens (-
) for mod names, but they shouldn't be used in any other case.
Next: API Methods
Warning
This documentation has moved!
You can find it here: https://wiki.godotmodding.com/
- Home
- Getting Started
- ModLoader API
- Reference
- Guides
- Versions & Releases