SkillTree ​
Inherits: DatabaseResource < Resource
Main container for skill trees with nodes and connections
Properties ​
CompressedTexture2D | background_texture | |
Color | background_color | Color(0.15, 0.15, 0.15, 1.0) |
Color | tree_tint_color | Color.WHITE |
Array[Requirement] | requirements | [] |
LockedDisplay | locked_display | LockedDisplay.SHOW |
String | dedication_group | "" |
int | dedication_points | 0 |
Array[SkillNode] | skill_nodes | [] |
Array[SkillConnection] | node_connections | [] |
Dictionary | visual_layout_data | {} # Store any editor metadata |
Methods ​
void | add_node( node: SkillNode ) |
bool | remove_node( node_id: int ) |
SkillNode | get_node_by_id( node_id: int ) |
void | add_connection( connection: SkillConnection ) |
bool | remove_connection( connection: SkillConnection ) |
bool | remove_connection_by_nodes( from_node_id: int, to_node_id: int ) |
SkillConnection | get_connection_between_nodes( from_node_id: int, to_node_id: int ) |
Array[SkillConnection] | get_connections_for_node( node_id: int ) |
bool | has_connection_between_nodes( from_node_id: int, to_node_id: int ) |
Array[SkillNode] | get_prerequisite_nodes( node_id: int ) |
Array[SkillNode] | get_dependent_nodes( node_id: int ) |
Array[SkillNode] | get_mutually_exclusive_nodes( node_id: int ) |
Array[SkillNode] | get_root_nodes() |
Array[SkillNode] | get_leaf_nodes() |
bool | has_cycles() |
int | get_max_depth() |
Array[SkillNode] | get_nodes_by_point_pool( pool_id: int ) |
Array[int] | get_used_point_pools() |
void | set_node_position( node_id: int, position: Vector2 ) |
Vector2 | get_node_position( node_id: int ) |
String | get_summary() |
Dictionary | get_detailed_info() |
Array[Dictionary] | validate() |
bool | is_valid() |
Enumerations ​
enum LockedDisplay ​
What a tree shows when the player cannot spend points in it yet
- SHOW =
0- The tree is listed, locked, with the reason - HIDE =
1- The tree is not listed until it opens
Property descriptions ​
CompressedTexture2D background_texture ​
========== VISUAL THEMING (for UI display) ==========
Color background_color = Color(0.15, 0.15, 0.15, 1.0) ​
Fallback background color if no texture
Color tree_tint_color = Color.WHITE ​
Tint color overlay for theming
Array[Requirement] requirements = [] ​
Requirements the player must meet before points can be spent in this tree (all of them). Use them to open a tree with another one ("31 points in the first tree"), with the choice of a node ("the Fire tree needs the Fire specialization"), a level, a quest or a faction. Points already spent stay when a tree locks again
LockedDisplay locked_display = LockedDisplay.SHOW ​
A tree that is locked: shown with the reason, or hidden
String dedication_group = "" ​
Dedication: trees of the same group are one choice. A group name ("talents"), empty = none. The first tree of the group the player puts points in is the one they dedicate to: the others stay locked until a tree of the group has "Dedication points" spent in it (Cataclysm: 31)
int dedication_points = 0 ​
The points a tree of the dedication group needs before the others open
Array[SkillNode] skill_nodes = [] ​
========== TREE STRUCTURE ==========
Array[SkillConnection] node_connections = [] ​
The connections between the nodes of the tree.
Dictionary visual_layout_data = # Store any editor metadata ​
========== VISUAL DATA (for future editor) ==========
Method descriptions ​
void add_node( node: SkillNode ) ​
========== TREE MANAGEMENT METHODS ==========
bool remove_node( node_id: int ) ​
Removes a node by its id. False when it is not in the tree.
SkillNode get_node_by_id( node_id: int ) ​
The node with this id, or null.
void add_connection( connection: SkillConnection ) ​
Adds a connection between two nodes.
bool remove_connection( connection: SkillConnection ) ​
Remove a specific connection from the tree
bool remove_connection_by_nodes( from_node_id: int, to_node_id: int ) ​
Remove connection between two specific nodes
SkillConnection get_connection_between_nodes( from_node_id: int, to_node_id: int ) ​
Get the connection between two specific nodes (if it exists)
Array[SkillConnection] get_connections_for_node( node_id: int ) ​
Get all connections involving a specific node
bool has_connection_between_nodes( from_node_id: int, to_node_id: int ) ​
Check if a connection exists between two nodes
Array[SkillNode] get_prerequisite_nodes( node_id: int ) ​
========== PREREQUISITE ANALYSIS ==========
Array[SkillNode] get_dependent_nodes( node_id: int ) ​
Get all nodes that have this node as a prerequisite
Array[SkillNode] get_mutually_exclusive_nodes( node_id: int ) ​
The nodes that cannot be taken together with this one.
Array[SkillNode] get_root_nodes() ​
Get all nodes that have no prerequisites
Array[SkillNode] get_leaf_nodes() ​
Get all nodes that have no dependent nodes
bool has_cycles() ​
Check if the skill tree has circular dependencies
int get_max_depth() ​
Get the maximum depth of the skill tree
Array[SkillNode] get_nodes_by_point_pool( pool_id: int ) ​
Get all nodes that use a specific point pool
Array[int] get_used_point_pools() ​
Get all point pool IDs used by nodes in this tree
void set_node_position( node_id: int, position: Vector2 ) ​
Store node position in visual layout data and update the node itself
Vector2 get_node_position( node_id: int ) ​
Get node position from visual layout data
String get_summary() ​
========== UTILITY METHODS ==========
Dictionary get_detailed_info() ​
Get detailed information about the tree structure
Array[Dictionary] validate() ​
Checks the settings. Gives the problems found (empty when it is fine).
bool is_valid() ​
Is it free of errors?