2020-09-14 22:14:15 +02:00
|
|
|
local Poll = {send_poll_result_to_discord = function() end}
|
2019-01-30 05:52:43 +02:00
|
|
|
local Rank = require 'features.rank_system'
|
2018-11-28 00:12:00 +02:00
|
|
|
local Token = require 'utils.token'
|
2018-11-27 14:32:33 +02:00
|
|
|
local Server = require 'features.server'
|
2019-01-30 05:52:43 +02:00
|
|
|
local Donator = require 'features.donator'
|
2018-09-21 20:48:12 +02:00
|
|
|
|
2024-10-22 21:22:35 +02:00
|
|
|
if storage.config.poll.enabled then
|
2020-09-14 22:14:15 +02:00
|
|
|
local Event = require 'utils.event'
|
|
|
|
|
|
|
|
local function set_poll()
|
|
|
|
-- Hack to prevent poll being required before control.lua finishes.
|
|
|
|
-- This is so that the top gui buttons are in the order they are
|
|
|
|
-- required in control.lua.
|
2020-10-04 22:19:05 +02:00
|
|
|
Poll = _G.package.loaded['features.gui.poll'] or Poll
|
2020-09-14 22:14:15 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
Event.on_init(set_poll)
|
|
|
|
Event.on_load(set_poll)
|
|
|
|
end
|
|
|
|
|
2018-11-26 18:07:24 +02:00
|
|
|
--- 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 = {}
|
2018-09-21 20:48:12 +02:00
|
|
|
|
2018-11-26 18:07:24 +02:00
|
|
|
ServerCommands.get_poll_result = Poll.send_poll_result_to_discord
|
2018-09-21 20:48:12 +02:00
|
|
|
|
2019-01-30 05:52:43 +02:00
|
|
|
ServerCommands.regular_sync = Rank.sync_ranks
|
|
|
|
ServerCommands.donator_sync = Donator.sync_donators
|
2018-10-02 01:10:53 +02:00
|
|
|
|
2018-11-26 18:07:24 +02:00
|
|
|
function ServerCommands.raise_callback(func_token, data)
|
2018-11-19 22:13:45 +02:00
|
|
|
local func = Token.get(func_token)
|
|
|
|
func(data)
|
|
|
|
end
|
|
|
|
|
2018-11-26 18:07:24 +02:00
|
|
|
ServerCommands.raise_data_set = Server.raise_data_set
|
|
|
|
ServerCommands.get_tracked_data_sets = Server.get_tracked_data_sets
|
2018-11-24 16:15:14 +02:00
|
|
|
|
2018-11-26 18:07:24 +02:00
|
|
|
function ServerCommands.server_started()
|
2018-11-24 16:15:14 +02:00
|
|
|
script.raise_event(Server.events.on_server_started, {})
|
|
|
|
end
|
|
|
|
|
2018-11-30 02:18:43 +02:00
|
|
|
ServerCommands.set_time = Server.set_time
|
2020-12-30 22:19:22 +02:00
|
|
|
ServerCommands.set_start_data = Server.set_start_data
|
2018-12-01 12:49:14 +02:00
|
|
|
ServerCommands.query_online_players = Server.query_online_players
|
2018-11-30 02:18:43 +02:00
|
|
|
|
2018-11-26 18:07:24 +02:00
|
|
|
return ServerCommands
|