fixes reinsertion formatting and includes groups in diaglog

This commit is contained in:
2024-01-28 22:35:03 -08:00
parent 49fa0c39d2
commit 0220baad9d
2 changed files with 38 additions and 15 deletions

View File

@@ -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)
]
}

View File

@@ -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: {