CHANGE TO escoria-core. action1 and action2 in tooltip

This commit is contained in:
2023-02-10 20:01:48 +01:00
parent b5c96bad3e
commit 8c1e59a40c
4 changed files with 17 additions and 8 deletions

View File

@@ -101,6 +101,12 @@ export(int) var interaction_direction
# The name for the tooltip of this item # The name for the tooltip of this item
export(String) var tooltip_name export(String) var tooltip_name
# The text for the tooltip of action1
export(String) var action1
# The text for the tooltip of action2
export(String) var action2
# Default action to use if object is not in the inventory # Default action to use if object is not in the inventory
export(String) var default_action export(String) var default_action

View File

@@ -221,7 +221,8 @@ func element_focused(element_id: String) -> void:
) )
var target_obj = escoria.object_manager.get_object(element_id).node var target_obj = escoria.object_manager.get_object(element_id).node
$tooltip_layer/tooltip.set_target(target_obj.tooltip_name) $tooltip_layer/tooltip.set_target(target_obj.action1 + " " + target_obj.action2)
# $tooltip_layer/tooltip.set_target(target_obj.tooltip_name)
if escoria.action_manager.current_action != VERB_USE \ if escoria.action_manager.current_action != VERB_USE \
and escoria.action_manager.current_tool == null \ and escoria.action_manager.current_tool == null \
@@ -236,7 +237,9 @@ func element_unfocused() -> void:
## ITEMS ## ## ITEMS ##
func click_on_item(item_global_id: String, event: InputEvent) -> void: func click_on_item(item_global_id: String, event: InputEvent, action: String) -> void:
escoria.action_manager.set_current_action(action)
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
@@ -254,12 +257,10 @@ func click_on_item(item_global_id: String, event: InputEvent) -> void:
) )
func left_click_on_item(item_global_id: String, event: InputEvent) -> void: 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, "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:
escoria.action_manager.set_current_action("action2") click_on_item(item_global_id, event, "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(

View File

@@ -1,5 +1,5 @@
:action1 :action1
say player "Action 1" say player "Action 1 asks me to say this"
:action2 :action2
say player "Action 2" say player "Action 2 asks me to say this"

View File

@@ -107,6 +107,8 @@ script = ExtResource( 5 )
global_id = "r1_wall_item1" global_id = "r1_wall_item1"
esc_script = "res://gymkhana/rooms/home/esc/wall_item.esc" esc_script = "res://gymkhana/rooms/home/esc/wall_item.esc"
tooltip_name = "Artwork" tooltip_name = "Artwork"
action1 = "This is action1"
action2 = "This is action2"
default_action = "action2" default_action = "action2"
combine_when_selected_action_is_in = [ ] combine_when_selected_action_is_in = [ ]
inventory_texture = ExtResource( 10 ) inventory_texture = ExtResource( 10 )