Drop exp_legacy player data that inventory_sync covers (#491)

Inventory sync already stores the player colour, tag, quickbar and alt
view (game view settings), so the legacy alt-view, quickbar and tag
modules and the colour persistence are removed along with
/save-quickbar and its quickbar presets.

The /tag, /tag-color and /tag-clear commands move to exp_scenario and
write player.tag directly, which inventory sync then carries between
servers. /tag-color reads the current text back out of the tag, so it
now needs a tag to be set first. It also used to concatenate the colour
table into the tag and error, it now formats it as rich text.

player-colours keeps giving new players their preset or a random
colour on creation, inventory sync replaces it with the stored one for
anyone who has played before.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
BastiaanandClaude Opus 5.5 authored and GitHub committed 2026-10-11 18:29:11 +01:00
1 parent 1c5c9909cc
commit 11ccee572b
17 files changed
+103 -286

No files matched your search

+62
View File
@@ -0,0 +1,62 @@
--[[-- Commands - Tag
Adds commands to set the tag shown after your name, inventory sync keeps it between servers
]]
local Commands = require("modules/exp_commands")
local format_text = Commands.format_rich_text_color
local Roles = require("modules/exp_roles")
local player_has_permission = Roles.player_has_permission
--- Split a player tag into its text and colour
--- @param tag string
--- @return string, string?
local function parse_tag(tag)
local color, text = tag:match("^%- %[color=([^%]]*)%](.*)%[/color%]$")
if color then
--- @cast text string
return text, color
end
return tag:match("^%- (.*)$") or tag, nil
end
--- Sets your player tag
Commands.new("tag", { "exp-commands_tag.description" })
:argument("tag", { "exp-commands_tag.arg-tag" }, Commands.types.string_max_length(20))
:enable_auto_concatenation()
:register(function(player, tag)
--- @cast tag string
local _, color = parse_tag(player.tag)
if tag == "" then
player.tag = ""
elseif color then
player.tag = "- [color=" .. color .. "]" .. tag .. "[/color]"
else
player.tag = "- " .. tag
end
end)
--- Sets your player tag colour
Commands.new("tag-color", { "exp-commands_tag.description-color" })
:argument("color", { "exp-commands_tag.arg-color" }, Commands.types.color)
:register(function(player, color)
--- @cast color Color
local text = parse_tag(player.tag)
if text == "" then
return Commands.status.error{ "exp-commands_tag.no-tag" }
end
player.tag = "- " .. format_text(text, color)
end)
--- Clears your tag, or the tag of another player
Commands.new("tag-clear", { "exp-commands_tag.description-clear" })
:optional("player", { "exp-commands_tag.arg-player" }, Commands.types.lower_role_player)
:defaults{
player = function(player) return player end
}
:register(function(player, other_player)
--- @cast other_player LuaPlayer
if other_player ~= player and not player_has_permission(player, "exp_scenario.command.tag_clear.always") then
return Commands.status.unauthorised()
end
other_player.tag = ""
end)