big refactor, WIP!
This commit is contained in:
@@ -3,48 +3,51 @@
|
||||
// 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 {};
|
||||
|
||||
// array of all respawn modules in the mission, used as 'base' locations for reinsertion
|
||||
milsim_baseObjects = allMissionObjects "ModuleRespawnPosition_F";
|
||||
publicVariable "milsim_baseObjects";
|
||||
|
||||
// register queue
|
||||
milsim_reinsert_reinsertionQueue = [];
|
||||
publicVariable "milsim_reinsert_reinsertionQueue";
|
||||
|
||||
GVAR(reinsertionQueue) = [];
|
||||
publicVariable QGVAR(reinsertionQueue);
|
||||
|
||||
// server mission start time
|
||||
milsim_reinsert_missionStartServerTime = serverTime;
|
||||
GVAR(missionStartServerTime) = serverTime;
|
||||
|
||||
// FILE REQUEST CBA HANDLER
|
||||
["milsim_reinsert_fileReinsertRequest", {
|
||||
[QGVAR(fileReinsertRequest), {
|
||||
params ["_player", "_base"];
|
||||
[_player, _base] call milsim_reinsert_fnc_addToQueue;
|
||||
[_player, _base] call FUNC(addToQueue);
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
// REMOVE REQUEST CBA HANDLER
|
||||
["milsim_reinsert_removeReinsertRequest", {
|
||||
[QGVAR(removeReinsertRequest), {
|
||||
params ["_player"];
|
||||
[_player] call milsim_reinsert_fnc_removeFromQueue;
|
||||
[_player] call FUNC(removeFromQueue);
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
|
||||
// automated wait threshold timer
|
||||
milsim_reinsert_reinsertionOverTimeoutLastNotificationTime = 0;
|
||||
GVAR(overTimeoutLastNotificationTime) = 0;
|
||||
|
||||
[{ // every 60 seconds
|
||||
|
||||
// validate queue
|
||||
call milsim_reinsert_fnc_validateQueue;
|
||||
call FUNC(validateQueue);
|
||||
|
||||
// check if last overTimeout notification was sent more than X minutes ago
|
||||
if (
|
||||
diag_tickTime - milsim_reinsert_reinsertionOverTimeoutLastNotificationTime > 60*5
|
||||
diag_tickTime - GVAR(overTimeoutLastNotificationTime) > 60*5
|
||||
) then {
|
||||
// show global queue notification with any players that are over timeout
|
||||
call milsim_reinsert_fnc_globalShowQueue;
|
||||
call FUNC(globalShowQueue);
|
||||
};
|
||||
|
||||
}, 60] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
[
|
||||
LEVEL_DEBUG,
|
||||
QUOTE(COMPONENT),
|
||||
"postInit complete",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
|
||||
Reference in New Issue
Block a user