aboutsummaryrefslogtreecommitdiff
path: root/game/src
diff options
context:
space:
mode:
Diffstat (limited to 'game/src')
-rw-r--r--game/src/Game/Autoload/Argument/ArgumentOption.gd12
-rw-r--r--game/src/Game/Autoload/Argument/ArgumentParser.gd22
-rw-r--r--game/src/Game/Autoload/Events.gd2
-rw-r--r--game/src/Game/Autoload/Events/Options.gd2
-rw-r--r--game/src/Game/Autoload/GameLoader.gd2
-rw-r--r--game/src/Game/Autoload/GuiScale.gd6
-rw-r--r--game/src/Game/Autoload/Resolution.gd4
-rw-r--r--game/src/Game/Autoload/SaveManager.gd2
-rw-r--r--game/src/Game/Autoload/SoundManager.gd6
-rw-r--r--game/src/Game/Autoload/WindowOverride.gd6
-rw-r--r--game/src/Game/GameMenu.gd14
-rw-r--r--game/src/Game/GameStart.gd4
-rw-r--r--game/src/Game/GlobalClass/Localisation.gd4
-rw-r--r--game/src/Game/LoadingScreen.gd6
-rw-r--r--game/src/Game/LocaleButton.gd10
-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
-rw-r--r--game/src/Game/MusicConductor/MusicConductor.gd10
-rw-r--r--game/src/Game/MusicConductor/MusicPlayer.gd20
-rw-r--r--game/src/Game/MusicConductor/SongInfo.gd2
-rw-r--r--game/src/Game/SplashContainer.gd6
41 files changed, 164 insertions, 162 deletions
diff --git a/game/src/Game/Autoload/Argument/ArgumentOption.gd b/game/src/Game/Autoload/Argument/ArgumentOption.gd
index f98b19c..a9b7000 100644
--- a/game/src/Game/Autoload/Argument/ArgumentOption.gd
+++ b/game/src/Game/Autoload/Argument/ArgumentOption.gd
@@ -17,10 +17,10 @@ extends Resource
TYPE_COLOR: default_value = Color()
_: default_value = null
notify_property_list_changed()
-var default_value
+var default_value : Variant
@export var description : String
-func _init(_name = "", _type = TYPE_NIL, _description = "", default = null):
+func _init(_name := "", _type := TYPE_NIL, _description := "", default : Variant = null) -> void:
name = _name
type = _type
if default != null and typeof(default) == type:
@@ -41,15 +41,17 @@ func get_type_string() -> StringName:
TYPE_COLOR: return "color"
return "<invalid type>"
-func _get(property):
+func _get(property : StringName) -> Variant:
if property == "default_value": return default_value
+ return null
-func _set(property, value):
+func _set(property : StringName, value : Variant) -> bool:
if property == "default_value":
default_value = value
return true
+ return false
-func _get_property_list():
+func _get_property_list() -> Array[Dictionary]:
var properties := []
properties.append({
diff --git a/game/src/Game/Autoload/Argument/ArgumentParser.gd b/game/src/Game/Autoload/Argument/ArgumentParser.gd
index b012215..b3e8632 100644
--- a/game/src/Game/Autoload/Argument/ArgumentParser.gd
+++ b/game/src/Game/Autoload/Argument/ArgumentParser.gd
@@ -46,7 +46,7 @@ const color_name_array : PackedStringArray =[
func has_argument_support(arg_name : StringName, include_aliases : bool = false) -> bool:
return option_array.any(
- func(opt):
+ func(opt : ArgumentOption) -> bool:
if include_aliases and arg_name in opt.aliases:
return true
return opt.name == arg_name
@@ -54,7 +54,7 @@ func has_argument_support(arg_name : StringName, include_aliases : bool = false)
func get_argument(arg_name : StringName, default_val : Variant = null) -> Variant:
if ProjectSettings.has_setting(argument_setting_path):
- var arg_setting = ProjectSettings.get_setting_with_override(argument_setting_path)
+ var arg_setting : Variant = ProjectSettings.get_setting_with_override(argument_setting_path)
if not arg_setting is Dictionary:
push_error("Argument setting is not a dictionary.")
return default_val
@@ -64,7 +64,7 @@ func get_argument(arg_name : StringName, default_val : Variant = null) -> Varian
func set_argument(arg_name : StringName, value : Variant) -> void:
if ProjectSettings.has_setting(argument_setting_path):
- var arg_setting = null
+ var arg_setting : Variant = null
arg_setting = ProjectSettings.get_setting_with_override(argument_setting_path)
if not arg_setting is Dictionary:
push_error("Argument setting is not a dictionary.")
@@ -124,7 +124,7 @@ func _parse_value(arg_name : StringName, value_string : String, type : Variant.T
TYPE_RECT2, \
TYPE_RECT2I:
push_warning("Value type '%s' may not be supported." % type)
- var data_array = value_string.lstrip("(").rstrip(")").split(",", false)
+ var data_array := value_string.lstrip("(").rstrip(")").split(",", false)
for index in range(data_array.size()):
data_array[index] = " " + data_array[index].strip_edges()
match type:
@@ -206,7 +206,7 @@ func _parse_argument_list(dictionary : Dictionary, arg_list : PackedStringArray)
var current_option : ArgumentOption = null
for arg in arg_list:
if current_option != null and not arg.begins_with("-"):
- var result = _parse_value(current_key, arg, current_option.type)
+ var result : Variant = _parse_value(current_key, arg, current_option.type)
if result != null:
dictionary[current_option.name] = result
current_option = null
@@ -229,8 +229,8 @@ func _parse_argument_list(dictionary : Dictionary, arg_list : PackedStringArray)
push_warning("Parsing shorthand alias containing '%s', perhaps you meant '--%s'? Skipping argument." % [c, arg])
break
var alias_found := false
- for o in option_array:
- if o.aliases.any(func(v): return c == v):
+ for o : ArgumentOption in option_array:
+ if o.aliases.any(func(v : StringName) -> bool: return c == v):
if o.type == TYPE_BOOL:
dictionary[o.name] = true
else:
@@ -258,7 +258,7 @@ func _parse_argument_list(dictionary : Dictionary, arg_list : PackedStringArray)
key = key.substr(1)
for o in option_array:
- if key == o.name or o.aliases.any(func(v): return key == v):
+ if key == o.name or o.aliases.any(func(v : StringName) -> bool: return key == v):
current_option = o
break
@@ -268,7 +268,7 @@ func _parse_argument_list(dictionary : Dictionary, arg_list : PackedStringArray)
current_key = key
if first_equal > -1:
- var arg_result = _parse_value(key, value, current_option.type)
+ var arg_result : Variant = _parse_value(key, value, current_option.type)
if arg_result != null:
dictionary[current_option.name] = arg_result
current_option = null
@@ -279,7 +279,7 @@ func _parse_argument_list(dictionary : Dictionary, arg_list : PackedStringArray)
return dictionary
-func _print_help():
+func _print_help() -> void:
var project_name : StringName = ProjectSettings.get_setting_with_override(&"application/config/name")
var project_version : String = _GIT_INFO_.tag
var project_hash : String = _GIT_INFO_.short_hash
@@ -310,7 +310,7 @@ Options:
option.description
])
-func _ready():
+func _ready() -> void:
if Engine.is_editor_hint(): return
_set_argument_setting()
GameDebug._singleton = GameDebug.new()
diff --git a/game/src/Game/Autoload/Events.gd b/game/src/Game/Autoload/Events.gd
index da29adb..4f38f61 100644
--- a/game/src/Game/Autoload/Events.gd
+++ b/game/src/Game/Autoload/Events.gd
@@ -5,5 +5,5 @@ extends Node
var Options: OptionsEventsObject
-func _init():
+func _init() -> void:
Options = OptionsEventsObject.new()
diff --git a/game/src/Game/Autoload/Events/Options.gd b/game/src/Game/Autoload/Events/Options.gd
index 726960b..f3fd706 100644
--- a/game/src/Game/Autoload/Events/Options.gd
+++ b/game/src/Game/Autoload/Events/Options.gd
@@ -31,6 +31,6 @@ var _settings_file := ConfigFile.new()
# * SS-9
# * UIFUN-7, UIFUN-12
# * FS-562
-func _init():
+func _init() -> void:
if FileAccess.file_exists(_settings_file_path):
_settings_file.load(_settings_file_path)
diff --git a/game/src/Game/Autoload/GameLoader.gd b/game/src/Game/Autoload/GameLoader.gd
index 8c14c7e..000ee20 100644
--- a/game/src/Game/Autoload/GameLoader.gd
+++ b/game/src/Game/Autoload/GameLoader.gd
@@ -2,5 +2,5 @@ extends Node
var ShaderManager : ShaderManagerClass
-func _init():
+func _init() -> void:
ShaderManager = ShaderManagerClass.new()
diff --git a/game/src/Game/Autoload/GuiScale.gd b/game/src/Game/Autoload/GuiScale.gd
index d364ff5..b8af59c 100644
--- a/game/src/Game/Autoload/GuiScale.gd
+++ b/game/src/Game/Autoload/GuiScale.gd
@@ -18,9 +18,9 @@ var _guiscales: Dictionary
#Similar to Resolution.gd, but we don't bother checking for strings from files
#and we have floats instead of vector2 integers
-func _ready():
+func _ready() -> void:
assert(minimum_guiscale > 0, "Minimum gui scale must be positive")
- for guiscale_value in _starting_guiscales:
+ for guiscale_value : float in _starting_guiscales:
add_guiscale(guiscale_value, _starting_guiscales[guiscale_value])
assert(not _guiscales.is_empty(), "No valid starting gui scales!")
@@ -43,7 +43,7 @@ func add_guiscale(guiscale_value: float, guiscale_name: StringName=&"") -> bool:
#returns floats
func get_guiscale_value_list() -> Array:
var list := _guiscales.keys()
- list.sort_custom(func(a, b): return a > b)
+ list.sort_custom(func(a : float, b : float) -> bool: return a > b)
return list
func get_guiscale_display_name(guiscale_value : float) -> StringName:
diff --git a/game/src/Game/Autoload/Resolution.gd b/game/src/Game/Autoload/Resolution.gd
index 73169fb..9dddb29 100644
--- a/game/src/Game/Autoload/Resolution.gd
+++ b/game/src/Game/Autoload/Resolution.gd
@@ -27,7 +27,7 @@ var _resolutions : Array[Vector2i]
const _regex_pattern : String = "(\\d+)\\s*[xX,]\\s*(\\d+)"
var _regex : RegEx
-func _ready():
+func _ready() -> void:
assert(minimum_resolution.x > 0 and minimum_resolution.y > 0, "Minimum resolution must be positive!")
for resolution_value in _starting_resolutions:
add_resolution(resolution_value)
@@ -53,7 +53,7 @@ func get_resolution_value_list() -> Array[Vector2i]:
var list : Array[Vector2i] = []
# Return a sorted copy instead of a reference to the private array
list.append_array(_resolutions)
- list.sort_custom(func(a, b): return a > b)
+ list.sort_custom(func(a : Vector2i, b : Vector2i) -> bool: return a > b)
return list
func get_resolution_value_from_string(resolution_string : String) -> Vector2i:
diff --git a/game/src/Game/Autoload/SaveManager.gd b/game/src/Game/Autoload/SaveManager.gd
index fb7806b..eead63c 100644
--- a/game/src/Game/Autoload/SaveManager.gd
+++ b/game/src/Game/Autoload/SaveManager.gd
@@ -10,7 +10,7 @@ var current_session_tag : StringName
var _save_dictionary : Dictionary = {}
var _dirty_save : SaveResource
-func _ready():
+func _ready() -> void:
var saves_dir_path : String = ProjectSettings.get_setting_with_override(save_directory_setting)
assert(saves_dir_path != null, "'%s' setting could not be found." % save_directory_setting)
diff --git a/game/src/Game/Autoload/SoundManager.gd b/game/src/Game/Autoload/SoundManager.gd
index c58ce1a..a8a8e80 100644
--- a/game/src/Game/Autoload/SoundManager.gd
+++ b/game/src/Game/Autoload/SoundManager.gd
@@ -11,9 +11,9 @@ var _bus_to_stream_player : Dictionary = {}
# REQUIREMENTS:
# * SND-10
-func _ready():
- var dir = DirAccess.open(_audio_directory_path)
- for fname in dir.get_files():
+func _ready() -> void:
+ var dir := DirAccess.open(_audio_directory_path)
+ for fname : String in dir.get_files():
match fname.get_extension():
"ogg", "wav", "mp3":
_loaded_sound[fname.get_basename()] = load(_audio_directory_path.path_join(fname)) # SND-10
diff --git a/game/src/Game/Autoload/WindowOverride.gd b/game/src/Game/Autoload/WindowOverride.gd
index 837570e..578aee0 100644
--- a/game/src/Game/Autoload/WindowOverride.gd
+++ b/game/src/Game/Autoload/WindowOverride.gd
@@ -2,11 +2,11 @@ extends Node
const VideoOptions = preload("res://src/Game/Menu/OptionMenu/VideoTab.tscn")
-func _init():
+func _init() -> void:
var window_id := DisplayServer.get_window_list()[0]
DisplayServer.window_set_size(Vector2(1280.0, 720.0), window_id)
-func _ready():
+func _ready() -> void:
if ArgumentParser.get_argument(&"help"): return
_on_SceneTree_idle()
# Hack to ensure Video Options load
@@ -15,7 +15,7 @@ func _ready():
add_child(video)
video.queue_free()
-func _on_SceneTree_idle():
+func _on_SceneTree_idle() -> void:
var window := get_window()
window.set_mode(Window.MODE_FULLSCREEN)
await get_tree().process_frame
diff --git a/game/src/Game/GameMenu.gd b/game/src/Game/GameMenu.gd
index 8e3239f..974c1d9 100644
--- a/game/src/Game/GameMenu.gd
+++ b/game/src/Game/GameMenu.gd
@@ -7,36 +7,36 @@ extends Control
# REQUIREMENTS
# * SS-10
-func _ready():
+func _ready() -> void:
Events.Options.load_settings_from_file()
-func _on_main_menu_new_game_button_pressed():
+func _on_main_menu_new_game_button_pressed() -> void:
_lobby_menu.show()
_main_menu.hide()
# REQUIREMENTS
# * SS-6
# * UIFUN-5
-func _on_main_menu_options_button_pressed():
+func _on_main_menu_options_button_pressed() -> void:
_options_menu.show()
_main_menu.hide()
-func _on_options_menu_back_button_pressed():
+func _on_options_menu_back_button_pressed() -> void:
_main_menu.show()
_options_menu.hide()
-func _on_lobby_menu_back_button_pressed():
+func _on_lobby_menu_back_button_pressed() -> void:
_main_menu.show()
_lobby_menu.hide()
-func _on_credits_back_button_pressed():
+func _on_credits_back_button_pressed() -> void:
_credits_menu.hide()
_main_menu.show()
-func _on_main_menu_credits_button_pressed():
+func _on_main_menu_credits_button_pressed() -> void:
_credits_menu.show()
_main_menu.hide()
diff --git a/game/src/Game/GameStart.gd b/game/src/Game/GameStart.gd
index 32e70c8..4b93077 100644
--- a/game/src/Game/GameStart.gd
+++ b/game/src/Game/GameStart.gd
@@ -41,7 +41,7 @@ func _save_setting(file : ConfigFile) -> void:
if file == null: return
file.set_value(section_name, setting_name, _settings_base_path)
-func _load_compatibility_mode():
+func _load_compatibility_mode() -> void:
# Set this to your Vic2 install dir or a mod's dir to enable compatibility mode
# (this won't work for mods which rely on vanilla map assets, copy missing assets
# into the mod's dir for a temporary fix)
@@ -107,5 +107,5 @@ func _initialize_game() -> void:
# change scene in a thread-safe way
get_tree().change_scene_to_packed.call_deferred(GameMenuScene)
-func _on_splash_container_splash_end():
+func _on_splash_container_splash_end() -> void:
loading_screen.show()
diff --git a/game/src/Game/GlobalClass/Localisation.gd b/game/src/Game/GlobalClass/Localisation.gd
index 946dc50..78afb69 100644
--- a/game/src/Game/GlobalClass/Localisation.gd
+++ b/game/src/Game/GlobalClass/Localisation.gd
@@ -23,12 +23,12 @@ static func load_localisation(dir_path : String) -> void:
# REQUIREMENTS
# * SS-57
# * FS-17
-static func initialize():
+static func initialize() -> void:
var localisation_dir_path : String = ProjectSettings.get_setting("internationalization/locale/localisation_path", "")
if localisation_dir_path.is_empty():
push_error("internationalization/locale/localisation_path setting is empty!")
else:
Localisation.load_localisation(localisation_dir_path)
-static func tr_number(num) -> String:
+static func tr_number(num : Variant) -> String:
return TextServerManager.get_primary_interface().format_number(str(num))
diff --git a/game/src/Game/LoadingScreen.gd b/game/src/Game/LoadingScreen.gd
index 08cd2a8..c1bfdc6 100644
--- a/game/src/Game/LoadingScreen.gd
+++ b/game/src/Game/LoadingScreen.gd
@@ -22,14 +22,14 @@ func start_loading_screen(thread_safe_function : Callable) -> void:
thread.start(thread_safe_function)
-func try_update_loading_screen(percent_complete: float, quote_should_change = false):
+func try_update_loading_screen(percent_complete: float, quote_should_change := false) -> void:
# forces the function to behave as if deferred
await get_tree().process_frame
progress_bar.value = percent_complete
if quote_should_change:
quote_label.text = quotes[randi() % quotes.size()]
-func _ready():
+func _ready() -> void:
if Engine.is_editor_hint(): return
thread = Thread.new()
# FS-3, UI-30, UIFUN-35
@@ -39,6 +39,6 @@ func _ready():
quotes = [""]
animation_player.play("loadingscreen_gear")
-func _exit_tree():
+func _exit_tree() -> void:
if thread != null and thread.is_started():
thread.wait_to_finish()
diff --git a/game/src/Game/LocaleButton.gd b/game/src/Game/LocaleButton.gd
index 30a2dab..e315330 100644
--- a/game/src/Game/LocaleButton.gd
+++ b/game/src/Game/LocaleButton.gd
@@ -5,15 +5,15 @@ const setting_name : String = "locale"
var _default_locale_index : int
-func _ready():
+func _ready() -> void:
var locales_country_rename : Dictionary = ProjectSettings.get_setting("internationalization/locale/country_short_name", {})
- var locales_list = TranslationServer.get_loaded_locales()
+ var locales_list := TranslationServer.get_loaded_locales()
var default_locale := Localisation.get_default_locale()
if default_locale not in locales_list:
locales_list.push_back(default_locale)
- for locale in locales_list:
+ for locale : String in locales_list:
# locale_name consists of a compulsory language name and optional script
# and country names, in the format: "<language>[ (script)][, country]"
var locale_name := TranslationServer.get_locale_name(locale)
@@ -33,7 +33,7 @@ func _ready():
Events.Options.load_settings.connect(load_setting)
Events.Options.save_settings.connect(save_setting)
-func _notification(what : int):
+func _notification(what : int) -> void:
match what:
NOTIFICATION_TRANSLATION_CHANGED:
_select_locale_by_string(TranslationServer.get_locale())
@@ -43,7 +43,7 @@ func _valid_index(index : int) -> bool:
func load_setting(file : ConfigFile) -> void:
if file == null: return
- var load_value = file.get_value(section_name, setting_name, Localisation.get_default_locale())
+ var load_value : Variant = file.get_value(section_name, setting_name, Localisation.get_default_locale())
match typeof(load_value):
TYPE_STRING, TYPE_STRING_NAME:
if _select_locale_by_string(load_value as String):
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
diff --git a/game/src/Game/MusicConductor/MusicConductor.gd b/game/src/Game/MusicConductor/MusicConductor.gd
index f298db6..abfc52f 100644
--- a/game/src/Game/MusicConductor/MusicConductor.gd
+++ b/game/src/Game/MusicConductor/MusicConductor.gd
@@ -13,7 +13,7 @@ signal song_scrubbed(percentage : float, seconds : float)
@export var _audio_stream_player : AudioStreamPlayer
-var _selected_track = 0
+var _selected_track := 0
var _available_songs : Array[SongInfo] = []
var _auto_play_next_song : bool = true
@@ -76,9 +76,9 @@ func select_previous_song() -> void:
# REQUIREMENTS
# * SND-2, SND-3
-func _ready():
- var dir = DirAccess.open(music_directory)
- for fname in dir.get_files():
+func _ready() -> void:
+ var dir := DirAccess.open(music_directory)
+ for fname : String in dir.get_files():
if fname.ends_with(".import"):
fname = fname.get_basename()
if fname.get_basename() == first_song_name:
@@ -91,7 +91,7 @@ func set_startup_music(play : bool) -> void:
_has_startup_happened = true
set_paused(not play)
-func _on_audio_stream_player_finished():
+func _on_audio_stream_player_finished() -> void:
song_finished.emit(_selected_track)
if _auto_play_next_song:
select_next_song()
diff --git a/game/src/Game/MusicConductor/MusicPlayer.gd b/game/src/Game/MusicConductor/MusicPlayer.gd
index e83ab9b..949f423 100644
--- a/game/src/Game/MusicConductor/MusicPlayer.gd
+++ b/game/src/Game/MusicConductor/MusicPlayer.gd
@@ -9,7 +9,7 @@ extends Control
var _is_user_dragging_progress_slider : bool = false
-func _ready():
+func _ready() -> void:
for songName in MusicConductor.get_all_song_names():
_song_selector_button.add_item(songName, _song_selector_button.item_count)
_on_song_set(MusicConductor.get_current_song_index())
@@ -22,35 +22,35 @@ func _on_song_set(track_id : int) -> void:
_song_selector_button.selected = track_id
_update_play_pause_button()
-func _process(_delta):
+func _process(_delta : float) -> void:
if !_is_user_dragging_progress_slider:
_progress_slider.value = MusicConductor.get_current_song_progress_percentage()
-func _update_play_pause_button(_arg1 = null, _arg2 = null):
+func _update_play_pause_button(_arg1 : Variant = null, _arg2 : Variant = null) -> void:
_play_pause_button.text = "◼" if MusicConductor.is_paused() else "▶"
-func _on_play_pause_button_pressed():
+func _on_play_pause_button_pressed() -> void:
MusicConductor.toggle_play_pause()
# REQUIREMENTS
# * UIFUN-93
-func _on_next_song_button_pressed():
+func _on_next_song_button_pressed() -> void:
MusicConductor.select_next_song()
# REQUIREMENTS
# * UIFUN-94
-func _on_previous_song_button_pressed():
+func _on_previous_song_button_pressed() -> void:
MusicConductor.select_previous_song()
# REQUIREMENTS
# * UIFUN-95
-func _on_option_button_item_selected(index):
+func _on_option_button_item_selected(index : int) -> void:
MusicConductor.start_song_by_index(index)
-func _on_progress_slider_drag_started():
+func _on_progress_slider_drag_started() -> void:
_is_user_dragging_progress_slider = true
-func _on_progress_slider_drag_ended(_value_changed):
+func _on_progress_slider_drag_ended(_value_changed : bool) -> void:
MusicConductor.scrub_song_by_percentage(_progress_slider.value)
_is_user_dragging_progress_slider = false
@@ -65,5 +65,5 @@ func _set_music_player_visible(is_player_visible : bool) -> void:
# REQUIREMENTS
# * UIFUN-91
-func _on_music_ui_visibility_button_pressed():
+func _on_music_ui_visibility_button_pressed() -> void:
_set_music_player_visible(not MusicConductor.is_music_player_visible)
diff --git a/game/src/Game/MusicConductor/SongInfo.gd b/game/src/Game/MusicConductor/SongInfo.gd
index 1ee9adc..abcf120 100644
--- a/game/src/Game/MusicConductor/SongInfo.gd
+++ b/game/src/Game/MusicConductor/SongInfo.gd
@@ -5,7 +5,7 @@ var song_path : String = ""
var song_name : String = ""
var song_stream : Resource
-func _init(dirname:String, fname:String):
+func _init(dirname:String, fname:String) -> void:
song_path = dirname.path_join(fname)
song_name = fname.get_basename().replace("_", " ")
song_stream = load(song_path)
diff --git a/game/src/Game/SplashContainer.gd b/game/src/Game/SplashContainer.gd
index 524d314..e74620b 100644
--- a/game/src/Game/SplashContainer.gd
+++ b/game/src/Game/SplashContainer.gd
@@ -6,14 +6,14 @@ signal splash_end
@export var _splash_image : TextureRect
@export var _splash_video : VideoStreamPlayer
-func _process(_delta):
+func _process(_delta : float) -> void:
var stream_texture := _splash_video.get_video_texture()
if stream_texture != null and not stream_texture.get_image().is_invisible():
_splash_image.hide()
_splash_finish.show()
set_process(false)
-func _input(event):
+func _input(event : InputEvent) -> void:
if (event is InputEventKey\
or event is InputEventMouse\
or event is InputEventScreenTouch\
@@ -22,7 +22,7 @@ func _input(event):
_on_splash_startup_finished()
accept_event()
-func _on_splash_startup_finished():
+func _on_splash_startup_finished() -> void:
set_process_input(false)
splash_end.emit()
var tween := create_tween()