forge/arma/server/addons/task/XEH_postInit.sqf
Jacob Schmidt 9deb73ec8e Migrate task logic to object classes
- Move task implementations from prototype scripts into `functions/objects`
- Keep public task functions as compatibility adapters
- Update docs and init wiring for the new object-based layout
2026-05-15 18:50:28 -05:00

57 lines
2.2 KiB
Plaintext

#include "script_component.hpp"
if (isNil QEGVAR(common,EventBus)) then { call EFUNC(common,eventBus); };
// Temporary migration instrumentation. Keep this visible while task lifecycle
// events are being moved onto the framework event bus.
if (isNil QGVAR(TaskLifecycleEventLogTokens)) then {
private _logTaskLifecycleEvent = {
params ["_event"];
["INFO", format [
"Task lifecycle event: %1 taskID=%2 taskType=%3 status=%4 participants=%5",
_event getOrDefault ["event", ""],
_event getOrDefault ["taskID", ""],
_event getOrDefault ["taskType", ""],
_event getOrDefault ["status", ""],
_event getOrDefault ["participants", []]
]] call EFUNC(common,log);
};
GVAR(TaskLifecycleEventLogTokens) = [
EGVAR(common,EventBus) call ["on", ["task.created", _logTaskLifecycleEvent, "task.lifecycle.log"]],
EGVAR(common,EventBus) call ["on", ["task.started", _logTaskLifecycleEvent, "task.lifecycle.log"]],
EGVAR(common,EventBus) call ["on", ["task.completed", _logTaskLifecycleEvent, "task.lifecycle.log"]],
EGVAR(common,EventBus) call ["on", ["task.failed", _logTaskLifecycleEvent, "task.lifecycle.log"]],
EGVAR(common,EventBus) call ["on", ["task.cleared", _logTaskLifecycleEvent, "task.lifecycle.log"]]
];
};
["ace_explosives_defuse", {
private _taskID = "";
private _explosive = objNull;
{
if (_x isEqualType objNull && { !isNull _x }) then {
if (isNull _explosive) then { _explosive = _x; };
_taskID = _x getVariable ["assignedTask", ""];
if (_taskID isNotEqualTo "") exitWith {};
};
} forEach _this;
if (_taskID isEqualTo "" && { !isNull _explosive }) then {
_taskID = GVAR(TaskStore) call ["findTaskEntityOwner", ["ieds", _explosive]];
};
if (_taskID isEqualTo "") exitWith {
["WARNING", format [
"ACE Defuse Event Ignored: No assignedTask found. Explosive=%1, Type=%2, NetID=%3",
_explosive,
typeOf _explosive,
netId _explosive
]] call EFUNC(common,log);
};
GVAR(TaskStore) call ["incrementDefuseCount", [_taskID]];
}] call CFUNC(addEventHandler);
[] call FUNC(missionManager);