Skip to content

Commit

Permalink
Merge pull request #205 from Oarcinae/204-210-crash-when-clicking-on-…
Browse files Browse the repository at this point in the history
…player-location-when-they-are-offline

Fixing crash in player list. Also bumping version.
  • Loading branch information
Oarcinae authored Oct 23, 2024
2 parents ef16cd0 + d891f75 commit 354e3a4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
5 changes: 5 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
---------------------------------------------------------------------------------------------------
Version: 2.1.1
Date: 2024-10-23
Bugfixes:
- Fix a crash when clicking on player location in player list.
---------------------------------------------------------------------------------------------------
Version: 2.1.0
Date: 2024-10-22
Major Features:
Expand Down
2 changes: 1 addition & 1 deletion info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "oarc-mod",
"version": "2.1.0",
"version": "2.1.1",
"factorio_version": "2.0",
"title": "Oarc Multiplayer Spawn",
"author": "Oarcinae",
Expand Down
11 changes: 10 additions & 1 deletion lib/gui_tabs/player_list.lua
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,15 @@ function PlayerListTabGuiClick(event)
local player_name = tags.player_name --[[@as string]]
local target_player = game.players[player_name]

player.set_controller{type = defines.controllers.remote, position = target_player.character.position, surface = target_player.character.surface}
if (target_player == nil) then
player.print({"oarc-player-not-found", player_name})
return
end

if (target_player.character) then
player.set_controller{type = defines.controllers.remote, position = target_player.character.position, surface = target_player.character.surface}
else
player.set_controller{type = defines.controllers.remote, position = target_player.position, surface = target_player.surface}
end
end
end

0 comments on commit 354e3a4

Please sign in to comment.