🎨 Auto-format GDScript code

Automated formatting applied by tools/run_development.py

🤖 Generated by Gitea Actions
Workflow: Continuous Integration
Run: http://server:3000/nett00n/skelly/actions/runs/90
This commit is contained in:
Gitea Actions
2025-10-01 11:05:19 +00:00
parent 3b8da89ad5
commit 1f1c394587
28 changed files with 655 additions and 1945 deletions

View File

@@ -14,13 +14,10 @@ var current_control_index: int = 0
var original_control_scales: Array[Vector2] = []
var original_control_modulates: Array[Color] = []
@onready
var master_slider = $SettingsContainer/MasterVolumeContainer/MasterVolumeSlider
@onready
var music_slider = $SettingsContainer/MusicVolumeContainer/MusicVolumeSlider
@onready var master_slider = $SettingsContainer/MasterVolumeContainer/MasterVolumeSlider
@onready var music_slider = $SettingsContainer/MusicVolumeContainer/MusicVolumeSlider
@onready var sfx_slider = $SettingsContainer/SFXVolumeContainer/SFXVolumeSlider
@onready
var language_stepper = $SettingsContainer/LanguageContainer/LanguageStepper
@onready var language_stepper = $SettingsContainer/LanguageContainer/LanguageStepper
@onready var reset_progress_button = $ResetSettingsContainer/ResetProgressButton
@@ -29,15 +26,11 @@ func _ready() -> void:
DebugManager.log_info("SettingsMenu ready", "Settings")
# Language selector is initialized automatically
var master_callback: Callable = _on_volume_slider_changed.bind(
"master_volume"
)
var master_callback: Callable = _on_volume_slider_changed.bind("master_volume")
if not master_slider.value_changed.is_connected(master_callback):
master_slider.value_changed.connect(master_callback)
var music_callback: Callable = _on_volume_slider_changed.bind(
"music_volume"
)
var music_callback: Callable = _on_volume_slider_changed.bind("music_volume")
if not music_slider.value_changed.is_connected(music_callback):
music_slider.value_changed.connect(music_callback)
@@ -64,28 +57,20 @@ func _update_controls_from_settings() -> void:
func _on_volume_slider_changed(value: float, setting_key: String) -> void:
# Input validation for volume settings
if not setting_key in ["master_volume", "music_volume", "sfx_volume"]:
DebugManager.log_error(
"Invalid volume setting key: " + str(setting_key), "Settings"
)
DebugManager.log_error("Invalid volume setting key: " + str(setting_key), "Settings")
return
if typeof(value) != TYPE_FLOAT and typeof(value) != TYPE_INT:
DebugManager.log_error(
"Invalid volume value type: " + str(typeof(value)), "Settings"
)
DebugManager.log_error("Invalid volume value type: " + str(typeof(value)), "Settings")
return
# Clamp value to valid range
var clamped_value: float = clamp(float(value), 0.0, 1.0)
if clamped_value != value:
DebugManager.log_warn(
"Volume value %f clamped to %f" % [value, clamped_value], "Settings"
)
DebugManager.log_warn("Volume value %f clamped to %f" % [value, clamped_value], "Settings")
if not settings_manager.set_setting(setting_key, clamped_value):
DebugManager.log_error(
"Failed to set volume setting: " + setting_key, "Settings"
)
DebugManager.log_error("Failed to set volume setting: " + setting_key, "Settings")
func _exit_settings() -> void:
@@ -95,13 +80,8 @@ func _exit_settings() -> void:
func _input(event: InputEvent) -> void:
if (
event.is_action_pressed("action_east")
or event.is_action_pressed("pause_menu")
):
DebugManager.log_debug(
"Cancel/back action pressed in settings", "Settings"
)
if event.is_action_pressed("action_east") or event.is_action_pressed("pause_menu"):
DebugManager.log_debug("Cancel/back action pressed in settings", "Settings")
_exit_settings()
get_viewport().set_input_as_handled()
return
@@ -136,12 +116,8 @@ func _on_back_button_pressed() -> void:
func update_text() -> void:
$SettingsContainer/SettingsTitle.text = tr("settings_title")
$SettingsContainer/MasterVolumeContainer/MasterVolume.text = tr(
"master_volume"
)
$SettingsContainer/MusicVolumeContainer/MusicVolume.text = tr(
"music_volume"
)
$SettingsContainer/MasterVolumeContainer/MasterVolume.text = tr("master_volume")
$SettingsContainer/MusicVolumeContainer/MusicVolume.text = tr("music_volume")
$SettingsContainer/SFXVolumeContainer/SFXVolume.text = tr("sfx_volume")
$SettingsContainer/LanguageContainer/LanguageLabel.text = tr("language")
$BackButtonContainer/BackButton.text = tr("back")
@@ -153,9 +129,7 @@ func _on_reset_setting_button_pressed() -> void:
DebugManager.log_info("Resetting settings", "Settings")
settings_manager.reset_settings_to_defaults()
_update_controls_from_settings()
localization_manager.change_language(
settings_manager.get_setting("language")
)
localization_manager.change_language(settings_manager.get_setting("language"))
func _setup_navigation_system() -> void:
@@ -182,22 +156,15 @@ func _setup_navigation_system() -> void:
func _navigate_controls(direction: int) -> void:
AudioManager.play_ui_click()
current_control_index = (
(current_control_index + direction) % navigable_controls.size()
)
current_control_index = ((current_control_index + direction) % navigable_controls.size())
if current_control_index < 0:
current_control_index = navigable_controls.size() - 1
_update_visual_selection()
DebugManager.log_info(
"Settings navigation: index " + str(current_control_index), "Settings"
)
DebugManager.log_info("Settings navigation: index " + str(current_control_index), "Settings")
func _adjust_current_control(direction: int) -> void:
if (
current_control_index < 0
or current_control_index >= navigable_controls.size()
):
if current_control_index < 0 or current_control_index >= navigable_controls.size():
return
var control: Control = navigable_controls[current_control_index]
@@ -211,26 +178,17 @@ func _adjust_current_control(direction: int) -> void:
slider.value = new_value
AudioManager.play_ui_click()
DebugManager.log_info(
(
"Slider adjusted: %s = %f"
% [_get_control_name(control), new_value]
),
"Settings"
"Slider adjusted: %s = %f" % [_get_control_name(control), new_value], "Settings"
)
# Handle language stepper with left/right
elif control == language_stepper:
if language_stepper.handle_input_action(
"move_left" if direction == -1 else "move_right"
):
if language_stepper.handle_input_action("move_left" if direction == -1 else "move_right"):
AudioManager.play_ui_click()
func _activate_current_control() -> void:
if (
current_control_index < 0
or current_control_index >= navigable_controls.size()
):
if current_control_index < 0 or current_control_index >= navigable_controls.size():
return
var control: Control = navigable_controls[current_control_index]
@@ -238,17 +196,12 @@ func _activate_current_control() -> void:
# Handle buttons
if control is Button:
AudioManager.play_ui_click()
DebugManager.log_info(
"Activating button via keyboard/gamepad: " + control.text,
"Settings"
)
DebugManager.log_info("Activating button via keyboard/gamepad: " + control.text, "Settings")
control.pressed.emit()
# Handle language stepper (no action needed on activation, left/right handles it)
elif control == language_stepper:
DebugManager.log_info(
"Language stepper selected - use left/right to change", "Settings"
)
DebugManager.log_info("Language stepper selected - use left/right to change", "Settings")
func _update_visual_selection() -> void:
@@ -260,8 +213,7 @@ func _update_visual_selection() -> void:
language_stepper.set_highlighted(true)
else:
control.scale = (
original_control_scales[i]
* UIConstants.UI_CONTROL_HIGHLIGHT_SCALE
original_control_scales[i] * UIConstants.UI_CONTROL_HIGHLIGHT_SCALE
)
control.modulate = Color(1.1, 1.1, 0.9)
else:
@@ -285,17 +237,9 @@ func _get_control_name(control: Control) -> String:
return "button"
func _on_language_stepper_value_changed(
new_value: String, new_index: float
) -> void:
func _on_language_stepper_value_changed(new_value: String, new_index: float) -> void:
DebugManager.log_info(
(
"Language changed via ValueStepper: "
+ new_value
+ " (index: "
+ str(int(new_index))
+ ")"
),
"Language changed via ValueStepper: " + new_value + " (index: " + str(int(new_index)) + ")",
"Settings"
)