Files
pomchronicles/ai/tasks/decorators/busy.gd

28 lines
591 B
GDScript

@tool
extends BTDecorator
@export var activity : String = ""
var prev_busy : bool
var prev_activity : String
func _get_task_icon():
return load("res://ai/icons/stopwatch.png")
func _enter() -> void:
if agent.get("busy") != null:
prev_busy = agent.busy
prev_activity = agent.activity
agent.busy = true
if activity != "":
agent.activity = activity
func _exit() -> void:
if agent.get("busy") != null:
agent.busy = prev_busy
agent.activity = prev_activity
# Called to generate a display name for the task (requires @tool).
func _generate_name() -> String:
return "Busy"