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 <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Opus 5.5 committed 2026-10-18 19:53:36 +00:00
1 parent 41dc294542
commit feb3253bec
2 files changed
+6 -4

No files matched your search

+5 -4
View File
@@ -1324,10 +1324,11 @@ function serialize.deserialize_player(player, serialized, components, local_cont
end end
end end
if syncs(components, "appearance") and serialized.color then if syncs(components, "appearance") then
player.color = serialized.color -- Imports may supply any subset of these
player.chat_color = serialized.chat_color if serialized.color then player.color = serialized.color end
player.tag = serialized.tag if serialized.chat_color then player.chat_color = serialized.chat_color end
if serialized.tag then player.tag = serialized.tag end
end end
if syncs(components, "force") and serialized.force then if syncs(components, "force") and serialized.force then
player.force = serialized.force player.force = serialized.force
+1
View File
@@ -105,6 +105,7 @@ describe("player_sync plugin", function() {
assert(accepts({ name: "player", generation: 0 })); assert(accepts({ name: "player", generation: 0 }));
assert(accepts(playerData("player", 0, { controller: "ghost", ticks_to_respawn: 300 }))); 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, { color: [1, 0, 0] })));
assert(accepts(playerData("player", 0, { chat_color: [1, 0, 0], tag: "tag" })));
assert(accepts(playerData("player", 0, { assert(accepts(playerData("player", 0, {
crafting_queue: { crafting_queue: {}, crafting_queue_progress: 0, ingredients: {} }, crafting_queue: { crafting_queue: {}, crafting_queue_progress: 0, ingredients: {} },
personal_logistic_slots: { 1: { name: "iron-plate", min: 50 } }, personal_logistic_slots: { 1: { name: "iron-plate", min: 50 } },