client/addons/task/functions/fnc_deliveryModule.sqf
Jacob Schmidt c822d4e601 feat: Implement cargo delivery task type and improve task assignment
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.
2025-05-25 12:33:36 -05:00

67 lines
2.7 KiB
Plaintext

#include "..\script_component.hpp"
/*
* Author: IDSolutions
* Creates a delivery task module
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* call forge_client_task_fnc_deliveryModule;
*
* Public: No
*/
// Module category
private _category = "Forge Tasks";
private _subCategory = "Delivery Tasks";
// Create the module
private _module = createDialog "RscDisplayAttributes";
_module setVariable ["category", _category];
_module setVariable ["subcategory", _subCategory];
_module setVariable ["description", "Configure a delivery task"];
// Add fields for task configuration
[_module, "Task ID", "taskID", "", true] call BIS_fnc_addAttribute;
[_module, "Fail Limit", "limitFail", "1", true] call BIS_fnc_addAttribute;
[_module, "Success Count", "limitSuccess", "3", true] call BIS_fnc_addAttribute;
[_module, "Delivery Zone", "deliveryZone", "", true] call BIS_fnc_addAttribute;
[_module, "Company Funds Reward", "companyFunds", "250000", true] call BIS_fnc_addAttribute;
[_module, "Rating Loss on Fail", "ratingFail", "-75", true] call BIS_fnc_addAttribute;
[_module, "Rating Gain on Success", "ratingSuccess", "300", true] call BIS_fnc_addAttribute;
[_module, "End Mission on Success", "endSuccess", "false", false] call BIS_fnc_addAttribute;
[_module, "End Mission on Fail", "endFail", "false", false] call BIS_fnc_addAttribute;
[_module, "Time Limit (seconds)", "timeLimit", "", false] call BIS_fnc_addAttribute;
// Add confirm button handler
_module setVariable ["onConfirm", {
params ["_module"];
private _taskID = _module getVariable ["taskID", ""];
private _limitFail = parseNumber (_module getVariable ["limitFail", "1"]);
private _limitSuccess = parseNumber (_module getVariable ["limitSuccess", "3"]);
private _deliveryZone = _module getVariable ["deliveryZone", ""];
private _companyFunds = parseNumber (_module getVariable ["companyFunds", "250000"]);
private _ratingFail = parseNumber (_module getVariable ["ratingFail", "-75"]);
private _ratingSuccess = parseNumber (_module getVariable ["ratingSuccess", "300"]);
private _endSuccess = _module getVariable ["endSuccess", "false"] == "true";
private _endFail = _module getVariable ["endFail", "false"] == "true";
private _timeLimit = _module getVariable ["timeLimit", ""];
// Convert time limit to number or nil
private _timeLimitNum = if (_timeLimit == "") then { nil } else { parseNumber _timeLimit };
// Create the task
private _params = [_taskID, _limitFail, _limitSuccess, _deliveryZone, _companyFunds, _ratingFail, _ratingSuccess, _endSuccess, _endFail];
if (!isNil "_timeLimitNum") then {
_params pushBack _timeLimitNum;
};
["delivery", _params] remoteExec ["forge_client_task_fnc_handler", 2, false];
}];