
This commit introduces a new "delivery" task type and enhances the task assignment process for various entities. The following changes were made: - Added `delivery` and `deliveryModule` to `XEH_PREP.hpp` for pre-processing. - Added `GVAR(allCargo)` to `XEH_preInit.sqf` to track cargo objects. - Implemented `delivery` case in `fnc_handler.sqf` to handle delivery tasks. - Added `makeCargo` to `XEH_PREP.hpp` for pre-processing. - Refactored `fnc_makeShooter.sqf`, `fnc_makeObject.sqf`, `fnc_makeTarget.sqf`, `fnc_makeHVT.sqf`, `fnc_makeHostage.sqf`, and `fnc_makeIED.sqf` to: - Update descriptions to reflect assignment rather than registration. - Add error handling for null entities and missing task IDs. - Add diag_log messages for debugging. - Standardize parameter handling.
39 lines
1.1 KiB
Plaintext
39 lines
1.1 KiB
Plaintext
#include "..\script_component.hpp"
|
|
|
|
/*
|
|
* Author: IDSolutions
|
|
* Assigns cargo to a task for delivery
|
|
*
|
|
* Arguments:
|
|
* 0: Object to convert to delivery cargo <OBJECT>
|
|
* 1: Task ID to assign the cargo to <STRING>
|
|
*
|
|
* 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 ["Damaged", {
|
|
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 damaged! Task: %1", _taskID];
|
|
};
|
|
};
|
|
}]; |