From a281242b166de8589cf2a9c3e8160dce62b9770a Mon Sep 17 00:00:00 2001 From: Nathan Lovato Date: Sat, 11 Jan 2020 17:23:45 +0100 Subject: [PATCH] Fix incorrect signal connection on the hook The signal should be one shot as it is the trigger to get out of the hook's fire state. I also moved the signal as the cooldown timer doesn't start if the player is not using the hook on a target. --- game/src/Player/Hook/States/Fire.gd | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/game/src/Player/Hook/States/Fire.gd b/game/src/Player/Hook/States/Fire.gd index 44e5ee4..3428191 100644 --- a/game/src/Player/Hook/States/Fire.gd +++ b/game/src/Player/Hook/States/Fire.gd @@ -6,8 +6,6 @@ func _on_Cooldown_timeout() -> void: func enter(msg: Dictionary = {}) -> void: - owner.cooldown.connect("timeout", self, "_on_Cooldown_timeout") - owner.is_aiming = false var target: HookTarget = owner.snap_detector.target @@ -20,10 +18,7 @@ func enter(msg: Dictionary = {}) -> void: owner.arrow.hook_position = target.global_position target.hooked_from(owner.global_position) + owner.cooldown.connect("timeout", self, "_on_Cooldown_timeout", [], CONNECT_ONESHOT) owner.cooldown.start() owner.emit_signal("hooked_onto_target", target.global_position) - - -func exit() -> void: - owner.cooldown.disconnect("timeout", self, "_on_Cooldown_timeout")