#include "..\script_component.hpp" /* * Author: IDSolutions * Assigns cargo to a task for delivery * * Arguments: * 0: Object to convert to delivery cargo * 1: Task ID to assign the cargo to * * Return Value: * None * * Example: * [_cargoObject, "delivery_1"] call forge_client_task_fnc_makeCargo; * * Public: Yes */ params [["_cargo", objNull, [objNull]], ["_taskID", "", [""]]]; diag_log format ["[FORGE] Make Cargo: %1", _this]; if (isNull _cargo) exitWith { diag_log "ERROR: Attempt to create cargo from null object"; }; if (_taskID == "") exitWith { diag_log "ERROR: No task ID provided for cargo"; }; SETPVAR(_cargo,assignedTask,_taskID); GVAR(allCargo) pushBack _cargo; _cargo addEventHandler ["Dammaged", { params ["_unit", "_hitSelection", "_damage", "_hitPartIndex", "_hitPoint", "_shooter", "_projectile"]; if (damage _unit >= 0.7) then { private _taskID = GETVAR(_unit,assignedTask,""); if (_taskID isNotEqualTo "") then { hint format ["Warning: Cargo severely dammaged! Task: %1", _taskID]; }; }; }];