From 4ff3e5107fc084fc225326e0f2558cefa881ac61 Mon Sep 17 00:00:00 2001 From: MrFastwind Date: Fri, 3 Jul 2026 16:37:05 +0200 Subject: [PATCH] fix: prevent group_diag from prematurely marking patrol groups for deletion Tags patrol groups (KPLIB_patrol_group) so group_diag skips them, and cleans up the tag + enables deleteGroupWhenEmpty only once the patrol lifecycle is complete. Prevents the '_grp was nil' log spam by fixing the root cause rather than just silencin the symptom. --- src/scripts/server/offloading/group_diag.sqf | 1 + src/scripts/server/patrols/manage_one_patrol.sqf | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/scripts/server/offloading/group_diag.sqf b/src/scripts/server/offloading/group_diag.sqf index 5985fa4..913a9ac 100644 --- a/src/scripts/server/offloading/group_diag.sqf +++ b/src/scripts/server/offloading/group_diag.sqf @@ -12,6 +12,7 @@ while {true} do { }; if !(isNil "_owner") then { + if (_x getVariable ["KPLIB_patrol_group", false]) then {continue;}; if !(isGroupDeletedWhenEmpty _x) then { if (local _x) then { _x deleteGroupWhenEmpty true; diff --git a/src/scripts/server/patrols/manage_one_patrol.sqf b/src/scripts/server/patrols/manage_one_patrol.sqf index 10c48ac..e557062 100644 --- a/src/scripts/server/patrols/manage_one_patrol.sqf +++ b/src/scripts/server/patrols/manage_one_patrol.sqf @@ -45,6 +45,10 @@ while { GRLIB_endgame == 0 } do { _grp = group ((crew _vehicle_object) select 0); }; + if (!isNull _grp) then { + _grp setVariable ["KPLIB_patrol_group", true, true]; + }; + [_grp] spawn patrol_ai; _started_time = time; @@ -81,6 +85,15 @@ while { GRLIB_endgame == 0 } do { }; }; + if (!isNull _grp) then { + _grp setVariable ["KPLIB_patrol_group", nil, true]; + if (local _grp) then { + _grp deleteGroupWhenEmpty true; + } else { + [_grp, true] remoteExecCall ["deleteGroupWhenEmpty", groupOwner _grp]; + }; + }; + if ( !([] call KPLIB_fnc_isBigtownActive) ) then { sleep (600.0 / GRLIB_difficulty_modifier); };