1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-06 00:23:49 +02:00
ComfyFactorio/utils/server_commands.lua
2019-02-20 11:43:29 +01:00

29 lines
888 B
Lua

local Poll = {send_poll_result_to_discord = function () end}
local Token = require 'utils.token'
local Server = require 'utils.server'
--- This module is for the web server to call functions and raise events.
-- Not intended to be called by scripts.
-- Needs to be in the _G table so it can be accessed by the web server.
ServerCommands = {}
ServerCommands.get_poll_result = Poll.send_poll_result_to_discord
function ServerCommands.raise_callback(func_token, data)
local func = Token.get(func_token)
func(data)
end
ServerCommands.raise_data_set = Server.raise_data_set
ServerCommands.get_tracked_data_sets = Server.get_tracked_data_sets
function ServerCommands.server_started()
script.raise_event(Server.events.on_server_started, {})
end
ServerCommands.set_time = Server.set_time
ServerCommands.query_online_players = Server.query_online_players
return ServerCommands