@@ -92,6 +92,7 @@ func _init():
func _ready ( ) :
# We need a slightly modified version of Action Manager to combine items with different actions.
escoria . action_manager = ESCActionManagerMonkey . new ( )
#escoria.di = RTMIDependencyInjector.new()
if $ tooltip_layer / tooltip . connect ( " tooltip_size_updated " , Callable ( self , " update_tooltip_following_mouse_position " ) . bind ( tooltip_node ) ) != 0 :
escoria . logger . error ( self , " Error connecting tooltip_size_updated with update_tooltip_following_mouse_position " )
@@ -235,10 +236,16 @@ func _process_input(event: InputEvent, is_default_state: bool) -> bool:
## BACKGROUND ##
func click_on_bg ( position : Vector2 ) - > void :
var current_state = escoria . action_manager . action_state
if escoria . action_manager . action_state == ESCActionManager . ACTION_INPUT_STATE . AWAITING_VERB_OR_ITEM :
gymkhana . cursor_manager . clear_cursor ( )
# If we are using an inventory item reset mouse cursor and cancel action
if escoria . action_manager . action_state == ESCActionManager . ACTION_INPUT_STATE . AWAITING_TARGET_ITEM :
Input . set_custom_mouse _cursor( null )
escoria . action_manager . clear_current_tool ( )
gymkhana . cursor_manager . clear _cursor( )
if escoria . main . current_scene . player :
escoria . action_manager . do (
@@ -291,7 +298,7 @@ func element_unfocused() -> void:
func click_on_item ( item_global_id : String , event : InputEvent , action : String ) - > void :
# If we are using an inventory item reset mouse cursor and use inventory actions (change action1 for action3 and action2 for action4)
if escoria . action_manager . action_state == ESCActionManager . ACTION_INPUT_STATE . AWAITING_TARGET_ITEM :
Input . set_custom_mouse _cursor( null )
gymkhana . cursor_manager . clear _cursor( )
action = ACTION3 if action == ACTION1 else ACTION4
escoria . action_manager . set_current_action ( action )
@@ -318,8 +325,10 @@ func left_double_click_on_item(item_global_id: String, event: InputEvent) -> voi
## INVENTORY ##
func click_on_inventory_item ( item_global_id : String , event : InputEvent , action : String ) - > void :
# If we are using an inventory item reset mouse cursor
if escoria . action_manager . action_state == null :
gymkhana . cursor_manager . clear_cursor ( )
if escoria . action_manager . action_state == ESCActionManager . ACTION_INPUT_STATE . AWAITING_TARGET_ITEM :
Input . set_custom_mouse _cursor( null )
gymkhana . cursor_manager . clear _cursor( )
escoria . action_manager . set_current_action ( action )
var target_obj = escoria . object_manager . get_object ( item_global_id ) . node
@@ -327,12 +336,7 @@ func click_on_inventory_item(item_global_id: String, event: InputEvent, action:
# If item needs combination with this action, use the item texture as mouse cursor
if action in target_obj . combine_when_selected_action_is_in :
var texture = target_obj . inventory_texture
var cursor = ImageTexture . new ( )
var texture_image : Image = texture . get_data ( )
texture_image . resize ( texture_image . get_width ( ) / 2 , texture_image . get_height ( ) / 2 )
cursor . create_from_image ( texture_image )
var middleOfTheTexture = Vector2 ( texture_image . get_width ( ) / 2 , texture_image . get_height ( ) / 2 )
Input . set_custom_mouse_cursor ( cursor , 0 , middleOfTheTexture )
gymkhana . cursor_manager . set_cursor ( texture )
escoria . action_manager . do (
escoria . action_manager . ACTION . ITEM_LEFT_CLICK ,