diff --git a/demo/demo/ai/tasks/arrive_pos.gd b/demo/demo/ai/tasks/arrive_pos.gd index 0c266cb..f55bca7 100644 --- a/demo/demo/ai/tasks/arrive_pos.gd +++ b/demo/demo/ai/tasks/arrive_pos.gd @@ -10,9 +10,9 @@ #* @tool extends BTAction -## ArrivePos: Arrive to a position, with a bias to horizontal movement. -## Returns SUCCESS when close to the target position (see tolerance); -## otherwise returns RUNNING. +## Moves the agent to the specified position, favoring horizontal movement. [br] +## Returns [code]SUCCESS[/code] when close to the target position (see [member tolerance]); +## otherwise returns [code]RUNNING[/code]. ## Blackboard variable that stores the target position (Vector2) @export var target_position_var := &"pos" diff --git a/demo/demo/ai/tasks/back_away.gd b/demo/demo/ai/tasks/back_away.gd index 1bab356..51983ff 100644 --- a/demo/demo/ai/tasks/back_away.gd +++ b/demo/demo/ai/tasks/back_away.gd @@ -10,8 +10,8 @@ #* @tool extends BTAction -## BackAway -## Returns RUNNING always. +## Moves the agent in the opposite direction of its current facing. [br] +## Returns [code]RUNNING[/code] always. ## Blackboard variable that stores desired speed. @export var speed_var: StringName = &"speed" diff --git a/demo/demo/ai/tasks/face_target.gd b/demo/demo/ai/tasks/face_target.gd index 86551b8..091c3e4 100644 --- a/demo/demo/ai/tasks/face_target.gd +++ b/demo/demo/ai/tasks/face_target.gd @@ -10,8 +10,8 @@ #* @tool extends BTAction -## FaceTarget and return SUCCESS. -## Returns FAILURE if target is not a valid Node2D instance. +## Flips the agent to face the target, returning [code]SUCCESS[/code]. [br] +## Returns [code]FAILURE[/code] if [member target_var] is not a valid [Node2D] instance. ## Blackboard variable that stores our target (expecting Node2D). @export var target_var: StringName = &"target" diff --git a/demo/demo/ai/tasks/get_first_in_group.gd b/demo/demo/ai/tasks/get_first_in_group.gd index 6d2ed59..9521058 100644 --- a/demo/demo/ai/tasks/get_first_in_group.gd +++ b/demo/demo/ai/tasks/get_first_in_group.gd @@ -10,8 +10,8 @@ #* @tool extends BTAction -## Get first node in group and save it to the blackboard. -## Returns FAILURE if group contains 0 nodes. +## Stores the first node in the [member group] on the blackboard, returning [code]SUCCESS[/code]. [br] +## Returns [code]FAILURE[/code] if the group contains 0 nodes. ## Name of the SceneTree group. @export var group: StringName diff --git a/demo/demo/ai/tasks/in_range.gd b/demo/demo/ai/tasks/in_range.gd index c6a6a30..09f4978 100644 --- a/demo/demo/ai/tasks/in_range.gd +++ b/demo/demo/ai/tasks/in_range.gd @@ -10,11 +10,10 @@ #* @tool extends BTCondition - ## InRange condition checks if the agent is within a range of target, -## defined by distance_min and distance_max. -## Returns SUCCESS if the agent is within the defined range; -## otherwise, returns FAILURE. +## defined by [member distance_min] and [member distance_max]. [br] +## Returns [code]SUCCESS[/code] if the agent is within the given range; +## otherwise, returns [code]FAILURE[/code]. ## Minimum distance to target. @export var distance_min: float diff --git a/demo/demo/ai/tasks/is_aligned_with_target.gd b/demo/demo/ai/tasks/is_aligned_with_target.gd index 8bbbcf5..8d1b3c9 100644 --- a/demo/demo/ai/tasks/is_aligned_with_target.gd +++ b/demo/demo/ai/tasks/is_aligned_with_target.gd @@ -10,9 +10,9 @@ #* @tool extends BTCondition -## IsAlignedWithTarget -## Returns SUCCESS if the agent is horizontally aligned with the target. -## Returns FAILURE if not aligned or if target is not a valid node instance. +## Checks if the agent is horizontally aligned with the target. [br] +## Returns [code]SUCCESS[/code] if the agent is horizontally aligned with the target. +## Returns [code]FAILURE[/code] if not aligned or if target is not a valid node instance. @export var target_var: StringName = &"target" diff --git a/demo/demo/ai/tasks/move_forward.gd b/demo/demo/ai/tasks/move_forward.gd index 47c8a65..83d2c02 100644 --- a/demo/demo/ai/tasks/move_forward.gd +++ b/demo/demo/ai/tasks/move_forward.gd @@ -10,9 +10,10 @@ #* @tool extends BTAction -## MoveForward: Applies velocity each tick until duration is exceeded. -## Returns SUCCESS if elapsed time exceeded duration. -## Returns RUNNING if elapsed time didn't exceed duration. +## Applies velocity in the direction the agent is facing on each tick +## until the [member duration] is exceeded. [br] +## Returns [code]SUCCESS[/code] if the elapsed time exceeds [member duration]. [br] +## Returns [code]RUNNING[/code] if the elapsed time does not exceed [member duration]. [br] ## Blackboard variable that stores desired speed. @export var speed_var: StringName = &"speed" diff --git a/demo/demo/ai/tasks/pursue.gd b/demo/demo/ai/tasks/pursue.gd index d3062ae..25b02d1 100644 --- a/demo/demo/ai/tasks/pursue.gd +++ b/demo/demo/ai/tasks/pursue.gd @@ -10,11 +10,10 @@ #* @tool extends BTAction -## Pursue: Move towards target until agent is flanking it. -## -## Returns RUNNING, while moving towards target but not yet at the desired position. -## Returns SUCCESS, when at the desired position from target (flanking it). -## Returns FAILURE, if target is not a valid Node2D instance. +## Move towards the target until the agent is flanking it. [br] +## Returns [code]RUNNING[/code] while moving towards the target but not yet at the desired position. [br] +## Returns [code]SUCCESS[/code] when at the desired position relative to the target (flanking it). [br] +## Returns [code]FAILURE[/code] if the target is not a valid [Node2D] instance. [br] ## How close should the agent be to the desired position to return SUCCESS. const TOLERANCE := 30.0 diff --git a/demo/demo/ai/tasks/select_flanking_pos.gd b/demo/demo/ai/tasks/select_flanking_pos.gd index 1f54871..cc44556 100644 --- a/demo/demo/ai/tasks/select_flanking_pos.gd +++ b/demo/demo/ai/tasks/select_flanking_pos.gd @@ -10,8 +10,9 @@ #* @tool extends BTAction -## SelectFlankingPos on the side of a target, and return SUCCESS. -## Returns FAILURE, if the target is not valid. +## Selects a position on the target's side and stores it on the +## blackboard, returning [code]SUCCESS[/code]. [br] +## Returns [code]FAILURE[/code] if the target is not valid. enum AgentSide { CLOSEST, @@ -71,4 +72,3 @@ func _tick(_delta: float) -> Status: flank_pos = target.global_position - offset blackboard.set_var(position_var, flank_pos) return SUCCESS - diff --git a/demo/demo/ai/tasks/select_random_nearby_pos.gd b/demo/demo/ai/tasks/select_random_nearby_pos.gd index 0b0e38f..1b108a5 100644 --- a/demo/demo/ai/tasks/select_random_nearby_pos.gd +++ b/demo/demo/ai/tasks/select_random_nearby_pos.gd @@ -1,7 +1,7 @@ @tool extends BTAction -## SelectRandomNearbyPos: Select a position nearby within specified range. -## Returns SUCCESS. +## Selects a random position nearby within the specified range and stores it on the blackboard. [br] +## Returns [code]SUCCESS[/code]. ## Minimum distance to the desired position. @export var range_min: float = 300.0 diff --git a/editor/task_palette.cpp b/editor/task_palette.cpp index f49bb93..1262671 100644 --- a/editor/task_palette.cpp +++ b/editor/task_palette.cpp @@ -24,8 +24,8 @@ #include "editor/editor_help.h" #include "editor/editor_node.h" #include "editor/editor_paths.h" -#include "editor/themes/editor_scale.h" #include "editor/plugins/script_editor_plugin.h" +#include "editor/themes/editor_scale.h" #include "scene/gui/check_box.h" #endif // LIMBO_MODULE @@ -57,30 +57,86 @@ using namespace godot; void TaskButton::_bind_methods() { } -Control *TaskButton::_do_make_tooltip(const String &p_text) const { +Control *TaskButton::_do_make_tooltip() const { #ifdef LIMBOAI_MODULE - EditorHelpBit *help_bit = memnew(EditorHelpBit); - help_bit->set_content_height_limits(1, 360 * EDSCALE); + String help_symbol; + bool is_resource = task_meta.begins_with("res://"); - String help_text; - if (!p_text.is_empty()) { - help_text = p_text; + if (is_resource) { + help_symbol = "class|\"" + task_meta.lstrip("res://") + "\"|"; } else { - help_text = "[i]" + TTR("No description.") + "[/i]"; + help_symbol = "class|" + task_meta + "|"; } - help_bit->set_custom_text(String(), String(), help_text); + EditorHelpBit *help_bit = memnew(EditorHelpBit(help_symbol)); + help_bit->set_content_height_limits(1, 360 * EDSCALE); - return help_bit; + String desc = _module_get_help_description(task_meta); + if (desc.is_empty() && is_resource) { + // ! HACK: Force documentation parsing. + Ref