Action1 and tooltips on inventory items

This commit is contained in:
2023-02-16 00:18:03 +01:00
parent fc50e75ad5
commit c9e9445f57
3 changed files with 15 additions and 7 deletions

View File

@@ -261,6 +261,7 @@ func left_double_click_on_item(item_global_id: String, event: InputEvent) -> voi
## INVENTORY ##
func left_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent) -> void:
click_on_item(inventory_item_global_id, event, ACTION1)
escoria.action_manager.do(
escoria.action_manager.ACTION.ITEM_LEFT_CLICK,
[inventory_item_global_id, event]
@@ -268,16 +269,15 @@ func left_click_on_inventory_item(inventory_item_global_id: String, event: Input
func inventory_item_focused(inventory_item_global_id: String) -> void:
$tooltip_layer/tooltip.set_target(
escoria.object_manager.get_object(
inventory_item_global_id
).node.tooltip_name
)
var target_obj = escoria.object_manager.get_object(inventory_item_global_id).node
if target_obj is ESCItem && target_obj.inventory_action1_enabled:
$tooltip_layer/tooltip.set_target(target_obj.tooltip_name)
if (target_obj is ESCItemWithTooltip) && target_obj.inventory_action2_enabled:
$tooltip_layer/tooltip2.set_target(target_obj.tooltip2_name)
func inventory_item_unfocused() -> void:
$tooltip_layer/tooltip.set_target("")
$tooltip_layer/tooltip2.set_target("")
element_unfocused()
func open_inventory():
$CanvasLayer/ui/HBoxContainer/inventory_ui.show_inventory()

View File

@@ -15,6 +15,12 @@ export(int) var action1_y = 0
# The text for the tooltip of action2
export(String) var tooltip2_name
# Action1 enabled in inventory
export(bool) var inventory_action1_enabled
# Action2 enabled in inventory
export(bool) var inventory_action2_enabled
#$tooltips.visible = true;
var action1Tooltip: Object
var action2Tooltip: Object

View File

@@ -19,6 +19,8 @@ dialog_color = Color( 1, 1, 1, 1 )
inventory_texture = ExtResource( 1 )
action1_text = "Mirar bombona"
action2_text = "Coger bombona"
inventory_action1_enabled = true
inventory_action2_enabled = false
animations = null
[node name="Sprite" type="Sprite" parent="."]