Scripting Reference - Megasploot/Dungeondraft GitHub Wiki
Functions and properties in this section are available to all scripts.
Functions and properties in this category are related to the tools and user interface of Dungeondraft. They are accessed through Global.Editor.VariableName.
Array<Tool> Global.Editor.Tools
Provides access to every tool in Dungeondraft by name. For example, you can access the Object Tool by indexing the variable in this manner Global.Editor.Tools["ObjectTool"]
.
Valid tool names are:
- SelectTool
- TextTool
- PrefabTool
- FloorShapeTool
- PatternShapeTool
- WallTool
- PortalTool
- RoofTool
- PathTool
- ObjectTool
- ScatterTool
- CaveBrush
- WaterBrush
- TerrainBrush
- MaterialBrush
- Environment
- LightTool
- Generator
- MapSettings
- LevelSettings
- LayerSettings
- TraceImage
ToolPanel Global.Editor.Toolset.CreateModTool(Reference script_instance, String category, String id, String name, String icon)
Creates a new tool inside Dungeondraft and automatically generates a Tool Panel as the return.
The category is the set of tools the new tool will show under. Valid options are
- Design
- Terrain
- Objects
- Effects
- Settings
The id is the internal tool name, while the name is displayed to the end user.
The icon is the path to a PNG to use as the button.
Functions and properties in this category are related to the map. They are accessed through Global.World.VariableName.
This name is base directory of the mod a script is packaged in. It is helpful for locating other files inside a mod, like a PNG file for icons. For example, you can assign a variable to a PNG filename by combining the Root name with a known relative path like so:
var icon = Global.Root + "icons/example_tool.png"
Functions in this category are specialized for modding Dungeondraft. They are accessed through Script.VariableName.
Array<String> Script.GetActiveMods()
Returns an Array of Strings of unique IDs of all active mods.
Functions and properties in this section are available only to tool scripts.
Array<String> Script.GetAssetList(String category)
Returns an Array of Strings populated by the path to all the assets of that category.
Valid categories are:
- Terrain
- Patterns
- Patterns Colorable
- Caves
- Roofs
- Objects
- Walls
- Materials
- Portals
- Paths
- Lights
- Simple Tiles
- Smart Tiles
- Smart Tiles Double