Global refactor
This commit is contained in:
parent
3868af29e3
commit
0589ca4e23
180 changed files with 249 additions and 401 deletions
33
weapons/bomb/bomb_main_state.gd
Normal file
33
weapons/bomb/bomb_main_state.gd
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
extends WeaponState
|
||||
|
||||
@export var bomb_scene: PackedScene
|
||||
|
||||
func enter():
|
||||
machine.animation_player.play(machine.animation_prefix+"plant")
|
||||
machine.animation_player.animation_finished.connect(on_animation_finished)
|
||||
if is_multiplayer_authority():
|
||||
machine.speed_modifier = 0.0
|
||||
machine.player.get_node("PlantAudio").multiplayer_play()
|
||||
|
||||
func exit():
|
||||
machine.animation_player.animation_finished.disconnect(on_animation_finished)
|
||||
machine.speed_modifier = 1.0
|
||||
|
||||
func on_animation_finished(animation: StringName):
|
||||
if is_multiplayer_authority() == false:
|
||||
return
|
||||
if animation == machine.animation_prefix + "plant":
|
||||
var bomb: ActiveBomb = bomb_scene.instantiate()
|
||||
Session.dynamic_objects_parent.add_child(bomb)
|
||||
|
||||
bomb.global_position = machine.player.global_position
|
||||
bomb.plant = Session.get_site(machine.player.player_id).name
|
||||
|
||||
machine.ammo -= 1
|
||||
return_to_previous.emit()
|
||||
|
||||
func use_end() -> void:
|
||||
if is_multiplayer_authority() == false:
|
||||
return
|
||||
transition.emit("Idle")
|
||||
machine.player.get_node("PlantAudio").multiplayer_stop()
|
||||
Loading…
Add table
Add a link
Reference in a new issue