Keep generated missions unaccepted until players accept them
- Skip auto-binding ownership for mission-manager tasks - Add quiet logging for catalog task lookups - Log mission cleanup before completing generators
This commit is contained in:
parent
0cd6509337
commit
c3582460f9
@ -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);
|
||||
|
||||
@ -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);
|
||||
};
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user