Compare commits

3 Commits

Author SHA1 Message Date
MrFastwind
4ff3e5107f 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.
2026-07-03 16:37:05 +02:00
f12355f581 Merge pull request 'spam in logs of "Error Undefined variable in expression: _grp"' (#1) from fix/patrol-spawn into master
All checks were successful
Build Mission PBO / pack (push) Successful in 1m0s
Build Mission PBO / deploy (push) Successful in 6s
Reviewed-on: #1
2026-07-02 14:43:25 +00:00
MrFastwind
91e3099f0e fix(kp-framework): Fixes spam in logs of "Error Undefined variable in
expression: _grp" in \scripts\server\patrols\manage_one_patrol.sqf...,
line 62
2026-07-02 04:08:00 +02:00
2 changed files with 20 additions and 1 deletions

View File

@@ -12,6 +12,7 @@ while {true} do {
}; };
if !(isNil "_owner") then { if !(isNil "_owner") then {
if (_x getVariable ["KPLIB_patrol_group", false]) then {continue;};
if !(isGroupDeletedWhenEmpty _x) then { if !(isGroupDeletedWhenEmpty _x) then {
if (local _x) then { if (local _x) then {
_x deleteGroupWhenEmpty true; _x deleteGroupWhenEmpty true;

View File

@@ -1,5 +1,5 @@
params [ "_minimum_readiness", "_is_infantry" ]; params [ "_minimum_readiness", "_is_infantry" ];
private [ "_headless_client" ]; private [ "_headless_client", "_grp", "_spawn_marker", "_sector_spawn_pos", "_started_time", "_patrol_continue" ];
waitUntil { !isNil "blufor_sectors" }; waitUntil { !isNil "blufor_sectors" };
waitUntil { !isNil "combat_readiness" }; waitUntil { !isNil "combat_readiness" };
@@ -45,6 +45,10 @@ while { GRLIB_endgame == 0 } do {
_grp = group ((crew _vehicle_object) select 0); _grp = group ((crew _vehicle_object) select 0);
}; };
if (!isNull _grp) then {
_grp setVariable ["KPLIB_patrol_group", true, true];
};
[_grp] spawn patrol_ai; [_grp] spawn patrol_ai;
_started_time = time; _started_time = time;
@@ -58,6 +62,11 @@ while { GRLIB_endgame == 0 } do {
}; };
while { _patrol_continue } do { while { _patrol_continue } do {
if (isNil "_grp") then {
_patrol_continue = false;
["_grp was nil, but patrol was expected", "MANAGE_ONE_PATROL"] call KPLIB_fnc_log;
break;
};
sleep 60; sleep 60;
if ( count (units _grp) == 0 ) then { if ( count (units _grp) == 0 ) then {
_patrol_continue = false; _patrol_continue = false;
@@ -76,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 { if ( !([] call KPLIB_fnc_isBigtownActive) ) then {
sleep (600.0 / GRLIB_difficulty_modifier); sleep (600.0 / GRLIB_difficulty_modifier);
}; };