big refactor to isolate functionality. adds milsim_fnc_log.

This commit is contained in:
2024-01-30 15:05:02 -08:00
parent f52011cbc4
commit 9ec51a5e19
20 changed files with 714 additions and 375 deletions

View File

@@ -0,0 +1,50 @@
// 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
if (!isServer) exitWith {};
// array of all respawn modules in the mission, used as 'base' locations for reinsertion
milsim_respawn_bases = allMissionObjects "ModuleRespawnPosition_F";
publicVariable "milsim_respawn_bases";
// register queue
milsim_respawn_reinsertionQueue = [];
publicVariable "milsim_respawn_reinsertionQueue";
// server mission start time
milsim_respawn_missionStartServerTime = serverTime;
// FILE REQUEST CBA HANDLER
["milsim_respawn_fileReinsertRequest", {
params ["_player", "_base"];
[_player, _base] call milsim_respawn_fnc_addToQueue;
}] call CBA_fnc_addEventHandler;
// REMOVE REQUEST CBA HANDLER
["milsim_respawn_removeReinsertRequest", {
params ["_player"];
[_player] call milsim_respawn_fnc_removeFromQueue;
}] call CBA_fnc_addEventHandler;
// automated wait threshold timer
milsim_respawn_reinsertionOverTimeoutLastNotificationTime = 0;
[{ // every 60 seconds
// validate queue
call milsim_respawn_fnc_validateQueue;
// check if last overTimeout notification was sent more than X minutes ago
if (
diag_tickTime - milsim_respawn_reinsertionOverTimeoutLastNotificationTime > 60*5
) then {
// show global queue notification with any players that are over timeout
call milsim_respawn_fnc_globalShowQueue;
};
}, 60] call CBA_fnc_addPerFrameHandler;