30 lines
754 B
GDScript
30 lines
754 B
GDScript
@icon("res://icons/turn_action.svg")
|
|
class_name Action
|
|
extends Node
|
|
# Base class for actions
|
|
|
|
# Optional predicate for if the action is allowed
|
|
func predicate() -> bool:
|
|
return true
|
|
|
|
func get_action_name() -> String:
|
|
push_error("get_action_name is unimplemented!")
|
|
return "UNIMPLEMENTED"
|
|
|
|
# Called when the action starts
|
|
func action_ready():
|
|
pass
|
|
|
|
# Called every frame, like _process
|
|
func action_process(_delta: float):
|
|
pass
|
|
|
|
# Must be emitted when an action is successful
|
|
@warning_ignore("unused_signal")
|
|
signal done()
|
|
# Must be emitted if something went wrong and the action can't be performed
|
|
# This could be called for example when an action was checked to be valid, but
|
|
# failed during execution
|
|
@warning_ignore("unused_signal")
|
|
signal abort()
|