extends SubStateMachine

class_name WeaponSubStateMachine

@export var animation_prefix: StringName

@export var max_ammo: int
@onready var ammo: int = max_ammo

var system: WeaponSystem
var animation_player: AnimationPlayer
var player_camera: PlayerCamera

func _ready() -> void:
	for child in get_children():
		if child is WeaponState:
			states[child.name] = child
			child.machine = self
			child.transition.connect(on_transition_required)
		else:
			push_warning("Child of state machine is not state")

@rpc("authority","call_local","reliable")
func use_begin() -> void:
	current_state.use_begin()
@rpc("authority","call_local","reliable")
func use_end() -> void:
	current_state.use_end()
func alternate_state() -> void:
	current_state.alternate_state()
# Need to clarify naming; Switch mode like firemode. For different states use
# alternate_state
func switch_mode() -> void:
	current_state.switch_mode()
