
This commit introduces a new "defend" task type. The following changes were made: - Added `defend` and `defendModule` to `XEH_PREP.hpp` for pre-processing. - Implemented `defend` case in `fnc_handler.sqf` to handle defend tasks. - Added `spawnEnemyWave` to `XEH_PREP.hpp` for pre-processing.
71 lines
1.8 KiB
Plaintext
71 lines
1.8 KiB
Plaintext
#include "..\script_component.hpp"
|
|
|
|
/*
|
|
* Author: IDSolutions
|
|
* Server side task handler/spawner
|
|
*
|
|
* Arguments:
|
|
* 0: Type of task <STRING>
|
|
* 1: Arguments 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", "", [""]], ["_args", [], [[]]], ["_minRating", 0, [0]]];
|
|
|
|
private _thread = 0;
|
|
|
|
GVAR(acceptTask) = false;
|
|
|
|
// TODO: Use player organization rating instead of global company rating
|
|
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 = _args spawn FUNC(attack);
|
|
waitUntil { sleep 2; scriptDone _thread };
|
|
};
|
|
case "defuse": {
|
|
private _thread = _args spawn FUNC(defuse);
|
|
waitUntil { sleep 2; scriptDone _thread };
|
|
};
|
|
case "destroy": {
|
|
private _thread = _args spawn FUNC(destroy);
|
|
waitUntil { sleep 2; scriptDone _thread };
|
|
};
|
|
case "delivery": {
|
|
private _thread = _args spawn FUNC(delivery);
|
|
waitUntil { sleep 2; scriptDone _thread };
|
|
};
|
|
case "defend": {
|
|
private _thread = _args spawn FUNC(defend);
|
|
waitUntil { sleep 2; scriptDone _thread };
|
|
};
|
|
case "hostage": {
|
|
private _thread = _args spawn FUNC(hostage);
|
|
waitUntil { sleep 2; scriptDone _thread };
|
|
};
|
|
case "hvt": {
|
|
private _thread = _args 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; |