Action3 and Action4

This commit is contained in:
2023-02-24 18:03:17 +01:00
parent 3d6e6b4035
commit e75c41ff9b
10 changed files with 45 additions and 159 deletions

View File

@@ -16,10 +16,10 @@ export(int) var action1_y = 0
export(String) var tooltip2_name
# Action1 tooltip text in inventory
export(String) var inventory_action1_text
export(String) var action3_text
# Action2 tooltip text in inventory
export(String) var inventory_action2_text
export(String) var action4_text
#$tooltips.visible = true;
var action1Tooltip: Object

View File

@@ -1,7 +1,13 @@
extends ESCGame
# Left mouse button on item
const ACTION1 = "action1"
# Right mouse button on item
const ACTION2 = "action2"
# Left mouse button on inventory item
const ACTION3 = "action3"
# Right mouse button on inventory item
const ACTION4 = "action4"
const VERB_USE = "use"
const VERB_WALK = "walk"
@@ -272,25 +278,25 @@ func click_on_inventory_item(item_global_id: String, event: InputEvent, action:
true
)
if (target_obj is ESCItemWithTooltip) && (action == ACTION1 && target_obj.inventory_action1_text != "") || (action == ACTION2 && target_obj.inventory_action2_text != ""):
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 ACTION1 in target_obj.combine_when_selected_action_is_in:
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)
func right_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent) -> void:
click_on_inventory_item(inventory_item_global_id, event, ACTION2)
click_on_inventory_item(inventory_item_global_id, event, ACTION4)
func inventory_item_focused(inventory_item_global_id: String) -> void:
var target_obj = escoria.object_manager.get_object(inventory_item_global_id).node
if target_obj is ESCItemWithTooltip:
$tooltip_layer/tooltip.set_target(target_obj.inventory_action1_text)
$tooltip_layer/tooltip2.set_target(target_obj.inventory_action2_text)
$tooltip_layer/tooltip.set_target(target_obj.action3_text)
$tooltip_layer/tooltip2.set_target(target_obj.action4_text)
func inventory_item_unfocused() -> void: