diff --git a/modules/show_inventory.lua b/modules/show_inventory.lua index 81eb6ec28..ef0d008a6 100644 --- a/modules/show_inventory.lua +++ b/modules/show_inventory.lua @@ -124,7 +124,7 @@ local function validate_player(player) if not player.connected then return false end - if not game.players[player.index] then + if not game.get_player(player.index) then return false end return true @@ -331,7 +331,7 @@ local function open_inventory(source, target) end local function on_gui_click(event) - local player = game.players[event.player_index] + local player = game.get_player(event.player_index) if not this.data[player.index] then return end @@ -384,7 +384,7 @@ local function on_gui_click(event) end end local function gui_closed(event) - local player = game.players[event.player_index] + local player = game.get_player(event.player_index) if not this.data[player.index] then return end @@ -401,7 +401,7 @@ local function gui_closed(event) end local function on_pre_player_left_game(event) - local player = game.players[event.player_index] + local player = game.get_player(event.player_index) if not this.data[player.index] then return end @@ -443,7 +443,7 @@ commands.add_command( if not cmd.parameter then return end - local target_player = game.players[cmd.parameter] + local target_player = game.get_player(cmd.parameter) if target_player == player and not player.admin then return player.print('Cannot open self.', Color.warning) diff --git a/utils/gui/group.lua b/utils/gui/group.lua index 549ad3028..16b938d0b 100644 --- a/utils/gui/group.lua +++ b/utils/gui/group.lua @@ -19,7 +19,7 @@ local this = { ['Production'] = {name = 'Production', founder = 'script', description = '[img=item/assembling-machine-1]', static = true}, ['Science'] = {name = 'Science', founder = 'script', description = '[img=item/chemical-science-pack]', static = true}, ['Trainman'] = {name = 'Trainman', founder = 'script', description = '[img=item/locomotive]', static = true}, - ['Oil processing'] = {name = 'processing', founder = 'script', description = '[img=fluid/crude-oil]', static = true}, + ['Oil processing'] = {name = 'Oil Processing', founder = 'script', description = '[img=fluid/crude-oil]', static = true}, ['Trooper'] = {name = 'Trooper', founder = 'script', description = '[img=item/submachine-gun]', static = true}, ['Fortifications'] = {name = 'Fortifications', founder = 'script', description = '[img=item/stone-wall]', static = true}, ['Support'] = {name = 'Support', founder = 'script', description = '[img=item/repair-pack]', static = true} diff --git a/utils/gui/player_list.lua b/utils/gui/player_list.lua index 487ce2c88..f69f345b8 100644 --- a/utils/gui/player_list.lua +++ b/utils/gui/player_list.lua @@ -155,7 +155,13 @@ local function get_sorted_list(sort_by) player_data.admin = player.admin player_data.color = player.color player_data.index = player.index - player_data.coins = player.get_inventory(defines.inventory.character_main).get_item_count('coin') or 0 + local inventory = player.get_main_inventory() + if inventory and inventory.valid then + local player_item_count = inventory.get_item_count('coin') + player_data.coins = player_item_count + else + player_data.coins = 0 + end player_data.played_time = get_formatted_playtime(player.online_time) player_data.played_ticks = player.online_time