fix(rtmi): Item highlight and shift key

This commit is contained in:
2025-11-02 00:48:56 +01:00
parent 78eb9f5235
commit b5202e462c
6 changed files with 21 additions and 34 deletions

View File

@@ -31,7 +31,7 @@ func handle_input(_event):
_dialog_manager.say_finished.disconnect(_on_say_finished)
finished.emit("interrupt")
get_viewport().set_input_as_handled()
#get_viewport().set_input_as_handled()
# Handles the end of a say function after it has emitted say_finished.

View File

@@ -10,7 +10,7 @@ var _perfect = false
@onready var total_time: Label = %TotalTime
@onready var unlocked_achievements_container: VBoxContainer = %UnlockedAchievementsContainer
@onready var submit_button: RTMIMenuButton = %SubmitButton
@onready var submit_button: Spinner = %Spinner
@onready var spinner: Spinner = %Spinner
func _ready() -> void:

View File

@@ -59,8 +59,6 @@ const ESC_UI_CHANGE_VERB_ACTION = "esc_change_verb"
@export var video_player: RTMIVideoPlayer
@export var language_selector: RTMILanguageSelector
var last_target: Object
# Tracks the mouse's current position onscreen.
var _current_mouse_pos = Vector2.ZERO
@@ -266,13 +264,9 @@ func element_focused(element_id: String) -> void:
tooltip_node.set_target(target_obj.tooltip_name)
tooltip_node.set_target_object(target_obj)
if is_instance_valid(last_target):
last_target.get_component("outline").highlight(false)
if escoria.action_manager.has_actions(target_obj):
if target_obj is ESCItemWithTooltip:
target_obj.get_component("outline").highlight(true)
last_target = target_obj
if target_obj.is_interactive:
gymkhana.cursor_manager.handle_item_cursor(target_obj)
update_highlights()
@@ -369,7 +363,7 @@ func click_on_inventory_item(item_global_id: String, event: InputEvent, action:
escoria.action_manager.ACTION.ITEM_LEFT_CLICK, [item_global_id, event], true
)
#update_highlights()
update_highlights()
# Hide tooltip if some action is being performed
# Disabled: leaves the tooltips hidden. ToDo: check if has other implications.
@@ -565,9 +559,6 @@ func correct_position(
func _on_event_done(return_code: int, _event_name: String):
escoria.logger.info(self, "EVENT DONE! code= %s" % [return_code])
# Reset mouse cursor (should be not needed, but avoids not resetting the cursor on bugs)
#gymkhana.cursor_manager.clear_cursor()
# Show tooltips, they were hidden while performing action
tooltip_node.show()
update_highlights()

View File

@@ -54,12 +54,6 @@ func set_texture(texture: Texture):
self.texture_hover = texture
#func _input(event: InputEvent) -> void:
# if not event.is_action("ui_show_hints") or escoria.current_state != escoria.GAME_STATE.DEFAULT:
# return
# update_highlight()
func update_highlight():
if (
escoria.action_manager.action_state

View File

@@ -27,6 +27,9 @@ func highlight(value: bool) -> void:
if node is ItemOutline:
node.visible = value
func _input(event) -> void :
if event.is_action("ui_show_hints"):
update_highlight()
func update_highlight():
if escoria.current_state != escoria.GAME_STATE.DEFAULT:
@@ -37,30 +40,28 @@ func update_highlight():
highlight(false)
return
#if gymkhana.is_item_under_mouse(get_global_id()):
# highlight(true)
# return
# No tool selected
if (
escoria.action_manager.action_state
!= escoria.action_manager.ACTION_INPUT_STATE.AWAITING_TARGET_ITEM
<= escoria.action_manager.ACTION_INPUT_STATE.AWAITING_ITEM
):
if gymkhana.is_hint_active:
highlight(true)
elif not gymkhana.is_item_under_mouse(get_global_id()):
highlight(false)
highlight(gymkhana.is_hint_active or gymkhana.is_item_under_mouse(get_global_id()))
return
# Only with tool selected
if (
escoria.action_manager.action_state
!= escoria.action_manager.ACTION_INPUT_STATE.AWAITING_TARGET_ITEM
):
highlight(false)
return
#if escoria.action_manager.action_state != escoria.action_manager.ACTION_INPUT_STATE.AWAITING_TARGET_ITEM:
# highlight(false)
# return
if not gymkhana.has_combination_with_current_tool(get_global_id()):
highlight(false)
return
if gymkhana.is_hint_active:
highlight(true)
elif not gymkhana.is_item_under_mouse(get_global_id()):
highlight(false)
#if gymkhana.is_hint_active:
# highlight(true)
#elif not gymkhana.is_item_under_mouse(get_global_id()):
#highlight(false)
highlight(gymkhana.is_hint_active or gymkhana.is_item_under_mouse(get_global_id()))

View File

@@ -64,3 +64,4 @@ func _on_cursor_hide_timer_timeout() -> void:
func _input(event: InputEvent) -> void:
if event is InputEventMouseMotion:
gymkhana.cursor_manager.show_cursor()