diff --git a/plugins/inventory_sync/module/inventory_sync.lua b/plugins/inventory_sync/module/inventory_sync.lua index 9805601c..4604e223 100644 --- a/plugins/inventory_sync/module/inventory_sync.lua +++ b/plugins/inventory_sync/module/inventory_sync.lua @@ -116,9 +116,9 @@ function inventory_sync.deserialize_player(player, finished_record) -- Transfer items from stashed inventory if stashed_corpse then - local main = player.get_main_inventory() local stash = stashed_corpse.get_inventory(defines.inventory.character_corpse) - if main then + if player.character then + local main = player.character.get_main_inventory() for i = 1, #stash do -- Try transferring a stack local source = stash[i] diff --git a/plugins/inventory_sync/module/serialize.lua b/plugins/inventory_sync/module/serialize.lua index bb7ab439..64b92e53 100644 --- a/plugins/inventory_sync/module/serialize.lua +++ b/plugins/inventory_sync/module/serialize.lua @@ -317,7 +317,7 @@ function serialize.serialize_crafting_queue(player) end function serialize.deserialize_crafting_queue(player, serialized) - local inventory = player.get_main_inventory() + local inventory = player.character.get_main_inventory() -- Give player some more inventory space to avoid duplicating items player.character_inventory_slots_bonus = player.character_inventory_slots_bonus + 1000