From 0570edc3ff6c11280ddb616387b5ba01f91665d8 Mon Sep 17 00:00:00 2001 From: bolinfest Date: Tue, 1 Mar 2022 11:48:59 -0800 Subject: [PATCH] fix: ESCItem that is a trigger should not capture input events (#516) Fixes https://github.com/godot-escoria/escoria-issues/issues/147 --- addons/escoria-core/game/core-scripts/esc_item.gd | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/addons/escoria-core/game/core-scripts/esc_item.gd b/addons/escoria-core/game/core-scripts/esc_item.gd index 482bcf9d..56f36ed1 100644 --- a/addons/escoria-core/game/core-scripts/esc_item.gd +++ b/addons/escoria-core/game/core-scripts/esc_item.gd @@ -270,6 +270,14 @@ func _ready(): # # - event: Triggered event func _unhandled_input(event: InputEvent) -> void: + # If this is a trigger, then escoria.inputs_manager is not wired up to + # receive the signals this function might dispatch. In particular, + # calling get_tree().set_input_as_handled() unnecessarily will prevent + # the ESCBackground from being able to process the event. + # See https://github.com/godot-escoria/escoria-issues/issues/147. + if is_trigger: + return + if event is InputEventMouseButton and event.is_pressed(): if not escoria.current_state == escoria.GAME_STATE.DEFAULT: escoria.logger.info("Game state doesn't accept interactions")