feature/reinsert-queue #9
@@ -61,7 +61,6 @@ if (isServer) then {
|
||||
private _stillValid = [];
|
||||
{
|
||||
_x params ["_player", "_baseName", "_timeFiled"]; // _unitArr = [unit, baseName, timeInQueue]
|
||||
private _nearBase = false;
|
||||
private _nearestDistance = 99999;
|
||||
{
|
||||
private _baseLocation = _x;
|
||||
@@ -69,18 +68,17 @@ if (isServer) then {
|
||||
if (_distanceFromBase < _nearestDistance) then {
|
||||
_nearestDistance = _distanceFromBase;
|
||||
};
|
||||
if (_distanceFromBase < milsim_respawn_setting_reinsertion_maxRangeToReady) then {
|
||||
_nearBase = true;
|
||||
};
|
||||
} forEach milsim_respawn_bases;
|
||||
|
||||
private _nearBase = _nearestDistance < milsim_respawn_setting_reinsertion_maxRangeToReady;
|
||||
|
||||
if (_nearBase && alive _player) then {
|
||||
_stillValid pushBackUnique _queueData;
|
||||
_stillValid pushBackUnique _x;
|
||||
} else {
|
||||
diag_log text format [
|
||||
"[milsim] (respawn_reinsertion) REMOVED AUTOMATICALLY name=%1 playerUID=%2 filedAtBase=%3 nearestBaseDistance=%4m inQueue=%5s",
|
||||
name _unit,
|
||||
getPlayerUID _unit,
|
||||
name _player,
|
||||
getPlayerUID _player,
|
||||
_baseName,
|
||||
_nearestDistance,
|
||||
diag_tickTime - _timeFiled
|
||||
@@ -96,7 +94,7 @@ if (isServer) then {
|
||||
// if at least 1 player in the queue has been waiting longer than the configured timeout,
|
||||
// show a notification to all players if the last notification was more than 5 minutes ago
|
||||
private _needNotification =
|
||||
diag_tickTime - milsim_respawn_reinsertionOverTimeoutLastNotificationTime > 60*5 // if last notification was more than 5 minutes ago
|
||||
diag_tickTime - milsim_respawn_reinsertionOverTimeoutLastNotificationTime > 60*5; // if last notification was more than 5 minutes ago
|
||||
if (_needNotification) then {
|
||||
private _timeout = missionNamespace getVariable ["milsim_respawn_setting_reinsertion_timeout", 60*20]; // default 20 minutes
|
||||
private _timeoutPlayers = milsim_respawn_reinsertionQueue select {alive (_x#0) && (diag_tickTime - (_x#2)) > _timeout};
|
||||
@@ -160,7 +158,8 @@ if (hasInterface) then {
|
||||
{
|
||||
params ["_target", "_player", "_params"];
|
||||
private _closestBase = [milsim_respawn_bases, _player] call BIS_fnc_nearestPosition;
|
||||
private _closestBaseName = _closestBase getVariable ["name", "unknown"];
|
||||
private _closestBaseName = _closestBase getVariable ["name", ""];
|
||||
if (_closestBaseName == "") then {_closestBaseName = format["near %1", text (nearestLocation [_closestBase, ""])]};
|
||||
["milsim_respawn_fileReinsertRequest", [_player, _closestBaseName, diag_tickTime]] call CBA_fnc_serverEvent;
|
||||
[["Re-insert Request Filed"], [format["Pickup at %1", _closestBaseName]]] call CBA_fnc_notify;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user