diff --git a/arma/server/addons/extension/functions/fnc_extCall.sqf b/arma/server/addons/extension/functions/fnc_extCall.sqf index 426a95b..595e42d 100644 --- a/arma/server/addons/extension/functions/fnc_extCall.sqf +++ b/arma/server/addons/extension/functions/fnc_extCall.sqf @@ -24,7 +24,10 @@ params [["_function", "", [""]], ["_arguments", [], [[]]]]; -private _quietFunctionLogs = ["task:defuse:get"]; +private _quietFunctionLogs = [ + "task:defuse:get", + "task:catalog:get" +]; private _functionLower = toLower _function; if !(_functionLower in _quietFunctionLogs) then { ["INFO", format ["Calling function: %1", _function], nil, nil] call EFUNC(common,log); diff --git a/arma/server/addons/task/functions/fnc_handler.sqf b/arma/server/addons/task/functions/fnc_handler.sqf index cffe3a1..526f7e7 100644 --- a/arma/server/addons/task/functions/fnc_handler.sqf +++ b/arma/server/addons/task/functions/fnc_handler.sqf @@ -47,13 +47,27 @@ if (_args isNotEqualTo [] && { (_args select 0) isEqualType "" }) then { }; if (_taskID isNotEqualTo "") then { - private _ownershipResult = GVAR(TaskStore) call ["bindTaskOwnership", [_taskID, _requesterUid]]; - if !(_ownershipResult getOrDefault ["success", false]) then { - ["WARNING", format [ - "Failed to bind task ownership for %1 (%2): %3", - _taskID, - _taskType, - _ownershipResult getOrDefault ["message", "Unknown error."] + private _catalogEntry = GVAR(TaskStore) call ["getTaskCatalogEntry", [_taskID]]; + private _source = if (_catalogEntry isEqualType createHashMap) then { + _catalogEntry getOrDefault ["source", ""] + } else { + "" + }; + + if (_requesterUid isNotEqualTo "" || { _source isNotEqualTo "mission_manager" }) then { + private _ownershipResult = GVAR(TaskStore) call ["bindTaskOwnership", [_taskID, _requesterUid]]; + if !(_ownershipResult getOrDefault ["success", false]) then { + ["WARNING", format [ + "Failed to bind task ownership for %1 (%2): %3", + _taskID, + _taskType, + _ownershipResult getOrDefault ["message", "Unknown error."] + ]] call EFUNC(common,log); + }; + } else { + ["INFO", format [ + "Skipped automatic ownership bind for generated mission %1 so it remains unaccepted until a player accepts it.", + _taskID ]] call EFUNC(common,log); }; diff --git a/arma/server/addons/task/functions/fnc_missionManager.sqf b/arma/server/addons/task/functions/fnc_missionManager.sqf index 1ee7ae6..91bd46d 100644 --- a/arma/server/addons/task/functions/fnc_missionManager.sqf +++ b/arma/server/addons/task/functions/fnc_missionManager.sqf @@ -75,13 +75,21 @@ GVAR(MissionManagerBaseClass) = compileFinal createHashMapFromArray [ private _taskID = _x; private _status = GVAR(TaskStore) call ["getTaskStatus", [_taskID]]; private _hasCatalogEntry = GVAR(TaskStore) call ["hasTaskCatalogEntry", [_taskID]]; - if !(_status in ["succeeded", "failed"] || { _status isEqualTo "" && { !_hasCatalogEntry } }) then { continue; }; + private _shouldCleanup = (_status in ["succeeded", "failed"]) || { _status isEqualTo "" && { !_hasCatalogEntry } }; + if (_shouldCleanup) then { + ["INFO", format [ + "Mission manager cleaning up generated mission %1. Status='%2', HasCatalogEntry=%3", + _taskID, + _status, + _hasCatalogEntry + ]] call EFUNC(common,log); - { - if (_x call ["completeMission", [_self, _taskID]]) exitWith {}; - } forEach (_self call ["getGenerators", []]); + { + if (_x call ["completeMission", [_self, _taskID]]) exitWith {}; + } forEach (_self call ["getGenerators", []]); - GVAR(TaskStore) call ["clearTaskStatus", [_taskID]]; + GVAR(TaskStore) call ["clearTaskStatus", [_taskID]]; + }; } forEach (_self call ["getActiveMissionIds", []]); true