1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-30 04:40:54 +02:00

Change Game.get_player_by_index -> game.get_player

This commit is contained in:
Gerkiz 2022-06-26 23:34:38 +02:00
parent 3f582a5cd1
commit 7590be58fe
3 changed files with 4 additions and 5 deletions

View File

@ -114,7 +114,7 @@ end
@return the created entity
]]
function Game.print_player_floating_text_position(player_index, text, color, x_offset, y_offset)
local player = Game.get_player_by_index(player_index)
local player = game.get_player(player_index)
if not player or not player.valid then
return
end

View File

@ -186,7 +186,7 @@ local function redraw_poll_viewer_content(data)
if next(edited_by_players) then
local edit_names = {'Edited by '}
for pi, _ in pairs(edited_by_players) do
local p = Game.get_player_by_index(pi)
local p = game.get_player(pi)
if p and p.valid then
insert(edit_names, p.name)
insert(edit_names, ', ')
@ -762,7 +762,7 @@ local function vote(event)
end
local function player_joined(event)
local player = Game.get_player_by_index(event.player_index)
local player = game.get_player(event.player_index)
if not player or not player.valid then
return
end

View File

@ -2,7 +2,6 @@ local Token = require 'utils.token'
local Task = require 'utils.task'
local Global = require 'utils.global'
local Event = require 'utils.event'
local Game = require 'utils.game'
local Print = require('utils.print_override')
-- local constants
@ -1313,7 +1312,7 @@ commands.add_command(
Event.add(
defines.events.on_player_joined_game,
function(event)
local player = Game.get_player_by_index(event.player_index)
local player = game.get_player(event.player_index)
if not player or not player.valid then
return
end