client/addons/task/functions/fnc_handler.sqf
Jacob Schmidt d474b3676a
All checks were successful
Build / Build (push) Successful in 28s
Refactor: Standardize function descriptions and variable handling
This commit refactors several client-side functions to improve code consistency and readability.

- Standardizes function descriptions by removing redundant "Function: forge_client..." prefixes and "[Description]" sections, focusing on concise descriptions of the function's purpose.
- Updates variable handling in arsenal functions to use GVAR and EGVARS for default values, improving consistency and reducing code duplication.
- Removes the bank init function as it is no longer needed.
- Adds a done variable to the preinit file.
2025-05-25 11:30:26 -05:00

62 lines
1.6 KiB
Plaintext

#include "..\script_component.hpp"
/*
* Author: IDSolutions
* Server side task handler/spawner
*
* Arguments:
* 0: Type of task <STRING>
* 1: Params for task <ARRAY>
* 2: Minimum rating for task <NUMBER> (default: nil)
*
* Return Value:
* None
*
* Example:
* ["task_type", [_reward, _punish, _time, etc.....], minRating] remoteExec ["forge_client_task_fnc_handler", 2, false];
*
* Public: Yes
*/
params [["_taskType", "", [""]], ["_cntParams", [], [[]]], ["_minRating", 0, [0]]];
private _thread = 0;
GVAR(acceptTask) = false;
if (isNil "companyRating") then { companyRating = 0; };
private _companyRating = companyRating;
if (_companyRating < _minRating) exitWith {
hint format ["The company rating of %1 does not meet or exceed the minimum required rating of %2.", _companyRating, _minRating];
};
switch (_taskType) do {
case "attack": {
private _thread = _cntParams spawn FUNC(attack);
waitUntil { sleep 2; scriptDone _thread };
};
case "defuse": {
private _thread = _cntParams spawn FUNC(defuse);
waitUntil { sleep 2; scriptDone _thread };
};
case "destroy": {
private _thread = _cntParams spawn FUNC(destroy);
waitUntil { sleep 2; scriptDone _thread };
};
case "hostage": {
private _thread = _cntParams spawn FUNC(hostage);
waitUntil { sleep 2; scriptDone _thread };
};
case "hvt": {
private _thread = _cntParams spawn FUNC(hvt);
waitUntil { sleep 2; scriptDone _thread };
};
default {
diag_log format ["Unknown Contract Type: %1", _taskType];
};
};
diag_log "[FORGE] Mission Handler Done";
GVAR(acceptTask) = true;