Files
MissionTemplate/framework/reinsert/server/fn_initServer.sqf
2024-02-06 01:52:25 -08:00

54 lines
1.4 KiB
Plaintext

// if a player files for reinsert using self-interaction
// they're added to the queue along with their nearest base location and the time they filed
// if a player's time in the queue exceeds the configured timeout, a message will be posted every 5 minutes on a cycle based around
// the player's time in the queue stating how long they have been waiting, their name, and their group's name
#include "..\script_component.hpp"
if (!isServer) exitWith {};
// register queue
GVAR(reinsertionQueue) = [];
publicVariable QGVAR(reinsertionQueue);
// server mission start time
GVAR(missionStartServerTime) = serverTime;
// FILE REQUEST CBA HANDLER
[QGVAR(fileReinsertRequest), {
params ["_player", "_base"];
[_player, _base] call FUNC(addToQueue);
}] call CBA_fnc_addEventHandler;
// REMOVE REQUEST CBA HANDLER
[QGVAR(removeReinsertRequest), {
params ["_player"];
[_player] call FUNC(removeFromQueue);
}] call CBA_fnc_addEventHandler;
// automated wait threshold timer
GVAR(overTimeoutLastNotificationTime) = 0;
[{ // every 60 seconds
// validate queue
call FUNC(validateQueue);
// check if last overTimeout notification was sent more than X minutes ago
if (
diag_tickTime - GVAR(overTimeoutLastNotificationTime) > 60*5
) then {
// show global queue notification with any players that are over timeout
call FUNC(globalShowQueue);
};
}, 60] call CBA_fnc_addPerFrameHandler;
[
LEVEL_DEBUG,
QUOTE(COMPONENT),
"postInit complete",
[]
] call EFUNC(common,log);