mirror of
https://github.com/Oarcinae/FactorioScenarioMultiplayerSpawn.git
synced 2024-12-04 09:43:00 +02:00
Merge pull request #182 from Oarcinae/174-crash-join-another-spawn
Fix crash when selecting shared spawn for a player that just left. No…
This commit is contained in:
commit
7318113af7
@ -760,6 +760,11 @@ function RemoveOrResetPlayer(player, remove_player)
|
||||
if (remove_player) then
|
||||
game.remove_offline_players({ player })
|
||||
end
|
||||
|
||||
-- Refresh the shared spawn spawn gui for all players
|
||||
for _,p in pairs(game.connected_players) do
|
||||
RefreshSharedSpawnFrameIfExist(p)
|
||||
end
|
||||
end
|
||||
|
||||
---Searches all unique spawns for the primary one for a player. This will return null if they joined someeone else's spawn.
|
||||
@ -771,6 +776,7 @@ function FindPrimaryUniqueSpawn(player_name)
|
||||
return spawns[player_name]
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
---Find the primary home spawn of a player, if one exists. It could be they joined a shared spawn.
|
||||
|
@ -842,7 +842,9 @@ function SharedSpawnSelect(gui_element, player)
|
||||
local button = gui_element.parent.join_other_spawn
|
||||
|
||||
local primary_spawn = FindPrimaryUniqueSpawn(host_name)
|
||||
if (IsSharedSpawnOpen(primary_spawn.surface_name, host_name) and not IsSharedSpawnFull(primary_spawn.surface_name, host_name)) then
|
||||
if (primary_spawn and
|
||||
IsSharedSpawnOpen(primary_spawn.surface_name, host_name) and
|
||||
not IsSharedSpawnFull(primary_spawn.surface_name, host_name)) then
|
||||
global.spawn_choices[player.name].host = host_name
|
||||
button.enabled = true
|
||||
button.caption = { "oarc-join-shared-button-enable", host_name, primary_spawn.surface_name }
|
||||
|
Loading…
Reference in New Issue
Block a user