2020-10-21 13:45:45 +02:00
|
|
|
local Poll = {
|
|
|
|
send_poll_result_to_discord = function()
|
|
|
|
end
|
|
|
|
}
|
2019-02-20 12:43:29 +02:00
|
|
|
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
|
2020-10-21 13:34:59 +02:00
|
|
|
ServerCommands.set_ups = Server.set_ups
|
2020-10-21 13:45:45 +02:00
|
|
|
ServerCommands.get_ups = Server.get_ups
|
2020-10-27 00:55:06 +02:00
|
|
|
ServerCommands.export_stats = Server.export_stats
|
2021-01-12 00:34:19 +02:00
|
|
|
ServerCommands.set_start_data = Server.set_start_data
|
2022-01-18 01:07:25 +02:00
|
|
|
ServerCommands.set_instances = Server.set_instances
|
2019-02-20 12:43:29 +02:00
|
|
|
ServerCommands.query_online_players = Server.query_online_players
|
|
|
|
|
2020-10-21 13:45:45 +02:00
|
|
|
local SC_Interface = {
|
|
|
|
get_ups = function()
|
2020-10-21 17:10:13 +02:00
|
|
|
return ServerCommands.get_ups()
|
2020-10-21 13:45:45 +02:00
|
|
|
end,
|
|
|
|
set_ups = function(tick)
|
|
|
|
if tick then
|
|
|
|
ServerCommands.set_ups(tick)
|
|
|
|
else
|
|
|
|
error("Remote call parameter to ServerCommands set_ups can't be nil.")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
|
|
|
if not remote.interfaces['ServerCommands'] then
|
|
|
|
remote.add_interface('ServerCommands', SC_Interface)
|
|
|
|
end
|
|
|
|
|
2019-02-20 12:43:29 +02:00
|
|
|
return ServerCommands
|