From d9bce1e39e9e0a7c9db81d7774d4ecb02123150d Mon Sep 17 00:00:00 2001 From: bbassie <17990055+bbassie@users.noreply.github.com> Date: Sun, 6 Sep 2026 01:10:43 +0000 Subject: [PATCH] Sync every toggleable shortcut instead of a fixed list Co-Authored-By: Claude Fable 5.1 --- plugins/inventory_sync/module/serialize.lua | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/plugins/inventory_sync/module/serialize.lua b/plugins/inventory_sync/module/serialize.lua index 85c09c27..927de50a 100644 --- a/plugins/inventory_sync/module/serialize.lua +++ b/plugins/inventory_sync/module/serialize.lua @@ -602,19 +602,12 @@ end --- @field crafting_queue table? --- @field recipe_notifications string? ---- Toggle shortcuts whose state is stored on the player and not covered by any other synced data -local synced_shortcuts = { - "toggle-personal-roboport", - "toggle-equipment-movement-bonus", -} - --- @param player LuaPlayer --- @return table function serialize.serialize_shortcuts(player) - local shortcut_prototypes = compat.prototypes.shortcut local shortcuts = {} - for _, name in ipairs(synced_shortcuts) do - if shortcut_prototypes[name] then + for name, prototype in pairs(compat.prototypes.shortcut) do + if prototype.toggleable then shortcuts[name] = player.is_shortcut_toggled(name) end end @@ -626,7 +619,8 @@ end function serialize.deserialize_shortcuts(player, serialized) local shortcut_prototypes = compat.prototypes.shortcut for name, toggled in pairs(serialized) do - if shortcut_prototypes[name] then + local prototype = shortcut_prototypes[name] + if prototype and prototype.toggleable then player.set_shortcut_toggled(name, toggled) end end