Follow the GDScript style guide in every script

- Types on every parameter, return value and variable, and snake_case names
  (the player name limit is the constant MAX_NAME_LENGTH).
- Spelling fixes: *_triggered, character_selected, separator, caught_errors.
  The server's catched_errors key stays as the server sends it.
- Signals are connected with signal.connect() instead of by name.
- Code is ordered signals, constants, exported vars, vars, @onready vars,
  functions, with @onready on one line and two blank lines between functions.
- Every script starts with a ## description. Template comments, old LOC notes
  and commented-out code are gone, apart from the local play code.
- Lines are at most 100 characters, apart from the local play path.
- The screenshot tour turns off the blinking text cursor so pictures match.
This commit is contained in:
Sansan committed 2026-10-06 11:53:26 +02:00
1 parent 674604425f
commit a0428e3475
45 files changed
+580 -589

No files matched your search

+10 -9
View File
@@ -4,35 +4,36 @@ extends ScrollContainer
## by itself, at the speed set in the settings.
## The soundtracks shown, in order.
var soundtracks: Array = []
# Scroll direction: 1 = down, -1 = up
var scroll_direction: int = 1
@onready
var _rows: VBoxContainer = $VBoxContainer
@onready var _rows: VBoxContainer = $VBoxContainer
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
scroll_direction = 1
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
var speed_pixels_per_second: float = float(Settings.inspiration_list_speed) * 60.0
var scroll_amount: float = speed_pixels_per_second * delta * float(scroll_direction)
var scroll_bar = get_v_scroll_bar()
var scroll_bar: VScrollBar = get_v_scroll_bar()
# Don't scroll if list is empty or too short
if scroll_bar.max_value <= 0:
return
var current_pos = scroll_bar.value
var current_pos: float = scroll_bar.value
if scroll_direction == 1:
# Scrolling down
if current_pos + scroll_bar.page < scroll_bar.max_value:
scroll_bar.value = min(current_pos + scroll_amount, scroll_bar.max_value - scroll_bar.page)
scroll_bar.value = minf(current_pos + scroll_amount,
scroll_bar.max_value - scroll_bar.page)
else:
# Reached bottom, reverse direction
scroll_direction = -1
@@ -40,7 +41,7 @@ func _process(delta: float) -> void:
else:
# Scrolling up
if current_pos > 0:
scroll_bar.value = max(current_pos + scroll_amount, 0)
scroll_bar.value = maxf(current_pos + scroll_amount, 0)
else:
# Reached top, reverse direction
scroll_direction = 1
@@ -50,7 +51,7 @@ func _process(delta: float) -> void:
## Fetches every soundtrack from the server and shows them.
func load_from_server() -> void:
GameLog.debug("load_from_server")
var populate_list: Callable = func populate_list(array) -> void:
var populate_list: Callable = func populate_list(array: Variant) -> void:
if typeof(array) == TYPE_ARRAY:
show_soundtracks(array)
else: