Always have a valid weapon

Fix crash when you're shooting when you die or when you start the game.
Since weapon is nil (waiting for anim to finish before assigning it),
the game crashes trying on Audio.play(weapon.sound_shoot).
pull/9/head
David Briscoe 2023-10-15 00:04:49 +07:00
parent 28fc66d961
commit b2c60a56e3
1 changed files with 1 additions and 0 deletions

@ -51,6 +51,7 @@ func _ready():
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
rotation_delta = Vector2.ZERO
weapon = weapons[weapon_index] # weapon must never be nil
initiate_change_weapon(weapon_index)