Sync the toolbar of players through the controller

The toolbar order, favourites, and open panels were saved into
exp_legacy's PlayerData, which was never synced, and the file doing so
was no longer loaded. When a player leaves, the lua side now sends
Gui.toolbar.get_state as json compressed with helpers.encode_string,
and the controller stores the string on the player record.

When the player joins again the instance plugin sends the stored string
over rcon to exp_scenario.player_settings.receive_toolbar, which
decodes it and calls Gui.toolbar.set_state. exp_gui builds the toolbar
in on_player_joined_game, so it exists by the time the rcon arrives.
A string which does not decode, or a state naming buttons which no
longer exist, is logged and ignored rather than raising in the game.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Opus 5.5 committed 2026-10-14 22:10:31 +00:00
1 parent ebe7504c00
commit 54941b85aa
15 files changed
+228 -45

No files matched your search

+5
View File
@@ -17,6 +17,7 @@ local Framework = assert(loadfile(shared_root .. "/framework.lua"))() --- @type
--- @field storage table The table registered with storage, as on_init would store it
--- @field on_load fun(tbl: table) Act out on_load with the given storage table
--- @field load_config fun(name: string): ExpScenario.Feature Load module/config/<name>.lua
--- @field load_module fun(name: string): any Load module/<name>.lua, such as "control/player_settings"
--- @field logged string[] Messages passed to log
--- @field events table[] Raised events, name and tick filled in
@@ -51,5 +52,9 @@ return Framework.suite(function(env)
return assert(loadfile(plugin_root .. "/module/config/" .. name .. ".lua"))()
end
function env.load_module(name)
return assert(loadfile(plugin_root .. "/module/" .. name .. ".lua"))()
end
return env
end)