weapon system rework
This commit is contained in:
parent
0ffc2b2497
commit
30b01100f0
27 changed files with 352 additions and 190 deletions
26
scripts/weapon_system/gun/idle_state.gd
Normal file
26
scripts/weapon_system/gun/idle_state.gd
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
extends WeaponState
|
||||
|
||||
@export var emptyable: bool
|
||||
|
||||
func enter() -> void:
|
||||
machine.animation_player.play(with_morphems("idle"))
|
||||
|
||||
func exit() -> void:
|
||||
pass
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if not machine.is_multiplayer_authority(): return
|
||||
|
||||
if event.is_action_pressed("plr_reload"):
|
||||
init_reload()
|
||||
|
||||
func use_begin() -> void:
|
||||
transition.emit("Shoot")
|
||||
|
||||
func init_reload():
|
||||
if machine.ammo == machine.max_ammo:
|
||||
return
|
||||
transition.emit("Reload")
|
||||
|
||||
func with_morphems(animation):
|
||||
return machine.animation_prefix + (animation+"_empty") if emptyable and machine.ammo == 0 else animation
|
||||
Loading…
Add table
Add a link
Reference in a new issue