Send the play queue ID to the server
The server keeps a play queue per client, identified by the X-Queue-Id header. The client sends the ID it has for the selected server with every request and keeps the one in each response, which is new after a reset or a sync. The IDs are saved per server in the [queues] section of settings.cfg, so the game goes on with the same queue after a restart. HttpTransport now passes the response headers on to the client.
This commit is contained in:
1 parent
d21b3e2ce0
commit
4a45e8516d
8 files changed
+212
-16
No files matched your search
@@ -79,6 +79,10 @@ var player_array: Array[PlayerObject]
|
||||
var edit_players: bool = false
|
||||
var currently_syncing: bool = false
|
||||
var character_select_open: bool = false
|
||||
## The ID of the game's play queue on each server, by server URL, set by
|
||||
## [code]MusicServerClient[/code]. Saved in the [code][queues][/code] section of
|
||||
## [method saved_settings_path], so the game goes on with the same queue after a restart.
|
||||
var queue_ids: Dictionary[String, String] = {}
|
||||
|
||||
## The game version, set in Project Settings > Application > Config > Version.
|
||||
## Releases are made from it, see RELEASING.md.
|
||||
@@ -153,6 +157,12 @@ func load_saved_settings() -> void:
|
||||
for section: String in SAVED_SETTINGS:
|
||||
for setting: StringName in SAVED_SETTINGS[section]:
|
||||
set(setting, _saved_value(file, section, setting, get(setting)))
|
||||
if file.has_section("queues"):
|
||||
queue_ids.clear()
|
||||
for server: String in file.get_section_keys("queues"):
|
||||
var id: Variant = file.get_value("queues", server)
|
||||
if id is String:
|
||||
queue_ids[server] = id
|
||||
|
||||
|
||||
## Saves the settings in [constant SAVED_SETTINGS], so they are the same the next time
|
||||
@@ -164,11 +174,19 @@ func save_settings() -> void:
|
||||
for section: String in SAVED_SETTINGS:
|
||||
for setting: StringName in SAVED_SETTINGS[section]:
|
||||
file.set_value(section, setting, get(setting))
|
||||
for server: String in queue_ids:
|
||||
file.set_value("queues", server, queue_ids[server])
|
||||
var error: Error = file.save(path)
|
||||
if error != OK:
|
||||
GameLog.warning("Could not save the settings to %s: %s" % [path, error_string(error)])
|
||||
|
||||
|
||||
## Sets the play queue ID for [param server] and saves it.
|
||||
func set_queue_id(server: String, id: String) -> void:
|
||||
queue_ids[server] = id
|
||||
save_settings()
|
||||
|
||||
|
||||
## Turns fullscreen on or off and saves it.
|
||||
func set_fullscreen(on: bool) -> void:
|
||||
fullscreen = on
|
||||
|
||||
Reference in new issue
Block a user