1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-03-17 20:58:13 +02:00

Update server.lua

Added new a new command.
Only the server can utilize this.
This commit is contained in:
Gerkiz 2020-04-05 18:34:29 +02:00 committed by GitHub
parent c57a41e045
commit 58427b8083
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -699,6 +699,24 @@ function Public.query_online_players()
raw_print(message)
end
--- The command 'cc' is only used by the server so it can communicate through the webpanel api to the instances that it starts.
-- Doing this, enables achivements and the webpanel can communicate without any interruptions.
commands.add_command(
'cc',
'Evaluate command',
function(cmd)
local player = game.player
if player then return end
local param = cmd.parameter
if param == nil then return end
local func, err = loadstring(param)
if not func then raw_print(err) return end
_, err2 = pcall(func)
if err2 then raw_print(err2) return end
end)
--- The [JOIN] nad [LEAVE] messages Factorio sends to stdout aren't sent in all cases of
-- players joining or leaving. So we send our own [PLAYER-JOIN] and [PLAYER-LEAVE] tags.
Event.add(