From 62b9678dc30bf8edb803dbdd5ad87708cf5a3930 Mon Sep 17 00:00:00 2001 From: IndigoFox Date: Sun, 28 Jan 2024 22:35:03 -0800 Subject: [PATCH] fixes reinsertion formatting and includes groups in diaglog --- functions/respawn/fn_init.sqf | 35 +++++++++++-------- .../fn_showReinsertQueueNotification.sqf | 18 +++++++++- 2 files changed, 38 insertions(+), 15 deletions(-) diff --git a/functions/respawn/fn_init.sqf b/functions/respawn/fn_init.sqf index 762dca0..3cb4625 100644 --- a/functions/respawn/fn_init.sqf +++ b/functions/respawn/fn_init.sqf @@ -25,9 +25,10 @@ if (isServer) then { params ["_unit", "_closestBaseName", "_time"]; milsim_respawn_reinsertionQueue pushBackUnique [_unit, _closestBaseName, _time]; diag_log text format [ - "[milsim] (respawn_reinsertion) ADDED name=%1 playerUID=%2 filedAtBase=%3", + "[milsim] (respawn_reinsertion) ADDED name=%1 playerUID=%2 group=%3 filedAtBase=%4", name _unit, - getPlayerUID _unit, + getPlayerUID _unit + groupId (group _unit), _closestBaseName ]; publicVariable "milsim_respawn_reinsertionQueue"; @@ -44,9 +45,10 @@ if (isServer) then { }, "DESCEND"] call BIS_fnc_sortBy; (_unitArrs#0) params ["_unit", "_baseName", "_timeFiled"]; // _unitArr = [unit, baseName, timeInQueue] private _timeInQueue = diag_tickTime - (_timeFiled); - diag_log text format ["[milsim] (respawn_reinsertion) REMOVED BY REQUEST name=%1 playerUID=%2 filedAtBase=%3 inQueue=%4s", + diag_log text format ["[milsim] (respawn_reinsertion) REMOVED BY REQUEST name=%1 playerUID=%2 group=%3 filedAtBase=%4 inQueue=%5s", name _unit, getPlayerUID _unit, + groupId (group _unit), _baseName, _timeInQueue ]; @@ -76,9 +78,10 @@ if (isServer) then { _stillValid pushBackUnique _x; } else { diag_log text format [ - "[milsim] (respawn_reinsertion) REMOVED AUTOMATICALLY name=%1 playerUID=%2 filedAtBase=%3 nearestBaseDistance=%4m inQueue=%5s", + "[milsim] (respawn_reinsertion) REMOVED AUTOMATICALLY name=%1 playerUID=%2 group=%3 filedAtBase=%4 nearestBaseDistance=%5m inQueue=%6s", name _player, getPlayerUID _player, + groupId (group _player), _baseName, _nearestDistance, diag_tickTime - _timeFiled @@ -97,23 +100,27 @@ if (isServer) then { 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}; + private _timeoutPlayers = milsim_respawn_reinsertionQueue select { + alive (_x#0) && + (diag_tickTime - (_x#2)) > _timeout + }; if (count _timeoutPlayers > 0) then { // sort _timeoutPlayers by time in queue, descending _timeoutPlayers = [_timeoutPlayers, [], { _x#2 }, "DESCEND"] call BIS_fnc_sortBy; - private _playerLines = _timeoutPlayers apply { + private _playerLines = ["Players are still waiting for Re-insert!"]; + { private _timeInQueue = diag_tickTime - (_x#2); - private _groupId = groupID (_x#0); - [format [ - "%1: %2 [%2s]", + private _groupId = groupID (group (_x#0)); + _playerLines pushBack ([format [ + "%1: %2 [%3]", _groupId, name (_x#0), [_timeInQueue, "MM:SS"] call BIS_fnc_secondsToString - ], 0.8, [0.8, 0.8, 0.8, 1]]; - }; - ["Players are still waiting for Re-insert!", _playerLines] remoteExec ["CBA_fnc_notify", -2]; + ], 0.8, [0.8, 0.8, 0.8, 1]]); + } forEach _timeoutPlayers; + _playerLines remoteExec ["CBA_fnc_notify", [0, -2] select isDedicated]; milsim_respawn_reinsertionOverTimeoutLastNotificationTime = diag_tickTime; @@ -123,8 +130,8 @@ if (isServer) then { _timeoutPlayers apply { format[ "%1: %2 [%3]", - groupID (_x#0), - name _x#0, + groupId (group (_x#0)), + name (_x#0), diag_tickTime - (_x#2) ] } diff --git a/functions/respawn/fn_showReinsertQueueNotification.sqf b/functions/respawn/fn_showReinsertQueueNotification.sqf index 4ae775c..4c626a2 100644 --- a/functions/respawn/fn_showReinsertQueueNotification.sqf +++ b/functions/respawn/fn_showReinsertQueueNotification.sqf @@ -5,9 +5,25 @@ private _baseNames = (missionNamespace getVariable ["milsim_respawn_reinsertionQ private _peopleAtThisBase = (missionNamespace getVariable ["milsim_respawn_reinsertionQueue", []]) select { _x#1 isEqualTo _baseName } apply { - [name (_x#0), 0.7, [1,1,1,1]]; + private _timeInQueue = diag_tickTime - (_x#2); + [ + format [ + "%1: %2 [%3]", + groupId (group (_x#0)), + name (_x#0), + [_timeInQueue, "MM:SS"] call BIS_fnc_secondsToString + ], + 0.7, + [1,1,1,1] + ]; }; + _peopleAtThisBase = [ + _peopleAtThisBase, + [], + {_x#0} + ] call BIS_fnc_sortBy; + private _playerCountText = ""; switch (count _peopleAtThisBase) do { case 0: {