Left click launches action1 and right click action2

This commit is contained in:
2023-02-10 17:45:26 +01:00
parent 488978cb1a
commit b5c96bad3e
3 changed files with 26 additions and 25 deletions

View File

@@ -179,14 +179,14 @@ func _process_input(event: InputEvent, is_default_state: bool) -> bool:
escoria.inputs_manager._on_left_click_on_bg(get_global_mouse_position()) escoria.inputs_manager._on_left_click_on_bg(get_global_mouse_position())
return true return true
elif event.is_action_pressed(ESC_UI_CHANGE_VERB_ACTION): elif event.is_action_pressed(ESC_UI_CHANGE_VERB_ACTION):
mousewheel_action(1) escoria.logger.error("Someone invoked ESC_UI_CHANGE_VERB_ACTION:", [event.as_text()])
return true return true
return false return false
## BACKGROUND ## ## BACKGROUND ##
func left_click_on_bg(position: Vector2) -> void: func click_on_bg(position: Vector2) -> void:
if escoria.main.current_scene.player: if escoria.main.current_scene.player:
escoria.action_manager.do( escoria.action_manager.do(
escoria.action_manager.ACTION.BACKGROUND_CLICK, escoria.action_manager.ACTION.BACKGROUND_CLICK,
@@ -196,8 +196,11 @@ func left_click_on_bg(position: Vector2) -> void:
$mouse_layer/verbs_menu.set_by_name(VERB_WALK) $mouse_layer/verbs_menu.set_by_name(VERB_WALK)
$mouse_layer/verbs_menu.clear_tool_texture() $mouse_layer/verbs_menu.clear_tool_texture()
func left_click_on_bg(position: Vector2) -> void:
click_on_bg(position)
func right_click_on_bg(position: Vector2) -> void: func right_click_on_bg(position: Vector2) -> void:
mousewheel_action(1) click_on_bg(position)
func left_double_click_on_bg(position: Vector2) -> void: func left_double_click_on_bg(position: Vector2) -> void:
if escoria.main.current_scene.player: if escoria.main.current_scene.player:
@@ -233,7 +236,7 @@ func element_unfocused() -> void:
## ITEMS ## ## ITEMS ##
func left_click_on_item(item_global_id: String, event: InputEvent) -> void: func click_on_item(item_global_id: String, event: InputEvent) -> void:
var target_obj = escoria.object_manager.get_object(item_global_id).node var target_obj = escoria.object_manager.get_object(item_global_id).node
# current_action will be empty if an event completes between when you stop # current_action will be empty if an event completes between when you stop
@@ -249,8 +252,14 @@ func left_click_on_item(item_global_id: String, event: InputEvent) -> void:
[item_global_id, event], [item_global_id, event],
true true
) )
func left_click_on_item(item_global_id: String, event: InputEvent) -> void:
escoria.action_manager.set_current_action("action1")
click_on_item(item_global_id, event)
func right_click_on_item(item_global_id: String, event: InputEvent) -> void: func right_click_on_item(item_global_id: String, event: InputEvent) -> void:
mousewheel_action(1) escoria.action_manager.set_current_action("action2")
click_on_item(item_global_id, event)
func left_double_click_on_item(item_global_id: String, event: InputEvent) -> void: func left_double_click_on_item(item_global_id: String, event: InputEvent) -> void:
escoria.action_manager.do( escoria.action_manager.do(
@@ -280,12 +289,12 @@ func left_click_on_inventory_item(inventory_item_global_id: String, event: Input
item.inventory_item.texture_normal item.inventory_item.texture_normal
) )
func right_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent) -> void: # func right_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent) -> void:
mousewheel_action(1) # mousewheel_action(1)
func left_double_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent) -> void: # func left_double_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent) -> void:
pass # pass
func inventory_item_focused(inventory_item_global_id: String) -> void: func inventory_item_focused(inventory_item_global_id: String) -> void:
@@ -308,8 +317,8 @@ func close_inventory():
$CanvasLayer/ui/HBoxContainer/inventory_ui.hide_inventory() $CanvasLayer/ui/HBoxContainer/inventory_ui.hide_inventory()
func mousewheel_action(direction: int): # func mousewheel_action(direction: int):
$mouse_layer/verbs_menu.iterate_actions_cursor(direction) # $mouse_layer/verbs_menu.iterate_actions_cursor(direction)
func hide_ui(): func hide_ui():

View File

@@ -30,7 +30,7 @@ func iterate_actions_cursor(direction: int):
elif current_cursor_id < 0: elif current_cursor_id < 0:
current_cursor_id = cursors.size() - 1 current_cursor_id = cursors.size() - 1
Input.set_custom_mouse_cursor(cursors[current_cursor_id].texture) # Input.set_custom_mouse_cursor(cursors[current_cursor_id].texture)
escoria.action_manager.set_current_action(cursors[current_cursor_id].name) escoria.action_manager.set_current_action(cursors[current_cursor_id].name)
if $mouse_position/tool.texture != null: if $mouse_position/tool.texture != null:
clear_tool_texture() clear_tool_texture()
@@ -41,7 +41,7 @@ func set_by_name(name: String) -> void:
current_cursor_id = i current_cursor_id = i
break break
Input.set_custom_mouse_cursor(cursors[current_cursor_id].texture) # Input.set_custom_mouse_cursor(cursors[current_cursor_id].texture)
escoria.action_manager.set_current_action(cursors[current_cursor_id].name) escoria.action_manager.set_current_action(cursors[current_cursor_id].name)
func set_tool_texture(texture: Texture): func set_tool_texture(texture: Texture):

View File

@@ -1,13 +1,5 @@
:action1
say player "Action 1"
:action2 :action2
> [eq dialog_advance 0] say player "Action 2"
say player ROOM1_look_wall_item_1:"I don't know what that stuff is."
set_global dialog_advance 1
stop
> [eq dialog_advance 1]
say player ROOM1_look_wall_item_2:"I REALLY don't know what that stuff is."
set_global dialog_advance 2
stop
> [eq dialog_advance 2]
say player ROOM1_look_wall_item_3:"No, SERIOUSLY, I have no idea what that is!"
say player ROOM1_look_wall_item_4:"Please stop asking me that!"
stop