big refactor to isolate functionality. adds milsim_fnc_log.
This commit is contained in:
53
functions/reinsert/client/fn_initClient.sqf
Normal file
53
functions/reinsert/client/fn_initClient.sqf
Normal file
@@ -0,0 +1,53 @@
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
// ACE SELF-INTERACTIONS FOR FILING AND RESCINDING REINSERT REQUESTS NEAR BASE - ALL PLAYERS
|
||||
localNamespace setVariable ["milsim_respawn_fileForReinsertClassesAdded", []];
|
||||
// add actions to current class
|
||||
[typeOf player] call milsim_respawn_fnc_addAceSelfActions;
|
||||
// add actions to future classes
|
||||
["ace_interact_menu_newControllableObject", {
|
||||
_this call milsim_respawn_fnc_addAceSelfActions;
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
// PILOTS ONLY
|
||||
// ACE SELF-INTERACTIONS FOR CHECKING REINSERT QUEUE - ONLY FOR PILOTS
|
||||
if ((typeOf player) in ["B_Helipilot_F", "B_helicrew_F"]) then {
|
||||
localNamespace setVariable ["milsim_respawn_checkReinsertQueueClassesAdded", []];
|
||||
localNamespace setVariable ["milsim_respawn_lastReinsertQueueCheck", diag_tickTime];
|
||||
|
||||
// add actions to current class
|
||||
[typeOf player] call milsim_respawn_fnc_addCheckQueueSelfAction;
|
||||
// add actions to future classes
|
||||
["ace_interact_menu_newControllableObject", {
|
||||
_this call milsim_respawn_fnc_addCheckQueueSelfAction;
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
};
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// ADD TIMER FOR PILOTS - IF REINSERT LIST NOT CHECKED FOR 20 MINUTES, SHOW NOTIFICATION AUTOMATICALLY
|
||||
if ((typeOf player) in ["B_Helipilot_F", "B_helicrew_F"]) then {
|
||||
[{
|
||||
// if module not enabled and pilot forced check not enabled, exit
|
||||
if (not (
|
||||
missionNamespace getVariable ["milsim_respawn_setting_reinsertion_enabled", true] &&
|
||||
missionNamespace getVariable ["milsim_respawn_setting_reinsertion_pilotForcedCheckEnabled", true]
|
||||
)) exitWith {};
|
||||
|
||||
// if last check was less than X minutes ago, skip
|
||||
private _lastCheck = localNamespace getVariable ["milsim_respawn_lastReinsertQueueCheck", diag_tickTime];
|
||||
private _requiredCheckInterval = missionNamespace getVariable ["milsim_respawn_setting_reinsertion_pilotForcedCheckInterval", 60*20];
|
||||
if (
|
||||
diag_tickTime - _lastCheck <
|
||||
_requiredCheckInterval
|
||||
) exitWith {}; // if last check was less than X minutes ago, skip
|
||||
|
||||
// last check was greater than X minutes ago
|
||||
// reset last check time
|
||||
localNamespace setVariable ["milsim_respawn_lastReinsertQueueCheck", diag_tickTime];
|
||||
// request notification from the server
|
||||
call milsim_respawn_fnc_requestShowQueue;
|
||||
}, 30] call CBA_fnc_addPerFrameHandler;
|
||||
};
|
||||
/////////////////////////////////////////////////////
|
||||
Reference in New Issue
Block a user