Adds enemies
This commit is contained in:
parent
cf8ba8bacb
commit
76e5b1927f
324 changed files with 28447 additions and 106 deletions
34
demo/ai/tasks/get_first_in_group.gd
Normal file
34
demo/ai/tasks/get_first_in_group.gd
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#*
|
||||
#* get_first_in_group.gd
|
||||
#* =============================================================================
|
||||
#* Copyright (c) 2023-present Serhii Snitsaruk and the LimboAI contributors.
|
||||
#*
|
||||
#* Use of this source code is governed by an MIT-style
|
||||
#* license that can be found in the LICENSE file or at
|
||||
#* https://opensource.org/licenses/MIT.
|
||||
#* =============================================================================
|
||||
#*
|
||||
@tool
|
||||
extends BTAction
|
||||
## 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
|
||||
|
||||
## Blackboard variable in which the task will store the acquired node.
|
||||
@export var output_var: StringName = &"target"
|
||||
|
||||
|
||||
func _generate_name() -> String:
|
||||
return "GetFirstNodeInGroup \"%s\" ➜%s" % [
|
||||
group,
|
||||
LimboUtility.decorate_var(output_var)
|
||||
]
|
||||
|
||||
func _tick(_delta: float) -> Status:
|
||||
var nodes: Array[Node] = agent.get_tree().get_nodes_in_group(group)
|
||||
if nodes.size() == 0:
|
||||
return FAILURE
|
||||
blackboard.set_var(output_var, nodes[0])
|
||||
return SUCCESS
|
||||
Loading…
Add table
Add a link
Reference in a new issue