Introduction
Modding Dungeondraft allows you to customize your software to have new tools, features, export formats, or appearances. Dungeondraft mods are compatible with version 1.1.0.0 newborn phoenix and higher.
Dungeondraft mods work by talking to Dungeondraft through a language similar to Python native to the Godot Engine called GDScript. You can familiarize yourself by reading the official GDScript documentation.
Structure
Every mod consists of a folder, a .ddmod file inside, and any number of .gd GDSCript files. Dungeondraft will automatically parse every .gd file inside a mod folder and call its start() function. There is no extra step needed to point to their paths. The .ddmod file exists to inform Dungeondraft's filesystem about your mod. It details your mod's name, version, author, unique id, minimum Dungeondraft version, and a description. It is written in the JSON format. The dependencies is optional and only necessary if you use scripts from other mods. See example:
{
"name": "Test Mod",
"unique_id": "Megasploot.TestMod",
"version": "1.0.0",
"author": "Megasploot",
"description": "Description here",
"dd_version": "1.1.0.0",
"dependencies": [ "Megasploot.ParentMod" ]
}
You can also include a PNG file named preview.png with 256x320 pixels to give any potential users of your mod a quick idea of what to expect. You can study an update-to-date structure here: https://github.com/Megasploot/Dungeondraft/tree/master/ddmods/toolmod
Scripting
Documentation
Tutorials
Development Environment
The recommended IDE for writing script is Visual Studio Code with the Godot Tools plugin installed. You can find the download for both here:
https://code.visualstudio.com/
https://marketplace.visualstudio.com/items?itemName=geequlim.godot-tools
By using this setup, you will have access to syntax highlighting and intellisense for the Godot Engine.
Script Types
The backbone of a Dungeondraft mod is the scripting. Dungeondraft scripts come in 2 flavors.
Tool Script
Example new tool script: https://github.com/Megasploot/Dungeondraft/blob/master/ddmods/toolmod/scripts/tools/example_new_tool.gd
Example tool extension script: https://github.com/Megasploot/Dungeondraft/blob/master/ddmods/toolmod/scripts/tools/example_extend_tool.gd
A tool script allows you to add a new tool onto the toolbar and extend a current tool featureset or invent completely new ones. You can add UI elements to the tool panel to the left side and also access the object or path library panels on the right.
Export Format Script
Example export format script: https://github.com/Megasploot/Dungeondraft/blob/master/ddmods/toolmod/scripts/export_formats/example_export_format.gd
Export format script allows you to add a new export format to the Dungeondraft export options. You can embed additional information to a PNG, JPG, or WEBP style export. Or you can extract additional information like LOS data to create your own VTT export format.