big refactor, WIP!
This commit is contained in:
@@ -1,36 +1,38 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
params ["_type"]; // string of the object's classname
|
||||
if (!(_type isKindOf "CAManBase")) exitWith {};
|
||||
|
||||
if (
|
||||
(localNamespace getVariable ["milsim_reinsert_fileForReinsertClassesAdded", []])
|
||||
(localNamespace getVariable [QGVAR(fileForReinsertClassesAdded), []])
|
||||
find _type != -1
|
||||
) exitWith {};
|
||||
|
||||
private _fileForReinsertAction = [
|
||||
"milsim_reinsert_fileReinsertRequest",
|
||||
QGVAR(fileReinsertRequestAction),
|
||||
"File Re-insert Request",
|
||||
"\A3\ui_f\data\igui\cfg\simpleTasks\types\takeoff_ca.paa",
|
||||
{ // statement
|
||||
params ["_target", "_player", "_params"];
|
||||
// find nearest base or location
|
||||
private _base = [_player] call milsim_util_fnc_getNearestBase;
|
||||
private _baseName = [_base] call milsim_util_fnc_getNameOfBase;
|
||||
private _base = [_player] call EFUNC(common,getNearestBase);
|
||||
private _baseName = [_base] call EFUNC(common,getNameOfBase);
|
||||
// send event to server
|
||||
["milsim_reinsert_fileReinsertRequest", [_player, _base]] call CBA_fnc_serverEvent;
|
||||
[QGVAR(fileReinsertRequest), [_player, _base]] call CBA_fnc_serverEvent;
|
||||
// notify player their request was filed
|
||||
[["Re-insert Request Filed"], [format["Location: %1", _baseName]]] call CBA_fnc_notify;
|
||||
},
|
||||
{ // condition
|
||||
params ["_target", "_player", "_params"];
|
||||
// find nearest base or location
|
||||
private _base = [_player] call milsim_util_fnc_getNearestBase;
|
||||
private _base = [_player] call EFUNC(common,getNearestBase);
|
||||
private _baseDistance = _player distance _base;
|
||||
|
||||
private _maxRangeToReady = missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_maxRangeToReady", 400];
|
||||
private _existingQueue = missionNamespace getVariable ["milsim_reinsert_reinsertionQueue", []];
|
||||
private _maxRangeToReady = missionNamespace getVariable [QGVAR(setting_maxRangeToReady), 400];
|
||||
private _existingQueue = missionNamespace getVariable [QGVAR(reinsertionQueue), []];
|
||||
|
||||
// check if module is enabled, player is near a base, and player is not already in the queue
|
||||
// (serverTime - milsim_reinsert_missionStartServerTime) > 60*5 && // only allow after 15 minutes
|
||||
// (serverTime - GVAR(missionStartServerTime)) > 60*5 && // only allow after 15 minutes
|
||||
missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_enabled", true] &&
|
||||
(_baseDistance < _maxRangeToReady) &&
|
||||
not (_player in (_existingQueue apply {_x#0}))
|
||||
@@ -39,29 +41,29 @@ private _fileForReinsertAction = [
|
||||
[_type, 1, ["ACE_SelfActions"], _fileForReinsertAction, true] call ace_interact_menu_fnc_addActionToClass;
|
||||
|
||||
private _removeFileForReinsertAction = [
|
||||
"milsim_reinsert_removeReinsertRequest",
|
||||
QGVAR(removeReinsertRequestAction),
|
||||
"Remove Re-insert Request",
|
||||
"\A3\ui_f\data\igui\cfg\simpleTasks\types\land_ca.paa",
|
||||
{ // statement
|
||||
params ["_target", "_player", "_params"];
|
||||
// send event to server
|
||||
["milsim_reinsert_removeReinsertRequest", [_player]] call CBA_fnc_serverEvent;
|
||||
[QGVAR(removeReinsertRequest), [_player]] call CBA_fnc_serverEvent;
|
||||
// notify player their request was rescinded
|
||||
"Re-insert Request Rescinded" call CBA_fnc_notify;
|
||||
},
|
||||
{ // condition
|
||||
params ["_target", "_player", "_params"];
|
||||
private _existingQueue = missionNamespace getVariable ["milsim_reinsert_reinsertionQueue", []];
|
||||
private _existingQueue = missionNamespace getVariable [QGVAR(reinsertionQueue), []];
|
||||
|
||||
// check if module is enabled, player is in the queue
|
||||
// (serverTime - milsim_reinsert_missionStartServerTime) > 60*5 && // only allow after 15 minutes
|
||||
// (serverTime - GVAR(missionStartServerTime)) > 60*5 && // only allow after 15 minutes
|
||||
missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_enabled", true] &&
|
||||
(_player in (_existingQueue apply {_x#0}))
|
||||
}
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
[_type, 1, ["ACE_SelfActions"], _removeFileForReinsertAction, true] call ace_interact_menu_fnc_addActionToClass;
|
||||
|
||||
private _classesActionsAddedTo = (localNamespace getVariable ["milsim_reinsert_fileForReinsertClassesAdded", []]);
|
||||
private _classesActionsAddedTo = (localNamespace getVariable [QGVAR(fileForReinsertClassesAdded), []]);
|
||||
_classesActionsAddedTo pushBackUnique _type;
|
||||
localNamespace setVariable ["milsim_reinsert_fileForReinsertClassesAdded", _classesActionsAddedTo];
|
||||
localNamespace setVariable [QGVAR(fileForReinsertClassesAdded), _classesActionsAddedTo];
|
||||
|
||||
|
||||
@@ -1,28 +1,30 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
params ["_type"]; // string of the object's classname
|
||||
if (!(_type isKindOf "CAManBase")) exitWith {};
|
||||
|
||||
if (
|
||||
(localNamespace getVariable ["milsim_reinsert_checkReinsertQueueClassesAdded", []])
|
||||
(localNamespace getVariable [QGVAR(checkReinsertQueueClassesAdded), []])
|
||||
find _type != -1
|
||||
) exitWith {};
|
||||
|
||||
private _checkReinsertQueueAction = [
|
||||
"milsim_reinsert_checkReinsertQueue",
|
||||
QGVAR(checkReinsertQueue),
|
||||
"[PILOT] Check Re-insert Queue",
|
||||
"\A3\ui_f\data\igui\cfg\simpleTasks\types\land_ca.paa",
|
||||
{
|
||||
params ["_target", "_player", "_params"];
|
||||
// request notification from the server
|
||||
call milsim_reinsert_fnc_requestShowQueue;
|
||||
call FUNC(requestShowQueue);
|
||||
// reset last check time
|
||||
localNamespace setVariable ["milsim_reinsert_lastReinsertQueueCheck", diag_tickTime];
|
||||
localNamespace setVariable [QGVAR(lastReinsertQueueCheck), diag_tickTime];
|
||||
},
|
||||
{
|
||||
missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_enabled", true]
|
||||
missionNamespace getVariable [QGVAR(setting_enabled), true]
|
||||
} // always allow
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
[_type, 1, ["ACE_SelfActions"], _checkReinsertQueueAction, true] call ace_interact_menu_fnc_addActionToClass;
|
||||
|
||||
private _classesActionsAddedTo = (localNamespace getVariable ["milsim_reinsert_checkReinsertQueueClassesAdded", []]);
|
||||
private _classesActionsAddedTo = (localNamespace getVariable [QGVAR(checkReinsertQueueClassesAdded), []]);
|
||||
_classesActionsAddedTo pushBackUnique _type;
|
||||
localNamespace setVariable ["milsim_reinsert_checkReinsertQueueClassesAdded", _classesActionsAddedTo];
|
||||
localNamespace setVariable [QGVAR(checkReinsertQueueClassesAdded), _classesActionsAddedTo];
|
||||
@@ -1,26 +1,28 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
// ACE SELF-INTERACTIONS FOR FILING AND RESCINDING REINSERT REQUESTS NEAR BASE - ALL PLAYERS
|
||||
localNamespace setVariable ["milsim_reinsert_fileForReinsertClassesAdded", []];
|
||||
localNamespace setVariable [QGVAR(fileForReinsertClassesAdded), []];
|
||||
// add actions to current class
|
||||
[typeOf player] call milsim_reinsert_fnc_addAceSelfActions;
|
||||
[typeOf player] call FUNC(addAceSelfActions);
|
||||
// add actions to future classes
|
||||
["ace_interact_menu_newControllableObject", {
|
||||
_this call milsim_reinsert_fnc_addAceSelfActions;
|
||||
_this call FUNC(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_reinsert_checkReinsertQueueClassesAdded", []];
|
||||
localNamespace setVariable ["milsim_reinsert_lastReinsertQueueCheck", diag_tickTime];
|
||||
localNamespace setVariable [QGVAR(checkReinsertQueueClassesAdded), []];
|
||||
localNamespace setVariable [QGVAR(lastReinsertQueueCheck), diag_tickTime];
|
||||
|
||||
// add actions to current class
|
||||
[typeOf player] call milsim_reinsert_fnc_addCheckQueueSelfAction;
|
||||
[typeOf player] call FUNC(addCheckQueueSelfAction);
|
||||
// add actions to future classes
|
||||
["ace_interact_menu_newControllableObject", {
|
||||
_this call milsim_reinsert_fnc_addCheckQueueSelfAction;
|
||||
_this call FUNC(addCheckQueueSelfAction);
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
};
|
||||
/////////////////////////////////////////////////////
|
||||
@@ -31,13 +33,13 @@ 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_reinsert_setting_reinsertion_enabled", true] &&
|
||||
missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_pilotForcedCheckEnabled", true]
|
||||
missionNamespace getVariable [QGVAR(setting_enabled), true] &&
|
||||
missionNamespace getVariable [QGVAR(setting_pilotForcedCheckEnabled), true]
|
||||
)) exitWith {};
|
||||
|
||||
// if last check was less than X minutes ago, skip
|
||||
private _lastCheck = localNamespace getVariable ["milsim_reinsert_lastReinsertQueueCheck", diag_tickTime];
|
||||
private _requiredCheckInterval = missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_pilotForcedCheckInterval", 60*20];
|
||||
private _lastCheck = localNamespace getVariable [QGVAR(lastReinsertQueueCheck), diag_tickTime];
|
||||
private _requiredCheckInterval = missionNamespace getVariable [QGVAR(setting_pilotForcedCheckInterval), 60*20];
|
||||
if (
|
||||
diag_tickTime - _lastCheck <
|
||||
_requiredCheckInterval
|
||||
@@ -45,9 +47,16 @@ if ((typeOf player) in ["B_Helipilot_F", "B_helicrew_F"]) then {
|
||||
|
||||
// last check was greater than X minutes ago
|
||||
// reset last check time
|
||||
localNamespace setVariable ["milsim_reinsert_lastReinsertQueueCheck", diag_tickTime];
|
||||
localNamespace setVariable [QGVAR(lastReinsertQueueCheck), diag_tickTime];
|
||||
// request notification from the server
|
||||
call milsim_reinsert_fnc_requestShowQueue;
|
||||
call FUNC(requestShowQueue);
|
||||
}, 30] call CBA_fnc_addPerFrameHandler;
|
||||
};
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
[
|
||||
LEVEL_DEBUG,
|
||||
QUOTE(COMPONENT),
|
||||
"postInit complete",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
@@ -1,3 +1,5 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
[] remoteExec ["milsim_reinsert_fnc_returnReinsertQueueNotification", 2];
|
||||
[] remoteExec [QFUNC(returnReinsertQueueNotification), 2];
|
||||
83
framework/reinsert/functions/fn_addCBASettings.sqf
Normal file
83
framework/reinsert/functions/fn_addCBASettings.sqf
Normal file
@@ -0,0 +1,83 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
//---------------------
|
||||
// Respawn Settings
|
||||
[
|
||||
QGVAR(setting_enabled), // variable
|
||||
"CHECKBOX", // type
|
||||
["Enabled", "Whether or not players can file for reinsert and pilots can check the reinsert queue"], // title
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||
true, // default value
|
||||
true, // global setting
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
QGVAR(setting_enabled),
|
||||
_value
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
QGVAR(setting_maxRangeToReady), // variable
|
||||
"SLIDER", // type
|
||||
["Max Request Filing Range", "Maximum distance from a respawn point a player can be to ready up"], // title
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||
[0, 1000, 400, 0, false], // [_min, _max, _default, _trailingDecimals, _isPercentage]
|
||||
true, // global setting
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
QGVAR(setting_maxRangeToReady),
|
||||
_value
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
QGVAR(setting_pilotForcedCheckEnabled), // variable
|
||||
"CHECKBOX", // type
|
||||
["Enabled", "Whether or not pilots are forced to view the contents of the reinsertion queue per interval"], // title
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||
false, // default value
|
||||
true, // global setting
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
QGVAR(setting_pilotForcedCheckEnabled),
|
||||
_value
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
QGVAR(setting_pilotForcedCheckInterval), // variable
|
||||
"TIME", // type
|
||||
["Pilot Forced Check Interval", "Pilots will be force shown the queue if they haven't checked it in X seconds"], // title
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||
[60*5, 60*30, 60*10], // [_min, _max, _default]
|
||||
true,
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
QGVAR(setting_pilotForcedCheckInterval),
|
||||
_value
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
QGVAR(setting_maxWait), // variable
|
||||
"TIME", // type
|
||||
["Max Wait Threshold", "How long should at least one person be waiting before prompting a global notification."], // title
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||
[60*5, 60*30, 60*20], // [_min, _max, _default]
|
||||
true,
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
QGVAR(setting_maxWait),
|
||||
_value
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
@@ -1,3 +1,3 @@
|
||||
#define COMPONENT fbcb2_reinsert
|
||||
#define COMPONENT_BEAUTIFIED FBCB2 - Reinsertion
|
||||
#define COMPONENT reinsert
|
||||
#define COMPONENT_BEAUTIFIED Reinsertion
|
||||
#include "../script_mod.hpp"
|
||||
@@ -1,3 +1,5 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
params [
|
||||
["_player", objNull, [objNull]],
|
||||
["_base", objNull, [objNull]],
|
||||
@@ -6,51 +8,54 @@ params [
|
||||
|
||||
if (!isServer) exitWith {
|
||||
[
|
||||
"respawn_reinsertion",
|
||||
LEVEL_ERROR,
|
||||
QUOTE(COMPONENT),
|
||||
"ATTEMPTED RUN ON CLIENT",
|
||||
[
|
||||
["player", _player],
|
||||
["base", _base]
|
||||
]
|
||||
] call milsim_util_fnc_log;
|
||||
] call EFUNC(common,log);
|
||||
["ATTEMPTED RUN ON CLIENT"] call BIS_fnc_error;
|
||||
};
|
||||
if (
|
||||
isNull _player ||
|
||||
isNull _base
|
||||
) exitWith {
|
||||
[
|
||||
"respawn_reinsertion",
|
||||
LEVEL_ERROR,
|
||||
QUOTE(COMPONENT),
|
||||
"NULL PARAMETERS",
|
||||
[
|
||||
["player", _player],
|
||||
["base", _base]
|
||||
]
|
||||
] call milsim_util_fnc_log;
|
||||
] call EFUNC(common,log);
|
||||
["NULL PARAMETERS"] call BIS_fnc_error;
|
||||
};
|
||||
|
||||
|
||||
private _maxRangeToReady = missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_maxRangeToReady", 400];
|
||||
private _maxRangeToReady = missionNamespace getVariable [QGVAR(setting_maxRangeToReady), 400];
|
||||
// nearest base here is the same as the base sent
|
||||
private _nearestBase = _base;
|
||||
|
||||
milsim_reinsert_reinsertionQueue pushBackUnique [
|
||||
GVAR(reinsertionQueue) pushBackUnique [
|
||||
_player, _base, _timeFiled
|
||||
];
|
||||
// broadcast new list to all machines
|
||||
publicVariable "milsim_reinsert_reinsertionQueue";
|
||||
publicVariable QGVAR(reinsertionQueue);
|
||||
|
||||
// log to rpt
|
||||
private _logParams = [
|
||||
["filedAtBase", [_base] call milsim_util_fnc_getNameOfBase],
|
||||
["filedAtBaseDistance", _player distance _base],
|
||||
["closestBase", [_nearestBase] call milsim_util_fnc_getNameOfBase],
|
||||
["closestBaseDistance", _player distance _nearestBase],
|
||||
["maxDistanceSetting", _maxRangeToReady],
|
||||
["inQueueDuration", diag_tickTime - _timeFiled]
|
||||
];
|
||||
_logParams = [_player, _logParams] call milsim_util_fnc_addPlayerInfoToArray;
|
||||
[
|
||||
"respawn_reinsertion",
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"PLAYER FILED REQUEST",
|
||||
_logParams
|
||||
] call milsim_util_fnc_log;
|
||||
[_player, [
|
||||
["filedAtBase", [_base] call EFUNC(common,getNameOfBase)],
|
||||
["filedAtBaseDistance", _player distance _base],
|
||||
["closestBase", [_nearestBase] call EFUNC(common,getNameOfBase)],
|
||||
["closestBaseDistance", _player distance _nearestBase],
|
||||
["maxDistanceSetting", _maxRangeToReady],
|
||||
["inQueueDuration", diag_tickTime - _timeFiled]
|
||||
]] call EFUNC(common,addPlayerInfoToArray)
|
||||
] call EFUNC(common,log);
|
||||
@@ -1,8 +1,10 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
// if at least 1 player in the queue has been waiting longer than the configured timeout, notify all players
|
||||
private _timeout = missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_max_wait", 60*20]; // default 20 minutes
|
||||
private _timeoutPlayers = milsim_reinsert_reinsertionQueue select {
|
||||
private _timeout = missionNamespace getVariable [QGVAR(setting_maxWait), 60*20]; // default 20 minutes
|
||||
private _timeoutPlayers = GVAR(reinsertionQueue) select {
|
||||
_x params ["_player", "_base", "_timeFiled"];
|
||||
alive (_player) &&
|
||||
(diag_tickTime - (_timeFiled)) > _timeout
|
||||
@@ -10,10 +12,10 @@ private _timeoutPlayers = milsim_reinsert_reinsertionQueue select {
|
||||
if (count _timeoutPlayers > 0) then {
|
||||
// GLOBAL CBA NOTIFY
|
||||
private _playerLines = [["Players are still waiting for Re-insert!", 1.2, [1, 0.64, 0, 1]]];
|
||||
private _maxRangeToReady = missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_maxRangeToReady", 400];
|
||||
private _maxRangeToReady = missionNamespace getVariable [QGVAR(setting_maxRangeToReady), 400];
|
||||
|
||||
// get base objects from queue
|
||||
private _basesWithPeople = (missionNamespace getVariable ["milsim_reinsert_reinsertionQueue", []]) apply {_x#1};
|
||||
private _basesWithPeople = (missionNamespace getVariable [QGVAR(reinsertionQueue), []]) apply {_x#1};
|
||||
// get unique base objects
|
||||
private _basesWithPeople = _basesWithPeople arrayIntersect _basesWithPeople;
|
||||
|
||||
@@ -21,7 +23,7 @@ if (count _timeoutPlayers > 0) then {
|
||||
private _thisBase = _x;
|
||||
|
||||
// Add line for base name
|
||||
_playerLines pushBack ([[_thisBase] call milsim_util_fnc_getNameOfBase, 1, [0,1,0,1]]);
|
||||
_playerLines pushBack ([[_thisBase] call EFUNC(common,getNameOfBase), 1, [0,1,0,1]]);
|
||||
|
||||
// Get players under this base
|
||||
private _thisBasePlayers = _timeoutPlayers select {_x#1 isEqualTo _thisBase};
|
||||
@@ -35,7 +37,7 @@ if (count _timeoutPlayers > 0) then {
|
||||
{ // for each player under this base, add a line
|
||||
_x params ["_player", "_base", "_timeFiled"];
|
||||
// get the closest base to the player
|
||||
private _nearestBase = [_player] call milsim_util_fnc_getNearestBase;
|
||||
private _nearestBase = [_player] call EFUNC(common,getNearestBase);
|
||||
|
||||
// add player to array of players under bases
|
||||
_playerLines pushBack ([format [
|
||||
@@ -46,25 +48,24 @@ if (count _timeoutPlayers > 0) then {
|
||||
], 0.8, [0.8, 0.8, 0.8, 1]]);
|
||||
|
||||
// log to rpt
|
||||
private _logParams = [
|
||||
["filedAtBase", [_base] call milsim_util_fnc_getNameOfBase],
|
||||
["filedAtBaseDistance", _player distance _base],
|
||||
["closestBase", [_nearestBase] call milsim_util_fnc_getNameOfBase],
|
||||
["closestBaseDistance", _player distance _nearestBase],
|
||||
["maxDistanceSetting", _maxRangeToReady],
|
||||
["inQueueDuration", diag_tickTime - _timeFiled]
|
||||
];
|
||||
_logParams = [_player, _logParams] call milsim_util_fnc_addPlayerInfoToArray;
|
||||
[
|
||||
"respawn_reinsertion",
|
||||
LEVEL_WARNING,
|
||||
QUOTE(COMPONENT),
|
||||
"PLAYER WAITING OVER TIMEOUT",
|
||||
_logParams
|
||||
] call milsim_util_fnc_log;
|
||||
[_player, [
|
||||
["filedAtBase", [_base] call EFUNC(common,getNameOfBase)],
|
||||
["filedAtBaseDistance", _player distance _base],
|
||||
["closestBase", [_nearestBase] call EFUNC(common,getNameOfBase)],
|
||||
["closestBaseDistance", _player distance _nearestBase],
|
||||
["maxDistanceSetting", _maxRangeToReady],
|
||||
["inQueueDuration", diag_tickTime - _timeFiled]
|
||||
]] call EFUNC(common,addPlayerInfoToArray)
|
||||
] call EFUNC(common,log);
|
||||
} forEach _thisBasePlayers;
|
||||
} forEach _basesWithPeople;
|
||||
|
||||
// SEND NOTIFY
|
||||
_playerLines remoteExec ["CBA_fnc_notify", [0, -2] select isDedicated];
|
||||
// RESET NOTIFICATION TIMER
|
||||
milsim_reinsert_reinsertionOverTimeoutLastNotificationTime = diag_tickTime;
|
||||
GVAR(overTimeoutLastNotificationTime) = diag_tickTime;
|
||||
};
|
||||
@@ -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);
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
params [["_player", objNull, [objNull]]];
|
||||
|
||||
if (!isServer) exitWith {
|
||||
@@ -20,16 +22,16 @@ if (isNull _player) exitWith {
|
||||
};
|
||||
|
||||
// get entries for this player from queue
|
||||
private _unitArrs = milsim_reinsert_reinsertionQueue select {_x#0 isEqualTo _player};
|
||||
private _unitArrs = GVAR(reinsertionQueue) select {_x#0 isEqualTo _player};
|
||||
// if player not in queue, skip
|
||||
if (count _unitArrs isEqualTo 0) exitWith {};
|
||||
|
||||
private _maxRangeToReady = missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_maxRangeToReady", 400];
|
||||
private _maxRangeToReady = missionNamespace getVariable [QGVAR(setting_maxRangeToReady), 400];
|
||||
|
||||
// remove player from queue
|
||||
milsim_reinsert_reinsertionQueue = milsim_reinsert_reinsertionQueue - _unitArrs;
|
||||
GVAR(reinsertionQueue) = GVAR(reinsertionQueue) - _unitArrs;
|
||||
// broadcast new list to all machines
|
||||
publicVariable "milsim_reinsert_reinsertionQueue";
|
||||
publicVariable QGVAR(reinsertionQueue);
|
||||
|
||||
// sort _unitArrs by time in queue, descending, to get longest wait (if for some reason there's a duplicate)
|
||||
[_unitArrs, [], {
|
||||
@@ -39,17 +41,17 @@ publicVariable "milsim_reinsert_reinsertionQueue";
|
||||
// get first entry (longest wait)
|
||||
(_unitArrs#0) params ["_player", "_base", "_timeFiled"]; // _unitArr = [unit, base, timeInQueue]
|
||||
// get the closest base to the player
|
||||
private _nearestBase = [_player] call milsim_util_fnc_getNearestBase;
|
||||
private _nearestBase = [_player] call EFUNC(common,getNearestBase);
|
||||
// log to rpt
|
||||
private _logParams = [
|
||||
["filedAtBase", [_base] call milsim_util_fnc_getNameOfBase],
|
||||
["filedAtBase", [_base] call EFUNC(common,getNameOfBase)],
|
||||
["filedAtBaseDistance", _player distance _base],
|
||||
["closestBase", [_nearestBase] call milsim_util_fnc_getNameOfBase],
|
||||
["closestBase", [_nearestBase] call EFUNC(common,getNameOfBase)],
|
||||
["closestBaseDistance", _player distance _nearestBase],
|
||||
["maxDistanceSetting", _maxRangeToReady],
|
||||
["inQueueDuration", diag_tickTime - _timeFiled]
|
||||
];
|
||||
_logParams = [_player, _logParams] call milsim_util_fnc_addPlayerInfoToArray;
|
||||
_logParams = [_player, _logParams] call EFUNC(common,addPlayerInfoToArray);
|
||||
[
|
||||
"respawn_reinsertion",
|
||||
"PLAYER RESCINDED REQUEST",
|
||||
|
||||
@@ -25,16 +25,16 @@ if (isNull _userObject) exitWith {
|
||||
};
|
||||
|
||||
// log to rpt
|
||||
private _logParams = [_userObject, []] call milsim_util_fnc_addPlayerInfoToArray;
|
||||
private _logParams = [_userObject, []] call EFUNC(common,addPlayerInfoToArray);
|
||||
[
|
||||
"respawn_reinsertion",
|
||||
"SHOW QUEUE REQUESTED",
|
||||
_logParams
|
||||
] call milsim_util_fnc_log;
|
||||
|
||||
private _queue = missionNamespace getVariable ["milsim_reinsert_reinsertionQueue", []];
|
||||
private _queue = missionNamespace getVariable [QGVAR(reinsertionQueue), []];
|
||||
// get base objects from queue
|
||||
private _basesWithPeople = (missionNamespace getVariable ["milsim_reinsert_reinsertionQueue", []]) apply {_x#1};
|
||||
private _basesWithPeople = (missionNamespace getVariable [QGVAR(reinsertionQueue), []]) apply {_x#1};
|
||||
// get unique base objects
|
||||
private _basesWithPeople = _basesWithPeople arrayIntersect _basesWithPeople;
|
||||
|
||||
@@ -48,7 +48,7 @@ if (count _basesWithPeople isEqualTo 0) then {
|
||||
// forEach _basesWithPeople
|
||||
{
|
||||
private _thisBase = _x;
|
||||
private _baseName = [_thisBase] call milsim_util_fnc_getNameOfBase;
|
||||
private _baseName = [_thisBase] call EFUNC(common,getNameOfBase);
|
||||
|
||||
// generate player lines for this base
|
||||
private _playerLines = _queue select {
|
||||
|
||||
@@ -1,32 +1,35 @@
|
||||
// revalidate any players in the queue
|
||||
// compare their distance to the nearest base, and remove them if they're too far away (or dead)
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
private _stillValid = [];
|
||||
private _maxRangeToReady = missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_maxRangeToReady", 400];
|
||||
private _maxRangeToReady = missionNamespace getVariable [QGVAR(setting_maxRangeToReady), 400];
|
||||
{
|
||||
_x params ["_player", "_base", "_timeFiled"]; // _unitArr = [unit, baseName, timeInQueue]
|
||||
|
||||
private _distanceToOriginalBase = _player distance _base;
|
||||
// get the closest base to the player
|
||||
private _nearestBase = [_player] call milsim_util_fnc_getNearestBase;
|
||||
private _nearestBase = [_player] call EFUNC(common,getNearestBase);
|
||||
private _isCloseEnoughToAnyBase = (_player distance _nearestBase) < _maxRangeToReady;
|
||||
|
||||
if (not _isCloseEnoughToAnyBase || not (alive _player)) then {
|
||||
// don't include player in updated queue
|
||||
// log to rpt
|
||||
private _logParams = [
|
||||
["filedAtBase", [_base] call milsim_util_fnc_getNameOfBase],
|
||||
["filedAtBaseDistance", _player distance _base],
|
||||
["closestBase", [_nearestBase] call milsim_util_fnc_getNameOfBase],
|
||||
["closestBaseDistance", _player distance _nearestBase],
|
||||
["maxDistanceSetting", _maxRangeToReady],
|
||||
["inQueueDuration", diag_tickTime - _timeFiled]
|
||||
];
|
||||
_logParams = [_player, _logParams] call milsim_util_fnc_addPlayerInfoToArray;
|
||||
private _logParams = ;
|
||||
_logParams = ;
|
||||
[
|
||||
"respawn_reinsertion",
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"PLAYER DEQUEUED AUTOMATICALLY",
|
||||
_logParams
|
||||
] call milsim_util_fnc_log;
|
||||
[_player, [
|
||||
["filedAtBase", [_base] call EFUNC(common,getNameOfBase)],
|
||||
["filedAtBaseDistance", _player distance _base],
|
||||
["closestBase", [_nearestBase] call EFUNC(common,getNameOfBase)],
|
||||
["closestBaseDistance", _player distance _nearestBase],
|
||||
["maxDistanceSetting", _maxRangeToReady],
|
||||
["inQueueDuration", diag_tickTime - _timeFiled]
|
||||
]] call EFUNC(common,addPlayerInfoToArray)
|
||||
] call EFUNC(common,log);
|
||||
// continue loop
|
||||
continue
|
||||
};
|
||||
@@ -36,22 +39,22 @@ private _maxRangeToReady = missionNamespace getVariable ["milsim_reinsert_settin
|
||||
// if player's base has changed, log to rpt
|
||||
if (_base != _nearestBase) then {
|
||||
private _logParams = [
|
||||
["filedAtBase", [_base] call milsim_util_fnc_getNameOfBase],
|
||||
["filedAtBase", [_base] call EFUNC(common,getNameOfBase)],
|
||||
["filedAtBaseDistance", _player distance _base],
|
||||
["closestBase", [_nearestBase] call milsim_util_fnc_getNameOfBase],
|
||||
["closestBase", [_nearestBase] call EFUNC(common,getNameOfBase)],
|
||||
["closestBaseDistance", _player distance _nearestBase],
|
||||
["maxDistanceSetting", _maxRangeToReady],
|
||||
["inQueueDuration", diag_tickTime - _timeFiled]
|
||||
];
|
||||
_logParams = [_player, _logParams] call milsim_util_fnc_addPlayerInfoToArray;
|
||||
_logParams = [_player, _logParams] call EFUNC(common,addPlayerInfoToArray);
|
||||
[
|
||||
"respawn_reinsertion",
|
||||
"PLAYER BASE WAS UPDATED",
|
||||
_logParams
|
||||
] call milsim_util_fnc_log;
|
||||
};
|
||||
} forEach milsim_reinsert_reinsertionQueue;
|
||||
} forEach GVAR(reinsertionQueue);
|
||||
|
||||
// broadcast new list to all machines
|
||||
milsim_reinsert_reinsertionQueue = _stillValid;
|
||||
publicVariable "milsim_reinsert_reinsertionQueue";
|
||||
GVAR(reinsertionQueue) = _stillValid;
|
||||
publicVariable QGVAR(reinsertionQueue);
|
||||
Reference in New Issue
Block a user