57 lines
2.2 KiB
Plaintext
57 lines
2.2 KiB
Plaintext
// revalidate any players in the queue
|
|
// compare their distance to the nearest base, and remove them if they're too far away (or dead)
|
|
private _stillValid = [];
|
|
private _maxRangeToReady = missionNamespace getVariable ["milsim_respawn_setting_reinsertion_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_respawn_fnc_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_respawn_fnc_getBaseName],
|
|
["filedAtBaseDistance", _player distance _base],
|
|
["closestBase", [_nearestBase] call milsim_respawn_fnc_getBaseName],
|
|
["closestBaseDistance", _player distance _nearestBase],
|
|
["maxDistanceSetting", _maxRangeToReady],
|
|
["inQueueDuration", diag_tickTime - _timeFiled]
|
|
];
|
|
_logParams = [_player, _logParams] call milsim_fnc_addPlayerInfoToArray;
|
|
[
|
|
"respawn_reinsertion",
|
|
"PLAYER DEQUEUED AUTOMATICALLY",
|
|
_logParams
|
|
] call milsim_fnc_log;
|
|
// continue loop
|
|
continue
|
|
};
|
|
|
|
// include player in updated queue, and update their location to nearest base
|
|
_stillValid pushBackUnique [_player, _nearestBase, _timeFiled];
|
|
// if player's base has changed, log to rpt
|
|
if (_base != _nearestBase) then {
|
|
private _logParams = [
|
|
["filedAtBase", [_base] call milsim_respawn_fnc_getBaseName],
|
|
["filedAtBaseDistance", _player distance _base],
|
|
["closestBase", [_nearestBase] call milsim_respawn_fnc_getBaseName],
|
|
["closestBaseDistance", _player distance _nearestBase],
|
|
["maxDistanceSetting", _maxRangeToReady],
|
|
["inQueueDuration", diag_tickTime - _timeFiled]
|
|
];
|
|
_logParams = [_player, _logParams] call milsim_fnc_addPlayerInfoToArray;
|
|
[
|
|
"respawn_reinsertion",
|
|
"PLAYER BASE WAS UPDATED",
|
|
_logParams
|
|
] call milsim_fnc_log;
|
|
};
|
|
} forEach milsim_respawn_reinsertionQueue;
|
|
|
|
// broadcast new list to all machines
|
|
milsim_respawn_reinsertionQueue = _stillValid;
|
|
publicVariable "milsim_respawn_reinsertionQueue"; |