Skip to content

Commit

Permalink
Fix crash loading mutiplayer map in singleplayer
Browse files Browse the repository at this point in the history
Caused by on_player_created not being called when
loading a multiplayer map in singleplayer. For
further discussion see $622 and
https://forums.factorio.com/viewtopic.php?f=7&t=113497
  • Loading branch information
Danielv123 committed May 15, 2024
1 parent e341adf commit f471c61
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions plugins/inventory_sync/module/inventory_sync.lua
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,11 @@ end

-- Download inventory from controller
inventory_sync.events[defines.events.on_player_joined_game] = function(event)
-- It's possible Factorio doesn't invoke the on_player_created event when loading a save in single player
if not global.inventory_sync.players[player.name] then
create_player(player, false)
end

-- Send acquire request even if an active download is currently in plogress
local player = game.get_player(event.player_index)
inventory_sync.acquire(player, false)
Expand Down

0 comments on commit f471c61

Please sign in to comment.