@tool
extends CutsceneCommand
class_name MoveCharacterCommand

@export_group("Setup")
@export_node_path("CharacterBase") var target_character: NodePath
@export_enum("Node", "Vector") var target_type = "Node":
	set(value):
		target_type = value
		notify_property_list_changed()
@export var use_character_speed = true:
	set(value):
		use_character_speed = value
		notify_property_list_changed()
@export var speed: float = 300
## AnimationTreeFiniteStateMachine state node that will be transitioned to.
@export var animation_state: String = ""

@export_group("Targets")
@export var target_vector = Vector2(0,0)
@export_node_path("Node2D") var target_node: NodePath

func _validate_property(property: Dictionary):
	if property.name == "target_node" and target_type == "Vector":
		property.usage |= PROPERTY_USAGE_READ_ONLY
	elif property.name == "target_node" and target_type == "Node":
		property.usage &= ~PROPERTY_USAGE_READ_ONLY
	if property.name == "target_vector" and target_type == "Vector":
		property.usage &= ~PROPERTY_USAGE_READ_ONLY
	elif property.name == "target_vector" and target_type == "Node":
		property.usage |= PROPERTY_USAGE_READ_ONLY
	
	if property.name == "speed" and use_character_speed:
		property.usage |= PROPERTY_USAGE_READ_ONLY
	elif property.name == "speed" and not use_character_speed:
		property.usage &= ~PROPERTY_USAGE_READ_ONLY
