Global madness

This commit is contained in:
2025-09-14 01:48:37 +02:00
parent 2d74a87b14
commit 8823132e8e
14 changed files with 91 additions and 41 deletions

View File

@@ -3,6 +3,13 @@ class_name ESCItemComponentGlobalBooleanObserver
@export var targeted_global_variable: String
@export var inverted: bool
@export var targeted_property: TargetProperty
enum TargetProperty {
active,
visible,
interactive
}
func get_component_type():
return "global-boolean-observer"
@@ -21,5 +28,13 @@ func _process(delta: float) -> void:
if global_value == null:
return
escoria.object_manager.get_object(get_global_id()).active = !global_value if inverted else global_value
var output_value = !global_value if inverted else global_value
if targeted_property == TargetProperty.active:
escoria.object_manager.get_object(get_global_id()).active = output_value
elif targeted_property == TargetProperty.visible:
get_parent().visible = output_value
elif targeted_property == TargetProperty.interactive:
escoria.object_manager.get_object(get_global_id()).active = output_value

View File

@@ -15,7 +15,11 @@ func _on_escoria_global_changed(global: String, old_value, new_value) -> void:
labelContainer.add_child(label)
var count = labelContainer.get_child_count()
if labelContainer.get_child_count() > 11:
var child = labelContainer.get_child(0)
func clear():
for child in labelContainer.get_children():
labelContainer.remove_child(child)
child.queue_free()
func _on_clear_button_pressed() -> void:
clear()

View File

@@ -8,6 +8,17 @@ anchors_preset = 0
script = ExtResource("1_42y5j")
labelContainer = NodePath("PanelContainer/MarginContainer/VBoxContainer/ScrollContainer/LabelContainer")
[node name="ClearButton" type="Button" parent="."]
layout_mode = 1
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_top = -40.0
offset_right = 53.0
grow_vertical = 0
text = "Clear
"
[node name="PanelContainer" type="PanelContainer" parent="."]
layout_mode = 0
offset_right = 40.0
@@ -26,3 +37,5 @@ layout_mode = 2
[node name="LabelContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer/ScrollContainer"]
layout_mode = 2
[connection signal="pressed" from="ClearButton" to="." method="_on_clear_button_pressed"]

View File

@@ -1,4 +1,4 @@
:setup
:ready
global turno_cocina_ingrediente_lentejas
global turno_cocina_tutorial_done
global zorionak_eneko
@@ -105,6 +105,7 @@
play_snd("res://gymkhana/sounds/music_loop.ogg", "_music")
:turno_cocina_eneko_catando_end_no_le_gusta
play_video("res://gymkhana/videos/turno_cocina/eneko_sale_no_le_gusta.ogv")
set_global("turno_cocina_eneko_cata_ok", false)
set_active($eneko_smoking, true)
set_active($turno_cocina_ajo, false)
play_snd("res://gymkhana/sounds/music_loop.ogg", "_music")
@@ -115,12 +116,6 @@
set_active($cocina_delante_puerta_detras, true)
set_global("cocina_delante_catando", false)
:pan_mojado_dialog
say($player, "Se ha caído un poco de agua sobre el pan y está blando.", "cocina_delante_pan_mojado_dialog_1")
say($eneko_smoking, "Está hablando? Y que es lo que dice?", "cocina_delante_pan_mojado_dialog_2")
@@ -134,12 +129,13 @@
var cocina_delante_dialog_option4_done = false
var cocina_delante_dialog_option5_done = false
var cocina_delante_dialog_option6_done = false
global turno_cocina_ingrediente_ajo_cogido
?!
- "cocina_delante_intro_dialog_catar:Ya he hecho las lentejas!" [turno_cocina_ingrediente_lentejas]
stop_snd()
play_video("res://gymkhana/videos/turno_cocina/eneko_entra_cocina.ogv")
global cocina_delante_catando = true
set_global("cocina_delante_catando", true)
set_active($eneko_smoking, false)
if !turno_cocina_ingrediente_ajo_cogido:
set_active($turno_cocina_ajo, true)

View File

@@ -2,6 +2,8 @@
[ext_resource type="Script" uid="uid://ceym82rf2qnxu" path="res://addons/escoria-ui-return-monkey-island/esc_item_with_tooltip.gd" id="1"]
[ext_resource type="Texture2D" uid="uid://cueb8gkqhbads" path="res://gymkhana/items/inventory/assets/turno_cocina_ajo.png" id="2"]
[ext_resource type="Script" uid="uid://bh55kesnba2x4" path="res://addons/escoria-ui-return-monkey-island/item_components/ESCItemComponentGlobalObserver.gd" id="6_fo2yn"]
[node name="turno_cocina_ajo" type="Area2D"]
process_mode = 1
@@ -26,3 +28,9 @@ texture = ExtResource("2")
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
polygon = PackedVector2Array(-7, -6, 7, -6, 7, 6, -7, 6)
[node name="ESCItemComponentGlobalBooleanObserver" type="Node" parent="."]
script = ExtResource("6_fo2yn")
targeted_global_variable = "turno_cocina_ingrediente_ajo_cogido"
inverted = true
metadata/_custom_type_script = "uid://bh55kesnba2x4"

View File

@@ -10,6 +10,10 @@
say($player, "Parece un cuerno de algún animal. Lo usan para llamar a comer.", "cocina_cuerno_action3_say")
:action4
global turno_cocina_ingrediente_patatas
global turno_cocina_ingrediente_ajo_en_lentejas
global turno_cocina_eneko_cata_ok
if turno_cocina_ingrediente_patatas and turno_cocina_ingrediente_ajo_en_lentejas and !turno_cocina_eneko_cata_ok:
say($player, "Debería pedirle a Eneko que pruebe las lentejas antes de llamar a la gente.", "cocina_cuerno_action4_hint")
stop

View File

@@ -1,17 +1,17 @@
[gd_scene load_steps=4 format=3 uid="uid://igj2f3midaad"]
[ext_resource type="Script" uid="uid://ceym82rf2qnxu" path="res://addons/escoria-ui-return-monkey-island/esc_item_with_tooltip.gd" id="1"]
[ext_resource type="Texture2D" uid="uid://d33c6oen4di3s" path="res://gymkhana/items/inventory/assets/turno_cocina_cuerno.png" id="2"]
[ext_resource type="Texture2D" uid="uid://bmrurk8dpgeci" path="res://gymkhana/items/inventory/assets/turno_cocina_cuerno_inventario.png" id="3"]
[ext_resource type="Texture2D" uid="uid://bpgvtgvlo10in" path="res://gymkhana/items/inventory/assets/turno_cocina_cuerno.png" id="2"]
[ext_resource type="Texture2D" uid="uid://cgrhr8eh24tbv" path="res://gymkhana/items/inventory/assets/turno_cocina_cuerno_inventario.png" id="3"]
[node name="turno_cocina_cuerno" type="Area2D"]
process_mode = 1
script = ExtResource("1")
global_id = "turno_cocina_cuerno"
esc_script = "res://gymkhana/items/inventory/turno_cocina_cuerno.esc"
combine_when_selected_action_is_in = []
combine_when_selected_action_is_in = PackedStringArray()
inventory_texture = ExtResource("3")
dialog_color = Color(1, 1, 1, 1)
inventory_texture_hovered = ExtResource("3")
custom_data = {
"tooltips": {
"action1": "tooltip_turno_cocina_cuerno_action1",
@@ -20,7 +20,6 @@ custom_data = {
"action4": "tooltip_turno_cocina_cuerno_action4"
}
}
animations = null
[node name="Sprite2D" type="Sprite2D" parent="."]
position = Vector2(8.125, -8.125)

View File

@@ -1,10 +1,11 @@
[gd_scene load_steps=6 format=3 uid="uid://d1ust40cvfjtw"]
[gd_scene load_steps=7 format=3 uid="uid://d1ust40cvfjtw"]
[ext_resource type="Script" uid="uid://ceym82rf2qnxu" path="res://addons/escoria-ui-return-monkey-island/esc_item_with_tooltip.gd" id="1"]
[ext_resource type="Texture2D" uid="uid://breq706ufjdyy" path="res://gymkhana/items/inventory/assets/turno_cocina_olla_inv_con_agua.png" id="2"]
[ext_resource type="Texture2D" uid="uid://bhdcferfexcgb" path="res://gymkhana/items/inventory/assets/turno_cocina_olla.png" id="3"]
[ext_resource type="PackedScene" uid="uid://d7l30s558mvd" path="res://gymkhana/particles/SmokeParticles.tscn" id="4"]
[ext_resource type="Script" uid="uid://con0lpnpm1118" path="res://gymkhana/items/inventory/scripts/turno_cocina_olla_llena_economica_encendida_observer.gd" id="5"]
[ext_resource type="Script" uid="uid://bh55kesnba2x4" path="res://addons/escoria-ui-return-monkey-island/item_components/ESCItemComponentGlobalObserver.gd" id="6_fo2yn"]
[node name="turno_cocina_olla_llena" type="Area2D"]
process_mode = 1
@@ -21,6 +22,7 @@ global_id = "turno_cocina_olla_llena"
esc_script = "res://gymkhana/items/inventory/turno_cocina_olla_llena.esc"
combine_when_selected_action_is_in = PackedStringArray("action4")
inventory_texture = ExtResource("2")
inventory_texture_hovered = ExtResource("2")
custom_data = {
"tooltips": {
"action1": "tooltip_common_look_inside",
@@ -37,3 +39,8 @@ polygon = PackedVector2Array(-59, 25, -59, 47, -35, 56, 7, 58, 54, 52, 55, -13,
[node name="SmokeParticles" parent="." instance=ExtResource("4")]
script = ExtResource("5")
[node name="ESCItemComponentGlobalBooleanObserver" type="Node" parent="."]
script = ExtResource("6_fo2yn")
targeted_global_variable = "turno_cocina_economica_con_olla"
metadata/_custom_type_script = "uid://bh55kesnba2x4"

View File

@@ -146,7 +146,6 @@ global_id = "puerta_delante_start"
[node name="turno_cocina_peso" parent="." instance=ExtResource("10")]
position = Vector2(2505, 160)
scale = Vector2(0.880435, 0.88735)
combine_when_selected_action_is_in = PackedStringArray("action4")
inventory_texture_hovered = ExtResource("11_fji2i")
[node name="turno_cocina_peso_collision" type="CollisionPolygon2D" parent="turno_cocina_peso"]
@@ -416,8 +415,6 @@ script = ExtResource("5")
visible = false
position = Vector2(1281, 491)
scale = Vector2(1.06318, 1.06318)
combine_when_selected_action_is_in = PackedStringArray("action4")
inventory_texture_hovered = ExtResource("23_td4ig")
[node name="ESCLocation" type="Marker2D" parent="turno_cocina_olla_llena"]
position = Vector2(-160.838, 201.283)

View File

@@ -7,21 +7,16 @@
global turno_cocina_economica_con_olla
global turno_cocina_economica_con_madera
# Disable cocina_patata if already picked.
# We cannot look in inventory because the countable item is a different item.
#if cocina_patata_picked:
# set_active($cocina_patata, false)
# Disable cocina_debajo_sofa if already picked.
# We cannot look in inventory because the countable item is a different item.
if cocina_debajo_sofa_picked:
set_active($cocina_debajo_sofa, false)
# Enable/disable olla on economica item if olla already put on the economica
if turno_cocina_economica_con_olla:
set_active($turno_cocina_olla_llena, true)
else:
set_active($turno_cocina_olla_llena, false)
#if turno_cocina_economica_con_olla:
# set_active($turno_cocina_olla_llena, true)
#else:
# set_active($turno_cocina_olla_llena, false)
# Position player depending of last scene
if ESC_LAST_SCENE == "cocina_detras":

View File

@@ -1,3 +1,6 @@
:ready
global turno_cocina_cocina_gas_encendida
:action1
say($player, "Rápido y sencillo. El gas mola.", "cocina_gas_action1_say")
@@ -8,17 +11,21 @@
say($player, "Necesito usar un mechero para encenderla.", "cocina_gas_action2_say_apagada")
:action3 "turno_cocina_mechero"
global turno_cocina_cocina_gas_encendida
if turno_cocina_cocina_gas_encendida:
say($player, "Ya está encendida!", "cocina_gas_action2_say_encendida")
else:
global turno_cocina_cocina_gas_encendida = true
turno_cocina_cocina_gas_encendida = true
say($player, "Ya tengo fuego, que listo soy!", "cocina_gas_action3_mechero_say")
:action3 "turno_cocina_carton"
global turno_cocina_cocina_gas_encendida
if turno_cocina_cocina_gas_encendida:
say($player, "Muy bien, ya tengo una llama portable!", "cocina_gas_action3_carton_say_encendida")
global turno_cocina_cocina_gas_encendida = false
turno_cocina_cocina_gas_encendida = false
inventory_remove($turno_cocina_carton)
inventory_add("turno_cocina_carton_encendido")
else:

View File

@@ -1,9 +1,7 @@
:setup
:action1
global turno_cocina_economica_encendida
global turno_cocina_economica_con_olla
global turno_cocina_economica_con_madera
:action1
if turno_cocina_economica_encendida:
say($player, "Está calentita, lista para cocinar.", "cocina_economica_action1_say_encendida")
else:
@@ -13,6 +11,8 @@
:action2
global turno_cocina_economica_encendida
if turno_cocina_economica_encendida:
say($player, "Ya está encendida. Al final no había interruptor.", "cocina_economica_action2_say_encendida")
else:
@@ -22,13 +22,14 @@
say($player, "Debería llenar la olla de agua primero.", "cocina_economica_action3_olla_vacia_say")
:action3 "turno_cocina_olla_llena"
set_active($turno_cocina_olla_llena, true)
turno_cocina_economica_con_olla = true
set_global("turno_cocina_economica_con_olla", true)
inventory_remove($turno_cocina_olla_llena)
say($player, "Me siento un cocinero de verdad.", "cocina_economica_action3_olla_llena_say")
:action3 "turno_cocina_madera"
turno_cocina_economica_con_madera = true
set_global("turno_cocina_economica_con_madera", true)
inventory_remove($turno_cocina_madera)
say($player, "Más madera que es la guerra!", "cocina_economica_action3_madera_say")
@@ -36,8 +37,10 @@
say($player, "Debería encender el cartón antes de meterlo.", "cocina_economica_action3_carton_say")
:action3 "turno_cocina_carton_encendido"
global turno_cocina_economica_con_madera
if turno_cocina_economica_con_madera:
turno_cocina_economica_encendida = true
set_global("turno_cocina_economica_encendida", true)
inventory_remove($turno_cocina_carton_encendido)
say($player, "He encendido la cocina, a cocinar!", "cocina_economica_action3_carton_encendido_say_madera_used")
else:

View File

@@ -8,7 +8,6 @@
say($player, "Bien! La primera patata!", "cocina_patata_action2_say")
if "turno_cocina_patata_grande" in inventory:
say($player, "La patata gigante no cuenta, es demasiado grande.", "cocina_patata_action2_say_patata_grande_in_inventory")
set_active("cocina_patata", false)
global cocina_patata_picked = true
set_global("cocina_patata_picked", true)
inventory_add("turno_cocina_patata")
item_count_add("turno_cocina_patata")

View File

@@ -18,6 +18,9 @@
set_global("turno_cocina_pan_mojado_playing", false)
set_global("turno_cocina_mikel_playing", false)
set_global("turno_cocina_mikel_played_times",0)
set_global("turno_cocina_tutorial_done", true)
set_global("turno_cocina_tutorial_done", false)
set_global("turno_cocina_eneko_cata_ok", false)
set_global("turno_cocina_hint_romero", false)
set_global("turno_cocina_ingrediente_ajo_cogido", false)
# Starting scene
change_scene("res://gymkhana/rooms/turno_cocina/cocina_delante/cocina_delante.tscn")