### void Start() Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/World Called at the start of the map creation to initialize the GridMesh, Bounds, and ExportFX. ```APIDOC ## void Start() ### Description Called at the start of the map creation to initialize the GridMesh, Bounds, and ExportFX. ### Method Start ``` -------------------------------- ### Tool Script: Minimum Viable Example Source: https://megasploot.github.io/DungeondraftModdingAPI/Scripting The smallest Tool Script. Sets script_class to "tool" and defines the start() method, which is called after the script instance is created and assets are loaded, but not on the welcome screen. ```gdscript var script_class = "tool" func start(): pass ``` -------------------------------- ### Start Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/Exporter Starts the export process on a separate thread. The mode parameter selects the export format: 0=PNG, 1=JPEG, 2=WEBP, 3=UniversalVTT, 4=Mod. ```APIDOC ## Start ### Description Starts the export process. Runs on separate thread. The parameter mode sets which format to export to. Valid options are: 0 = PNG, 1 = JPEG, 2 = WEBP, 3 = UniversalVTT, 4 = Mod. ### Method void ### Parameters - **mode** (int) - Required - The export format: 0=PNG, 1=JPEG, 2=WEBP, 3=UniversalVTT, 4=Mod. - **ppi** (int) - Required - Pixels per inch for the export. - **path** (String) - Required - The file path to save the export. ### Response No return value. ``` -------------------------------- ### GetGuidePosition() Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/WorldUI Returns the guide position. ```APIDOC ## GetGuidePosition() ### Description Returns the guide position. ### Method GetGuidePosition ### Parameters None ### Return Value Vector2 - The guide position. ``` -------------------------------- ### Export Format Script: Minimum Viable Example Source: https://megasploot.github.io/DungeondraftModdingAPI/Scripting The smallest Export Format Script. Sets script_class to "export_format" and defines required variables (export_format_name, export_file_extension, export_image_format, show_quality_slider) and the start() and process() methods. process() is called after the imaging step of the export process. ```gdscript var script_class = "export_format" var export_format_name = "Export Format Name" var export_file_extension = "myexportextension" var export_image_format = "webp" var show_quality_slider = true func start(): pass func process(path : String, image : File, ppi : int): pass ``` -------------------------------- ### ClearGuidePosition() Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/WorldUI Clears the guide position. ```APIDOC ## ClearGuidePosition() ### Description Clears the guide position. ### Method ClearGuidePosition ### Parameters None ### Return Value void ``` -------------------------------- ### BeginSection Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/ToolPanel Starts a new UI section. All UI controls created after this call will be enclosed in the section until EndSection is called. ```APIDOC ## BeginSection ### Description Encloses all UI controls created afterwards inside a section. Must be closed with EndSection(). The parameter stretch causes the section to extend all the way to the bottom of the panel. ### Method BeginSection ### Parameters - **stretch** (bool) - Optional - Default: true - If true, the section extends to the bottom of the panel. ### Returns VBoxContainer - The section container. ``` -------------------------------- ### Get asset list with Script.GetAssetList(String category) Source: https://megasploot.github.io/DungeondraftModdingAPI/Globals Returns an Array of Strings populated by the path to all the assets of that category. Valid categories are Asset Categories. ```gdscript Array Script.GetAssetList(String category) ``` -------------------------------- ### Init() Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/ObjectLibraryPanel Initializes the menu and loads the assets. This method should be called to set up the panel. ```APIDOC ## Init() ### Description Initialize the menu and load the assets. ### Method Init ### Parameters None ### Returns void ``` -------------------------------- ### Quickswitch Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/Toolset Instantly changes to a new tool. ```APIDOC ## Quickswitch ### Description Instant change to a new tool. ### Method void Quickswitch(String tool) ### Parameters - **tool** (String) - Required - The name of the tool to switch to. ### Returns void ``` -------------------------------- ### Init Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/Toolset Initializes the toolset. Called once on launch. ```APIDOC ## Init ### Description Initialize the toolset. Called once on launch. ### Method void Init() ### Parameters None ### Returns void ``` -------------------------------- ### void Set ( Vector2[] points, Texture texture, Color color, bool loop = true, bool shadow = true, int type = 0, int joint = 1, bool normalizeUV = true ) Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/Wall Initializes and sets options for the wall. Type is the type of wall: 0 = Auto, 1 = Manual, 2 = Cave. Joint parameter valid options: 0 = Sharp, 1 = Bevel, 2 = Round. ```APIDOC ## void Set ( Vector2[] points, Texture texture, Color color, bool loop = true, bool shadow = true, int type = 0, int joint = 1, bool normalizeUV = true ) ### Description Initializes and sets options for the wall. Type is the type of wall: 0 = Auto, 1 = Manual, 2 = Cave. Joint parameter valid options: 0 = Sharp, 1 = Bevel, 2 = Round. ### Method Set ### Parameters - **points** (Vector2[]) - Required - The points of the wall. - **texture** (Texture) - Required - The texture of the wall. - **color** (Color) - Required - The color of the wall. - **loop** (bool) - Optional - Whether the wall loops. - **shadow** (bool) - Optional - Whether the wall casts shadows. - **type** (int) - Optional - Type of wall: 0 = Auto, 1 = Manual, 2 = Cave. - **joint** (int) - Optional - Joint type: 0 = Sharp, 1 = Bevel, 2 = Round. - **normalizeUV** (bool) - Optional - Whether to normalize UV. ``` -------------------------------- ### GetToolPanel Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/Toolset Gets a ToolPanel by its tool name. ```APIDOC ## GetToolPanel ### Description Gets a ToolPanel by its tool name. ### Method ToolPanel GetToolPanel(String tool) ### Parameters - **tool** (String) - Required - The name of the tool. ### Returns ToolPanel - The ToolPanel associated with the given tool name. ``` -------------------------------- ### LightTool.CreatePreview() Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/LightTool Creates a new light as a preview and stores it in the preview property. ```APIDOC ## LightTool.CreatePreview() ### Description Creates a new light as a preview and stores it in the preview property. ### Method CreatePreview ### Parameters None ### Returns void ``` -------------------------------- ### get_vertices Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/Plexigon2D Gets all vertices in all polygons as an array. ```APIDOC ## get_vertices ### Description Get all the vertices in all polygons in an Array. ### Method Vector2[] ### Parameters None ### Returns Vector2[] - All vertices. ``` -------------------------------- ### void LevelUp() Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/World Goes up a level. ```APIDOC ## void LevelUp() ### Description Go up a level. ### Method LevelUp ``` -------------------------------- ### get_polygon_count Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/Plexigon2D Gets the total polygon count. ```APIDOC ## get_polygon_count ### Description Get total polygon count. ### Method int ### Parameters None ### Returns int - The number of polygons. ``` -------------------------------- ### Enable Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/Toolset Enables the toolbar. ```APIDOC ## Enable ### Description Enable the toolbar. ### Method void Enable(bool value) ### Parameters - **value** (bool) - Required - Whether to enable or disable. ### Returns void ``` -------------------------------- ### get_outline_count Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/Plexigon2D Gets the total number of outlines. ```APIDOC ## get_outline_count ### Description Get total number of outlines. Once converted to polygon and cleared, it would be zero. ### Method int ### Parameters None ### Returns int - The number of outlines. ``` -------------------------------- ### get_outline Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/Plexigon2D Gets the points of an outline by its index. ```APIDOC ## get_outline ### Description Get the points of a outline by id. ### Method Vector2[] ### Parameters - **idx** (int) - Required - The index of the outline. ### Returns Vector2[] - The outline points. ``` -------------------------------- ### InitShaderMaterial() Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/MaterialMesh Called automatically to set up the shader. This method initializes the shader material used by the mesh. ```APIDOC ## InitShaderMaterial() ### Description Called automatically to set up the shader. ### Method InitShaderMaterial ### Returns - **ShaderMaterial** - The shader material used for shading. ``` -------------------------------- ### SetGuidePosition(Vector2 position) Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/WorldUI Sets the guide position. ```APIDOC ## SetGuidePosition(Vector2 position) ### Description Sets the guide position. ### Method SetGuidePosition ### Parameters - **position** (Vector2) - Required - The guide position to set. ``` -------------------------------- ### get_polygon Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/Plexigon2D Gets the vertex indices of a specific polygon. ```APIDOC ## get_polygon ### Description Get the vertex indices of a specific polygon. ### Method int[] ### Parameters - **idx** (int) - Required - The index of the polygon. ### Returns int[] - The vertex indices. ``` -------------------------------- ### void AddTraceImage(String path, float scale, float opacity) Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/World Loads a new trace image from a file path. ```APIDOC ## void AddTraceImage(String path, float scale, float opacity) ### Description Load a new trace image from a file path. ### Method AddTraceImage ### Parameters - **path** (String) - Required - The file path to the trace image. - **scale** (float) - Required - The scale for the trace image. - **opacity** (float) - Required - The opacity for the trace image. ``` -------------------------------- ### GetShapes Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/PatternShape Gets the parent PatternShapes that holds all the shapes on the same level. ```APIDOC ## GetShapes ( ) ### Description Gets the parent PatternShapes that holds all the shapes on the same level. ### Method GetShapes ### Returns - **PatternShapes** - The parent PatternShapes instance. ``` -------------------------------- ### ShowAllObjects() Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/ObjectLibraryPanel Displays all object assets in the menu. ```APIDOC ## ShowAllObjects() ### Description Show all object assets in the menu. ### Method ShowAllObjects ### Parameters None ### Returns void ``` -------------------------------- ### CreateTilesetMenu Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/ToolPanel Generates the menu that displays the floor tile options. ```APIDOC ## CreateTilesetMenu ### Description Generates the menu that displays the floor tile options. ### Method CreateTilesetMenu ### Parameters - **property** (String) - Required - The property to bind the menu to. ### Returns - **void** - No return value. ``` -------------------------------- ### GetCustomChunkSize Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/Exporter Gets the custom camera chunk size if enabled. ```APIDOC ## GetCustomChunkSize ### Description Gets the custom camera chunk size if enabled. ### Method Vector2 ### Parameters None. ### Response Returns a Vector2 representing the custom chunk size. ``` -------------------------------- ### PrefabTool Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/PrefabTool The PrefabTool class provides methods to manage prefab sets, select prefabs, create instances, delete prefabs, clear previews, and confirm changes. It is accessed via Global.Editor.Tools["PrefabTool"]. ```APIDOC ## PrefabTool ### Description The tool used to edit the prefabs. Accessed by `Global.Editor.Tools["PrefabTool"]`. ### Properties - **set** (OptionButton) - The UI button that allows the user to select a set of prefabs. - **list** (ItemList) - The UI list that allows the user to select a prefab. - **preview** (Dictionary) - The preview of the prefab created by Instance() with the keys being the reference to the asset instances and their values being their type as an int. ### Methods - **void SetSet(int index)** - Called by the UI when the user changes a set to update the prefab list. - **void OnSelectPrefab(int index)** - Called by the UI when the user selects a specific prefab and instances it as a preview. Calls Instance(). - **void Instance()** - Creates a new instance of a prefab and sets it as the preview property. - **void Forget()** - Deletes the currently selected prefab (not the instance) from the list. - **void Clear()** - Deletes the current prefab instance (the preview). - **void Confirm()** - Make the preview prefab permanent and records its Undo history. ### Method Details #### SetSet(int index) Called by the UI when the user changes a set to update the prefab list. #### OnSelectPrefab(int index) Called by the UI when the user selects a specific prefab and instances it as a preview. Calls Instance(). #### Instance() Creates a new instance of a prefab and sets it as the preview property. #### Forget() Deletes the currently selected prefab (not the instance) from the list. #### Clear() Deletes the current prefab instance (the preview). #### Confirm() Make the preview prefab permanent and records its Undo history. ``` -------------------------------- ### Level GetCurrentLevel() Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/World Gets the level currently visible and editable to the user. ```APIDOC ## Level GetCurrentLevel() ### Description Get the level currently visible and editable to the user. ### Method GetCurrentLevel ### Returns - **Level** - The current level. ``` -------------------------------- ### void Init ( float min, float max, float step, float minValue, float maxValue ) Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/RangeSlider Initializes the RangeSlider control with the given minimum, maximum, step, and initial values. ```APIDOC ## Init ### Description Call to initialize the Control with the proper values. ### Method Init ### Parameters - **min** (float) - Required - The minimum value of the slider range. - **max** (float) - Required - The maximum value of the slider range. - **step** (float) - Required - The step increment for the slider. - **minValue** (float) - Required - The initial value for the minimum slider. - **maxValue** (float) - Required - The initial value for the maximum slider. ### Returns void ``` -------------------------------- ### TerrainBrush Properties Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/TerrainBrush Properties available on the TerrainBrush tool for getting or setting brush and terrain state. ```APIDOC ## TerrainBrush Properties ### Description Properties available on the TerrainBrush tool for getting or setting brush and terrain state. ### Properties #### Enabled (bool) - **Type:** bool - **Access:** Read-only - **Description:** Gets if the tool is enabled by the user. #### BrushRadius (float) - **Type:** float - **Access:** Read-only - **Description:** Gets the brush radius in canvas unit size. #### IsPainting (bool) - **Type:** bool - **Access:** Read-only - **Description:** Gets if the user is currently painting. #### TerrainID (int) - **Type:** int - **Access:** Read/Write - **Description:** Get or set the terrain being painted by slot order. #### SmoothBlending (bool) - **Type:** bool - **Access:** Read-only - **Description:** Get if the brush is smooth. Call SetSmoothBlending() to set instead. #### Size (float) - **Type:** float - **Access:** Read/Write - **Description:** Get or set the size of the brush. #### Intensity (float) - **Type:** float - **Access:** Read/Write - **Description:** Get or set the intensity of the brush. #### brush (Image) - **Type:** Image - **Access:** Read-only - **Description:** The Godot Image of the current brush style. #### previousSplat (Image) - **Type:** Image - **Access:** Read-only - **Description:** The previous version of the splatmap of the Terrain. Used for undo history. #### previousSplat2 (Image) - **Type:** Image - **Access:** Read-only - **Description:** The previous version of the 2nd splatmap needed when slots are expanded to 8. Used for undo history. #### terrainList (ItemList) - **Type:** ItemList - **Access:** Read-only - **Description:** The UI Control that contains the current set of textures available. #### terrainButtonBox (VBoxContainer) - **Type:** VBoxContainer - **Access:** Read-only - **Description:** The UI Control that contains all the terrain selection buttons. #### extendedTerrainTypes (bool) - **Type:** bool - **Access:** Read-only - **Description:** Gets whether or not the user has selected to expand terrain slots. ``` -------------------------------- ### void InsertPortal ( Portal portal, bool remakeLines ) Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/Wall Inserts a Portal onto this Wall manually. Proceed with caution. ```APIDOC ## void InsertPortal ( Portal portal, bool remakeLines ) ### Description Inserts a Portal onto this Wall manually. Proceed with caution. ### Method InsertPortal ### Parameters - **portal** (Portal) - Required - The portal to insert. - **remakeLines** (bool) - Required - Whether to remake lines after insertion. ``` -------------------------------- ### Get active mods with Script.GetActiveMods() Source: https://megasploot.github.io/DungeondraftModdingAPI/Globals Returns an Array of Strings of unique IDs of all active mods. ```gdscript Array Script.GetActiveMods() ``` -------------------------------- ### WallTool.GetWallColor(Texture texture = null) Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/WallTool Gets the current selected wall style's color if applicable. ```APIDOC ## GetWallColor(Texture texture = null) ### Description Get the current selected wall style's color if applicable. ### Method GetWallColor ### Parameters - **texture** (Texture) - Optional - The texture to get the color for. Defaults to null. ### Returns Color ``` -------------------------------- ### Load(String[] data) Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/ColorPalette Loads the presets from an Array of hexcodes. Calls AddPresets() internally. ```APIDOC ## Load(String[] data) ### Description Loads the presets from an Array of hexcodes. Calls AddPresets() internally. ### Method Load ### Parameters - **data** (String[]) - Required - Array of hexcodes to load as presets. ### Returns void ### Example ``` colorPalette.Load(["#ff0000", "#00ff00"]) ``` ``` -------------------------------- ### Get current level with Global.World.GetCurrentLevel() Source: https://megasploot.github.io/DungeondraftModdingAPI/Globals Returns the current level object, used to hold and modify the map itself. ```gdscript Global.World.GetCurrentLevel() ``` -------------------------------- ### CreateDropdownMenu Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/ToolPanel Creates a Godot OptionButton (dropdown menu) and fills it with the given options. ```APIDOC ## CreateDropdownMenu ### Description Creates and returns a Godot OptionButton (which is a dropdown menu) and autofill the menu with options. ### Method CreateDropdownMenu ### Parameters - **property** (String) - Required - The property name to bind the dropdown to. - **options** (String[]) - Required - The list of options. - **default** (String) - Required - The default selected option. ### Returns OptionButton - The created dropdown menu. ``` -------------------------------- ### FindBestLocation(Vector2 position) Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/PortalTool Finds the best location based on the proximity to the parameter position and sets the preview Portal to that position. The Portal creation data cannot cross C#<->GDScript language barrier unfortunately. ```APIDOC ## FindBestLocation(Vector2 position) ### Description Finds the best location based on the proximity to the parameter position and sets the preview Portal to that position. The Portal creation data cannot cross C#<->GDScript language barrier unfortunately. ### Method FindBestLocation ### Parameters - **position** (Vector2) - Required - The position to find the best location near. ### Returns void ``` -------------------------------- ### ShowPicker() Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/ColorPalette Show the color picker. ```APIDOC ## ShowPicker() ### Description Show the color picker. ### Method ShowPicker ### Parameters None ### Returns void ### Example ``` colorPalette.ShowPicker() ``` ``` -------------------------------- ### Level TryGetLevel(int index) Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/World Gets a level safely. Will not crash if an invalid index is provided. Just returns null. ```APIDOC ## Level TryGetLevel(int index) ### Description Get a level safely. Will not crash if an invalid index is provided. Just returns null. ### Method TryGetLevel ### Parameters - **index** (int) - Required - The index of the level to retrieve. ### Returns - **Level** - The level at the given index, or null if invalid. ``` -------------------------------- ### ShowNoObjects() Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/ObjectLibraryPanel Displays nothing in the menu. ```APIDOC ## ShowNoObjects() ### Description Show nothing in the menu. ### Method ShowNoObjects ### Parameters None ### Returns void ``` -------------------------------- ### TerrainBrush Methods Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/TerrainBrush Methods available on the TerrainBrush tool for setting terrain, brush size, blending, texture, updating the brush, getting brush radius, filling terrain, and expanding slots. ```APIDOC ## TerrainBrush Methods ### Description Methods available on the TerrainBrush tool for setting terrain, brush size, blending, texture, updating the brush, getting brush radius, filling terrain, and expanding slots. ### Methods #### SetBiome (int index) - **Return Type:** void - **Parameters:** - **index** (int) - Required - The index of the texture list to select the terrain. - **Description:** Selects a Terrain to paint based on the index of the texture list. #### SetSize (float value) - **Return Type:** void - **Parameters:** - **value** (float) - Required - The new brush size. - **Description:** Change the brush size. Calls UpdateBrush() automatically. #### SetSmoothBlending (bool enabled) - **Return Type:** void - **Parameters:** - **enabled** (bool) - Required - Whether to enable smooth blending. - **Description:** Toggles if the terrain is using textured blending or smooth blending. #### SetTextureFromWindow (Texture texture, int listIndex) - **Return Type:** void - **Parameters:** - **texture** (Texture) - Required - The texture to set. - **listIndex** (int) - Required - The index in the texture list. - **Description:** Called by the Texture Window to set the terrain. #### UpdateBrush () - **Return Type:** void - **Parameters:** None - **Description:** Call to update the brush once Size is set. #### GetBrushRadius () - **Return Type:** float - **Parameters:** None - **Description:** Gets the brush radius. #### Fill () - **Return Type:** void - **Parameters:** None - **Description:** Fill the terrain with the selected terrain texture. #### ExpandSlots (bool value) - **Return Type:** void - **Parameters:** - **value** (bool) - Required - Whether to expand terrain to 8 slots. - **Description:** Set to expand terrain to 8 slots. #### SetControlsForExpandedSlots (bool value) - **Return Type:** void - **Parameters:** - **value** (bool) - Required - Whether to update UI for expanded slots. - **Description:** Called by ExpandSlots() to update the UI to use more slots. ``` -------------------------------- ### void SetColor ( Color color ) Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/Wall Changes the wall color. ```APIDOC ## void SetColor ( Color color ) ### Description Changes the wall color. ### Method SetColor ### Parameters - **color** (Color) - Required - The new color for the wall. ``` -------------------------------- ### void SetCompareLevels(Level referenceLevel, float referenceOpacity, float currentOpacity, bool saveSetting) Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/World Sets up having two levels disable on top of each other for referencing, like when drawing multiple floors. Set saveSetting to true if called manually. ```APIDOC ## void SetCompareLevels(Level referenceLevel, float referenceOpacity, float currentOpacity, bool saveSetting) ### Description Set up having two levels disable on top of each other for referencing, like when drawing multiple floors. Set saveSetting to true if called manually. ### Method SetCompareLevels ### Parameters - **referenceLevel** (Level) - Required - The reference level. - **referenceOpacity** (float) - Required - The opacity of the reference level. - **currentOpacity** (float) - Required - The opacity of the current level. - **saveSetting** (bool) - Required - Whether to save the setting. ``` -------------------------------- ### Access all tools via Global.Editor.Tools Source: https://megasploot.github.io/DungeondraftModdingAPI/Globals 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"]`. ```gdscript Array Global.Editor.Tools ``` -------------------------------- ### Dungeondraft .ddmod manifest example Source: https://megasploot.github.io/DungeondraftModdingAPI The .ddmod file is a JSON manifest that informs Dungeondraft's filesystem about your mod. It details the mod's name, unique id, version, author, description, minimum Dungeondraft version, and an optional dependencies array for scripts from other mods. ```json { "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" ] } ``` -------------------------------- ### CreateRadioMenu Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/ToolPanel Creates a radio menu and returns the array of all the CheckBox. ```APIDOC ## CreateRadioMenu ### Description Creates a radio menu and returns the array of all the CheckBox. ### Method CreateRadioMenu ### Parameters - **property** (String) - Required - The property name to bind the radio menu to. - **options** (String[]) - Required - The list of options. ### Returns CheckBox[] - The array of CheckBox controls. ``` -------------------------------- ### Save() Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/ColorPalette Saves and returns the presets as an Array of hexcodes. ```APIDOC ## Save() ### Description Saves and returns the presets as an Array of hexcodes. ### Method Save ### Parameters None ### Returns String[] - Array of hexcodes representing the color presets. ### Example ``` var hexcodes = colorPalette.Save() ``` ``` -------------------------------- ### ObjectTool Methods Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/ObjectTool Methods for manipulating object placement and preview. ```APIDOC ## ObjectTool Methods ### Record ( Prop obj ) #### Description Change this Prop from preview to real, assign it an NodeID, and then record the action to undo history. #### Parameters - **obj** (Prop) - Required - The Prop object to record. #### Returns void ### Next ( ) #### Description Create a new preview Prop using the last known options and texture selected. #### Parameters None #### Returns void ### SetLayer ( int index ) #### Description Set layer option and update the preview Prop to reflect it. #### Parameters - **index** (int) - Required - The layer index to set. #### Returns void ### SetShadow ( bool value ) #### Description Set shadow option and update the preview Prop to reflect it. #### Parameters - **value** (bool) - Required - Whether to enable shadows. #### Returns void ### ChangeColor ( Color color, String name ) #### Description Change the custom color if it applies. Update the Object Library Panel icons to reflect it as well if enabled. #### Parameters - **color** (Color) - Required - The color to change to. - **name** (String) - Required - The name of the color. #### Returns void ### Confirm ( ) #### Description Finalize the preview into the map and create a new preview Prop. Calls Record() and Next() internally. #### Parameters None #### Returns void ### PromoteCustomColor ( ) #### Description Update the preview Prop to reflect the custom color. Better to call ChangeColor() than this function directly. #### Parameters None #### Returns void ### SetSorting ( int sorting ) #### Description Sets the sorting of the tool, and updates the preview Prop to reflect it. 0 = Over, 1 = Under. #### Parameters - **sorting** (int) - Required - The sorting value (0 or 1). #### Returns void ### EmbebObject ( String file ) #### Description Embed a PNG file directly into the map. Bloats the file size, use wisely. #### Parameters - **file** (String) - Required - The path to the PNG file. #### Returns void ### SetBlockLight ( bool value ) #### Description Set the preview Prop to block light. #### Parameters - **value** (bool) - Required - Whether to block light. #### Returns void ``` -------------------------------- ### Global.Editor.Toolset.CreateModTool() Source: https://megasploot.github.io/DungeondraftModdingAPI/Globals 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. ```APIDOC ## Global.Editor.Toolset.CreateModTool() ### Description 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. ### Method `ToolPanel Global.Editor.Toolset.CreateModTool(Reference script_instance, String category, String id, String name, String icon)` ### Parameters - **script_instance** (Reference) - Required - The script instance that the tool belongs to. - **category** (String) - Required - The set of tools the new tool will show under. Valid options are: Design, Terrain, Objects, Effects, Settings. - **id** (String) - Required - The internal tool name. - **name** (String) - Required - The name displayed to the end user. - **icon** (String) - Required - The path to a PNG to use as the button. ### Returns - **ToolPanel** - The generated Tool Panel for the new tool. ``` -------------------------------- ### Portal AddPortal ( Texture texture, bool closed, Vector2 position, Vector2 direction, int pointIndex, float radius, bool flip ) Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/Wall Creates a new Portal along the wall. Position is in local space to the Wall. PointIndex is the index of the wall's point just before the Portal placement. ```APIDOC ## Portal AddPortal ( Texture texture, bool closed, Vector2 position, Vector2 direction, int pointIndex, float radius, bool flip ) ### Description Creates a new Portal along the wall. Position is in local space to the Wall. PointIndex is the index of the wall's point just before the Portal placement. ### Method AddPortal ### Parameters - **texture** (Texture) - Required - The texture for the portal. - **closed** (bool) - Required - Whether the portal is closed. - **position** (Vector2) - Required - Position in local space to the Wall. - **direction** (Vector2) - Required - Direction of the portal. - **pointIndex** (int) - Required - Index of the wall's point just before the Portal placement. - **radius** (float) - Required - Radius of the portal. - **flip** (bool) - Required - Whether to flip the portal. ### Returns Portal - The created portal. ``` -------------------------------- ### BeginNamedSection Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/ToolPanel Creates a named UI section that can be referenced later via Tool.Controls[name]. ```APIDOC ## BeginNamedSection ### Description Create a UI control section that can be referenced through Tool.Controls[name]. ### Method BeginNamedSection ### Parameters - **name** (String) - Required - The name used to reference the section. - **stretch** (bool) - Optional - Default: true - If true, the section extends to the bottom of the panel. ### Returns VBoxContainer - The section container. ``` -------------------------------- ### SwitchToPreviousTool Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/Toolset Swaps to the last used tool. ```APIDOC ## SwitchToPreviousTool ### Description Swap to the last used tool. ### Method void SwitchToPreviousTool() ### Parameters None ### Returns void ``` -------------------------------- ### void SetOverlayLevel(int level, float opacity) Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/World Sets an overlay level for export. Mostly used by the Exporter. ```APIDOC ## void SetOverlayLevel(int level, float opacity) ### Description Set an overlay level for export. Mostly used by the Exporter. ### Method SetOverlayLevel ### Parameters - **level** (int) - Required - The level index to set as overlay. - **opacity** (float) - Required - The opacity for the overlay. ``` -------------------------------- ### ShowPalette() Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/ColorPalette Show the color palette selector. ```APIDOC ## ShowPalette() ### Description Show the color palette selector. ### Method ShowPalette ### Parameters None ### Returns void ### Example ``` colorPalette.ShowPalette() ``` ``` -------------------------------- ### WallTool.EndWall(bool loop) Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/WallTool Takes the polyline from WorldUI and turns it into a Wall and adds it into the Walls children. Better to call Confirm() rather than this directly. ```APIDOC ## EndWall(bool loop) ### Description Takes the polyline from WorldUI and turns it into a Wall and adds it into the Walls children. Better to call Confirm() rather than this directly. ### Method EndWall ### Parameters - **loop** (bool) - Required - Whether the wall should loop. ### Returns void ``` -------------------------------- ### CreateTool(String name, String label, String icon, bool mod = false) Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/Toolbar Creates a new tool to be added to the toolbar and returns a new tool panel to modify. ```APIDOC ## CreateTool(String name, String label, String icon, bool mod = false) ### Description Creates a new tool to be added to the tool bar and return a new tool panel to modify. The real reason you came to this page. ### Method ToolPanel ### Parameters - **name** (String) - Required - The name of the tool. - **label** (String) - Required - The label of the tool. - **icon** (String) - Required - The icon of the tool. - **mod** (bool) - Optional - Whether the tool is a mod. Defaults to false. ### Returns - **ToolPanel** - The newly created tool panel. ``` -------------------------------- ### Create a mod tool with Global.Editor.Toolset.CreateModTool Source: https://megasploot.github.io/DungeondraftModdingAPI/Globals 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. 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. ```gdscript ToolPanel Global.Editor.Toolset.CreateModTool(Reference script_instance, String category, String id, String name, String icon) ``` -------------------------------- ### Select Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/Roof Visually selects the Roof. Does not mean it is selected in the SelectTool. ```APIDOC ## Select ### Description Visually selects the Roof. Does not mean it is selected in the SelectTool. ### Method Select ### Parameters - **bvalue** (bool) - Required - Whether to visually select the Roof. ### Returns - **void** ``` -------------------------------- ### Set Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/Roof Sets the options of the Roof. Must be called after creation. Valid type values: 0 = Gable, 1 = Hip, 2 = Dormer. ```APIDOC ## Set ### Description Sets the options of the Roof. Must be called after creation. Valid type values: 0 = Gable, 1 = Hip, 2 = Dormer. ### Method Set ### Parameters - **points** (Vector2[]) - Required - The points of the Roof. - **width** (float) - Required - The width of the Roof. - **type** (int) - Required - The type of the roof: 0 = Gable, 1 = Hip, 2 = Dormer. ### Returns - **void** ``` -------------------------------- ### CreateModTool Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/Toolset Creates a new mod tool by passing the mod script and relevant data. Returns a newly created ToolPanel. ```APIDOC ## CreateModTool ### Description Create a new mod tool by passing it the mod script and the relevant data. Returns a newly created ToolPanel. Calls Toolbar.CreateTool(). ### Method ToolPanel CreateModTool(Reference scriptInstance, String category, String id, String label, String icon) ### Parameters - **scriptInstance** (Reference) - Required - The mod script instance. - **category** (String) - Required - The category for the tool. - **id** (String) - Required - The unique identifier for the tool. - **label** (String) - Required - The display label for the tool. - **icon** (String) - Required - The icon for the tool. ### Returns ToolPanel - The newly created ToolPanel. ``` -------------------------------- ### Wall.InsertPortal Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/Wall Inserts a portal into the wall. ```APIDOC ## InsertPortal ### Description Inserts a portal into the wall. ### Method InsertPortal ### Parameters - **portal** (Portal) - Required - The portal to insert. - **remakeLines** (bool) - Required - Whether to remake lines. ``` -------------------------------- ### Highlight Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/Roof Highlights the Roof. ```APIDOC ## Highlight ### Description Highlights the Roof. ### Method Highlight ### Parameters - **value** (bool) - Required - Whether to highlight the Roof. ### Returns - **void** ``` -------------------------------- ### PreviewContainer Class Reference Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/PreviewContainer Reference documentation for the PreviewContainer class, including its properties and methods that can be called directly. ```APIDOC # PreviewContainer **Extends:** PanelContainer ## Description This class when accessed in `Global.Editor.Preview` is the preview of Props when hovering over the library menu. ## Properties - **texture** (TextureRect) - The UI element that displays the asset image. - **label** (Label) - The UI element that displays the asset name. - **currentLibraryCategory** (String) - The category of the current library. - **bigPreview** (bool) - Get or set if the preview is in big format. ## Methods ### Set ( Texture thumbnail, String label, String category ) Set the thumbnail to be previewed. ### Unset ( ) Clear the preview. ### SetPreviewMaterial ( Material material ) Change the material used to shade the preview. ``` -------------------------------- ### CreateColorButton Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/ToolPanel Creates a simple color selection control. ```APIDOC ## CreateColorButton ### Description Create a simple color selection control without a color palette. The presets Array are of type String. ### Method CreateColorButton ### Parameters - **name** (String) - Required - The name of the color button. - **propertyOnly** (bool) - Required - If true, only the property is used (no palette). - **default** (String) - Required - The default color value. - **presets** (String[]) - Required - The list of preset colors. ### Returns ColorPickerButton - The created color button. ``` -------------------------------- ### WallTool.Confirm() Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/WallTool Takes the polyline from WorldUI and turns it into a Wall, adding it to the Walls children. Automatically determines if it needs to loop or add new points, and calls EndWall(). ```APIDOC ## Confirm() ### Description Takes the polyline from WorldUI and turns it into a Wall and adds it into the Walls children. Automagically determines if it needs to loop or add new points. Calls EndWall(). ### Method Confirm ### Parameters None ### Returns void ``` -------------------------------- ### void LoadLevel(int index, Dictionary data) Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/World Loads a level data into a specific index. Used by LoadLevels(). ```APIDOC ## void LoadLevel(int index, Dictionary data) ### Description Load a level data into a specific index. Used by LoadLevels(). ### Method LoadLevel ### Parameters - **index** (int) - Required - The index to load the level data into. - **data** (Dictionary) - Required - The level data to load. ``` -------------------------------- ### CreateLayerMenu Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/ToolPanel Creates a dropdown menu for selecting layers (Objects, Paths, Materials). ```APIDOC ## CreateLayerMenu ### Description Creates and returns the dropdown menu representing the layer system for Objects, Paths, and Materials for Dungeondraft. There should only ever be a single instance of this UI control per tool if needed. To inspect the current selected layer, check the variable Global.Editor.Tools["mod_tool_id"].ActiveLayer which returns the int of the layer value. ### Method CreateLayerMenu ### Parameters None. ### Returns OptionButton - The created layer dropdown menu. ``` -------------------------------- ### CreateNewBitmap Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/MarchingSquaresMesh Create or replace the bitmap with an empty one of the right size. ```APIDOC ## CreateNewBitmap ### Description Create or replace the bitmap with an empty one of the right size. ### Method CreateNewBitmap ### Signature void CreateNewBitmap() ### Example ``` mesh.CreateNewBitmap() ``` ``` -------------------------------- ### Load Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/Lights Loads a list of saved light data, used by a saved map file to load existing lights. ```APIDOC ## Load ### Description Loads a list of saved light data. Used by a saved map file to load existing lights. ### Method Load ### Signature void Load ( Dictionary[] data ) ### Parameters - **data** (Dictionary[]) - Required - The array of saved light data to load. ``` -------------------------------- ### Save() Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/Roofs Saves all Roofs and sun data in the level as a list in the save file format and returns it as a Dictionary. ```APIDOC ## Save() ### Description Saves all Roofs and sun data in the level as a list in the save file format and returns it as a Dictionary. ### Method Save ### Returns - **Dictionary** - The saved data containing all Roofs and sun settings. ``` -------------------------------- ### SetBuildingWear Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/MapSettings Sets the building wear texture applied on walls and floors. 0 is off. ```APIDOC ## SetBuildingWear ### Description Sets the building wear texture applied on walls and floors. 0 is off. ### Method SetBuildingWear ### Parameters - **index** (int) - Required - The building wear texture index. 0 is off. ### Returns void ``` -------------------------------- ### SetBitmap Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/MarchingSquaresMesh Replace the bitmap with a specific one and updates the visuals. WARNING: THE SIZE MUST MATCH! ```APIDOC ## SetBitmap ### Description Replace the bitmap with a specific one and updates the visuals. WARNING: THE SIZE MUST MATCH! ### Method SetBitmap ### Signature void SetBitmap(BitMap bitmap) ### Parameters - **bitmap** (BitMap) - Required - The new bitmap to set. ### Example ``` mesh.SetBitmap(bitmap) ``` ``` -------------------------------- ### CreateLabel Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/ToolPanel Creates a label. ```APIDOC ## CreateLabel ### Description Creates a label. ### Method CreateLabel ### Parameters - **label** (String) - Required - The text to display. ### Returns void ``` -------------------------------- ### void UpdateTexture ( Texture texture ) Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/Wall Changes the wall texture. ```APIDOC ## void UpdateTexture ( Texture texture ) ### Description Changes the wall texture. ### Method UpdateTexture ### Parameters - **texture** (Texture) - Required - The new texture for the wall. ``` -------------------------------- ### Wall.Set Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/Wall Sets the wall's points, texture, color, and other properties. ```APIDOC ## Set ### Description Sets the wall's points, texture, color, and other properties. ### Method Set ### Parameters - **points** (Vector2[]) - Required - The wall points. - **texture** (Texture) - Required - The wall texture. - **color** (Color) - Required - The wall color. - **loop** (bool) - Optional - Default: true - **shadow** (bool) - Optional - Default: true - **type** (int) - Optional - Default: 0 - **joint** (int) - Optional - Default: 1 - **normalizeUV** (bool) - Optional - Default: true ``` -------------------------------- ### void LevelDown() Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/World Goes down a level. ```APIDOC ## void LevelDown() ### Description Go down a level. ### Method LevelDown ``` -------------------------------- ### CreateToggle Source: https://megasploot.github.io/DungeondraftModdingAPI/reference/ToolPanel Creates a toggle-style Godot Button. ```APIDOC ## CreateToggle ### Description Creates and returns a toggle style Godot Button. ### Method CreateToggle ### Parameters - **property** (String) - Required - The property name to bind the toggle to. - **default** (bool) - Required - The default state of the toggle. - **onLabel** (String) - Required - The label when the toggle is on. - **onIcon** (String) - Required - The icon when the toggle is on. - **offLabel** (String) - Required - The label when the toggle is off. - **offIcon** (String) - Required - The icon when the toggle is off. ### Returns Button - The created toggle button. ```