Skip to main content

Task

Based on game build 714014 | Last updated: 2026-02-27

Overview

The Task component defines metadata and configuration for a single map generation task used in DST's world generation system. It encapsulates constraints and options for how rooms are selected, placed, and connected—such as locking requirements (locks), keys provided (keys_given), entrance room rules, and special room behavior (e.g., maze tiles, background rooms, cove rooms). This component is self-contained and does not attach to entities or interact with other components at runtime; it serves as a data structure for the map/task generation pipeline.

Usage example

local task = Task("cave_entrance", {
locks = { "cave", "no_plant" },
keys_given = "cave_key",
region_id = "caves",
entrance_room = "cave_entrance_room",
entrance_room_chance = 0.5,
room_choices = { "room_a", "room_b" },
room_tags = { "dark", "rocky" },
required_prefabs = { "candle" },
hub_room = "cave_hub",
maze_tiles = true,
maze_tile_size = 1.5,
crosslink_factor = 0.2,
make_loop = true,
colour = { 0.2, 0.2, 0.4 },
})

Dependencies & tags

Components used: None
Tags: None identified.

Properties

PropertyTypeDefault ValueDescription
idstringUnique identifier for this task (passed as first constructor argument).
lockstable<string> or stringnilKey(s) required to unlock this task during generation. Non-table inputs are normalized to a single-element table.
keys_giventable<string> or stringnilKey(s) this task makes available to subsequent tasks. Non-table inputs are normalized to a single-element table.
region_idstringnilIdentifier of the region this task belongs to (e.g., "caves", "forest").
entrance_roomstringnilName of the designated entrance room prefab for this task.
entrance_room_chancenumbernilProbability (0.0 to 1.0) that the entrance_room is used.
room_choicestable<string>nilList of candidate room prefabs to choose from when placing this task.
room_choices_specialtable<string>nilList of special room prefabs with distinct generation rules.
room_bgstringnilBackground room prefab used for visual layering.
background_roomstringnilAlternate background room (alias for room_bg, likely legacy).
cove_room_namestringnilName of a special "cove" room variant to optionally use.
cove_room_chancenumbernilProbability (0.0 to 1.0) of using the cove room variant.
cove_room_max_edgesnumbernilMaximum number of connections (edges) allowed for the cove room.
colourtable<number>nilRGB colour array used for debug/visual marker rendering.
maze_tilesbooleannilIndicates if this task uses maze-style tile placement.
maze_tile_sizenumbernilSize multiplier for maze tiles.
crosslink_factornumbernilProbability for adding extra cross-links between rooms in the task.
make_loopbooleannilWhether the task’s internal room graph should form a loop.
room_tagstable<string>nilTags to apply to rooms generated by this task (e.g., "dark", "wet").
required_prefabstable<string>nilPrefab names required to be present in all rooms of this task.
hub_roomstringnilName of the designated hub room prefab for this task.
level_set_piece_blockerbooleannilIf true, prevents the task from receiving random_set_pieces and required_setpieces defined in the level.

Main functions

Task:__tostring()

  • Description: Returns a human-readable string representation of the task for logging or debugging.
  • Parameters: None.
  • Returns: string — Format: "Task: <id>", where <id> is self.id.
  • Error states: None.

Events & listeners

None.