From 1ac1664faf4bc0261d5e38cd56f1683937285e7a Mon Sep 17 00:00:00 2001 From: IndigoFox Date: Sun, 28 Jan 2024 13:46:56 -0800 Subject: [PATCH] bug fixes --- functions/respawn/fn_init.sqf | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/functions/respawn/fn_init.sqf b/functions/respawn/fn_init.sqf index 59aec70..762dca0 100644 --- a/functions/respawn/fn_init.sqf +++ b/functions/respawn/fn_init.sqf @@ -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; },