Added ESCItemWithTooltip.target_when_selected_action_is_in

This commit is contained in:
2023-03-08 23:25:20 +01:00
parent c9ce5acd5b
commit d8d25e5dbb
4 changed files with 21 additions and 14 deletions

View File

@@ -205,7 +205,7 @@ func perform_inputevent_on_object(
# depending on the used action verb.
var tool_just_set = _set_tool_and_action(obj, default_action)
# MODIFIED FOR RETURN TO MONKEY UI
var need_combine = _check_item_needs_combine_obj(obj, tool_just_set)
var need_combine = _check_item_needs_combine_obj(obj)
# If the current tool was not set, this is our first item, make it the tool
if not current_tool or (current_tool and not need_combine):
@@ -338,7 +338,7 @@ func _set_tool_and_action(obj: ESCObject, default_action: bool):
if current_action and current_tool:
# MODIFIED FOR RETURN TO MONKEY UI
if (not current_action in escoria.action_manager\
.current_tool.node.combine_when_selected_action_is_in and not current_action in obj.node.combine_when_selected_action_is_in):
.current_tool.node.combine_when_selected_action_is_in and not current_action in obj.node.target_when_selected_action_is_in):
current_tool = obj
tool_just_set = true
elif default_action:
@@ -357,10 +357,9 @@ func _set_tool_and_action(obj: ESCObject, default_action: bool):
#
# *Returns* True if current action on "obj" requires a combination
# MODIFIED FOR RETURN TO MONKEY UI
func _check_item_needs_combine_obj(obj: ESCObject, tool_just_set: bool) -> bool:
func _check_item_needs_combine_obj(obj: ESCObject) -> bool:
return current_action \
and current_tool \
and (current_action in current_tool.node.combine_when_selected_action_is_in
# MODIFIED FOR RETURN TO MONKEY UI
or !tool_just_set)
# or current_action in obj.node.combine_when_selected_action_is_in)
or current_action in obj.node.target_when_selected_action_is_in)

View File

@@ -4,13 +4,21 @@ 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 = ""
# 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)
export(Array) var target_when_selected_action_is_in = []