Chelimbalo/scripts/weapon_system/weapon_substate_machine.gd
2025-11-26 23:05:37 +05:00

32 lines
849 B
GDScript

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)
@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()