From 9576cdc8e7d5258d1460c20fe176a2a4f2b09ec5 Mon Sep 17 00:00:00 2001 From: VisitingOcean <73324418+VisitingOcean@users.noreply.github.com> Date: Tue, 30 Jan 2024 16:48:42 -0600 Subject: [PATCH] Update custom-tasks.rst Fix some spacing typos to prevent mixed space/tab errors when copy/pasting into the Godot editor. --- doc/source/getting-started/custom-tasks.rst | 42 ++++++++++----------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/doc/source/getting-started/custom-tasks.rst b/doc/source/getting-started/custom-tasks.rst index e2aa084..0c7d6b3 100644 --- a/doc/source/getting-started/custom-tasks.rst +++ b/doc/source/getting-started/custom-tasks.rst @@ -54,13 +54,13 @@ Task anatomy # Called each time this task is ticked (aka executed). func _tick(delta: float) -> Status: - return SUCCESS + return SUCCESS # Strings returned from this method are displayed as warnings in the editor. func _get_configuration_warnings() -> PackedStringArray: - var warnings := PackedStringArray() - return warnings + var warnings := PackedStringArray() + return warnings Example 1: A simple action @@ -81,16 +81,16 @@ Example 1: A simple action # Called to generate a display name for the task (requires @tool). func _generate_name() -> String: - return "SetVisible %s node_path: \"%s\"" % [visible, node_path] + return "SetVisible %s node_path: \"%s\"" % [visible, node_path] # Called each time this task is ticked (aka executed). func _tick(p_delta: float) -> Status: - var n: CanvasItem = agent.get_node_or_null(node_path) - if is_instance_valid(n): - n.visible = visible - return SUCCESS - return FAILURE + var n: CanvasItem = agent.get_node_or_null(node_path) + if is_instance_valid(n): + n.visible = visible + return SUCCESS + return FAILURE Example 2: InRange condition @@ -116,24 +116,24 @@ Example 2: InRange condition # Called to generate a display name for the task. func _generate_name() -> String: - return "InRange (%d, %d) of %s" % [distance_min, distance_max, - LimboUtility.decorate_var(target_var)] + return "InRange (%d, %d) of %s" % [distance_min, distance_max, + LimboUtility.decorate_var(target_var)] # Called to initialize the task. func _setup() -> void: - _min_distance_squared = distance_min * distance_min - _max_distance_squared = distance_max * distance_max + _min_distance_squared = distance_min * distance_min + _max_distance_squared = distance_max * distance_max # Called when the task is executed. func _tick(_delta: float) -> Status: - var target: Node2D = blackboard.get_var(target_var, null) - if not is_instance_valid(target): - return FAILURE + var target: Node2D = blackboard.get_var(target_var, null) + if not is_instance_valid(target): + return FAILURE - var dist_sq: float = agent.global_position.distance_squared_to(target.global_position) - if dist_sq >= _min_distance_squared and dist_sq <= _max_distance_squared: - return SUCCESS - else: - return FAILURE + var dist_sq: float = agent.global_position.distance_squared_to(target.global_position) + if dist_sq >= _min_distance_squared and dist_sq <= _max_distance_squared: + return SUCCESS + else: + return FAILURE