Move server calls to MusicServerClient and give players stable ids

Server requests move out of Settings into a new MusicServerClient
autoload with one function per endpoint. It sends requests through a
swappable HttpTransport so tests can fake the server, and it frees its
HTTPRequest nodes after use.

Players now have a UUID that never changes. Their position in
Settings.player_array is only used for the Alt+<number> keybinds.
Previously the position doubled as the id, so removing a player made
points and wins land on the wrong player, and could delete another
player's point from a song.

Also fixes:
- format_time showed 59.6 seconds as "00:60"
- searches containing regex characters such as "Q*bert" broke search
- SongObject and PlayerObject were Nodes that were never freed; they
  are now RefCounted
- search matching is split out of the UI code into find_matches()
This commit is contained in:
Sansan committed 2026-10-05 19:33:41 +02:00
1 parent 4a275e6a88
commit 87ff3d899b
18 files changed
+281 -162

No files matched your search

+9 -9
View File
@@ -39,12 +39,12 @@ func set_label() -> void:
func update_players() -> void:
Settings.delete_children(song_list_players)
if song_object != null:
for player_id: int in song_object.players_given_point:
for player: PlayerObject in Settings.player_array:
if player.id == player_id:
var texture: TextureRect = TextureRect.new()
texture.texture = player.character
texture.expand_mode = TextureRect.EXPAND_FIT_WIDTH_PROPORTIONAL
texture.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
texture.custom_minimum_size = Vector2(50, 25)
song_list_players.add_child(texture)
# Show players in the same order as the player list
for player: PlayerObject in Settings.player_array:
if song_object.players_given_point.has(player.id):
var texture: TextureRect = TextureRect.new()
texture.texture = player.character
texture.expand_mode = TextureRect.EXPAND_FIT_WIDTH_PROPORTIONAL
texture.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
texture.custom_minimum_size = Vector2(50, 25)
song_list_players.add_child(texture)