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
| Property | Type | Default Value | Description |
|---|---|---|---|
id | string | — | Unique identifier for this task (passed as first constructor argument). |
locks | table<string> or string | nil | Key(s) required to unlock this task during generation. Non-table inputs are normalized to a single-element table. |
keys_given | table<string> or string | nil | Key(s) this task makes available to subsequent tasks. Non-table inputs are normalized to a single-element table. |
region_id | string | nil | Identifier of the region this task belongs to (e.g., "caves", "forest"). |
entrance_room | string | nil | Name of the designated entrance room prefab for this task. |
entrance_room_chance | number | nil | Probability (0.0 to 1.0) that the entrance_room is used. |
room_choices | table<string> | nil | List of candidate room prefabs to choose from when placing this task. |
room_choices_special | table<string> | nil | List of special room prefabs with distinct generation rules. |
room_bg | string | nil | Background room prefab used for visual layering. |
background_room | string | nil | Alternate background room (alias for room_bg, likely legacy). |
cove_room_name | string | nil | Name of a special "cove" room variant to optionally use. |
cove_room_chance | number | nil | Probability (0.0 to 1.0) of using the cove room variant. |
cove_room_max_edges | number | nil | Maximum number of connections (edges) allowed for the cove room. |
colour | table<number> | nil | RGB colour array used for debug/visual marker rendering. |
maze_tiles | boolean | nil | Indicates if this task uses maze-style tile placement. |
maze_tile_size | number | nil | Size multiplier for maze tiles. |
crosslink_factor | number | nil | Probability for adding extra cross-links between rooms in the task. |
make_loop | boolean | nil | Whether the task’s internal room graph should form a loop. |
room_tags | table<string> | nil | Tags to apply to rooms generated by this task (e.g., "dark", "wet"). |
required_prefabs | table<string> | nil | Prefab names required to be present in all rooms of this task. |
hub_room | string | nil | Name of the designated hub room prefab for this task. |
level_set_piece_blocker | boolean | nil | If 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>isself.id. - Error states: None.
Events & listeners
None.