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 = []

View File

@@ -45,17 +45,15 @@ set_global loom_conversation_done false
#set_gui_visible true
:action3 i_caja_herramientas
say eneko_smoking "No quiero una caja vacía 3"
:action3
say eneko_smoking "Nada"
:action4 i_caja_herramientas
say eneko_smoking "No quiero una caja vacía 4"
say eneko_smoking "No quiero una caja vacía"
:action3 i_bombona2
> [bombona2_offered]
> [eq bombona2_offered 1]
say eneko_smoking "¡No vuelvas a hacerlo, es peligroso!"
set_global bombona2_offered 2
stop
> [eq bombona2_offered 2]
say eneko_smoking "¡SE ACABÓ, TE HE BLOQUEADO EN WHATSAPP!"
stop
say eneko_smoking "¿Estás loco? ¿No ves que estoy fumando?"
set_global bombona2_offered true
set_global bombona2_offered 1

View File

@@ -69,6 +69,7 @@ action1_text = "Esto es una puerta y tiene una descripcion mu larga"
action2_text = "Entrar! con descricion..."
action3_target_texts = { "i_bombona2": "Usar la bombona con la puerta?" }
action4_target_texts = { "i_bombona2": "Lanzarla contra la puerta" }
target_when_selected_action_is_in = [ "action3", "action4" ]
animations = SubResource( 2 )
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hotspots/entrada_cocina"]
@@ -120,6 +121,7 @@ dialog_color = Color( 0, 1, 0.462745, 1 )
action1_text = "Objervar sujeto"
action2_text = "Hablar"
action3_target_texts = { "i_bombona2": "Toma, un regalo", "i_caja_herramientas": "Regalar" }
target_when_selected_action_is_in = [ "action3" ]
selectable = true
[node name="ESCLocation" type="Position2D" parent="EnekoSmoking"]