From 9e06ff86c6be2a4e469e71301cf3379c6eda3fee Mon Sep 17 00:00:00 2001 From: Oier Bravo Urtasun Date: Sun, 14 Sep 2025 18:01:23 +0200 Subject: [PATCH] Creditos music --- .../esc/commands/set_volume.gd | 54 +++++++++++++++++++ .../esc/commands/set_volume.gd.uid | 1 + .../turno_cocina/creditos/esc/creditos.esc | 1 + 3 files changed, 56 insertions(+) create mode 100644 addons/escoria-ui-return-monkey-island/esc/commands/set_volume.gd create mode 100644 addons/escoria-ui-return-monkey-island/esc/commands/set_volume.gd.uid diff --git a/addons/escoria-ui-return-monkey-island/esc/commands/set_volume.gd b/addons/escoria-ui-return-monkey-island/esc/commands/set_volume.gd new file mode 100644 index 00000000..c7569e2f --- /dev/null +++ b/addons/escoria-ui-return-monkey-island/esc/commands/set_volume.gd @@ -0,0 +1,54 @@ +# `set_volume value player` +# +# Sets the volume for the specified channel. +# +# **Parameters** +# +# - *volume*: Targeted volume +# - *player*: Sound player to use. Can either be `_sound`, which is used to play non- +# looping sound effects; `_music`, which plays looping music; or `_speech`, which +# plays non-looping voice files (default: `_sound`) +# +# @ESC + +extends ESCBaseCommand +class_name SetVolumeCommand + + +# Return the descriptor of the arguments of this command +func configure() -> ESCCommandArgumentDescriptor: + return ESCCommandArgumentDescriptor.new( + 1, + [TYPE_FLOAT,TYPE_STRING], + [null, "_music"] + ) + + +# Validate whether the given arguments match the command descriptor +func validate(arguments: Array): + if not super.validate(arguments): + return false + + if not escoria.object_manager.has(arguments[1]): + raise_error(self, "Invalid sound player. Sound player %s not registered." % arguments[1]) + return false + + return true + + +# Run the command +func run(command_params: Array) -> int: + AudioServer.set_bus_volume_db( + AudioServer.get_bus_index(escoria.BUS_MUSIC), + linear_to_db( + command_params[0] + ) + ) + return ESCExecution.RC_OK + + +# Function called when the command is interrupted. +func interrupt(): + # Do nothing + pass + diff --git a/addons/escoria-ui-return-monkey-island/esc/commands/set_volume.gd.uid b/addons/escoria-ui-return-monkey-island/esc/commands/set_volume.gd.uid new file mode 100644 index 00000000..e4fe22a5 --- /dev/null +++ b/addons/escoria-ui-return-monkey-island/esc/commands/set_volume.gd.uid @@ -0,0 +1 @@ +uid://dqxnqfx6f0n6k diff --git a/gymkhana/rooms/turno_cocina/creditos/esc/creditos.esc b/gymkhana/rooms/turno_cocina/creditos/esc/creditos.esc index d225a377..ab6b0fde 100644 --- a/gymkhana/rooms/turno_cocina/creditos/esc/creditos.esc +++ b/gymkhana/rooms/turno_cocina/creditos/esc/creditos.esc @@ -21,6 +21,7 @@ say($oier_dancing, "Hmm, mejor no.", "turno_cocina_creditos_8") say($oier_dancing, "Lanzamos los créditos?", "turno_cocina_creditos_9") say($eneko_dancing, "Daleee!", "turno_cocina_creditos_10") + set_volume(1.0,"_music") play_snd("res://gymkhana/sounds/intro_menu_loop.ogg", "_music") set_global("turno_credits_rolling", true) set_global("turno_cocina_credits_dancing", true)