1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-24 03:47:58 +02:00

Merge pull request #198 from ComfyFactory/chronotrain_commands_fix

fix for crash when sending commande from console
This commit is contained in:
hanakocz 2021-12-22 07:03:20 +01:00 committed by GitHub
commit af61da269d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -42,18 +42,22 @@ local function scenario(p, parameter)
end end
local function cmd_handler(cmd) local function cmd_handler(cmd)
local command_name = cmd.name
local player = game.get_player(cmd.player_index)
local p local p
if not player or not player.valid then if not cmd.player_index then
p = log p = log
else else
p = player.print local player = game.get_player(cmd.player_index)
if not player.admin then if not player or not player.valid then
p({'chronosphere.cmd_not_admin'}, Color.fail) p = log
return else
p = player.print
if not player.admin then
p({'chronosphere.cmd_not_admin'}, Color.fail)
return
end
end end
end end
local command_name = cmd.name
if command_name == 'scenario' then if command_name == 'scenario' then
scenario(p, cmd.parameter) scenario(p, cmd.parameter)
elseif command_name == 'chronojump' then elseif command_name == 'chronojump' then