fix(monkey-ui): action3/action4 when using objects
This commit is contained in:
@@ -238,33 +238,22 @@ func element_unfocused() -> void:
|
||||
|
||||
## ITEMS ##
|
||||
func click_on_item(item_global_id: String, event: InputEvent, action: String) -> void:
|
||||
escoria.logger.info(self, "current_action:" + escoria.action_manager.current_action)
|
||||
escoria.logger.info(self, "action_state:" + String(escoria.action_manager.action_state))
|
||||
escoria.action_manager.set_current_action(action)
|
||||
|
||||
escoria.logger.info(self, "current_action2:" + escoria.action_manager.current_action)
|
||||
escoria.logger.info(self, "action_state2:" + String(escoria.action_manager.action_state))
|
||||
# if escoria.action_manager.current_target == null:
|
||||
# escoria.logger.info(self, "current_target:null")
|
||||
# else:
|
||||
# escoria.logger.info(self, "current_target:" + escoria.action_manager.current_target.to_string())
|
||||
# if escoria.action_manager.current_tool == null:
|
||||
# escoria.logger.info(self, "current_tool:null")
|
||||
# else:
|
||||
# escoria.logger.info(self, "current_tool:" + escoria.action_manager.current_tool.to_string())
|
||||
|
||||
# If we are awaiting input action use inventory actions (change action1 for action3 and action2 for action4)
|
||||
if escoria.action_manager.action_state == ESCActionManager.ACTION_INPUT_STATE.AWAITING_TARGET_ITEM:
|
||||
action = ACTION3 if action == ACTION1 else ACTION4
|
||||
|
||||
escoria.action_manager.set_current_action(action)
|
||||
var target_obj = escoria.object_manager.get_object(item_global_id).node
|
||||
|
||||
escoria.action_manager.do(
|
||||
escoria.action_manager.ACTION.ITEM_LEFT_CLICK,
|
||||
[item_global_id, event],
|
||||
false
|
||||
# true
|
||||
true
|
||||
)
|
||||
|
||||
if (action == ACTION1 && target_obj.tooltip_name != "") || (action == ACTION2 && target_obj is ESCItemWithTooltip && target_obj.tooltip2_name != ""):
|
||||
$tooltip_layer/tooltip.hide()
|
||||
#$tooltip_layer/tooltip2.hide()
|
||||
|
||||
func left_click_on_item(item_global_id: String, event: InputEvent) -> void:
|
||||
click_on_item(item_global_id, event, ACTION1)
|
||||
@@ -282,23 +271,12 @@ 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:
|
||||
escoria.logger.info(self, "current_action inv:" + escoria.action_manager.current_action)
|
||||
escoria.logger.info(self, "action_state inv:" + String(escoria.action_manager.action_state))
|
||||
escoria.action_manager.set_current_action(action)
|
||||
|
||||
escoria.logger.info(self, "current_action2 inv:" + escoria.action_manager.current_action)
|
||||
escoria.logger.info(self, "action_state2 inv:" + String(escoria.action_manager.action_state))
|
||||
# if escoria.action_manager.current_target == null:
|
||||
# escoria.logger.info(self, "current_target:null")
|
||||
# else:
|
||||
# escoria.logger.info(self, "current_target:" + escoria.action_manager.current_target.to_string())
|
||||
# if escoria.action_manager.current_tool == null:
|
||||
# escoria.logger.info(self, "current_tool:null")
|
||||
# else:
|
||||
# escoria.logger.info(self, "current_tool:" + escoria.action_manager.current_tool.to_string())
|
||||
|
||||
var target_obj = escoria.object_manager.get_object(item_global_id).node
|
||||
|
||||
if action in target_obj.combine_when_selected_action_is_in:
|
||||
Input.set_custom_mouse_cursor(target_obj.inventory_texture)
|
||||
|
||||
escoria.action_manager.do(
|
||||
escoria.action_manager.ACTION.ITEM_LEFT_CLICK,
|
||||
[item_global_id, event],
|
||||
@@ -307,14 +285,9 @@ func click_on_inventory_item(item_global_id: String, event: InputEvent, action:
|
||||
|
||||
if (target_obj is ESCItemWithTooltip) && (action == ACTION3 && target_obj.action3_text != "") || (action == ACTION4 && target_obj.action4_text != ""):
|
||||
$tooltip_layer/tooltip.hide()
|
||||
#$tooltip_layer/tooltip2.hide()
|
||||
|
||||
func left_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent) -> void:
|
||||
var target_obj = escoria.object_manager.get_object(inventory_item_global_id).node
|
||||
if ACTION3 in target_obj.combine_when_selected_action_is_in:
|
||||
Input.set_custom_mouse_cursor(target_obj.inventory_texture)
|
||||
click_on_inventory_item(inventory_item_global_id, event, ACTION1)
|
||||
# click_on_inventory_item(inventory_item_global_id, event, ACTION3)
|
||||
click_on_inventory_item(inventory_item_global_id, event, ACTION3)
|
||||
|
||||
func right_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent) -> void:
|
||||
click_on_inventory_item(inventory_item_global_id, event, ACTION4)
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
:action1 i_bombona2
|
||||
:action1
|
||||
say player "Parece que veo a Mikel"
|
||||
|
||||
:action2
|
||||
#say player "Esta cerrada por dentro."
|
||||
play_snd res://game/sfx/sounds/doorOpen_2.ogg
|
||||
change_scene "res://gymkhana/rooms/interior_cocina/interior_cocina.tscn"
|
||||
|
||||
:action3 i_bombona2
|
||||
say player "He usado la 'bombona' con la puerta"
|
||||
# > [eq r5_dialog_advance 2]
|
||||
# say player "I already fixed the water leak."
|
||||
@@ -10,10 +18,6 @@ say player "He usado la 'bombona' con la puerta"
|
||||
# set_global r5_dialog_advance 2
|
||||
# accept_input ALL
|
||||
|
||||
:action1
|
||||
say player "Parece que veo a Mikel"
|
||||
|
||||
:action2
|
||||
#say player "Esta cerrada por dentro."
|
||||
play_snd res://game/sfx/sounds/doorOpen_2.ogg
|
||||
change_scene "res://gymkhana/rooms/interior_cocina/interior_cocina.tscn"
|
||||
:action4 i_bombona2
|
||||
say player "No creo que les haga gracia"
|
||||
|
||||
@@ -102,7 +102,7 @@ position = Vector2( 355, 409 )
|
||||
script = ExtResource( 28 )
|
||||
global_id = "i_bombona2"
|
||||
esc_script = "res://gymkhana/rooms/trasera_cocina/esc/i_bombona2.esc"
|
||||
combine_when_selected_action_is_in = [ "action1", "action3" ]
|
||||
combine_when_selected_action_is_in = [ "action3" ]
|
||||
use_from_inventory_only = true
|
||||
inventory_texture = ExtResource( 29 )
|
||||
dialog_color = Color( 1, 1, 1, 1 )
|
||||
|
||||
Reference in New Issue
Block a user