Use inventory items (WIP)

This commit is contained in:
2023-02-17 00:14:13 +01:00
parent fab2a7c234
commit a83e5f2778
4 changed files with 45 additions and 28 deletions

View File

@@ -238,7 +238,8 @@ func click_on_item(item_global_id: String, event: InputEvent, action: String) ->
escoria.action_manager.do(
escoria.action_manager.ACTION.ITEM_LEFT_CLICK,
[item_global_id, event],
true
false
# true
)
if (action == ACTION1 && target_obj.tooltip_name != "") || (action == ACTION2 && target_obj is ESCItemWithTooltip && target_obj.tooltip2_name != ""):
@@ -276,6 +277,9 @@ func click_on_inventory_item(item_global_id: String, event: InputEvent, action:
$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:
Input.set_custom_mouse_cursor(target_obj.inventory_texture)
click_on_inventory_item(inventory_item_global_id, event, ACTION1)
func right_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent) -> void:

View File

@@ -7,11 +7,6 @@
[node name="i_bombona" type="Area2D"]
pause_mode = 1
combine_when_selected_action_is_in = [ ]
dialog_color = Color( 1, 1, 1, 1 )
inventory_texture = ExtResource( 1 )
action1_text = "Mirar bombona"
action2_text = "Coger bombona"
[node name="Sprite" type="Sprite" parent="."]
position = Vector2( 10, 10 )
@@ -29,8 +24,3 @@ position = Vector2( -13, 51 )
[node name="ESCLocation" type="Position2D" parent="."]
position = Vector2( -65, 57 )
script = ExtResource( 3 )
[connection signal="mouse_entered" from="i_bombona" to="i_bombona/action1" method="_on_ESCItemWithTooltip_mouse_entered"]
[connection signal="mouse_entered" from="i_bombona" to="i_bombona/action2" method="_on_ESCItemWithTooltip_mouse_entered"]
[connection signal="mouse_exited" from="i_bombona" to="i_bombona/action1" method="_on_ESCItemWithTooltip_mouse_exited"]
[connection signal="mouse_exited" from="i_bombona" to="i_bombona/action2" method="_on_ESCItemWithTooltip_mouse_exited"]

View File

@@ -1,7 +1,19 @@
:action1
say player "Parece que veo a Mikel"
:action1 i_bombona2
say player "He usado la 'bombona' con la puerta"
# > [eq r5_dialog_advance 2]
# say player "I already fixed the water leak."
# stop
# accept_input SKIP
# set_state r5_pipe stop_water
# set_global r5_pipe_broken false
# say player "The leak's now fixed."
# set_global r5_dialog_advance 2
# accept_input ALL
:action2
#say player "Esta cerrada por dentro."
play_snd res://game/sfx/sounds/doorOpen_2.ogg
change_scene "res://gymkhana/rooms/home/home.tscn"
change_scene "res://gymkhana/rooms/home/home.tscn"

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=30 format=2]
[gd_scene load_steps=31 format=2]
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_room.gd" type="Script" id=1]
[ext_resource path="res://addons/escoria-core/game/core-scripts/esc_background.gd" type="Script" id=2]
@@ -7,6 +7,7 @@
[ext_resource path="res://gymkhana/rooms/trasera_cocina/HoverStartAnimation.gd" type="Script" id=5]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/background trasera cocina-pix.png" type="Texture" id=6]
[ext_resource path="res://game/characters/mark/mark.tscn" type="PackedScene" id=7]
[ext_resource path="res://game/items/inventory/wrench.png" type="Texture" id=8]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-014.png" type="Texture" id=9]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-011.png" type="Texture" id=10]
[ext_resource path="res://gymkhana/rooms/trasera_cocina/assets/eneko-anim/unscreen-002.png" type="Texture" id=11]
@@ -62,7 +63,7 @@ script = ExtResource( 2 )
position = Vector2( 1476, 363 )
scale = Vector2( 0.634168, 0.634168 )
frames = SubResource( 2 )
frame = 7
frame = 5
playing = true
flip_h = true
@@ -70,7 +71,7 @@ flip_h = true
position = Vector2( 1018, 333 )
scale = Vector2( 0.867751, 0.867751 )
frames = SubResource( 2 )
frame = 6
frame = 4
playing = true
offset = Vector2( -0.09375, 20.0582 )
@@ -117,8 +118,9 @@ script = ExtResource( 28 )
global_id = "i_bombona"
esc_script = "res://gymkhana/rooms/trasera_cocina/esc/i_bombona.esc"
tooltip_name = "TT Mirar bombona"
action1_text = ""
action2_text = ""
combine_when_selected_action_is_in = [ ]
inventory_texture = ExtResource( 8 )
dialog_color = Color( 1, 1, 1, 1 )
tooltip2_name = "TT2 Coger bombona"
inventory_action1_text = "¿Cómo ha entrado en mi bolsillo?"
inventory_action2_text = "¿Por qué es una llave inglesa?"
@@ -130,60 +132,69 @@ script = ExtResource( 28 )
global_id = "i_bombona2"
esc_script = "res://gymkhana/rooms/trasera_cocina/esc/i_bombona2.esc"
tooltip_name = "TT Mirar bombona"
action1_text = ""
action2_text = ""
combine_when_selected_action_is_in = [ "action1" ]
inventory_texture = ExtResource( 8 )
dialog_color = Color( 1, 1, 1, 1 )
tooltip2_name = "TT2 Coger bombona"
inventory_action1_text = "¿Cómo ha entrado en mi bolsillo?"
inventory_action1_text = "Usar"
inventory_action2_text = "¿Por qué es una llave inglesa?"
animations = null
[node name="bombona3" parent="Hotspots" instance=ExtResource( 27 )]
visible = false
position = Vector2( 857, 508 )
script = ExtResource( 28 )
global_id = "i_bombona3"
esc_script = "res://gymkhana/rooms/trasera_cocina/esc/i_bombona3.esc"
tooltip_name = "TT Mirar bombona"
action1_text = ""
action2_text = ""
combine_when_selected_action_is_in = [ ]
inventory_texture = ExtResource( 8 )
dialog_color = Color( 1, 1, 1, 1 )
tooltip2_name = "TT2 Coger bombona"
inventory_action1_text = "¿Cómo ha entrado en mi bolsillo?"
inventory_action2_text = "¿Por qué es una llave inglesa?"
animations = null
[node name="bombona4" parent="Hotspots" instance=ExtResource( 27 )]
visible = false
position = Vector2( 757, 508 )
script = ExtResource( 28 )
global_id = "i_bombona4"
esc_script = "res://gymkhana/rooms/trasera_cocina/esc/i_bombona4.esc"
tooltip_name = "TT Mirar bombona"
action1_text = ""
action2_text = ""
combine_when_selected_action_is_in = [ ]
inventory_texture = ExtResource( 8 )
dialog_color = Color( 1, 1, 1, 1 )
tooltip2_name = "TT2 Coger bombona"
inventory_action1_text = "¿Cómo ha entrado en mi bolsillo?"
inventory_action2_text = "¿Por qué es una llave inglesa?"
animations = null
[node name="bombona5" parent="Hotspots" instance=ExtResource( 27 )]
visible = false
position = Vector2( 557, 508 )
script = ExtResource( 28 )
global_id = "i_bombona5"
esc_script = "res://gymkhana/rooms/trasera_cocina/esc/i_bombona5.esc"
tooltip_name = "TT Mirar bombona"
action1_text = ""
action2_text = ""
combine_when_selected_action_is_in = [ ]
inventory_texture = ExtResource( 8 )
dialog_color = Color( 1, 1, 1, 1 )
tooltip2_name = "TT2 Coger bombona"
inventory_action1_text = "¿Cómo ha entrado en mi bolsillo?"
inventory_action2_text = "¿Por qué es una llave inglesa?"
animations = null
[node name="bombona6" parent="Hotspots" instance=ExtResource( 27 )]
visible = false
position = Vector2( 1057, 508 )
script = ExtResource( 28 )
global_id = "i_bombona6"
esc_script = "res://gymkhana/rooms/trasera_cocina/esc/i_bombona6.esc"
tooltip_name = "TT Mirar bombona"
action1_text = ""
action2_text = ""
combine_when_selected_action_is_in = [ ]
inventory_texture = ExtResource( 8 )
dialog_color = Color( 1, 1, 1, 1 )
tooltip2_name = "TT2 Coger bombona"
inventory_action1_text = "¿Cómo ha entrado en mi bolsillo?"
inventory_action2_text = "¿Por qué es una llave inglesa?"