From 9de6c1fe62a3c3aaa5a60a34d3dd35b2ac6058b2 Mon Sep 17 00:00:00 2001 From: Balloonpopper Date: Fri, 29 Jul 2022 14:20:55 +1000 Subject: [PATCH] Warning message added when location cant be reached. --- .../game/core-scripts/esc/esc_action_manager.gd | 14 ++++++++++++++ .../game/core-scripts/esc/esc_event_manager.gd | 1 + 2 files changed, 15 insertions(+) diff --git a/addons/escoria-core/game/core-scripts/esc/esc_action_manager.gd b/addons/escoria-core/game/core-scripts/esc/esc_action_manager.gd index 49e95734..51b74325 100644 --- a/addons/escoria-core/game/core-scripts/esc/esc_action_manager.gd +++ b/addons/escoria-core/game/core-scripts/esc/esc_action_manager.gd @@ -540,6 +540,20 @@ func perform_inputevent_on_object( if not player_global_pos.is_equal_approx(destination_position): dont_interact = true + escoria.logger.info( + self, + "Player could not reach destination coordinates %s. " % str(destination_position) \ + + "Any requested action for %s will not fire." % obj.global_id + ) + if escoria.event_manager.EVENT_CANT_REACH in obj.events: + escoria.event_manager.queue_event(obj.events[escoria.event_manager.EVENT_CANT_REACH]) + else: + escoria.logger.info( + self, + "%s event not found for object %s so nothing to do." % \ + [escoria.event_manager.EVENT_CANT_REACH, obj.global_id] + ) + # If no interaction should happen after player has arrived, leave # immediately. diff --git a/addons/escoria-core/game/core-scripts/esc/esc_event_manager.gd b/addons/escoria-core/game/core-scripts/esc/esc_event_manager.gd index a256262b..26cb2420 100644 --- a/addons/escoria-core/game/core-scripts/esc/esc_event_manager.gd +++ b/addons/escoria-core/game/core-scripts/esc/esc_event_manager.gd @@ -31,6 +31,7 @@ const EVENT_ROOM_SELECTOR = "room_selector" const EVENT_SETUP = "setup" const EVENT_TRANSITION_IN = "transition_in" const EVENT_TRANSITION_OUT = "transition_out" +const EVENT_CANT_REACH = "cant_reach" # Event channel names