aboutsummaryrefslogtreecommitdiff
path: root/game/src/Game/Menu
diff options
context:
space:
mode:
author Spartan322 <Megacake1234@gmail.com>2023-12-23 05:01:51 +0100
committer George L. Albany <Megacake1234@gmail.com>2023-12-24 04:52:36 +0100
commitb6413251a866c76538869b84ed1c9b9852f7c507 (patch)
tree1b99c935438692bb2ebadeac412b990c82089b65 /game/src/Game/Menu
parent50b0b935b0bf0724f40b5140aca85d1830a8b1b3 (diff)
Apply type hints to menu scripts
Diffstat (limited to 'game/src/Game/Menu')
-rw-r--r--game/src/Game/Menu/CreditsMenu/CreditsMenu.gd36
-rw-r--r--game/src/Game/Menu/CreditsMenu/GodotEngineButton.gd2
-rw-r--r--game/src/Game/Menu/LobbyMenu/LobbyMenu.gd26
-rw-r--r--game/src/Game/Menu/LobbyMenu/LobbyPanelButton.gd10
-rw-r--r--game/src/Game/Menu/MainMenu/MainMenu.gd16
-rw-r--r--game/src/Game/Menu/MainMenu/ReleaseInfoBox.gd10
-rw-r--r--game/src/Game/Menu/OptionMenu/GuiScaleSelector.gd8
-rw-r--r--game/src/Game/Menu/OptionMenu/MonitorDisplaySelector.gd2
-rw-r--r--game/src/Game/Menu/OptionMenu/OptionsMenu.gd10
-rw-r--r--game/src/Game/Menu/OptionMenu/QualityPresetSelector.gd2
-rw-r--r--game/src/Game/Menu/OptionMenu/RefreshRateSelector.gd2
-rw-r--r--game/src/Game/Menu/OptionMenu/ResolutionSelector.gd8
-rw-r--r--game/src/Game/Menu/OptionMenu/ScreenModeSelector.gd2
-rw-r--r--game/src/Game/Menu/OptionMenu/SettingNodes/SettingCheckBox.gd6
-rw-r--r--game/src/Game/Menu/OptionMenu/SettingNodes/SettingHSlider.gd10
-rw-r--r--game/src/Game/Menu/OptionMenu/SettingNodes/SettingOptionButton.gd8
-rw-r--r--game/src/Game/Menu/OptionMenu/SettingNodes/SettingRevertButton.gd2
-rw-r--r--game/src/Game/Menu/OptionMenu/SettingRevertDialog.gd4
-rw-r--r--game/src/Game/Menu/OptionMenu/SoundTab.gd4
-rw-r--r--game/src/Game/Menu/OptionMenu/VolumeGrid.gd14
-rw-r--r--game/src/Game/Menu/SaveLoadMenu/SavePanelButton.gd2
-rw-r--r--game/src/Game/Menu/SaveLoadMenu/SaveResource.gd2
22 files changed, 93 insertions, 93 deletions
diff --git a/game/src/Game/Menu/CreditsMenu/CreditsMenu.gd b/game/src/Game/Menu/CreditsMenu/CreditsMenu.gd
index 61140c0..2f1e867 100644
--- a/game/src/Game/Menu/CreditsMenu/CreditsMenu.gd
+++ b/game/src/Game/Menu/CreditsMenu/CreditsMenu.gd
@@ -43,7 +43,7 @@ const title_key : String = "TITLE"
# * FS-4
func _load_credit_file(path : String) -> Dictionary:
var roles := {}
- var core_credits = FileAccess.open(path, FileAccess.READ)
+ var core_credits := FileAccess.open(path, FileAccess.READ)
if core_credits == null:
push_error("Failed to open credits file %s (error code %d)" % [path, FileAccess.get_open_error()])
return roles
@@ -79,7 +79,7 @@ func _load_credit_file(path : String) -> Dictionary:
roles[title_key] = [roles[title_key][0]]
else:
push_warning("Credits file %s missing %s" % [path, title_key])
- for role_list in roles.values():
+ for role_list : Array in roles.values():
role_list.sort_custom(func(a : String, b : String) -> bool: return a.naturalnocasecmp_to(b) < 0)
return roles
@@ -94,7 +94,7 @@ func _add_label(node : Node, text : String, type_variation : StringName) -> void
# REQUIREMENTS:
# * UI-34, UI-35
func _add_project_credits(project : Dictionary) -> void:
- var project_credits_list = VBoxContainer.new()
+ var project_credits_list := VBoxContainer.new()
project_credits_list.name = 'Credits'
if title_key in project:
var title : String = project[title_key][0]
@@ -102,13 +102,13 @@ func _add_project_credits(project : Dictionary) -> void:
_add_label(project_credits_list, title, label_variants_project)
project_credits_list.add_child(HSeparator.new())
- for role in project:
+ for role : String in project:
if role == title_key:
continue
- var role_parent = VBoxContainer.new()
+ var role_parent := VBoxContainer.new()
- for person in project[role]:
+ for person : String in project[role]:
_add_label(role_parent, person, label_variants_person)
_add_label(project_credits_list, role, label_variants_role)
@@ -118,19 +118,19 @@ func _add_project_credits(project : Dictionary) -> void:
credits_list.add_child(project_credits_list)
func _add_godot_credits() -> void:
- var godot_credits_list = VBoxContainer.new()
+ var godot_credits_list := VBoxContainer.new()
godot_credits_list.name = 'CreditsGodot'
- var godot_engine = godot_engine_scene.instantiate()
+ var godot_engine := godot_engine_scene.instantiate()
godot_credits_list.add_child(godot_engine)
godot_credits_list.add_child(HSeparator.new())
var author_dict := Engine.get_author_info()
_add_label(godot_credits_list, "Contributors", label_variants_role)
- for role in author_dict:
- var role_parent = VBoxContainer.new()
+ for role : String in author_dict:
+ var role_parent := VBoxContainer.new()
- for person in author_dict[role]:
+ for person : String in author_dict[role]:
_add_label(role_parent, person, label_variants_person)
_add_label(godot_credits_list, role.replace("_", " ").capitalize(), label_variants_role)
@@ -140,11 +140,11 @@ func _add_godot_credits() -> void:
var donor_dict := Engine.get_donor_info()
_add_label(godot_credits_list, "Donors", label_variants_role)
- for role in donor_dict:
+ for role : String in donor_dict:
if donor_dict[role].size() == 0 or donor_dict[role][0].begins_with("None"): continue
- var role_parent = VBoxContainer.new()
+ var role_parent := VBoxContainer.new()
- for person in donor_dict[role]:
+ for person : String in donor_dict[role]:
_add_label(role_parent, person, label_variants_person)
_add_label(godot_credits_list, role.replace("_", " ").capitalize(), label_variants_role)
@@ -163,7 +163,7 @@ func _add_link_button(node : Node, text : String, url: String, type_variation :
node.add_child(button)
func _add_licenses() -> void:
- var license_list = VBoxContainer.new()
+ var license_list := VBoxContainer.new()
license_list.name = 'Licenses'
_add_label(license_list, "Third-Party Licenses", label_variants_project)
license_list.add_child(HSeparator.new())
@@ -178,7 +178,7 @@ func _add_licenses() -> void:
# Add additional licenses required for attribution here
# These licenses should also either be displayed or exported alongside this project
- for project in license_info:
+ for project : String in license_info:
_add_label(license_list, project, label_variants_role)
_add_link_button(license_list, license_info[project][0], license_info[project][1], label_variants_person)
license_list.add_child(HSeparator.new())
@@ -188,12 +188,12 @@ func _add_licenses() -> void:
# REQUIREMENTS:
# * SS-17
-func _ready():
+func _ready() -> void:
_add_project_credits(_load_credit_file(core_credits_path))
_add_godot_credits()
_add_licenses()
-func _input(event):
+func _input(event : InputEvent) -> void:
if self.is_visible_in_tree():
if event.is_action_pressed("ui_cancel"):
_on_back_button_pressed()
diff --git a/game/src/Game/Menu/CreditsMenu/GodotEngineButton.gd b/game/src/Game/Menu/CreditsMenu/GodotEngineButton.gd
index ca3a958..f8d6dd3 100644
--- a/game/src/Game/Menu/CreditsMenu/GodotEngineButton.gd
+++ b/game/src/Game/Menu/CreditsMenu/GodotEngineButton.gd
@@ -1,4 +1,4 @@
extends Button
-func _on_pressed():
+func _on_pressed() -> void:
OS.shell_open("https://godotengine.org")
diff --git a/game/src/Game/Menu/LobbyMenu/LobbyMenu.gd b/game/src/Game/Menu/LobbyMenu/LobbyMenu.gd
index 3c857fe..cc681ba 100644
--- a/game/src/Game/Menu/LobbyMenu/LobbyMenu.gd
+++ b/game/src/Game/Menu/LobbyMenu/LobbyMenu.gd
@@ -46,7 +46,7 @@ var _id_to_tag : Array[StringName] = []
# * FS-8
func _build_save_list() -> void:
game_select_save_tab.add_tab("GAMELOBBY_SELECT_ALL")
- for save_name in SaveManager._save_dictionary:
+ for save_name : StringName in SaveManager._save_dictionary:
var save : SaveResource = SaveManager._save_dictionary[save_name]
var save_node := _create_save_node(save)
game_select_save_list.add_child(save_node)
@@ -55,16 +55,16 @@ func _build_save_list() -> void:
game_select_save_tab.add_tab(save.session_tag)
func _create_save_node(resource : SaveResource) -> Control:
- var save_node = save_scene.instantiate()
+ var save_node := save_scene.instantiate()
save_node.resource = resource
save_node.pressed.connect(_on_save_node_pressed.bind(save_node))
save_node.request_to_delete.connect(_on_save_node_delete_requested.bind(save_node))
return save_node
func _queue_clear_lists() -> void:
- var full_list = game_select_start_date.get_children()
+ var full_list := game_select_start_date.get_children()
full_list.append_array(game_select_save_list.get_children())
- for child in full_list:
+ for child : Node in full_list:
child.queue_free()
game_select_save_tab.clear_tabs()
_id_to_tag.clear()
@@ -72,7 +72,7 @@ func _queue_clear_lists() -> void:
# REQUIREMENTS:
# * SS-16
# * UIFUN-40
-func _on_back_button_button_down():
+func _on_back_button_button_down() -> void:
print("Returning to Main Menu.")
SaveManager.current_session_tag = ""
SaveManager.current_save = null
@@ -80,7 +80,7 @@ func _on_back_button_button_down():
# REQUIREMENTS:
# * SS-21
-func _on_start_button_pressed():
+func _on_start_button_pressed() -> void:
print("Starting new game.")
if SaveManager.current_session_tag == "":
# TODO: Get country tag as well
@@ -102,20 +102,20 @@ func _on_start_button_pressed():
# REQUIREMENTS:
# * SS-19
-func _on_game_select_list_item_selected(index):
+func _on_game_select_list_item_selected(index) -> void:
print("Selected save game: ", index)
save_game_selected.emit(index)
# If the date is double-clicked, start the game!
-func _on_game_select_list_item_activated(index):
+func _on_game_select_list_item_activated(index) -> void:
_on_game_select_list_item_selected(index)
_on_start_button_pressed()
-func _on_session_tag_edit_text_submitted(new_text):
+func _on_session_tag_edit_text_submitted(new_text : String) -> void:
SaveManager.current_session_tag = new_text
_on_start_button_pressed()
-func _on_session_tag_dialog_confirmed():
+func _on_session_tag_dialog_confirmed() -> void:
get_tree().change_scene_to_file("res://src/Game/GameSession/GameSession.tscn")
var _requested_node_to_delete : Control
@@ -147,17 +147,17 @@ func _on_save_node_pressed(node : Control) -> void:
start_button.disabled = false
save_game_selected.emit(SaveManager.current_save)
-func _on_game_select_save_tab_tab_changed(tab) -> void:
+func _on_game_select_save_tab_tab_changed(tab : int) -> void:
if tab == 0:
filter_for_tag(&"")
else:
filter_for_tag(_id_to_tag[tab - 1])
-func _on_delete_dialog_confirmed():
+func _on_delete_dialog_confirmed() -> void:
_requested_node_to_delete.resource.delete()
_requested_node_to_delete.queue_free()
-func _on_visibility_changed():
+func _on_visibility_changed() -> void:
if visible:
_build_date_list()
_build_save_list()
diff --git a/game/src/Game/Menu/LobbyMenu/LobbyPanelButton.gd b/game/src/Game/Menu/LobbyMenu/LobbyPanelButton.gd
index 5f3ea46..646c694 100644
--- a/game/src/Game/Menu/LobbyMenu/LobbyPanelButton.gd
+++ b/game/src/Game/Menu/LobbyMenu/LobbyPanelButton.gd
@@ -73,7 +73,7 @@ func _get_draw_mode_style() -> StyleBox:
return background_button.get_theme_stylebox(_get_draw_mode_name(false))
return result
-func _notification(what) -> void:
+func _notification(what : int) -> void:
if what == NOTIFICATION_SORT_CHILDREN:
var _size := size
var offset := Vector2()
@@ -89,14 +89,14 @@ func _notification(what) -> void:
fit_child_in_rect(child, Rect2(offset, _size))
-func _on_background_button_button_down():
+func _on_background_button_button_down() -> void:
button_down.emit()
-func _on_background_button_button_up():
+func _on_background_button_button_up() -> void:
button_up.emit()
-func _on_background_button_pressed():
+func _on_background_button_pressed() -> void:
pressed.emit()
-func _on_background_button_toggled(button_pressed : bool):
+func _on_background_button_toggled(button_pressed : bool) -> void:
toggled.emit(button_pressed)
diff --git a/game/src/Game/Menu/MainMenu/MainMenu.gd b/game/src/Game/Menu/MainMenu/MainMenu.gd
index 9d0edc6..cc8841f 100644
--- a/game/src/Game/Menu/MainMenu/MainMenu.gd
+++ b/game/src/Game/Menu/MainMenu/MainMenu.gd
@@ -9,42 +9,42 @@ var _new_game_button : BaseButton
# REQUIREMENTS:
# * SS-3
-func _ready():
+func _ready() -> void:
_on_new_game_button_visibility_changed()
# REQUIREMENTS:
# * SS-14
# * UIFUN-32
-func _on_new_game_button_pressed():
+func _on_new_game_button_pressed() -> void:
print("Start a new game!")
new_game_button_pressed.emit()
-func _on_continue_button_pressed():
+func _on_continue_button_pressed() -> void:
print("Continue last game!")
-func _on_multi_player_button_pressed():
+func _on_multi_player_button_pressed() -> void:
print("Have fun with friends!")
-func _on_options_button_pressed():
+func _on_options_button_pressed() -> void:
print("Check out some options!")
options_button_pressed.emit()
# REQUIREMENTS
# * UI-32
# * UIFUN-36
-func _on_credits_button_pressed():
+func _on_credits_button_pressed() -> void:
credits_button_pressed.emit()
# REQUIREMENTS
# * SS-4
# * UIFUN-3
-func _on_exit_button_pressed():
+func _on_exit_button_pressed() -> void:
print("See you later!")
get_tree().quit()
-func _on_new_game_button_visibility_changed():
+func _on_new_game_button_visibility_changed() -> void:
if visible:
_new_game_button.grab_focus.call_deferred()
diff --git a/game/src/Game/Menu/MainMenu/ReleaseInfoBox.gd b/game/src/Game/Menu/MainMenu/ReleaseInfoBox.gd
index f401919..c52503c 100644
--- a/game/src/Game/Menu/MainMenu/ReleaseInfoBox.gd
+++ b/game/src/Game/Menu/MainMenu/ReleaseInfoBox.gd
@@ -14,7 +14,7 @@ var _checksum : String = "????"
# REQUIREMENTS:
# * SS-104, SS-105, SS-106, SS-107
# * UIFUN-97, UIFUN-297, UIFUN-299
-func _ready():
+func _ready() -> void:
_version_label.text = _GIT_INFO_.release_name
_version_label.tooltip_text = _GIT_INFO_.tag
_commit_label.text = _GIT_INFO_.short_hash
@@ -23,7 +23,7 @@ func _ready():
_checksum = Checksum.get_checksum_text()
_update_checksum_label_text()
-func _notification(what : int):
+func _notification(what : int) -> void:
match what:
NOTIFICATION_TRANSLATION_CHANGED:
_update_checksum_label_text()
@@ -32,11 +32,11 @@ func _update_checksum_label_text() -> void:
_checksum_label.tooltip_text = tr("MAINMENU_CHECKSUM").format({ "checksum": _checksum })
_checksum_label.text = "(%s)" % _checksum.substr(0, 4)
-func _on_version_label_pressed():
+func _on_version_label_pressed() -> void:
DisplayServer.clipboard_set(_GIT_INFO_.tag)
-func _on_commit_label_pressed():
+func _on_commit_label_pressed() -> void:
DisplayServer.clipboard_set(_GIT_INFO_.commit_hash)
-func _on_checksum_label_pressed():
+func _on_checksum_label_pressed() -> void:
DisplayServer.clipboard_set(_checksum)
diff --git a/game/src/Game/Menu/OptionMenu/GuiScaleSelector.gd b/game/src/Game/Menu/OptionMenu/GuiScaleSelector.gd
index 42be5e0..3be8c2c 100644
--- a/game/src/Game/Menu/OptionMenu/GuiScaleSelector.gd
+++ b/game/src/Game/Menu/OptionMenu/GuiScaleSelector.gd
@@ -17,7 +17,7 @@ func _sync_guiscales(to_select : float = GuiScale.get_current_guiscale()) -> voi
clear()
default_selected = -1
selected = -1
- for guiscale_value in GuiScale.get_guiscale_value_list():
+ for guiscale_value : float in GuiScale.get_guiscale_value_list():
add_item(GuiScale.get_guiscale_display_name(guiscale_value))
set_item_metadata(item_count - 1, guiscale_value)
@@ -33,7 +33,7 @@ func _sync_guiscales(to_select : float = GuiScale.get_current_guiscale()) -> voi
if selected == -1:
selected = default_selected
-func _setup_button():
+func _setup_button() -> void:
if default_value <= 0:
default_value = ProjectSettings.get_setting("display/window/stretch/scale")
GuiScale.add_guiscale(default_value, &"default")
@@ -45,7 +45,7 @@ func _get_value_for_file(select_value : int):
else:
return null
-func _set_value_from_file(load_value):
+func _set_value_from_file(load_value : Variant) -> void:
if typeof(load_value) == TYPE_FLOAT:
var target_guiscale : float = load_value
selected = _find_guiscale_index_by_value(target_guiscale)
@@ -56,7 +56,7 @@ func _set_value_from_file(load_value):
push_error("Setting value '%s' invalid for setting [%s] %s" % [load_value, section_name, setting_name])
selected = default_selected
-func _on_option_selected(index : int, by_user : bool):
+func _on_option_selected(index : int, by_user : bool) -> void:
if _valid_index(index):
GuiScale.set_guiscale(get_item_metadata(index))
else:
diff --git a/game/src/Game/Menu/OptionMenu/MonitorDisplaySelector.gd b/game/src/Game/Menu/OptionMenu/MonitorDisplaySelector.gd
index c3beaf6..a535f17 100644
--- a/game/src/Game/Menu/OptionMenu/MonitorDisplaySelector.gd
+++ b/game/src/Game/Menu/OptionMenu/MonitorDisplaySelector.gd
@@ -8,7 +8,7 @@ func _setup_button() -> void:
_update_monitor_options_text()
default_selected = Resolution.get_current_monitor()
-func _notification(what : int):
+func _notification(what : int) -> void:
match what:
NOTIFICATION_TRANSLATION_CHANGED:
_update_monitor_options_text()
diff --git a/game/src/Game/Menu/OptionMenu/OptionsMenu.gd b/game/src/Game/Menu/OptionMenu/OptionsMenu.gd
index 93ef3e4..2b70d1c 100644
--- a/game/src/Game/Menu/OptionMenu/OptionsMenu.gd
+++ b/game/src/Game/Menu/OptionMenu/OptionsMenu.gd
@@ -7,7 +7,7 @@ signal back_button_pressed
@export var _tab_container : TabContainer
-func _ready():
+func _ready() -> void:
_tab_container.set_tab_title(0, "OPTIONS_GENERAL")
_tab_container.set_tab_title(1, "OPTIONS_VIDEO")
_tab_container.set_tab_title(2, "OPTIONS_SOUND")
@@ -41,19 +41,19 @@ func _ready():
button_list.add_child(back_button)
get_viewport().get_window().close_requested.connect(_on_window_close_requested)
_save_overrides.call_deferred()
- Events.Options.save_settings.connect(func(_f): self._save_overrides.call_deferred())
+ Events.Options.save_settings.connect(func(_f : ConfigFile) -> void: self._save_overrides.call_deferred())
-func _notification(what):
+func _notification(what : int) -> void:
match what:
NOTIFICATION_CRASH:
_on_window_close_requested()
-func _input(event):
+func _input(event : InputEvent) -> void:
if self.is_visible_in_tree():
if event.is_action_pressed("ui_cancel"):
_on_back_button_pressed()
-func _on_back_button_pressed():
+func _on_back_button_pressed() -> void:
Events.Options.save_settings_to_file()
back_button_pressed.emit()
diff --git a/game/src/Game/Menu/OptionMenu/QualityPresetSelector.gd b/game/src/Game/Menu/OptionMenu/QualityPresetSelector.gd
index 57ba4ab..4fb02a6 100644
--- a/game/src/Game/Menu/OptionMenu/QualityPresetSelector.gd
+++ b/game/src/Game/Menu/OptionMenu/QualityPresetSelector.gd
@@ -1,4 +1,4 @@
extends SettingOptionButton
-func _setup_button():
+func _setup_button() -> void:
pass
diff --git a/game/src/Game/Menu/OptionMenu/RefreshRateSelector.gd b/game/src/Game/Menu/OptionMenu/RefreshRateSelector.gd
index 31b115b..d66833e 100644
--- a/game/src/Game/Menu/OptionMenu/RefreshRateSelector.gd
+++ b/game/src/Game/Menu/OptionMenu/RefreshRateSelector.gd
@@ -1,5 +1,5 @@
extends SettingOptionButton
-func _setup_button():
+func _setup_button() -> void:
pass
diff --git a/game/src/Game/Menu/OptionMenu/ResolutionSelector.gd b/game/src/Game/Menu/OptionMenu/ResolutionSelector.gd
index cb7a1fb..1a21211 100644
--- a/game/src/Game/Menu/OptionMenu/ResolutionSelector.gd
+++ b/game/src/Game/Menu/OptionMenu/ResolutionSelector.gd
@@ -34,7 +34,7 @@ func _sync_resolutions() -> void:
selected = default_selected
_update_resolution_options_text()
-func _notification(what : int):
+func _notification(what : int) -> void:
match what:
NOTIFICATION_TRANSLATION_CHANGED:
_update_resolution_options_text()
@@ -56,7 +56,7 @@ func _update_resolution_options_text() -> void:
set_item_text(index, display_name)
func _setup_button() -> void:
- Resolution.resolution_added.connect(func (_value : Vector2i): _sync_resolutions())
+ Resolution.resolution_added.connect(func (_value : Vector2i) -> void: _sync_resolutions())
if default_value.x <= 0:
default_value.x = ProjectSettings.get_setting("display/window/size/viewport_width")
if default_value.y <= 0:
@@ -66,7 +66,7 @@ func _setup_button() -> void:
else:
_sync_resolutions()
-func _get_value_for_file(select_value : int) -> Variant:
+func _get_value_for_file(select_value : int):
if _valid_index(select_value):
return get_item_metadata(select_value)
else:
@@ -74,7 +74,7 @@ func _get_value_for_file(select_value : int) -> Variant:
# REQUIREMENTS:
# * SS-25
-func _set_value_from_file(load_value) -> void:
+func _set_value_from_file(load_value : Variant) -> void:
var target_resolution := Resolution.error_resolution
match typeof(load_value):
TYPE_VECTOR2I: target_resolution = load_value
diff --git a/game/src/Game/Menu/OptionMenu/ScreenModeSelector.gd b/game/src/Game/Menu/OptionMenu/ScreenModeSelector.gd
index 0d1836c..84ec9c9 100644
--- a/game/src/Game/Menu/OptionMenu/ScreenModeSelector.gd
+++ b/game/src/Game/Menu/OptionMenu/ScreenModeSelector.gd
@@ -28,7 +28,7 @@ func get_window_mode_from_screen_mode(screen_mode : ScreenMode) -> Window.Mode:
_:
return Window.MODE_EXCLUSIVE_FULLSCREEN
-func _setup_button():
+func _setup_button() -> void:
default_selected = get_screen_mode_from_window_mode(Resolution.get_current_window_mode())
selected = default_selected
diff --git a/game/src/Game/Menu/OptionMenu/SettingNodes/SettingCheckBox.gd b/game/src/Game/Menu/OptionMenu/SettingNodes/SettingCheckBox.gd
index 344a2b5..46fe4d7 100644
--- a/game/src/Game/Menu/OptionMenu/SettingNodes/SettingCheckBox.gd
+++ b/game/src/Game/Menu/OptionMenu/SettingNodes/SettingCheckBox.gd
@@ -15,14 +15,14 @@ var default_pressed : bool = true
func _setup_button() -> void:
pass
-func _ready():
+func _ready() -> void:
Events.Options.load_settings.connect(load_setting)
Events.Options.save_settings.connect(save_setting)
Events.Options.reset_settings.connect(reset_setting)
- toggled.connect(func(p : bool): option_selected.emit(p, true))
+ toggled.connect(func(p : bool) -> void: option_selected.emit(p, true))
_setup_button()
-func _set_value_from_file(load_value) -> void:
+func _set_value_from_file(load_value : Variant) -> void:
match typeof(load_value):
TYPE_BOOL, TYPE_INT:
set_pressed_no_signal(load_value as bool)
diff --git a/game/src/Game/Menu/OptionMenu/SettingNodes/SettingHSlider.gd b/game/src/Game/Menu/OptionMenu/SettingNodes/SettingHSlider.gd
index 6fa30ed..a728ba0 100644
--- a/game/src/Game/Menu/OptionMenu/SettingNodes/SettingHSlider.gd
+++ b/game/src/Game/Menu/OptionMenu/SettingNodes/SettingHSlider.gd
@@ -10,14 +10,14 @@ var setting_name : String = "setting_hslider"
@export
var default_value : float = 0
-func _ready():
+func _ready() -> void:
Events.Options.load_settings.connect(load_setting)
Events.Options.save_settings.connect(save_setting)
Events.Options.reset_settings.connect(reset_setting)
-func load_setting(file : ConfigFile):
+func load_setting(file : ConfigFile) -> void:
if file == null: return
- var load_value = file.get_value(section_name, setting_name, default_value)
+ var load_value : Variant = file.get_value(section_name, setting_name, default_value)
match typeof(load_value):
TYPE_FLOAT, TYPE_INT:
if value == load_value: value_changed.emit(value)
@@ -33,9 +33,9 @@ func load_setting(file : ConfigFile):
push_error("Setting value '%s' invalid for setting [%s] \"%s\"" % [load_value, section_name, setting_name])
value = default_value
-func save_setting(file : ConfigFile):
+func save_setting(file : ConfigFile) -> void:
if file == null: return
file.set_value(section_name, setting_name, value)
-func reset_setting():
+func reset_setting() -> void:
value = default_value
diff --git a/game/src/Game/Menu/OptionMenu/SettingNodes/SettingOptionButton.gd b/game/src/Game/Menu/OptionMenu/SettingNodes/SettingOptionButton.gd
index 079dd4d..a972ed6 100644
--- a/game/src/Game/Menu/OptionMenu/SettingNodes/SettingOptionButton.gd
+++ b/game/src/Game/Menu/OptionMenu/SettingNodes/SettingOptionButton.gd
@@ -21,13 +21,13 @@ var default_selected : int = -1:
func _valid_index(index : int) -> bool:
return 0 <= index and index < item_count
-func _get_value_for_file(select_value : int):
+func _get_value_for_file(select_value : int) -> Variant:
if _valid_index(select_value):
return select_value
else:
return null
-func _set_value_from_file(load_value) -> void:
+func _set_value_from_file(load_value : Variant) -> void:
match typeof(load_value):
TYPE_INT:
if _valid_index(load_value):
@@ -50,11 +50,11 @@ func _set_value_from_file(load_value) -> void:
func _setup_button() -> void:
pass
-func _ready():
+func _ready() -> void:
Events.Options.load_settings.connect(load_setting)
Events.Options.save_settings.connect(save_setting)
Events.Options.reset_settings.connect(reset_setting)
- item_selected.connect(func(index : int): option_selected.emit(index, true))
+ item_selected.connect(func(index : int) -> void: option_selected.emit(index, true))
_setup_button()
if not _valid_index(default_selected) or selected == -1:
var msg := "Failed to generate any valid %s %s options." % [setting_name, section_name]
diff --git a/game/src/Game/Menu/OptionMenu/SettingNodes/SettingRevertButton.gd b/game/src/Game/Menu/OptionMenu/SettingNodes/SettingRevertButton.gd
index 431e3e5..6785f73 100644
--- a/game/src/Game/Menu/OptionMenu/SettingNodes/SettingRevertButton.gd
+++ b/game/src/Game/Menu/OptionMenu/SettingNodes/SettingRevertButton.gd
@@ -6,7 +6,7 @@ class_name SettingRevertButton
var previous_index : int = -1
-func _ready():
+func _ready() -> void:
super()
if revert_dialog != null:
revert_dialog.visibility_changed.connect(_on_revert_dialog_visibility_changed)
diff --git a/game/src/Game/Menu/OptionMenu/SettingRevertDialog.gd b/game/src/Game/Menu/OptionMenu/SettingRevertDialog.gd
index 5e2b81f..7928d15 100644
--- a/game/src/Game/Menu/OptionMenu/SettingRevertDialog.gd
+++ b/game/src/Game/Menu/OptionMenu/SettingRevertDialog.gd
@@ -16,12 +16,12 @@ func show_dialog(button : SettingRevertButton, time : float = 0) -> void:
popup_centered(Vector2(1,1))
_revert_node = button
-func _notification(what):
+func _notification(what : int) -> void:
if what == NOTIFICATION_VISIBILITY_CHANGED:
set_process(visible)
if not visible: _revert_node = null
-func _process(_delta) -> void:
+func _process(_delta : float) -> void:
dialog_text = tr(dialog_text_key).format({ "time": Localisation.tr_number(int(timer.time_left)) })
func _on_canceled_or_close_requested() -> void:
diff --git a/game/src/Game/Menu/OptionMenu/SoundTab.gd b/game/src/Game/Menu/OptionMenu/SoundTab.gd
index d1daf3d..a84af70 100644
--- a/game/src/Game/Menu/OptionMenu/SoundTab.gd
+++ b/game/src/Game/Menu/OptionMenu/SoundTab.gd
@@ -2,5 +2,5 @@ extends HBoxContainer
@export var _startup_music_button : SettingCheckBox
-func _ready():
- _startup_music_button.option_selected.connect(func (pressed : bool, _by_user : bool): MusicConductor.set_startup_music(pressed))
+func _ready() -> void:
+ _startup_music_button.option_selected.connect(func (pressed : bool, _by_user : bool) -> void: MusicConductor.set_startup_music(pressed))
diff --git a/game/src/Game/Menu/OptionMenu/VolumeGrid.gd b/game/src/Game/Menu/OptionMenu/VolumeGrid.gd
index 46613b4..cce231f 100644
--- a/game/src/Game/Menu/OptionMenu/VolumeGrid.gd
+++ b/game/src/Game/Menu/OptionMenu/VolumeGrid.gd
@@ -39,7 +39,7 @@ func add_volume_row(bus_name : String, bus_index : int) -> HSlider:
# REQUIREMENTS
# * UI-22
-func _ready():
+func _ready() -> void:
for bus_index in AudioServer.bus_count:
add_volume_row(AudioServer.get_bus_name(bus_index), bus_index)
@@ -54,17 +54,17 @@ func _on_slider_value_changed(value : float, bus_index : int) -> void:
AudioServer.set_bus_volume_db(bus_index, get_volume_value_as_db(value))
-func _on_options_menu_load_settings(load_file : ConfigFile):
- for volume_slider in _slider_dictionary.values():
+func _on_options_menu_load_settings(load_file : ConfigFile) -> void:
+ for volume_slider : SettingHSlider in _slider_dictionary.values():
volume_slider.load_setting(load_file)
# REQUIREMENTS
# * UIFUN-23
-func _on_options_menu_save_settings(save_file : ConfigFile):
- for volume_slider in _slider_dictionary.values():
+func _on_options_menu_save_settings(save_file : ConfigFile) -> void:
+ for volume_slider : SettingHSlider in _slider_dictionary.values():
volume_slider.save_setting(save_file)
-func _on_options_menu_reset_settings():
- for volume_slider in _slider_dictionary.values():
+func _on_options_menu_reset_settings() -> void:
+ for volume_slider : SettingHSlider in _slider_dictionary.values():
volume_slider.reset_setting()
diff --git a/game/src/Game/Menu/SaveLoadMenu/SavePanelButton.gd b/game/src/Game/Menu/SaveLoadMenu/SavePanelButton.gd
index 5fe4917..6dc43c9 100644
--- a/game/src/Game/Menu/SaveLoadMenu/SavePanelButton.gd
+++ b/game/src/Game/Menu/SaveLoadMenu/SavePanelButton.gd
@@ -26,7 +26,7 @@ func set_text(value : StringName) -> void:
if resource != null:
resource.save_name = value
-func _ready():
+func _ready() -> void:
_resource_changed()
func _is_start_date() -> bool:
diff --git a/game/src/Game/Menu/SaveLoadMenu/SaveResource.gd b/game/src/Game/Menu/SaveLoadMenu/SaveResource.gd
index 5e7faa6..63cfd7f 100644
--- a/game/src/Game/Menu/SaveLoadMenu/SaveResource.gd
+++ b/game/src/Game/Menu/SaveLoadMenu/SaveResource.gd
@@ -27,7 +27,7 @@ var file_path : String:
emit_changed()
var file : ConfigFile = ConfigFile.new()
-func set_file_path(name : StringName, path : String):
+func set_file_path(name : StringName, path : String) -> void:
file_path = path
save_name = name