From feb3253bec0f68844583072fb0b751dd5a4c6a6a Mon Sep 17 00:00:00 2001 From: bbassie <17990055+bbassie@users.noreply.github.com> Date: Sun, 18 Oct 2026 19:53:36 +0000 Subject: [PATCH] Restore each imported appearance field on its own An import with color but no chat_color or tag assigned nil to the missing LuaPlayer properties and failed restoration. Co-Authored-By: Claude Opus 5.5 --- plugins/player_sync/module/serialize.lua | 9 +++++---- plugins/player_sync/test/plugin.js | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/player_sync/module/serialize.lua b/plugins/player_sync/module/serialize.lua index 867f82cd..d2bf0666 100644 --- a/plugins/player_sync/module/serialize.lua +++ b/plugins/player_sync/module/serialize.lua @@ -1324,10 +1324,11 @@ function serialize.deserialize_player(player, serialized, components, local_cont end end - if syncs(components, "appearance") and serialized.color then - player.color = serialized.color - player.chat_color = serialized.chat_color - player.tag = serialized.tag + if syncs(components, "appearance") then + -- Imports may supply any subset of these + if serialized.color then player.color = serialized.color end + if serialized.chat_color then player.chat_color = serialized.chat_color end + if serialized.tag then player.tag = serialized.tag end end if syncs(components, "force") and serialized.force then player.force = serialized.force diff --git a/plugins/player_sync/test/plugin.js b/plugins/player_sync/test/plugin.js index 123ab9e6..4752f356 100644 --- a/plugins/player_sync/test/plugin.js +++ b/plugins/player_sync/test/plugin.js @@ -105,6 +105,7 @@ describe("player_sync plugin", function() { assert(accepts({ name: "player", generation: 0 })); assert(accepts(playerData("player", 0, { controller: "ghost", ticks_to_respawn: 300 }))); assert(accepts(playerData("player", 0, { color: [1, 0, 0] }))); + assert(accepts(playerData("player", 0, { chat_color: [1, 0, 0], tag: "tag" }))); assert(accepts(playerData("player", 0, { crafting_queue: { crafting_queue: {}, crafting_queue_progress: 0, ingredients: {} }, personal_logistic_slots: { 1: { name: "iron-plate", min: 50 } },