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,9 +42,11 @@ local function scenario(p, parameter)
end
local function cmd_handler(cmd)
local command_name = cmd.name
local player = game.get_player(cmd.player_index)
local p
if not cmd.player_index then
p = log
else
local player = game.get_player(cmd.player_index)
if not player or not player.valid then
p = log
else
@ -54,6 +56,8 @@ local function cmd_handler(cmd)
return
end
end
end
local command_name = cmd.name
if command_name == 'scenario' then
scenario(p, cmd.parameter)
elseif command_name == 'chronojump' then