1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-01-18 03:21:47 +02:00

Fix commands not working when run from the server console.

This commit is contained in:
James Gillham 2021-05-20 20:51:26 +01:00
parent 864b5dd37b
commit 665ea1cbbc

View File

@ -149,7 +149,13 @@ function Command.add(command_name, options, callback)
help_text,
function(command)
local print -- custom print reference in case no player is present
local player = game.get_player(command.player_index)
local player_index = command.player_index
local player = nil
if player_index ~= nil and player_index ~= 0 then
player = game.get_player(player_index)
end
local player_name = player and player.valid and player.name or '<server>'
if not player or not player.valid then
print = log