diff --git a/src/player/hold_component.gd b/src/player/hold_component.gd index ab7f136..2174096 100644 --- a/src/player/hold_component.gd +++ b/src/player/hold_component.gd @@ -28,6 +28,9 @@ const THROW_TUTORIAL_DELAY := 6.0 ## Temporary collision mask. @export_flags_3d_physics var hold_collision_physics := 0b01000001 +## This is set when an object is thrown and released when the mouse button is released +var just_threw_object := false + ## The object currently being held. var _held_object: RigidBody3D @@ -108,6 +111,7 @@ func _process_hold_controls() -> void: drop() elif Input.is_action_just_pressed("fire"): throw() + just_threw_object = true func _physics_process(delta: float) -> void: @@ -115,6 +119,10 @@ func _physics_process(delta: float) -> void: if holding_object(): _process_hold_controls() + # Release held object lockout as soon as possible + if not Input.is_action_pressed("fire"): + just_threw_object = false + # Held object logic if not holding_object(): return diff --git a/src/player/player.gd b/src/player/player.gd index 8d06794..4a96c4c 100644 --- a/src/player/player.gd +++ b/src/player/player.gd @@ -216,7 +216,8 @@ func _physics_process(delta: float) -> void: firing = false if tool: # Tool use - if Input.is_action_pressed("fire"): + # Lockout fire input after throwing an object until input is released. + if Input.is_action_pressed("fire") and not hold_component.just_threw_object: tool.fire() firing = true else: