outline fix

This commit is contained in:
2024-03-17 20:02:52 +01:00
parent 19ef4704d4
commit e56b3149c8
4 changed files with 4 additions and 30 deletions

View File

@@ -342,10 +342,8 @@ func has_actions(current_target_object):
return false return false
func get_tooltip_from_current_target(verb,current_target_object): func get_tooltip_from_current_target(verb,current_target_object):
var tooltips = current_target_object.get('tooltips') return gymkhana.tooltip_manager.getTooltip(current_target_object.global_id, verb)
if(tooltips.has(verb)):
return tooltips.get(verb)
return ""
func get_action_target_text(action_target_texts: Dictionary): func get_action_target_text(action_target_texts: Dictionary):
var action_target_text = action_target_texts.get(escoria.action_manager.current_tool.global_id) var action_target_text = action_target_texts.get(escoria.action_manager.current_tool.global_id)
return action_target_text if action_target_text else "" return action_target_text if action_target_text else ""

View File

@@ -2,26 +2,6 @@ tool
extends ESCItem extends ESCItem
class_name ESCItemWithTooltip, "res://addons/escoria-core/design/esc_item.svg" class_name ESCItemWithTooltip, "res://addons/escoria-core/design/esc_item.svg"
# Action 1 Label text
export(String) var action1_text = ""
# Action 2 Label text
export(String) var action2_text = ""
# Action 3 tooltip text if item in inventory
export(String) var action3_text = ""
# Action 4 tooltip text if item in inventory
export(String) var action4_text = ""
export(Dictionary) var tooltips = {}
# Action 3 tooltip texts if item is target. Dictionary with tool's global id as key.
export(Dictionary) var action3_target_texts = {}
# Action 4 tooltip texts if item is target. Dictionary with tool's global id as key
export(Dictionary) var action4_target_texts = {}
# If action used by player is in this list, this is a valid target (second item in combination) # If action used by player is in this list, this is a valid target (second item in combination)
export(Array) var target_when_selected_action_is_in = [] export(Array) var target_when_selected_action_is_in = []
@@ -33,10 +13,6 @@ func _ready():
register_components() register_components()
func set_tooltip(action: String, text: String):
tooltips[action] = text
func has_component(key: String)->bool: func has_component(key: String)->bool:
return components.has(key) return components.has(key)

View File

@@ -355,7 +355,7 @@ func right_click_on_inventory_item(inventory_item_global_id: String, event: Inpu
func inventory_item_focused(inventory_item_global_id: String) -> void: func inventory_item_focused(inventory_item_global_id: String) -> void:
var target_obj = escoria.object_manager.get_object(inventory_item_global_id).node var target_obj = escoria.object_manager.get_object(inventory_item_global_id).node
if target_obj is ESCItemWithTooltip: if target_obj is ESCItemWithTooltip:
$tooltip_layer/tooltip.set_target(target_obj.action3_text) #$tooltip_layer/tooltip.set_target(target_obj.action3_text)
$tooltip_layer/tooltip.set_target_object(target_obj) $tooltip_layer/tooltip.set_target_object(target_obj)

View File

@@ -897,7 +897,7 @@ _global_script_class_icons={
"InventoryAddCommand": "", "InventoryAddCommand": "",
"InventoryRemoveCommand": "", "InventoryRemoveCommand": "",
"ItemCountAddCommand": "", "ItemCountAddCommand": "",
"ItemOutline": "", "ItemOutline": "res://addons/escoria-core/design/esc_item.svg",
"PlayLibSound": "", "PlayLibSound": "",
"PlaySndCommand": "", "PlaySndCommand": "",
"PlayVideoCommand": "", "PlayVideoCommand": "",