mirror of
https://github.com/Refactorio/RedMew.git
synced 2025-03-03 14:53:01 +02:00
Merge pull request #1215 from grilledham/fix-commands-from-server
Fix commands not working when run from the server console.
This commit is contained in:
commit
6e81c72741
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user