Skip to content

Mod Files

Darkly77 edited this page Jan 17, 2023 · 25 revisions

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

Example mod_main.gd

See API Methods for more info.

extends Node

const MOD_DIR = "AuthorName-ModName/"
const LOG_NAME = "AuthorName-ModName"

var dir = ""
var ext_dir = ""
var trans_dir = ""

func _init(modLoader = ModLoader):
	modLoader.mod_log("Init", LOG_NAME)
	dir = modLoader.UNPACKED_DIR + 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 + "translations/bfx.en.translation")


func _ready():
	ModLoader.mod_log("Done", LOG_NAME)

Example manifest.json

{
	"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": {
			"id": "AuthorName-ModName",
			"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": {}
		}
	}
}
Clone this wiki locally