Migrate task logic to object classes
- Move task implementations from prototype scripts into `functions/objects` - Keep public task functions as compatibility adapters - Update docs and init wiring for the new object-based layout
This commit is contained in:
parent
732433f848
commit
9deb73ec8e
@ -41,17 +41,17 @@ system intentionally starts clean after each server or mission restart.
|
|||||||
- defuse progress
|
- defuse progress
|
||||||
- per-task entity registries for cargo, hostages, HVTs, IEDs, protected entities, shooters, and targets
|
- per-task entity registries for cargo, hostages, HVTs, IEDs, protected entities, shooters, and targets
|
||||||
|
|
||||||
### Object Model Prototype
|
### Object Model
|
||||||
A review-only prototype for object-based task instances lives under
|
Object-style task instances and entity controllers live under
|
||||||
`prototypes/`. It is not wired into runtime.
|
`functions/objects/` and are initialized directly from `XEH_preInit.sqf`.
|
||||||
|
|
||||||
- `forge_server_task_fnc_initPrototypes`
|
- `TaskInstanceBaseClass`
|
||||||
- `prototypes/README.md`
|
- `EntityControllerBaseClass`
|
||||||
|
- `functions/objects/README.md`
|
||||||
|
|
||||||
The prototype sketches task classes for attack, defuse, defend, delivery,
|
The task functions are compatibility adapters around these object-style task
|
||||||
destroy, hostage, and HVT flows using `createHashMapObject` so the team can
|
classes. This keeps the public task function names stable while moving stateful
|
||||||
review a stateful per-task design without replacing the current procedural task
|
task behavior into per-task `createHashMapObject` instances.
|
||||||
flows.
|
|
||||||
|
|
||||||
### Reward Handling
|
### Reward Handling
|
||||||
`fnc_handleTaskRewards.sqf` applies org-owned rewards:
|
`fnc_handleTaskRewards.sqf` applies org-owned rewards:
|
||||||
@ -212,6 +212,7 @@ If you want the accepting player's org to own the task rewards, use `fnc_handler
|
|||||||
- compiles functions
|
- compiles functions
|
||||||
- initializes `TaskStore`
|
- initializes `TaskStore`
|
||||||
- `XEH_postInit.sqf`
|
- `XEH_postInit.sqf`
|
||||||
|
- registers temporary task lifecycle event logs for migration testing
|
||||||
- registers the ACE defuse event hook
|
- registers the ACE defuse event hook
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|||||||
@ -19,7 +19,6 @@ PREP(initTaskStore);
|
|||||||
PREP_SUBDIR(generators,attackMissionGenerator);
|
PREP_SUBDIR(generators,attackMissionGenerator);
|
||||||
|
|
||||||
PREP_SUBDIR(helpers,handleTaskRewards);
|
PREP_SUBDIR(helpers,handleTaskRewards);
|
||||||
PREP_SUBDIR(helpers,heartBeat);
|
|
||||||
PREP_SUBDIR(helpers,parseRewards);
|
PREP_SUBDIR(helpers,parseRewards);
|
||||||
PREP_SUBDIR(helpers,spawnEnemyWave);
|
PREP_SUBDIR(helpers,spawnEnemyWave);
|
||||||
PREP_SUBDIR(helpers,startTask);
|
PREP_SUBDIR(helpers,startTask);
|
||||||
@ -37,21 +36,20 @@ PREP_SUBDIR(modules,hvtModule);
|
|||||||
PREP_SUBDIR(modules,protectedModule);
|
PREP_SUBDIR(modules,protectedModule);
|
||||||
PREP_SUBDIR(modules,shootersModule);
|
PREP_SUBDIR(modules,shootersModule);
|
||||||
|
|
||||||
PREP_SUBDIR(prototypes,initPrototypes);
|
PREP_SUBDIR(objects,TaskInstanceBaseClass);
|
||||||
PREP_SUBDIR(prototypes,TaskInstanceBaseClass);
|
PREP_SUBDIR(objects,EntityControllerBaseClass);
|
||||||
PREP_SUBDIR(prototypes,EntityControllerBaseClass);
|
PREP_SUBDIR(objects,AttackTaskBaseClass);
|
||||||
PREP_SUBDIR(prototypes,AttackTaskBaseClass);
|
PREP_SUBDIR(objects,HostageTaskBaseClass);
|
||||||
PREP_SUBDIR(prototypes,HostageTaskBaseClass);
|
PREP_SUBDIR(objects,HostageEntityController);
|
||||||
PREP_SUBDIR(prototypes,HostageEntityController);
|
PREP_SUBDIR(objects,TargetEntityController);
|
||||||
PREP_SUBDIR(prototypes,TargetEntityController);
|
PREP_SUBDIR(objects,ShooterEntityController);
|
||||||
PREP_SUBDIR(prototypes,ShooterEntityController);
|
PREP_SUBDIR(objects,HVTEntityController);
|
||||||
PREP_SUBDIR(prototypes,HVTEntityController);
|
PREP_SUBDIR(objects,CargoEntityController);
|
||||||
PREP_SUBDIR(prototypes,CargoEntityController);
|
PREP_SUBDIR(objects,ProtectedEntityController);
|
||||||
PREP_SUBDIR(prototypes,ProtectedEntityController);
|
PREP_SUBDIR(objects,IEDEntityController);
|
||||||
PREP_SUBDIR(prototypes,IEDEntityController);
|
PREP_SUBDIR(objects,DefenseEnemyController);
|
||||||
PREP_SUBDIR(prototypes,DefenseEnemyController);
|
PREP_SUBDIR(objects,DefuseTaskBaseClass);
|
||||||
PREP_SUBDIR(prototypes,DefuseTaskBaseClass);
|
PREP_SUBDIR(objects,DestroyTaskBaseClass);
|
||||||
PREP_SUBDIR(prototypes,DestroyTaskBaseClass);
|
PREP_SUBDIR(objects,DeliveryTaskBaseClass);
|
||||||
PREP_SUBDIR(prototypes,DeliveryTaskBaseClass);
|
PREP_SUBDIR(objects,HVTTaskBaseClass);
|
||||||
PREP_SUBDIR(prototypes,HVTTaskBaseClass);
|
PREP_SUBDIR(objects,DefendTaskBaseClass);
|
||||||
PREP_SUBDIR(prototypes,DefendTaskBaseClass);
|
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
if (isNil QEGVAR(common,EventBus)) then { call EFUNC(common,eventBus); };
|
if (isNil QEGVAR(common,EventBus)) then { call EFUNC(common,eventBus); };
|
||||||
|
|
||||||
|
// Temporary migration instrumentation. Keep this visible while task lifecycle
|
||||||
|
// events are being moved onto the framework event bus.
|
||||||
if (isNil QGVAR(TaskLifecycleEventLogTokens)) then {
|
if (isNil QGVAR(TaskLifecycleEventLogTokens)) then {
|
||||||
private _logTaskLifecycleEvent = {
|
private _logTaskLifecycleEvent = {
|
||||||
params ["_event"];
|
params ["_event"];
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* This public function is now a compatibility adapter around
|
* This public function is now a compatibility adapter around
|
||||||
* AttackTaskBaseClass. Keep the argument list stable for Eden modules,
|
* AttackTaskBaseClass. Keep the argument list stable for Eden modules,
|
||||||
* startTask, and external scripts while the object-style task prototypes
|
* startTask, and external scripts while the object-style task objects
|
||||||
* become the live implementation.
|
* become the live implementation.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
|
|||||||
@ -1,35 +1,7 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Author: IDSolutions
|
* Compatibility adapter for the object-style defend task implementation.
|
||||||
* Registers a defend task where players must hold a zone marked by a marker
|
|
||||||
*
|
|
||||||
* Arguments:
|
|
||||||
* 0: ID of the task <STRING>
|
|
||||||
* 1: Defense zone marker name <STRING>
|
|
||||||
* 2: Time to defend in seconds <NUMBER>
|
|
||||||
* 3: Amount of funds the company receives if the task is successful <NUMBER> (default: 0)
|
|
||||||
* 4: Amount of rating the company and player lose if the task is failed <NUMBER> (default: 0)
|
|
||||||
* 5: Amount of rating the company and player receive if the task is successful <NUMBER> (default: 0)
|
|
||||||
* 6: Should the mission end (MissionSuccess) if the task is successful <BOOL> (default: false)
|
|
||||||
* 7: Should the mission end (MissionFailed) if the task is failed <BOOL> (default: false)
|
|
||||||
* 8: Enemy wave count <NUMBER> (default: 3)
|
|
||||||
* 9: Time between waves in seconds <NUMBER> (default: 300)
|
|
||||||
* 10: Minimum BLUFOR units required in zone <NUMBER> (default: 1)
|
|
||||||
* 11: Enemy template groups <ARRAY> (default: [])
|
|
||||||
* 12: Equipment rewards <ARRAY> (default: [])
|
|
||||||
* 13: Supply rewards <ARRAY> (default: [])
|
|
||||||
* 14: Weapon rewards <ARRAY> (default: [])
|
|
||||||
* 15: Vehicle rewards <ARRAY> (default: [])
|
|
||||||
* 16: Special rewards <ARRAY> (default: [])
|
|
||||||
*
|
|
||||||
* Return Value:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* ["defend_zone_1", "defend_marker", 900, 500000, -100, 400, false, false, 3, 300, 1, ["ItemGPS"], ["FirstAidKit"], ["arifle_MX_F"], ["B_MRAP_01_F"], ["B_UAV_01_F"]] spawn forge_server_task_fnc_defend;
|
|
||||||
*
|
|
||||||
* Public: Yes
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params [
|
params [
|
||||||
@ -52,103 +24,34 @@ params [
|
|||||||
["_specialRewards", [], [[]]]
|
["_specialRewards", [], [[]]]
|
||||||
];
|
];
|
||||||
|
|
||||||
if (_defenseZone == "" || !(markerShape _defenseZone in ["RECTANGLE", "ELLIPSE"])) exitWith {
|
private _taskParams = createHashMapFromArray [
|
||||||
["ERROR", format ["Invalid defense zone marker: %1", _defenseZone]] call EFUNC(common,log);
|
["defenseZone", _defenseZone],
|
||||||
};
|
["defendTime", _defendTime],
|
||||||
|
["funds", _companyFunds],
|
||||||
|
["ratingFail", _ratingFail],
|
||||||
|
["ratingSuccess", _ratingSuccess],
|
||||||
|
["endSuccess", _endSuccess],
|
||||||
|
["endFail", _endFail],
|
||||||
|
["waveCount", _waveCount],
|
||||||
|
["waveCooldown", _waveCooldown],
|
||||||
|
["minBlufor", _minBlufor],
|
||||||
|
["enemyTemplates", _enemyTemplates],
|
||||||
|
["useTaskStore", true]
|
||||||
|
];
|
||||||
|
|
||||||
private _result = 0;
|
if (_equipmentRewards isNotEqualTo []) then { _taskParams set ["equipment", _equipmentRewards]; };
|
||||||
private _startTime = -1;
|
if (_supplyRewards isNotEqualTo []) then { _taskParams set ["supplies", _supplyRewards]; };
|
||||||
private _nextWaveTime = -1;
|
if (_weaponRewards isNotEqualTo []) then { _taskParams set ["weapons", _weaponRewards]; };
|
||||||
private _currentWave = 0;
|
if (_vehicleRewards isNotEqualTo []) then { _taskParams set ["vehicles", _vehicleRewards]; };
|
||||||
private _zoneEmptyCounter = 0;
|
if (_specialRewards isNotEqualTo []) then { _taskParams set ["special", _specialRewards]; };
|
||||||
private _warningIssued = false;
|
|
||||||
private _defenseStarted = false;
|
|
||||||
|
|
||||||
waitUntil {
|
private _task = createHashMapObject [
|
||||||
sleep 1;
|
GVAR(DefendTaskBaseClass),
|
||||||
GVAR(TaskStore) call ["isTaskAccepted", [_taskID]]
|
[
|
||||||
};
|
_taskID,
|
||||||
|
createHashMap,
|
||||||
|
_taskParams
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
waitUntil {
|
_task call ["runLoop", []];
|
||||||
sleep 1;
|
|
||||||
GVAR(TaskStore) call ["trackParticipants", [_taskID, [], _defenseZone, 0]];
|
|
||||||
|
|
||||||
private _bluforInZone = count (allUnits select { _x isKindOf "CAManBase" && { side _x == west } && { alive _x }} inAreaArray _defenseZone);
|
|
||||||
private _readyToStart = _bluforInZone >= _minBlufor;
|
|
||||||
|
|
||||||
if (_readyToStart) then {
|
|
||||||
_defenseStarted = true;
|
|
||||||
_startTime = time;
|
|
||||||
_nextWaveTime = _startTime;
|
|
||||||
|
|
||||||
GVAR(TaskStore) call ["notifyParticipants", [_taskID, "info", "Tasks", "Defense has started. Hold the zone."]];
|
|
||||||
};
|
|
||||||
|
|
||||||
_readyToStart
|
|
||||||
};
|
|
||||||
|
|
||||||
waitUntil {
|
|
||||||
sleep 1;
|
|
||||||
GVAR(TaskStore) call ["trackParticipants", [_taskID, [], _defenseZone, 0]];
|
|
||||||
private _bluforInZone = count (allUnits select { _x isKindOf "CAManBase" && { side _x == west } && { alive _x }} inAreaArray _defenseZone);
|
|
||||||
private _timeElapsed = if (_defenseStarted) then { time - _startTime } else { 0 };
|
|
||||||
|
|
||||||
if (_bluforInZone < _minBlufor) then {
|
|
||||||
_zoneEmptyCounter = _zoneEmptyCounter + 1;
|
|
||||||
|
|
||||||
if (_zoneEmptyCounter == 15 && !_warningIssued) then {
|
|
||||||
GVAR(TaskStore) call ["notifyParticipants", [_taskID, "warning", "Tasks", "Defense zone is empty. Return immediately."]];
|
|
||||||
_warningIssued = true;
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
_zoneEmptyCounter = 0;
|
|
||||||
_warningIssued = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
if (_currentWave < _waveCount && _defenseStarted && { time >= _nextWaveTime }) then {
|
|
||||||
[_defenseZone, _taskID, _currentWave, _enemyTemplates] call FUNC(spawnEnemyWave);
|
|
||||||
|
|
||||||
_currentWave = _currentWave + 1;
|
|
||||||
_nextWaveTime = time + _waveCooldown;
|
|
||||||
|
|
||||||
GVAR(TaskStore) call ["notifyParticipants", [_taskID, "info", "Tasks", format ["Enemy forces approaching. Wave %1 of %2.", _currentWave, _waveCount]]];
|
|
||||||
};
|
|
||||||
|
|
||||||
if (_zoneEmptyCounter >= 30) then { _result = 1; };
|
|
||||||
|
|
||||||
(_result == 1) or ((_bluforInZone >= _minBlufor) && (_timeElapsed >= _defendTime) && (_currentWave >= _waveCount));
|
|
||||||
};
|
|
||||||
|
|
||||||
if (_result == 1) then {
|
|
||||||
[_taskID, "FAILED"] call BFUNC(taskSetState);
|
|
||||||
GVAR(TaskStore) call ["setTaskStatus", [_taskID, "failed"]];
|
|
||||||
|
|
||||||
sleep 1;
|
|
||||||
|
|
||||||
GVAR(TaskStore) call ["notifyParticipants", [_taskID, "warning", "Tasks", format ["Task failed: %1 reputation", _ratingFail]]];
|
|
||||||
GVAR(TaskStore) call ["applyRatingOutcome", [_taskID, _ratingFail]];
|
|
||||||
GVAR(TaskStore) call ["clearTask", [_taskID]];
|
|
||||||
|
|
||||||
if (_endFail) then { "EveryoneLost" call BFUNC(endMissionServer); };
|
|
||||||
} else {
|
|
||||||
private _rewards = createHashMap;
|
|
||||||
_rewards set ["funds", _companyFunds];
|
|
||||||
|
|
||||||
if (_equipmentRewards isNotEqualTo []) then { _rewards set ["equipment", _equipmentRewards]; };
|
|
||||||
if (_supplyRewards isNotEqualTo []) then { _rewards set ["supplies", _supplyRewards]; };
|
|
||||||
if (_weaponRewards isNotEqualTo []) then { _rewards set ["weapons", _weaponRewards]; };
|
|
||||||
if (_vehicleRewards isNotEqualTo []) then { _rewards set ["vehicles", _vehicleRewards]; };
|
|
||||||
if (_specialRewards isNotEqualTo []) then { _rewards set ["special", _specialRewards]; };
|
|
||||||
|
|
||||||
[_taskID, _rewards] call FUNC(handleTaskRewards);
|
|
||||||
[_taskID, "SUCCEEDED"] call BFUNC(taskSetState);
|
|
||||||
GVAR(TaskStore) call ["setTaskStatus", [_taskID, "succeeded"]];
|
|
||||||
|
|
||||||
sleep 1;
|
|
||||||
|
|
||||||
GVAR(TaskStore) call ["notifyParticipants", [_taskID, "success", "Tasks", format ["Task completed: %1 reputation, $%2 funds", _ratingSuccess, [_companyFunds] call EFUNC(common,formatNumber)]]];
|
|
||||||
GVAR(TaskStore) call ["applyRatingOutcome", [_taskID, _ratingSuccess]];
|
|
||||||
GVAR(TaskStore) call ["clearTask", [_taskID]];
|
|
||||||
|
|
||||||
if (_endSuccess) then { "EveryoneWon" call BFUNC(endMissionServer); };
|
|
||||||
};
|
|
||||||
|
|||||||
@ -1,120 +1,52 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Author: IDSolutions
|
* Compatibility adapter for the object-style defuse task implementation.
|
||||||
* Registers a defuse task
|
|
||||||
*
|
|
||||||
* Arguments:
|
|
||||||
* 0: ID of the task <STRING>
|
|
||||||
* 1: Amount of entities destroyed to fail the task <NUMBER>
|
|
||||||
* 2: Amount of ieds defused to complete the task <NUMBER>
|
|
||||||
* 3: Amount of funds the company recieves if the task is successful <NUMBER> (default: 0)
|
|
||||||
* 4: Amount of rating the company and player lose if the task is failed <NUMBER> (default: 0)
|
|
||||||
* 5: Amount of rating the company and player recieve if the task is successful <NUMBER> (default: 0)
|
|
||||||
* 6: Should the mission end (MissionSuccess) if the task is successful <BOOL> (default: false)
|
|
||||||
* 7: Should the mission end (MissionFailed) if the task is failed <BOOL> (default: false)
|
|
||||||
* 8: Equipment rewards <ARRAY> (default: [])
|
|
||||||
* 9: Supply rewards <ARRAY> (default: [])
|
|
||||||
* 10: Weapon rewards <ARRAY> (default: [])
|
|
||||||
* 11: Vehicle rewards <ARRAY> (default: [])
|
|
||||||
* 12: Special rewards <ARRAY> (default: [])
|
|
||||||
*
|
|
||||||
* Return Value:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* ["task_name", 2, 3, 375000, -75, 300, false, false] spawn forge_server_task_fnc_defuse;
|
|
||||||
*
|
|
||||||
* Public: Yes
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params [
|
params [
|
||||||
["_taskID", "", [""]],
|
["_taskID", "", [""]],
|
||||||
["_limitFail", -1, [0]],
|
["_limitFail", -1, [0]],
|
||||||
["_limitSuccess", -1, [0]],
|
["_limitSuccess", -1, [0]],
|
||||||
["_companyFunds", 0, [0]],
|
["_companyFunds", 0, [0]],
|
||||||
["_ratingFail", 0, [0]],
|
["_ratingFail", 0, [0]],
|
||||||
["_ratingSuccess", 0, [0]],
|
["_ratingSuccess", 0, [0]],
|
||||||
["_endSuccess", false, [false]],
|
["_endSuccess", false, [false]],
|
||||||
["_endFail", false, [false]],
|
["_endFail", false, [false]],
|
||||||
["_equipmentRewards", [], [[]]],
|
["_equipmentRewards", [], [[]]],
|
||||||
["_supplyRewards", [], [[]]],
|
["_supplyRewards", [], [[]]],
|
||||||
["_weaponRewards", [], [[]]],
|
["_weaponRewards", [], [[]]],
|
||||||
["_vehicleRewards", [], [[]]],
|
["_vehicleRewards", [], [[]]],
|
||||||
["_specialRewards", [], [[]]]
|
["_specialRewards", [], [[]]]
|
||||||
];
|
];
|
||||||
|
|
||||||
private _result = 0;
|
private _taskParams = createHashMapFromArray [
|
||||||
private _ieds = [];
|
["limitFail", _limitFail],
|
||||||
|
["limitSuccess", _limitSuccess],
|
||||||
|
["funds", _companyFunds],
|
||||||
|
["ratingFail", _ratingFail],
|
||||||
|
["ratingSuccess", _ratingSuccess],
|
||||||
|
["endSuccess", _endSuccess],
|
||||||
|
["endFail", _endFail],
|
||||||
|
["useTaskStore", true]
|
||||||
|
];
|
||||||
|
|
||||||
waitUntil {
|
if (_equipmentRewards isNotEqualTo []) then { _taskParams set ["equipment", _equipmentRewards]; };
|
||||||
sleep 1;
|
if (_supplyRewards isNotEqualTo []) then { _taskParams set ["supplies", _supplyRewards]; };
|
||||||
_ieds = GVAR(TaskStore) call ["getTaskEntities", ["ieds", _taskID]];
|
if (_weaponRewards isNotEqualTo []) then { _taskParams set ["weapons", _weaponRewards]; };
|
||||||
count _ieds > 0
|
if (_vehicleRewards isNotEqualTo []) then { _taskParams set ["vehicles", _vehicleRewards]; };
|
||||||
};
|
if (_specialRewards isNotEqualTo []) then { _taskParams set ["special", _specialRewards]; };
|
||||||
|
|
||||||
_ieds = GVAR(TaskStore) call ["getTaskEntities", ["ieds", _taskID]];
|
private _task = createHashMapObject [
|
||||||
private _entities = GVAR(TaskStore) call ["getTaskEntities", ["entities", _taskID]];
|
GVAR(DefuseTaskBaseClass),
|
||||||
private _requiredDefusals = if (_limitSuccess < 0) then { count _ieds } else { _limitSuccess };
|
[
|
||||||
private _maxProtectedLosses = if (_limitFail < 0) then { count _entities } else { _limitFail };
|
_taskID,
|
||||||
private _entitiesDestroyed = 0;
|
createHashMapFromArray [
|
||||||
private _defusedCount = 0;
|
["ieds", GVAR(TaskStore) call ["getTaskEntities", ["ieds", _taskID]]],
|
||||||
private _shouldFail = false;
|
["protected", GVAR(TaskStore) call ["getTaskEntities", ["entities", _taskID]]]
|
||||||
private _shouldSucceed = false;
|
],
|
||||||
private _done = false;
|
_taskParams
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
waitUntil {
|
_task call ["runLoop", []];
|
||||||
sleep 1;
|
|
||||||
GVAR(TaskStore) call ["trackParticipants", [_taskID, _ieds + _entities, "", 250]];
|
|
||||||
|
|
||||||
_entitiesDestroyed = ({ !alive _x } count _entities);
|
|
||||||
_defusedCount = GVAR(TaskStore) call ["getDefuseCount", [_taskID]];
|
|
||||||
_shouldFail = (_maxProtectedLosses > 0) && { _entitiesDestroyed >= _maxProtectedLosses };
|
|
||||||
_shouldSucceed = (_requiredDefusals > 0) && { _defusedCount >= _requiredDefusals } && { (_maxProtectedLosses <= 0) || { _entitiesDestroyed < _maxProtectedLosses } };
|
|
||||||
_done = false;
|
|
||||||
|
|
||||||
if (_shouldFail) then { _result = 1; };
|
|
||||||
if ((_result == 1) or _shouldSucceed) then { _done = true; };
|
|
||||||
|
|
||||||
_done
|
|
||||||
};
|
|
||||||
|
|
||||||
if (_result == 1) then {
|
|
||||||
{ deleteVehicle _x } forEach _ieds;
|
|
||||||
{ deleteVehicle _x } forEach _entities;
|
|
||||||
|
|
||||||
[_taskID, "FAILED"] call BFUNC(taskSetState);
|
|
||||||
GVAR(TaskStore) call ["setTaskStatus", [_taskID, "failed"]];
|
|
||||||
|
|
||||||
sleep 1;
|
|
||||||
|
|
||||||
GVAR(TaskStore) call ["notifyParticipants", [_taskID, "warning", "Tasks", format ["Task failed: %1 reputation", _ratingFail]]];
|
|
||||||
GVAR(TaskStore) call ["applyRatingOutcome", [_taskID, _ratingFail]];
|
|
||||||
|
|
||||||
if (_endFail) then { "EveryoneLost" call BFUNC(endMissionServer); };
|
|
||||||
} else {
|
|
||||||
{ deleteVehicle _x } forEach _ieds;
|
|
||||||
{ deleteVehicle _x } forEach _entities;
|
|
||||||
|
|
||||||
private _rewards = createHashMap;
|
|
||||||
_rewards set ["funds", _companyFunds];
|
|
||||||
|
|
||||||
if (_equipmentRewards isNotEqualTo []) then { _rewards set ["equipment", _equipmentRewards]; };
|
|
||||||
if (_supplyRewards isNotEqualTo []) then { _rewards set ["supplies", _supplyRewards]; };
|
|
||||||
if (_weaponRewards isNotEqualTo []) then { _rewards set ["weapons", _weaponRewards]; };
|
|
||||||
if (_vehicleRewards isNotEqualTo []) then { _rewards set ["vehicles", _vehicleRewards]; };
|
|
||||||
if (_specialRewards isNotEqualTo []) then { _rewards set ["special", _specialRewards]; };
|
|
||||||
|
|
||||||
[_taskID, _rewards] call FUNC(handleTaskRewards);
|
|
||||||
[_taskID, "SUCCEEDED"] call BFUNC(taskSetState);
|
|
||||||
GVAR(TaskStore) call ["setTaskStatus", [_taskID, "succeeded"]];
|
|
||||||
|
|
||||||
sleep 1;
|
|
||||||
|
|
||||||
GVAR(TaskStore) call ["notifyParticipants", [_taskID, "success", "Tasks", format ["Task completed: %1 reputation, $%2 funds", _ratingSuccess, [_companyFunds] call EFUNC(common,formatNumber)]]];
|
|
||||||
GVAR(TaskStore) call ["applyRatingOutcome", [_taskID, _ratingSuccess]];
|
|
||||||
|
|
||||||
if (_endSuccess) then { "EveryoneWon" call BFUNC(endMissionServer); };
|
|
||||||
};
|
|
||||||
|
|
||||||
GVAR(TaskStore) call ["clearTask", [_taskID]];
|
|
||||||
|
|||||||
@ -1,34 +1,7 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Author: IDSolutions
|
* Compatibility adapter for the object-style delivery task implementation.
|
||||||
* Registers a delivery task
|
|
||||||
*
|
|
||||||
* Arguments:
|
|
||||||
* 0: ID of the task <STRING>
|
|
||||||
* 1: Amount of damaged cargo to fail the task <NUMBER>
|
|
||||||
* 2: Amount of cargo delivered to complete the task <NUMBER>
|
|
||||||
* 3: Marker name for the delivery zone <STRING>
|
|
||||||
* 4: Amount of funds the company receives if the task is successful <NUMBER> (default: 0)
|
|
||||||
* 5: Amount of rating the company and player lose if the task is failed <NUMBER> (default: 0)
|
|
||||||
* 6: Amount of rating the company and player receive if the task is successful <NUMBER> (default: 0)
|
|
||||||
* 7: Should the mission end (MissionSuccess) if the task is successful <BOOL> (default: false)
|
|
||||||
* 8: Should the mission end (MissionFailed) if the task is failed <BOOL> (default: false)
|
|
||||||
* 9: Amount of time to complete delivery <NUMBER> (default: 0)
|
|
||||||
* 10: Equipment rewards <ARRAY> (default: [])
|
|
||||||
* 11: Supply rewards <ARRAY> (default: [])
|
|
||||||
* 12: Weapon rewards <ARRAY> (default: [])
|
|
||||||
* 13: Vehicle rewards <ARRAY> (default: [])
|
|
||||||
* 14: Special rewards <ARRAY> (default: [])
|
|
||||||
*
|
|
||||||
* Return Value:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* ["delivery_1", 1, 3, "delivery_zone", 250000, -75, 300, false, false] spawn forge_server_task_fnc_delivery;
|
|
||||||
* ["delivery_1", 1, 3, "delivery_zone", 250000, -75, 300, false, false, 900] spawn forge_server_task_fnc_delivery;
|
|
||||||
*
|
|
||||||
* Public: Yes
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params [
|
params [
|
||||||
@ -43,88 +16,38 @@ params [
|
|||||||
["_endFail", false, [false]],
|
["_endFail", false, [false]],
|
||||||
["_timeLimit", 0, [0]],
|
["_timeLimit", 0, [0]],
|
||||||
["_equipmentRewards", [], [[]]],
|
["_equipmentRewards", [], [[]]],
|
||||||
["_supplyRewards", [], [[]]],
|
["_supplyRewards", [], [[]]],
|
||||||
["_weaponRewards", [], [[]]],
|
["_weaponRewards", [], [[]]],
|
||||||
["_vehicleRewards", [], [[]]],
|
["_vehicleRewards", [], [[]]],
|
||||||
["_specialRewards", [], [[]]]
|
["_specialRewards", [], [[]]]
|
||||||
];
|
];
|
||||||
|
|
||||||
private _result = 0;
|
private _taskParams = createHashMapFromArray [
|
||||||
private _cargo = [];
|
["limitFail", _limitFail],
|
||||||
|
["limitSuccess", _limitSuccess],
|
||||||
|
["deliveryZone", _deliveryZone],
|
||||||
|
["funds", _companyFunds],
|
||||||
|
["ratingFail", _ratingFail],
|
||||||
|
["ratingSuccess", _ratingSuccess],
|
||||||
|
["endSuccess", _endSuccess],
|
||||||
|
["endFail", _endFail],
|
||||||
|
["timeLimit", _timeLimit],
|
||||||
|
["useTaskStore", true]
|
||||||
|
];
|
||||||
|
|
||||||
waitUntil {
|
if (_equipmentRewards isNotEqualTo []) then { _taskParams set ["equipment", _equipmentRewards]; };
|
||||||
sleep 1;
|
if (_supplyRewards isNotEqualTo []) then { _taskParams set ["supplies", _supplyRewards]; };
|
||||||
_cargo = GVAR(TaskStore) call ["getTaskEntities", ["cargo", _taskID]];
|
if (_weaponRewards isNotEqualTo []) then { _taskParams set ["weapons", _weaponRewards]; };
|
||||||
GVAR(TaskStore) call ["trackParticipants", [_taskID, _cargo, _deliveryZone, 125]];
|
if (_vehicleRewards isNotEqualTo []) then { _taskParams set ["vehicles", _vehicleRewards]; };
|
||||||
count _cargo > 0
|
if (_specialRewards isNotEqualTo []) then { _taskParams set ["special", _specialRewards]; };
|
||||||
};
|
|
||||||
|
|
||||||
_cargo = GVAR(TaskStore) call ["getTaskEntities", ["cargo", _taskID]];
|
private _task = createHashMapObject [
|
||||||
|
GVAR(DeliveryTaskBaseClass),
|
||||||
|
[
|
||||||
|
_taskID,
|
||||||
|
createHashMapFromArray [["cargo", GVAR(TaskStore) call ["getTaskEntities", ["cargo", _taskID]]]],
|
||||||
|
_taskParams
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
if (_timeLimit isNotEqualTo 0) then {
|
_task call ["runLoop", []];
|
||||||
waitUntil {
|
|
||||||
sleep 1;
|
|
||||||
GVAR(TaskStore) call ["isTaskAccepted", [_taskID]]
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
private _startTime = if (_timeLimit isNotEqualTo 0) then { floor(time) } else { nil };
|
|
||||||
|
|
||||||
waitUntil {
|
|
||||||
sleep 1;
|
|
||||||
GVAR(TaskStore) call ["trackParticipants", [_taskID, _cargo, _deliveryZone, 125]];
|
|
||||||
|
|
||||||
private _cargoDelivered = ({ _x inArea _deliveryZone && (damage _x) < 0.7 } count _cargo);
|
|
||||||
private _cargoDamaged = ({ damage _x >= 0.7 } count _cargo);
|
|
||||||
|
|
||||||
if (_timeLimit isNotEqualTo 0) then {
|
|
||||||
private _timeExpired = (floor time - _startTime >= _timeLimit);
|
|
||||||
|
|
||||||
if (_cargoDamaged >= _limitFail) then { _result = 1; };
|
|
||||||
if (_cargoDelivered < _limitSuccess && _timeExpired) then { _result = 1; };
|
|
||||||
|
|
||||||
(_result == 1) or ((_cargoDelivered >= _limitSuccess) && (_cargoDamaged < _limitFail))
|
|
||||||
} else {
|
|
||||||
if (_cargoDamaged >= _limitFail) then { _result = 1; };
|
|
||||||
|
|
||||||
(_result == 1) or ((_cargoDelivered >= _limitSuccess) && (_cargoDamaged < _limitFail))
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
if (_result == 1) then {
|
|
||||||
{ deleteVehicle _x } forEach _cargo;
|
|
||||||
|
|
||||||
[_taskID, "FAILED"] call BFUNC(taskSetState);
|
|
||||||
GVAR(TaskStore) call ["setTaskStatus", [_taskID, "failed"]];
|
|
||||||
|
|
||||||
sleep 1;
|
|
||||||
|
|
||||||
GVAR(TaskStore) call ["notifyParticipants", [_taskID, "warning", "Tasks", format ["Task failed: %1 reputation", _ratingFail]]];
|
|
||||||
GVAR(TaskStore) call ["applyRatingOutcome", [_taskID, _ratingFail]];
|
|
||||||
GVAR(TaskStore) call ["clearTask", [_taskID]];
|
|
||||||
|
|
||||||
if (_endFail) then { "EveryoneLost" call BFUNC(endMissionServer); };
|
|
||||||
} else {
|
|
||||||
{ deleteVehicle _x } forEach _cargo;
|
|
||||||
|
|
||||||
private _rewards = createHashMap;
|
|
||||||
_rewards set ["funds", _companyFunds];
|
|
||||||
|
|
||||||
if (_equipmentRewards isNotEqualTo []) then { _rewards set ["equipment", _equipmentRewards]; };
|
|
||||||
if (_supplyRewards isNotEqualTo []) then { _rewards set ["supplies", _supplyRewards]; };
|
|
||||||
if (_weaponRewards isNotEqualTo []) then { _rewards set ["weapons", _weaponRewards]; };
|
|
||||||
if (_vehicleRewards isNotEqualTo []) then { _rewards set ["vehicles", _vehicleRewards]; };
|
|
||||||
if (_specialRewards isNotEqualTo []) then { _rewards set ["special", _specialRewards]; };
|
|
||||||
|
|
||||||
[_taskID, _rewards] call FUNC(handleTaskRewards);
|
|
||||||
[_taskID, "SUCCEEDED"] call BFUNC(taskSetState);
|
|
||||||
GVAR(TaskStore) call ["setTaskStatus", [_taskID, "succeeded"]];
|
|
||||||
|
|
||||||
sleep 1;
|
|
||||||
|
|
||||||
GVAR(TaskStore) call ["notifyParticipants", [_taskID, "success", "Tasks", format ["Task completed: %1 reputation, $%2 funds", _ratingSuccess, [_companyFunds] call EFUNC(common,formatNumber)]]];
|
|
||||||
GVAR(TaskStore) call ["applyRatingOutcome", [_taskID, _ratingSuccess]];
|
|
||||||
GVAR(TaskStore) call ["clearTask", [_taskID]];
|
|
||||||
|
|
||||||
if (_endSuccess) then { "EveryoneWon" call BFUNC(endMissionServer); };
|
|
||||||
};
|
|
||||||
|
|||||||
@ -1,124 +1,51 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Author: IDSolutions
|
* Compatibility adapter for the object-style destroy task implementation.
|
||||||
* Registers an destroy task
|
|
||||||
*
|
|
||||||
* Arguments:
|
|
||||||
* 0: ID of the task <STRING>
|
|
||||||
* 1: Amount of targets escaped to fail the task <NUMBER>
|
|
||||||
* 2: Amount of targets eliminated to complete the task <NUMBER>
|
|
||||||
* 3: Amount of funds the company recieves if the task is successful <NUMBER> (default: 0)
|
|
||||||
* 4: Amount of rating the company and player lose if the task is failed <NUMBER> (default: 0)
|
|
||||||
* 5: Amount of rating the company and player recieve if the task is successful <NUMBER> (default: 0)
|
|
||||||
* 6: Should the mission end (MissionSuccess) if the task is successful <BOOL> (default: false)
|
|
||||||
* 7: Should the mission end (MissionFailed) if the task is failed <BOOL> (default: false)
|
|
||||||
* 8: Amount of time before target(s) escape <NUMBER> (default: 0, 0 = no limit)
|
|
||||||
* 9: Equipment rewards <ARRAY> (default: [])
|
|
||||||
* 10: Supply rewards <ARRAY> (default: [])
|
|
||||||
* 11: Weapon rewards <ARRAY> (default: [])
|
|
||||||
* 12: Vehicle rewards <ARRAY> (default: [])
|
|
||||||
* 13: Special rewards <ARRAY> (default: [])
|
|
||||||
*
|
|
||||||
* Return Value:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* ["task_name", 1, 2, 250000, -75, 300, false, false] spawn forge_server_task_fnc_destroy;
|
|
||||||
* ["task_name", 1, 2, 250000, -75, 300, false, false, 45] spawn forge_server_task_fnc_destroy;
|
|
||||||
*
|
|
||||||
* Public: Yes
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params [
|
params [
|
||||||
["_taskID", "", [""]],
|
["_taskID", "", [""]],
|
||||||
["_limitFail", -1, [0]],
|
["_limitFail", -1, [0]],
|
||||||
["_limitSuccess", -1, [0]],
|
["_limitSuccess", -1, [0]],
|
||||||
["_companyFunds", 0, [0]],
|
["_companyFunds", 0, [0]],
|
||||||
["_ratingFail", 0, [0]],
|
["_ratingFail", 0, [0]],
|
||||||
["_ratingSuccess", 0, [0]],
|
["_ratingSuccess", 0, [0]],
|
||||||
["_endSuccess", false, [false]],
|
["_endSuccess", false, [false]],
|
||||||
["_endFail", false, [false]],
|
["_endFail", false, [false]],
|
||||||
["_timeLimit", 0, [0]],
|
["_timeLimit", 0, [0]],
|
||||||
["_equipmentRewards", [], [[]]],
|
["_equipmentRewards", [], [[]]],
|
||||||
["_supplyRewards", [], [[]]],
|
["_supplyRewards", [], [[]]],
|
||||||
["_weaponRewards", [], [[]]],
|
["_weaponRewards", [], [[]]],
|
||||||
["_vehicleRewards", [], [[]]],
|
["_vehicleRewards", [], [[]]],
|
||||||
["_specialRewards", [], [[]]]
|
["_specialRewards", [], [[]]]
|
||||||
];
|
];
|
||||||
|
|
||||||
private _result = 0;
|
private _taskParams = createHashMapFromArray [
|
||||||
private _targets = [];
|
["limitFail", _limitFail],
|
||||||
|
["limitSuccess", _limitSuccess],
|
||||||
|
["funds", _companyFunds],
|
||||||
|
["ratingFail", _ratingFail],
|
||||||
|
["ratingSuccess", _ratingSuccess],
|
||||||
|
["endSuccess", _endSuccess],
|
||||||
|
["endFail", _endFail],
|
||||||
|
["timeLimit", _timeLimit],
|
||||||
|
["useTaskStore", true]
|
||||||
|
];
|
||||||
|
|
||||||
waitUntil {
|
if (_equipmentRewards isNotEqualTo []) then { _taskParams set ["equipment", _equipmentRewards]; };
|
||||||
sleep 1;
|
if (_supplyRewards isNotEqualTo []) then { _taskParams set ["supplies", _supplyRewards]; };
|
||||||
_targets = GVAR(TaskStore) call ["getTaskEntities", ["targets", _taskID]];
|
if (_weaponRewards isNotEqualTo []) then { _taskParams set ["weapons", _weaponRewards]; };
|
||||||
GVAR(TaskStore) call ["trackParticipants", [_taskID, _targets, "", 300]];
|
if (_vehicleRewards isNotEqualTo []) then { _taskParams set ["vehicles", _vehicleRewards]; };
|
||||||
count _targets > 0
|
if (_specialRewards isNotEqualTo []) then { _taskParams set ["special", _specialRewards]; };
|
||||||
};
|
|
||||||
|
|
||||||
_targets = GVAR(TaskStore) call ["getTaskEntities", ["targets", _taskID]];
|
private _task = createHashMapObject [
|
||||||
|
GVAR(DestroyTaskBaseClass),
|
||||||
|
[
|
||||||
|
_taskID,
|
||||||
|
createHashMapFromArray [["targets", GVAR(TaskStore) call ["getTaskEntities", ["targets", _taskID]]]],
|
||||||
|
_taskParams
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
if (_timeLimit isNotEqualTo 0) then {
|
_task call ["runLoop", []];
|
||||||
waitUntil {
|
|
||||||
sleep 1;
|
|
||||||
GVAR(TaskStore) call ["isTaskAccepted", [_taskID]]
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
private _startTime = if (_timeLimit isNotEqualTo 0) then { floor(time) } else { nil };
|
|
||||||
|
|
||||||
waitUntil {
|
|
||||||
sleep 1;
|
|
||||||
GVAR(TaskStore) call ["trackParticipants", [_taskID, _targets, "", 300]];
|
|
||||||
|
|
||||||
private _targetsDestroyed = ({ !alive _x } count _targets);
|
|
||||||
|
|
||||||
if (_timeLimit isNotEqualTo 0) then {
|
|
||||||
private _timeExpired = (floor time - _startTime >= _timeLimit);
|
|
||||||
|
|
||||||
if (_targetsDestroyed < _limitSuccess && _timeExpired) then { _result = 1; };
|
|
||||||
|
|
||||||
(_result == 1) or (_targetsDestroyed >= _limitSuccess)
|
|
||||||
} else {
|
|
||||||
(_targetsDestroyed >= _limitSuccess)
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
if (_result == 1) then {
|
|
||||||
{ deleteVehicle _x } forEach _targets;
|
|
||||||
|
|
||||||
[_taskID, "FAILED"] call BFUNC(taskSetState);
|
|
||||||
GVAR(TaskStore) call ["setTaskStatus", [_taskID, "failed"]];
|
|
||||||
|
|
||||||
sleep 1;
|
|
||||||
|
|
||||||
GVAR(TaskStore) call ["notifyParticipants", [_taskID, "warning", "Tasks", format ["Task failed: %1 reputation", _ratingFail]]];
|
|
||||||
GVAR(TaskStore) call ["applyRatingOutcome", [_taskID, _ratingFail]];
|
|
||||||
GVAR(TaskStore) call ["clearTask", [_taskID]];
|
|
||||||
|
|
||||||
if (_endFail) then { "EveryoneLost" call BFUNC(endMissionServer); };
|
|
||||||
} else {
|
|
||||||
{ deleteVehicle _x } forEach _targets;
|
|
||||||
|
|
||||||
private _rewards = createHashMap;
|
|
||||||
_rewards set ["funds", _companyFunds];
|
|
||||||
|
|
||||||
if (_equipmentRewards isNotEqualTo []) then { _rewards set ["equipment", _equipmentRewards]; };
|
|
||||||
if (_supplyRewards isNotEqualTo []) then { _rewards set ["supplies", _supplyRewards]; };
|
|
||||||
if (_weaponRewards isNotEqualTo []) then { _rewards set ["weapons", _weaponRewards]; };
|
|
||||||
if (_vehicleRewards isNotEqualTo []) then { _rewards set ["vehicles", _vehicleRewards]; };
|
|
||||||
if (_specialRewards isNotEqualTo []) then { _rewards set ["special", _specialRewards]; };
|
|
||||||
|
|
||||||
[_taskID, _rewards] call FUNC(handleTaskRewards);
|
|
||||||
[_taskID, "SUCCEEDED"] call BFUNC(taskSetState);
|
|
||||||
GVAR(TaskStore) call ["setTaskStatus", [_taskID, "succeeded"]];
|
|
||||||
|
|
||||||
sleep 1;
|
|
||||||
|
|
||||||
GVAR(TaskStore) call ["notifyParticipants", [_taskID, "success", "Tasks", format ["Task completed: %1 reputation, $%2 funds", _ratingSuccess, [_companyFunds] call EFUNC(common,formatNumber)]]];
|
|
||||||
GVAR(TaskStore) call ["applyRatingOutcome", [_taskID, _ratingSuccess]];
|
|
||||||
GVAR(TaskStore) call ["clearTask", [_taskID]];
|
|
||||||
|
|
||||||
if (_endSuccess) then { "EveryoneWon" call BFUNC(endMissionServer); };
|
|
||||||
};
|
|
||||||
|
|||||||
@ -1,186 +1,62 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Author: IDSolutions
|
* Compatibility adapter for the object-style hostage task implementation.
|
||||||
* Registers an hostage task
|
|
||||||
*
|
|
||||||
* Arguments:
|
|
||||||
* 0: ID of the task <STRING>
|
|
||||||
* 1: Amount of hostages KIA to fail the task <NUMBER>
|
|
||||||
* 2: Amount of hostages rescued to complete the task <NUMBER>
|
|
||||||
* 3: Marker name for the extraction zone <STRING>
|
|
||||||
* 4: Amount of funds the company recieves if the task is successful <NUMBER> (default: 0)
|
|
||||||
* 5: Amount of rating the company and player lose if the task is failed <NUMBER> (default: 0)
|
|
||||||
* 6: Amount of rating the company and player recieve if the task is successful <NUMBER> (default: 0)
|
|
||||||
* 7: Subcategory of task <ARRAY> (default: [false, true])
|
|
||||||
* 8: Should the mission end (MissionSuccess) if the task is successful <BOOL> (default: false)
|
|
||||||
* 9: Should the mission end (MissionFailed) if the task is failed <BOOL> (default: false)
|
|
||||||
* 10: Amount of time before hostage(s) are executed <NUMBER> (default: 0, 0 = no limit)
|
|
||||||
* 11: Marker name for the cbrn zone <STRING> (default: "")
|
|
||||||
* 12: Equipment rewards <ARRAY> (default: [])
|
|
||||||
* 13: Supply rewards <ARRAY> (default: [])
|
|
||||||
* 14: Weapon rewards <ARRAY> (default: [])
|
|
||||||
* 15: Vehicle rewards <ARRAY> (default: [])
|
|
||||||
* 16: Special rewards <ARRAY> (default: [])
|
|
||||||
*
|
|
||||||
* Return Value:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* ["task_name", 1, 2, "marker_name", 1500000, -75, 500, [false, true], false, false] spawn forge_server_task_fnc_hostage;
|
|
||||||
* ["task_name", 1, 2, "marker_name", 1500000, -75, 500, [false, true], false, false, 45] spawn forge_server_task_fnc_hostage;
|
|
||||||
* ["task_name", 1, 2, "marker_name", 1500000, -75, 500, [true, false], false, false, 45, "marker_name"] spawn forge_server_task_fnc_hostage;
|
|
||||||
*
|
|
||||||
* Public: Yes
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params [
|
params [
|
||||||
["_taskID", ""],
|
["_taskID", "", [""]],
|
||||||
["_limitFail", -1],
|
["_limitFail", -1, [0]],
|
||||||
["_limitSuccess", -1],
|
["_limitSuccess", -1, [0]],
|
||||||
["_extZone", ""],
|
["_extZone", "", [""]],
|
||||||
["_companyFunds", 0],
|
["_companyFunds", 0, [0]],
|
||||||
["_ratingFail", 0],
|
["_ratingFail", 0, [0]],
|
||||||
["_ratingSuccess", 0],
|
["_ratingSuccess", 0, [0]],
|
||||||
["_type", [["_cbrn", false, [false]], ["_hostage", true, [false]]]],
|
["_type", [false, true], [[]]],
|
||||||
["_endSuccess", false, [false]],
|
["_endSuccess", false, [false]],
|
||||||
["_endFail", false, [false]],
|
["_endFail", false, [false]],
|
||||||
["_timeLimit", 0, [0]],
|
["_timeLimit", 0, [0]],
|
||||||
["_cbrnZone", "", [""]],
|
["_cbrnZone", "", [""]],
|
||||||
["_equipmentRewards", [], [[]]],
|
["_equipmentRewards", [], [[]]],
|
||||||
["_supplyRewards", [], [[]]],
|
["_supplyRewards", [], [[]]],
|
||||||
["_weaponRewards", [], [[]]],
|
["_weaponRewards", [], [[]]],
|
||||||
["_vehicleRewards", [], [[]]],
|
["_vehicleRewards", [], [[]]],
|
||||||
["_specialRewards", [], [[]]]
|
["_specialRewards", [], [[]]]
|
||||||
];
|
];
|
||||||
|
|
||||||
private _cbrn = (_this select 7) select 0;
|
private _taskParams = createHashMapFromArray [
|
||||||
private _hostage = (_this select 7) select 1;
|
["limitFail", _limitFail],
|
||||||
private _result = 0;
|
["limitSuccess", _limitSuccess],
|
||||||
private _hostages = [];
|
["extractionZone", _extZone],
|
||||||
private _shooters = [];
|
["funds", _companyFunds],
|
||||||
|
["ratingFail", _ratingFail],
|
||||||
|
["ratingSuccess", _ratingSuccess],
|
||||||
|
["type", _type],
|
||||||
|
["cbrn", _type param [0, false, [false]]],
|
||||||
|
["execution", _type param [1, true, [false]]],
|
||||||
|
["endSuccess", _endSuccess],
|
||||||
|
["endFail", _endFail],
|
||||||
|
["timeLimit", _timeLimit],
|
||||||
|
["cbrnZone", _cbrnZone],
|
||||||
|
["useTaskStore", true]
|
||||||
|
];
|
||||||
|
|
||||||
waitUntil {
|
if (_equipmentRewards isNotEqualTo []) then { _taskParams set ["equipment", _equipmentRewards]; };
|
||||||
sleep 1;
|
if (_supplyRewards isNotEqualTo []) then { _taskParams set ["supplies", _supplyRewards]; };
|
||||||
_hostages = GVAR(TaskStore) call ["getTaskEntities", ["hostages", _taskID]];
|
if (_weaponRewards isNotEqualTo []) then { _taskParams set ["weapons", _weaponRewards]; };
|
||||||
count _hostages > 0
|
if (_vehicleRewards isNotEqualTo []) then { _taskParams set ["vehicles", _vehicleRewards]; };
|
||||||
};
|
if (_specialRewards isNotEqualTo []) then { _taskParams set ["special", _specialRewards]; };
|
||||||
|
|
||||||
waitUntil {
|
private _task = createHashMapObject [
|
||||||
sleep 1;
|
GVAR(HostageTaskBaseClass),
|
||||||
_shooters = GVAR(TaskStore) call ["getTaskEntities", ["shooters", _taskID]];
|
[
|
||||||
GVAR(TaskStore) call ["trackParticipants", [_taskID, _hostages + _shooters, _extZone, 250]];
|
_taskID,
|
||||||
count _shooters > 0
|
createHashMapFromArray [
|
||||||
};
|
["hostages", GVAR(TaskStore) call ["getTaskEntities", ["hostages", _taskID]]],
|
||||||
|
["shooters", GVAR(TaskStore) call ["getTaskEntities", ["shooters", _taskID]]]
|
||||||
|
],
|
||||||
|
_taskParams
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
_hostages = GVAR(TaskStore) call ["getTaskEntities", ["hostages", _taskID]];
|
_task call ["runLoop", []];
|
||||||
_shooters = GVAR(TaskStore) call ["getTaskEntities", ["shooters", _taskID]];
|
|
||||||
private _requiredRescues = if (_limitSuccess < 0) then { count _hostages } else { _limitSuccess };
|
|
||||||
private _maxHostageLosses = if (_limitFail < 0) then { count _hostages } else { _limitFail };
|
|
||||||
|
|
||||||
if (_timeLimit isNotEqualTo 0) then {
|
|
||||||
waitUntil {
|
|
||||||
sleep 1;
|
|
||||||
GVAR(TaskStore) call ["isTaskAccepted", [_taskID]]
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
private _startTime = if (_timeLimit isNotEqualTo 0) then { floor(time) } else { nil };
|
|
||||||
|
|
||||||
waitUntil {
|
|
||||||
sleep 1;
|
|
||||||
GVAR(TaskStore) call ["trackParticipants", [_taskID, _hostages + _shooters, _extZone, 250]];
|
|
||||||
|
|
||||||
private _hostagesInZone = ({ _x inArea _extZone } count _hostages);
|
|
||||||
private _hostagesKilled = ({ !alive _x } count _hostages);
|
|
||||||
private _shootersAlive = ({ alive _x } count _shooters);
|
|
||||||
private _hostageSucceeded = (_hostagesInZone >= _requiredRescues) && { _hostagesKilled < _maxHostageLosses };
|
|
||||||
private _shootersClearedSucceeded = (!isNil "_shooters") && { _shootersAlive <= 0 } && { _hostageSucceeded };
|
|
||||||
|
|
||||||
if (_timeLimit isNotEqualTo 0) then {
|
|
||||||
private _timeExpired = (floor time - _startTime >= _timeLimit);
|
|
||||||
|
|
||||||
if (!_hostageSucceeded && _timeExpired) then { _result = 1; };
|
|
||||||
if (_hostagesKilled >= _maxHostageLosses) then { _result = 1; };
|
|
||||||
|
|
||||||
(_result == 1) or
|
|
||||||
_hostageSucceeded or
|
|
||||||
_shootersClearedSucceeded
|
|
||||||
} else {
|
|
||||||
if (_hostagesKilled >= _maxHostageLosses) then { _result = 1; };
|
|
||||||
|
|
||||||
(_result == 1) or
|
|
||||||
_hostageSucceeded or
|
|
||||||
_shootersClearedSucceeded
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
if (_result == 1) then {
|
|
||||||
if (_cbrn) then {
|
|
||||||
"SmokeShellYellow" createVehicle getMarkerPos _cbrnZone;
|
|
||||||
|
|
||||||
sleep 5;
|
|
||||||
|
|
||||||
{
|
|
||||||
if (captive _x) then {
|
|
||||||
_x setDamage 0.9;
|
|
||||||
_x playMove "acts_executionvictim_kill_end";
|
|
||||||
|
|
||||||
sleep 2.75;
|
|
||||||
|
|
||||||
_x setDamage 1;
|
|
||||||
}
|
|
||||||
} forEach _hostages;
|
|
||||||
};
|
|
||||||
|
|
||||||
if (_hostage) then {
|
|
||||||
{
|
|
||||||
_x enableAIFeature ["MOVE", true];
|
|
||||||
_x playMove "";
|
|
||||||
} forEach _shooters;
|
|
||||||
|
|
||||||
sleep 1;
|
|
||||||
|
|
||||||
{ _x setCaptive false; } forEach _hostages;
|
|
||||||
|
|
||||||
sleep 5;
|
|
||||||
};
|
|
||||||
|
|
||||||
{ deleteVehicle _x } forEach _hostages;
|
|
||||||
{ deleteVehicle _x } forEach _shooters;
|
|
||||||
|
|
||||||
[_taskID, "FAILED"] call BFUNC(taskSetState);
|
|
||||||
GVAR(TaskStore) call ["setTaskStatus", [_taskID, "failed"]];
|
|
||||||
|
|
||||||
sleep 1;
|
|
||||||
|
|
||||||
GVAR(TaskStore) call ["notifyParticipants", [_taskID, "warning", "Tasks", format ["Task failed: %1 reputation", _ratingFail]]];
|
|
||||||
GVAR(TaskStore) call ["applyRatingOutcome", [_taskID, _ratingFail]];
|
|
||||||
GVAR(TaskStore) call ["clearTask", [_taskID]];
|
|
||||||
|
|
||||||
if (_endFail) then { "EveryoneLost" call BFUNC(endMissionServer); };
|
|
||||||
} else {
|
|
||||||
{ deleteVehicle _x } forEach _hostages;
|
|
||||||
{ deleteVehicle _x } forEach _shooters;
|
|
||||||
|
|
||||||
private _rewards = createHashMap;
|
|
||||||
_rewards set ["funds", _companyFunds];
|
|
||||||
|
|
||||||
if (_equipmentRewards isNotEqualTo []) then { _rewards set ["equipment", _equipmentRewards]; };
|
|
||||||
if (_supplyRewards isNotEqualTo []) then { _rewards set ["supplies", _supplyRewards]; };
|
|
||||||
if (_weaponRewards isNotEqualTo []) then { _rewards set ["weapons", _weaponRewards]; };
|
|
||||||
if (_vehicleRewards isNotEqualTo []) then { _rewards set ["vehicles", _vehicleRewards]; };
|
|
||||||
if (_specialRewards isNotEqualTo []) then { _rewards set ["special", _specialRewards]; };
|
|
||||||
|
|
||||||
[_taskID, _rewards] call FUNC(handleTaskRewards);
|
|
||||||
[_taskID, "SUCCEEDED"] call BFUNC(taskSetState);
|
|
||||||
GVAR(TaskStore) call ["setTaskStatus", [_taskID, "succeeded"]];
|
|
||||||
|
|
||||||
sleep 1;
|
|
||||||
|
|
||||||
GVAR(TaskStore) call ["notifyParticipants", [_taskID, "success", "Tasks", format ["Task completed: %1 reputation, $%2 funds", _ratingSuccess, [_companyFunds] call EFUNC(common,formatNumber)]]];
|
|
||||||
GVAR(TaskStore) call ["applyRatingOutcome", [_taskID, _ratingSuccess]];
|
|
||||||
GVAR(TaskStore) call ["clearTask", [_taskID]];
|
|
||||||
|
|
||||||
if (_endSuccess) then { "EveryoneWon" call BFUNC(endMissionServer); };
|
|
||||||
};
|
|
||||||
|
|||||||
@ -1,141 +1,56 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Author: IDSolutions
|
* Compatibility adapter for the object-style HVT task implementation.
|
||||||
* Registers an hvt task
|
|
||||||
*
|
|
||||||
* Arguments:
|
|
||||||
* 0: ID of the task <STRING>
|
|
||||||
* 1: Amount of HVTs KIA to fail the task <NUMBER>
|
|
||||||
* 2: Amount of HVTs Captured or KIA to complete the task <NUMBER>
|
|
||||||
* 3: Marker name for the extraction zone <STRING>
|
|
||||||
* 4: Amount of funds the company recieves if the task is successful <NUMBER> (default: 0)
|
|
||||||
* 5: Amount of rating the company and player lose if the task is failed <NUMBER> (default: 0)
|
|
||||||
* 6: Amount of rating the company and player recieve if the task is successful <NUMBER> (default: 0)
|
|
||||||
* 7: Subcategory of task <ARRAY> (default: [true, false])
|
|
||||||
* 8: Should the mission end (MissionSuccess) if the task is successful <BOOL> (default: false)
|
|
||||||
* 9: Should the mission end (MissionFailed) if the task is failed <BOOL> (default: false)
|
|
||||||
* 10: Amount of time before HVT task fails <NUMBER> (default: 0, 0 = no limit)
|
|
||||||
* 11: Equipment rewards <ARRAY> (default: [])
|
|
||||||
* 12: Supply rewards <ARRAY> (default: [])
|
|
||||||
* 13: Weapon rewards <ARRAY> (default: [])
|
|
||||||
* 14: Vehicle rewards <ARRAY> (default: [])
|
|
||||||
* 15: Special rewards <ARRAY> (default: [])
|
|
||||||
*
|
|
||||||
* Return Value:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* ["task_name", 1, 1, "marker_name", 500000, -75, 300, [true, false], false, false] spawn forge_server_task_fnc_hvt;
|
|
||||||
* ["task_name", -1, 1, "", 500000, -75, 300, [false, true], false, false] spawn forge_server_task_fnc_hvt;
|
|
||||||
* ["task_name", 1, 1, "marker_name", 500000, -75, 300, [true, false], false, false, 45] spawn forge_server_task_fnc_hvt;
|
|
||||||
* ["task_name", -1, 1, "", 500000, -75, 300, [false, true], false, false, 45] spawn forge_server_task_fnc_hvt;
|
|
||||||
*
|
|
||||||
* Public: Yes
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params [
|
params [
|
||||||
["_taskID", "", [""]],
|
["_taskID", "", [""]],
|
||||||
["_limitFail", -1, [0]],
|
["_limitFail", -1, [0]],
|
||||||
["_limitSuccess", -1, [0]],
|
["_limitSuccess", -1, [0]],
|
||||||
["_extZone", "", [""]],
|
["_extZone", "", [""]],
|
||||||
["_companyFunds", 0, [0]],
|
["_companyFunds", 0, [0]],
|
||||||
["_ratingFail", 0, [0]],
|
["_ratingFail", 0, [0]],
|
||||||
["_ratingSuccess", 0, [0]],
|
["_ratingSuccess", 0, [0]],
|
||||||
["_type", [["_capture", true, [false]], ["_eliminate", false, [false]]]],
|
["_type", [true, false], [[]]],
|
||||||
["_endSuccess", false, [false]],
|
["_endSuccess", false, [false]],
|
||||||
["_endFail", false, [false]],
|
["_endFail", false, [false]],
|
||||||
["_timeLimit", 0, [0]],
|
["_timeLimit", 0, [0]],
|
||||||
["_equipmentRewards", [], [[]]],
|
["_equipmentRewards", [], [[]]],
|
||||||
["_supplyRewards", [], [[]]],
|
["_supplyRewards", [], [[]]],
|
||||||
["_weaponRewards", [], [[]]],
|
["_weaponRewards", [], [[]]],
|
||||||
["_vehicleRewards", [], [[]]],
|
["_vehicleRewards", [], [[]]],
|
||||||
["_specialRewards", [], [[]]]
|
["_specialRewards", [], [[]]]
|
||||||
];
|
];
|
||||||
|
|
||||||
private _capture = (_this select 7) select 0;
|
private _taskParams = createHashMapFromArray [
|
||||||
private _eliminate = (_this select 7) select 1;
|
["limitFail", _limitFail],
|
||||||
private _result = 0;
|
["limitSuccess", _limitSuccess],
|
||||||
private _hvts = [];
|
["extractionZone", _extZone],
|
||||||
|
["funds", _companyFunds],
|
||||||
|
["ratingFail", _ratingFail],
|
||||||
|
["ratingSuccess", _ratingSuccess],
|
||||||
|
["type", _type],
|
||||||
|
["captureHvt", _type param [0, true, [false]]],
|
||||||
|
["endSuccess", _endSuccess],
|
||||||
|
["endFail", _endFail],
|
||||||
|
["timeLimit", _timeLimit],
|
||||||
|
["useTaskStore", true]
|
||||||
|
];
|
||||||
|
|
||||||
waitUntil {
|
if (_equipmentRewards isNotEqualTo []) then { _taskParams set ["equipment", _equipmentRewards]; };
|
||||||
sleep 1;
|
if (_supplyRewards isNotEqualTo []) then { _taskParams set ["supplies", _supplyRewards]; };
|
||||||
_hvts = GVAR(TaskStore) call ["getTaskEntities", ["hvts", _taskID]];
|
if (_weaponRewards isNotEqualTo []) then { _taskParams set ["weapons", _weaponRewards]; };
|
||||||
GVAR(TaskStore) call ["trackParticipants", [_taskID, _hvts, _extZone, 250]];
|
if (_vehicleRewards isNotEqualTo []) then { _taskParams set ["vehicles", _vehicleRewards]; };
|
||||||
count _hvts > 0
|
if (_specialRewards isNotEqualTo []) then { _taskParams set ["special", _specialRewards]; };
|
||||||
};
|
|
||||||
|
|
||||||
_hvts = GVAR(TaskStore) call ["getTaskEntities", ["hvts", _taskID]];
|
private _task = createHashMapObject [
|
||||||
private _requiredHvts = if (_limitSuccess < 0) then { count _hvts } else { _limitSuccess };
|
GVAR(HVTTaskBaseClass),
|
||||||
private _maxHvtLosses = if (_limitFail < 0) then { count _hvts } else { _limitFail };
|
[
|
||||||
|
_taskID,
|
||||||
|
createHashMapFromArray [["hvts", GVAR(TaskStore) call ["getTaskEntities", ["hvts", _taskID]]]],
|
||||||
|
_taskParams
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
if (_timeLimit isNotEqualTo 0) then {
|
_task call ["runLoop", []];
|
||||||
waitUntil {
|
|
||||||
sleep 1;
|
|
||||||
GVAR(TaskStore) call ["isTaskAccepted", [_taskID]]
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
private _startTime = if (_timeLimit isNotEqualTo 0) then { floor(time) } else { nil };
|
|
||||||
|
|
||||||
waitUntil {
|
|
||||||
sleep 1;
|
|
||||||
GVAR(TaskStore) call ["trackParticipants", [_taskID, _hvts, _extZone, 250]];
|
|
||||||
|
|
||||||
private _hvtsKilled = ({ !alive _x } count _hvts);
|
|
||||||
private _hvtsInZone = ({ _x inArea _extZone } count _hvts);
|
|
||||||
private _captureSucceeded = _capture && { _hvtsInZone >= _requiredHvts } && { _hvtsKilled < _maxHvtLosses };
|
|
||||||
private _eliminateSucceeded = _eliminate && { _hvtsKilled >= _requiredHvts };
|
|
||||||
|
|
||||||
if (_timeLimit isNotEqualTo 0) then {
|
|
||||||
private _timeExpired = (floor time - _startTime >= _timeLimit);
|
|
||||||
|
|
||||||
if (_capture && { _hvtsKilled >= _maxHvtLosses }) then { _result = 1; };
|
|
||||||
if (_capture && { !_captureSucceeded } && { _timeExpired }) then { _result = 1; };
|
|
||||||
if (_eliminate && { !_eliminateSucceeded } && { _timeExpired }) then { _result = 1; };
|
|
||||||
|
|
||||||
(_result == 1) or _captureSucceeded or _eliminateSucceeded
|
|
||||||
} else {
|
|
||||||
if (_capture && { _hvtsKilled >= _maxHvtLosses }) then { _result = 1; };
|
|
||||||
|
|
||||||
(_result == 1) or _captureSucceeded or _eliminateSucceeded
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
if (_result == 1) then {
|
|
||||||
{ deleteVehicle _x } forEach _hvts;
|
|
||||||
|
|
||||||
[_taskID, "FAILED"] call BFUNC(taskSetState);
|
|
||||||
GVAR(TaskStore) call ["setTaskStatus", [_taskID, "failed"]];
|
|
||||||
|
|
||||||
sleep 1;
|
|
||||||
|
|
||||||
GVAR(TaskStore) call ["notifyParticipants", [_taskID, "warning", "Tasks", format ["Task failed: %1 reputation", _ratingFail]]];
|
|
||||||
GVAR(TaskStore) call ["applyRatingOutcome", [_taskID, _ratingFail]];
|
|
||||||
GVAR(TaskStore) call ["clearTask", [_taskID]];
|
|
||||||
|
|
||||||
if (_endFail) then { "EveryoneLost" call BFUNC(endMissionServer); };
|
|
||||||
} else {
|
|
||||||
{ deleteVehicle _x } forEach _hvts;
|
|
||||||
|
|
||||||
private _rewards = createHashMap;
|
|
||||||
_rewards set ["funds", _companyFunds];
|
|
||||||
|
|
||||||
if (_equipmentRewards isNotEqualTo []) then { _rewards set ["equipment", _equipmentRewards]; };
|
|
||||||
if (_supplyRewards isNotEqualTo []) then { _rewards set ["supplies", _supplyRewards]; };
|
|
||||||
if (_weaponRewards isNotEqualTo []) then { _rewards set ["weapons", _weaponRewards]; };
|
|
||||||
if (_vehicleRewards isNotEqualTo []) then { _rewards set ["vehicles", _vehicleRewards]; };
|
|
||||||
if (_specialRewards isNotEqualTo []) then { _rewards set ["special", _specialRewards]; };
|
|
||||||
|
|
||||||
[_taskID, _rewards] call FUNC(handleTaskRewards);
|
|
||||||
[_taskID, "SUCCEEDED"] call BFUNC(taskSetState);
|
|
||||||
GVAR(TaskStore) call ["setTaskStatus", [_taskID, "succeeded"]];
|
|
||||||
|
|
||||||
sleep 1;
|
|
||||||
|
|
||||||
GVAR(TaskStore) call ["notifyParticipants", [_taskID, "success", "Tasks", format ["Task completed: %1 reputation, $%2 funds", _ratingSuccess, [_companyFunds] call EFUNC(common,formatNumber)]]];
|
|
||||||
GVAR(TaskStore) call ["applyRatingOutcome", [_taskID, _ratingSuccess]];
|
|
||||||
GVAR(TaskStore) call ["clearTask", [_taskID]];
|
|
||||||
|
|
||||||
if (_endSuccess) then { "EveryoneWon" call BFUNC(endMissionServer); };
|
|
||||||
};
|
|
||||||
|
|||||||
@ -1,41 +1,22 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Author: IDSolutions
|
* Assigns cargo to a task for delivery.
|
||||||
* Assigns cargo to a task for delivery
|
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Public compatibility adapter around CargoEntityController.
|
||||||
* 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_server_task_fnc_makeCargo;
|
|
||||||
*
|
|
||||||
* Public: Yes
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params [["_cargo", objNull, [objNull]], ["_taskID", "", [""]]];
|
params [["_cargo", objNull, [objNull]], ["_taskID", "", [""]]];
|
||||||
|
|
||||||
["INFO", format ["Make Cargo: %1", _this]] call EFUNC(common,log);
|
["INFO", format ["Make Cargo: %1", _this]] call EFUNC(common,log);
|
||||||
|
|
||||||
if (isNull _cargo) exitWith { ["ERROR", "Attempt to create cargo from null object"] call EFUNC(common,log); };
|
if (isNull _cargo) exitWith { ["ERROR", "Attempt to create cargo from null object"] call EFUNC(common,log); false };
|
||||||
if (_taskID == "") exitWith { ["ERROR", "No task ID provided for cargo"] call EFUNC(common,log); };
|
if (_taskID isEqualTo "") exitWith { ["ERROR", "No task ID provided for cargo"] call EFUNC(common,log); false };
|
||||||
|
|
||||||
SETPVAR(_cargo,assignedTask,_taskID);
|
private _controller = createHashMapObject [
|
||||||
GVAR(TaskStore) call ["registerTaskEntity", ["cargo", _taskID, _cargo]];
|
GVAR(CargoEntityController),
|
||||||
|
[_taskID, _cargo, createHashMap]
|
||||||
|
];
|
||||||
|
|
||||||
_cargo addEventHandler ["Dammaged", {
|
if !(_controller call ["registerTaskEntity", ["cargo"]]) exitWith { false };
|
||||||
params ["_unit", "_hitSelection", "_damage", "_hitPartIndex", "_hitPoint", "_shooter", "_projectile"];
|
_controller call ["watchDamage", []]
|
||||||
|
|
||||||
if (damage _unit >= 0.7) then {
|
|
||||||
private _taskID = GETVAR(_unit,assignedTask,"");
|
|
||||||
if (_taskID isEqualTo "") exitWith {};
|
|
||||||
if (_unit getVariable [QGVAR(cargoDamageWarned), false]) exitWith {};
|
|
||||||
|
|
||||||
_unit setVariable [QGVAR(cargoDamageWarned), true];
|
|
||||||
GVAR(TaskStore) call ["notifyParticipants", [_taskID, "warning", "Tasks", format ["Cargo for task %1 has been severely damaged.", _taskID]]];
|
|
||||||
};
|
|
||||||
}];
|
|
||||||
|
|||||||
@ -1,30 +1,23 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Author: IDSolutions
|
* Assigns an AI unit to a task as an HVT.
|
||||||
* Assigns an AI unit to a task as a hvt
|
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Public compatibility adapter around HVTEntityController.
|
||||||
* 0: The AI unit <OBJECT>
|
|
||||||
* 1: ID of the task <STRING>
|
|
||||||
*
|
|
||||||
* Return Value:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* [this, "task_name"] spawn forge_server_task_fnc_makeHVT;
|
|
||||||
*
|
|
||||||
* Public: Yes
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params [["_entity", objNull, [objNull, grpNull]], ["_taskID", "", [""]]];
|
params [["_entity", objNull, [objNull, grpNull]], ["_taskID", "", [""]]];
|
||||||
|
|
||||||
if (isNull _entity) exitWith { ["ERROR", "Attempt to create entity from null object"] call EFUNC(common,log); };
|
if (isNull _entity) exitWith { ["ERROR", "Attempt to create entity from null object"] call EFUNC(common,log); false };
|
||||||
if (_taskID == "") exitWith { ["ERROR", "No task ID provided for entity"] call EFUNC(common,log); };
|
if (_taskID isEqualTo "") exitWith { ["ERROR", "No task ID provided for entity"] call EFUNC(common,log); false };
|
||||||
|
|
||||||
["INFO", format ["Make HVT: %1", _this]] call EFUNC(common,log);
|
["INFO", format ["Make HVT: %1", _this]] call EFUNC(common,log);
|
||||||
|
|
||||||
SETVAR(_entity,assignedTask,_taskID);
|
private _controller = createHashMapObject [
|
||||||
GVAR(TaskStore) call ["registerTaskEntity", ["hvts", _taskID, _entity]];
|
GVAR(HVTEntityController),
|
||||||
|
[_taskID, _entity, createHashMap]
|
||||||
|
];
|
||||||
|
|
||||||
if (alive _entity) then { [_entity, "hvt"] spawn FUNC(heartBeat); };
|
_controller call ["registerTaskEntity", ["hvts"]];
|
||||||
|
|
||||||
|
true
|
||||||
|
|||||||
@ -1,35 +1,24 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Author: IDSolutions
|
* Assigns an AI unit to a task as a hostage.
|
||||||
* Assigns an AI unit to a task as a hostage
|
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Public compatibility adapter around HostageEntityController. The hostage
|
||||||
* 0: The AI unit <OBJECT>
|
* task instance owns the rescue loop, so this helper only registers and
|
||||||
* 1: ID of the task <STRING>
|
* applies initial state.
|
||||||
*
|
|
||||||
* Return Value:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* [this, "task_name"] spawn forge_server_task_fnc_makeHostage;
|
|
||||||
*
|
|
||||||
* Public: Yes
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params [["_entity", objNull, [objNull, grpNull]], ["_taskID", "", [""]]];
|
params [["_entity", objNull, [objNull, grpNull]], ["_taskID", "", [""]]];
|
||||||
|
|
||||||
if (isNull _entity) exitWith { ["ERROR", "Attempt to create entity from null object"] call EFUNC(common,log); };
|
if (isNull _entity) exitWith { ["ERROR", "Attempt to create entity from null object"] call EFUNC(common,log); false };
|
||||||
if (_taskID == "") exitWith { ["ERROR", "No task ID provided for entity"] call EFUNC(common,log); };
|
if (_taskID isEqualTo "") exitWith { ["ERROR", "No task ID provided for entity"] call EFUNC(common,log); false };
|
||||||
|
|
||||||
["INFO", format ["Make Hostage: %1", _this]] call EFUNC(common,log);
|
["INFO", format ["Make Hostage: %1", _this]] call EFUNC(common,log);
|
||||||
|
|
||||||
SETVAR(_entity,assignedTask,_taskID);
|
private _controller = createHashMapObject [
|
||||||
GVAR(TaskStore) call ["registerTaskEntity", ["hostages", _taskID, _entity]];
|
GVAR(HostageEntityController),
|
||||||
|
[_taskID, _entity, createHashMap]
|
||||||
|
];
|
||||||
|
|
||||||
if (alive _entity) then {
|
if !(_controller call ["registerTaskEntity", ["hostages"]]) exitWith { false };
|
||||||
_entity setCaptive true;
|
_controller call ["applyInitialState", []]
|
||||||
_entity enableAIFeature ["MOVE", false];
|
|
||||||
|
|
||||||
[_entity, "hostage"] spawn FUNC(heartBeat);
|
|
||||||
};
|
|
||||||
|
|||||||
@ -1,32 +1,26 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Author: IDSolutions
|
* Assigns an IED to a task and starts its required countdown timer.
|
||||||
* Assigns an IED to a task and starts its required countdown timer
|
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Public compatibility adapter around IEDEntityController.
|
||||||
* 0: The object <OBJECT>
|
|
||||||
* 1: ID of the task <STRING>
|
|
||||||
* 2: Countdown timer in seconds <NUMBER> (must be greater than 0)
|
|
||||||
*
|
|
||||||
* Return Value:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* [this, "task_name", 30] spawn forge_server_task_fnc_makeIED;
|
|
||||||
*
|
|
||||||
* Public: Yes
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params [["_entity", objNull, [objNull]], ["_taskID", "", [""]], ["_time", 0, [0]]];
|
params [["_entity", objNull, [objNull]], ["_taskID", "", [""]], ["_time", 0, [0]]];
|
||||||
|
|
||||||
if (isNull _entity) exitWith { ["ERROR", "Attempt to create entity from null object"] call EFUNC(common,log); };
|
if (isNull _entity) exitWith { ["ERROR", "Attempt to create entity from null object"] call EFUNC(common,log); false };
|
||||||
if (_taskID == "") exitWith { ["ERROR", "No task ID provided for entity"] call EFUNC(common,log); };
|
if (_taskID isEqualTo "") exitWith { ["ERROR", "No task ID provided for entity"] call EFUNC(common,log); false };
|
||||||
if (_time <= 0) exitWith { ["ERROR", "Invalid time provided for IED"] call EFUNC(common,log); };
|
if (_time <= 0) exitWith { ["ERROR", "Invalid time provided for IED"] call EFUNC(common,log); false };
|
||||||
|
|
||||||
["INFO", format ["Make IED: %1", _this]] call EFUNC(common,log);
|
["INFO", format ["Make IED: %1", _this]] call EFUNC(common,log);
|
||||||
|
|
||||||
SETPVAR(_entity,assignedTask,_taskID);
|
_entity setVariable [QGVAR(iedCountdown), _time, true];
|
||||||
GVAR(TaskStore) call ["registerTaskEntity", ["ieds", _taskID, _entity]];
|
|
||||||
|
|
||||||
if (alive _entity) then { [_entity, "ied", _time] spawn FUNC(heartBeat); };
|
private _controller = createHashMapObject [
|
||||||
|
GVAR(IEDEntityController),
|
||||||
|
[_taskID, _entity, createHashMapFromArray [["countdown", _time]]]
|
||||||
|
];
|
||||||
|
|
||||||
|
_controller call ["registerTaskEntity", ["ieds"]];
|
||||||
|
|
||||||
|
true
|
||||||
|
|||||||
@ -1,28 +1,21 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Author: IDSolutions
|
* Assigns an object to a task as a protected target.
|
||||||
* Assigns an object to a task as a protected target
|
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Public compatibility adapter around ProtectedEntityController.
|
||||||
* 0: The object <OBJECT>
|
|
||||||
* 1: ID of the task <STRING>
|
|
||||||
*
|
|
||||||
* Return Value:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* [this, "task_name"] spawn forge_server_task_fnc_makeObject;
|
|
||||||
*
|
|
||||||
* Public: Yes
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params [["_entity", objNull, [objNull]], ["_taskID", "", [""]]];
|
params [["_entity", objNull, [objNull]], ["_taskID", "", [""]]];
|
||||||
|
|
||||||
if (isNull _entity) exitWith { ["ERROR", "Attempt to create entity from null object"] call EFUNC(common,log); };
|
if (isNull _entity) exitWith { ["ERROR", "Attempt to create entity from null object"] call EFUNC(common,log); false };
|
||||||
if (_taskID == "") exitWith { ["ERROR", "No task ID provided for entity"] call EFUNC(common,log); };
|
if (_taskID isEqualTo "") exitWith { ["ERROR", "No task ID provided for entity"] call EFUNC(common,log); false };
|
||||||
|
|
||||||
["INFO", format ["Make Object: %1", _this]] call EFUNC(common,log);
|
["INFO", format ["Make Object: %1", _this]] call EFUNC(common,log);
|
||||||
|
|
||||||
SETPVAR(_entity,assignedTask,_taskID);
|
private _controller = createHashMapObject [
|
||||||
GVAR(TaskStore) call ["registerTaskEntity", ["entities", _taskID, _entity]];
|
GVAR(ProtectedEntityController),
|
||||||
|
[_taskID, _entity, createHashMap]
|
||||||
|
];
|
||||||
|
|
||||||
|
_controller call ["registerTaskEntity", ["entities"]]
|
||||||
|
|||||||
@ -1,28 +1,21 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Author: IDSolutions
|
* Assigns an AI unit to a task as a shooter.
|
||||||
* Assigns an AI unit to a task as a shooter
|
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Public compatibility adapter around ShooterEntityController.
|
||||||
* 0: The AI unit <OBJECT>
|
|
||||||
* 1: ID of the task <STRING>
|
|
||||||
*
|
|
||||||
* Return Value:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* [this, "task_name"] spawn forge_server_task_fnc_makeShooter;
|
|
||||||
*
|
|
||||||
* Public: Yes
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params [["_entity", objNull, [objNull, grpNull]], ["_taskID", "", [""]]];
|
params [["_entity", objNull, [objNull, grpNull]], ["_taskID", "", [""]]];
|
||||||
|
|
||||||
if (isNull _entity) exitWith { ["ERROR", "Attempt to create entity from null object"] call EFUNC(common,log); };
|
if (isNull _entity) exitWith { ["ERROR", "Attempt to create entity from null object"] call EFUNC(common,log); false };
|
||||||
if (_taskID == "") exitWith { ["ERROR", "No task ID provided for entity"] call EFUNC(common,log); };
|
if (_taskID isEqualTo "") exitWith { ["ERROR", "No task ID provided for entity"] call EFUNC(common,log); false };
|
||||||
|
|
||||||
["INFO", format ["Make Shooter: %1", _this]] call EFUNC(common,log);
|
["INFO", format ["Make Shooter: %1", _this]] call EFUNC(common,log);
|
||||||
|
|
||||||
SETVAR(_entity,assignedTask,_taskID);
|
private _controller = createHashMapObject [
|
||||||
GVAR(TaskStore) call ["registerTaskEntity", ["shooters", _taskID, _entity]];
|
GVAR(ShooterEntityController),
|
||||||
|
[_taskID, _entity, createHashMap]
|
||||||
|
];
|
||||||
|
|
||||||
|
_controller call ["registerTaskEntity", ["shooters"]]
|
||||||
|
|||||||
@ -1,28 +1,21 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Author: IDSolutions
|
* Assigns an object to a task as a target.
|
||||||
* Assigns an object to a task as a target
|
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Public compatibility adapter around TargetEntityController.
|
||||||
* 0: The object <OBJECT>
|
|
||||||
* 1: ID of the task <STRING>
|
|
||||||
*
|
|
||||||
* Return Value:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* [this, "task_name"] spawn forge_server_task_fnc_makeTarget;
|
|
||||||
*
|
|
||||||
* Public: Yes
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params [["_entity", objNull, [objNull, grpNull]], ["_taskID", "", [""]]];
|
params [["_entity", objNull, [objNull, grpNull]], ["_taskID", "", [""]]];
|
||||||
|
|
||||||
if (isNull _entity) exitWith { ["ERROR", "Attempt to create entity from null object"] call EFUNC(common,log); };
|
if (isNull _entity) exitWith { ["ERROR", "Attempt to create entity from null object"] call EFUNC(common,log); false };
|
||||||
if (_taskID == "") exitWith { ["ERROR", "No task ID provided for entity"] call EFUNC(common,log); };
|
if (_taskID isEqualTo "") exitWith { ["ERROR", "No task ID provided for entity"] call EFUNC(common,log); false };
|
||||||
|
|
||||||
["INFO", format ["Make Target: %1", _this]] call EFUNC(common,log);
|
["INFO", format ["Make Target: %1", _this]] call EFUNC(common,log);
|
||||||
|
|
||||||
SETVAR(_entity,assignedTask,_taskID);
|
private _controller = createHashMapObject [
|
||||||
GVAR(TaskStore) call ["registerTaskEntity", ["targets", _taskID, _entity]];
|
GVAR(TargetEntityController),
|
||||||
|
[_taskID, _entity, createHashMap]
|
||||||
|
];
|
||||||
|
|
||||||
|
_controller call ["registerTaskEntity", ["targets"]]
|
||||||
|
|||||||
62
arma/server/addons/task/functions/objects/README.md
Normal file
62
arma/server/addons/task/functions/objects/README.md
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
# Task Objects
|
||||||
|
|
||||||
|
This folder documents the active `createHashMapObject` task instances and entity
|
||||||
|
controllers. Their source lives under `functions/objects/`, and each class is
|
||||||
|
initialized directly from `XEH_preInit.sqf`.
|
||||||
|
|
||||||
|
Current task objects:
|
||||||
|
- `TaskInstanceBaseClass`
|
||||||
|
- `EntityControllerBaseClass`
|
||||||
|
- `TargetEntityController`
|
||||||
|
- `ShooterEntityController`
|
||||||
|
- `AttackTaskBaseClass`
|
||||||
|
- `HostageTaskBaseClass`
|
||||||
|
- `HostageEntityController`
|
||||||
|
- `HVTEntityController`
|
||||||
|
- `CargoEntityController`
|
||||||
|
- `ProtectedEntityController`
|
||||||
|
- `IEDEntityController`
|
||||||
|
- `DefenseEnemyController`
|
||||||
|
- `DefuseTaskBaseClass`
|
||||||
|
- `DestroyTaskBaseClass`
|
||||||
|
- `DeliveryTaskBaseClass`
|
||||||
|
- `HVTTaskBaseClass`
|
||||||
|
- `DefendTaskBaseClass`
|
||||||
|
|
||||||
|
Source entry points:
|
||||||
|
- [fnc_TaskInstanceBaseClass.sqf](./fnc_TaskInstanceBaseClass.sqf)
|
||||||
|
- [fnc_EntityControllerBaseClass.sqf](./fnc_EntityControllerBaseClass.sqf)
|
||||||
|
- [fnc_TargetEntityController.sqf](./fnc_TargetEntityController.sqf)
|
||||||
|
- [fnc_ShooterEntityController.sqf](./fnc_ShooterEntityController.sqf)
|
||||||
|
- [fnc_AttackTaskBaseClass.sqf](./fnc_AttackTaskBaseClass.sqf)
|
||||||
|
- [fnc_HostageTaskBaseClass.sqf](./fnc_HostageTaskBaseClass.sqf)
|
||||||
|
- [fnc_HostageEntityController.sqf](./fnc_HostageEntityController.sqf)
|
||||||
|
- [fnc_HVTEntityController.sqf](./fnc_HVTEntityController.sqf)
|
||||||
|
- [fnc_CargoEntityController.sqf](./fnc_CargoEntityController.sqf)
|
||||||
|
- [fnc_ProtectedEntityController.sqf](./fnc_ProtectedEntityController.sqf)
|
||||||
|
- [fnc_IEDEntityController.sqf](./fnc_IEDEntityController.sqf)
|
||||||
|
- [fnc_DefenseEnemyController.sqf](./fnc_DefenseEnemyController.sqf)
|
||||||
|
- [fnc_DefuseTaskBaseClass.sqf](./fnc_DefuseTaskBaseClass.sqf)
|
||||||
|
- [fnc_DestroyTaskBaseClass.sqf](./fnc_DestroyTaskBaseClass.sqf)
|
||||||
|
- [fnc_DeliveryTaskBaseClass.sqf](./fnc_DeliveryTaskBaseClass.sqf)
|
||||||
|
- [fnc_HVTTaskBaseClass.sqf](./fnc_HVTTaskBaseClass.sqf)
|
||||||
|
- [fnc_DefendTaskBaseClass.sqf](./fnc_DefendTaskBaseClass.sqf)
|
||||||
|
|
||||||
|
Purpose:
|
||||||
|
- keep per-task instance state in task objects
|
||||||
|
- keep per-entity behavior in controller objects
|
||||||
|
- separate state ownership from long procedural function flows
|
||||||
|
- keep shared lifecycle and reward initialization in `TaskInstanceBaseClass`
|
||||||
|
- so concrete task objects only define task-specific state
|
||||||
|
- keep heartbeat-style AI/object behavior in separate entity controllers instead
|
||||||
|
of mixing it into task outcome loops
|
||||||
|
|
||||||
|
Important design choice:
|
||||||
|
- these objects use explicit `markSucceeded`, `markFailed`, and `cleanup`
|
||||||
|
methods instead of relying on `#delete`
|
||||||
|
- task loops that use `sleep` or `waitUntil` with `sleep` must be started from
|
||||||
|
scheduled code, typically via `spawn`
|
||||||
|
|
||||||
|
That is intentional. `createHashMapObject` destructor timing is reference-based,
|
||||||
|
so `#delete` is not a good primitive for mission-critical task completion or
|
||||||
|
reward flow.
|
||||||
@ -1,13 +1,13 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Review-only prototype attack task class.
|
* Object-style attack task class.
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* call compile preprocessFileLineNumbers
|
* call compile preprocessFileLineNumbers
|
||||||
* "\forge\forge_server\addons\task\prototypes\TaskInstanceBaseClass.sqf";
|
* "\forge\forge_server\addons\task\objects\TaskInstanceBaseClass.sqf";
|
||||||
* call compile preprocessFileLineNumbers
|
* call compile preprocessFileLineNumbers
|
||||||
* "\forge\forge_server\addons\task\prototypes\AttackTaskBaseClass.sqf";
|
* "\forge\forge_server\addons\task\objects\AttackTaskBaseClass.sqf";
|
||||||
*
|
*
|
||||||
* private _task = createHashMapObject [
|
* private _task = createHashMapObject [
|
||||||
* GVAR(AttackTaskBaseClass),
|
* GVAR(AttackTaskBaseClass),
|
||||||
@ -1,7 +1,7 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Review-only prototype delivery cargo entity controller.
|
* Object-style delivery cargo entity controller.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma hemtt ignore_variables ["_self"]
|
#pragma hemtt ignore_variables ["_self"]
|
||||||
@ -23,7 +23,7 @@ GVAR(CargoEntityController) = createHashMapFromArray [
|
|||||||
["#delete", compileFinal {
|
["#delete", compileFinal {
|
||||||
_self call ["cleanup", []];
|
_self call ["cleanup", []];
|
||||||
}],
|
}],
|
||||||
["installDamageWarningHandler", compileFinal {
|
["watchDamage", compileFinal {
|
||||||
private _entity = _self getOrDefault ["entity", objNull];
|
private _entity = _self getOrDefault ["entity", objNull];
|
||||||
if (isNull _entity) exitWith { false };
|
if (isNull _entity) exitWith { false };
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ GVAR(CargoEntityController) = createHashMapFromArray [
|
|||||||
false
|
false
|
||||||
};
|
};
|
||||||
|
|
||||||
_self call ["installDamageWarningHandler", []];
|
_self call ["watchDamage", []];
|
||||||
_self call ["markActive", []];
|
_self call ["markActive", []];
|
||||||
|
|
||||||
waitUntil {
|
waitUntil {
|
||||||
@ -1,7 +1,7 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Review-only prototype defend task class.
|
* Object-style defend task class.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma hemtt ignore_variables ["_self"]
|
#pragma hemtt ignore_variables ["_self"]
|
||||||
@ -1,7 +1,7 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Review-only prototype defense enemy controller.
|
* Object-style defense enemy controller.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma hemtt ignore_variables ["_self"]
|
#pragma hemtt ignore_variables ["_self"]
|
||||||
@ -1,13 +1,13 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Review-only prototype defuse task class.
|
* Object-style defuse task class.
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* call compile preprocessFileLineNumbers
|
* call compile preprocessFileLineNumbers
|
||||||
* "\forge\forge_server\addons\task\prototypes\TaskInstanceBaseClass.sqf";
|
* "\forge\forge_server\addons\task\objects\TaskInstanceBaseClass.sqf";
|
||||||
* call compile preprocessFileLineNumbers
|
* call compile preprocessFileLineNumbers
|
||||||
* "\forge\forge_server\addons\task\prototypes\DefuseTaskBaseClass.sqf";
|
* "\forge\forge_server\addons\task\objects\DefuseTaskBaseClass.sqf";
|
||||||
*
|
*
|
||||||
* private _task = createHashMapObject [
|
* private _task = createHashMapObject [
|
||||||
* GVAR(DefuseTaskBaseClass),
|
* GVAR(DefuseTaskBaseClass),
|
||||||
@ -64,12 +64,89 @@ GVAR(DefuseTaskBaseClass) = createHashMapFromArray [
|
|||||||
_self set ["iedTimer", _taskParams getOrDefault ["iedTimer", 300]];
|
_self set ["iedTimer", _taskParams getOrDefault ["iedTimer", 300]];
|
||||||
_self set ["useTaskStore", _taskParams getOrDefault ["useTaskStore", false]];
|
_self set ["useTaskStore", _taskParams getOrDefault ["useTaskStore", false]];
|
||||||
_self set ["localDefuseCount", _taskParams getOrDefault ["localDefuseCount", 0]];
|
_self set ["localDefuseCount", _taskParams getOrDefault ["localDefuseCount", 0]];
|
||||||
|
_self set ["iedControllers", []];
|
||||||
|
|
||||||
_self call ["registerInstance", []];
|
_self call ["registerInstance", []];
|
||||||
}],
|
}],
|
||||||
["#delete", compileFinal {
|
["#delete", compileFinal {
|
||||||
_self call ["unregisterInstance", []];
|
_self call ["unregisterInstance", []];
|
||||||
}],
|
}],
|
||||||
|
["refreshEntitiesFromStore", compileFinal {
|
||||||
|
private _taskID = _self getOrDefault ["taskID", ""];
|
||||||
|
if (_taskID isEqualTo "" || { !(_self getOrDefault ["useTaskStore", false]) }) exitWith { false };
|
||||||
|
|
||||||
|
private _ieds = GVAR(TaskStore) call ["getTaskEntities", ["ieds", _taskID]];
|
||||||
|
private _protected = GVAR(TaskStore) call ["getTaskEntities", ["entities", _taskID]];
|
||||||
|
_self set ["ieds", _ieds];
|
||||||
|
_self set ["protected", _protected];
|
||||||
|
|
||||||
|
private _taskParams = _self getOrDefault ["taskParams", createHashMap];
|
||||||
|
private _requiredDefusals = _taskParams getOrDefault ["limitSuccess", -1];
|
||||||
|
if (_requiredDefusals < 0) then { _requiredDefusals = count _ieds; };
|
||||||
|
|
||||||
|
private _maxProtectedLosses = _taskParams getOrDefault ["limitFail", -1];
|
||||||
|
if (_maxProtectedLosses < 0) then { _maxProtectedLosses = count _protected; };
|
||||||
|
|
||||||
|
_self set ["requiredDefusals", _requiredDefusals];
|
||||||
|
_self set ["maxProtectedLosses", _maxProtectedLosses];
|
||||||
|
true
|
||||||
|
}],
|
||||||
|
["trackParticipants", compileFinal {
|
||||||
|
private _taskID = _self getOrDefault ["taskID", ""];
|
||||||
|
if (_taskID isEqualTo "" || { !(_self getOrDefault ["useTaskStore", false]) }) exitWith { false };
|
||||||
|
|
||||||
|
GVAR(TaskStore) call ["trackParticipants", [_taskID, (_self getOrDefault ["ieds", []]) + (_self getOrDefault ["protected", []]), "", 250]];
|
||||||
|
true
|
||||||
|
}],
|
||||||
|
["waitForRequiredEntities", compileFinal {
|
||||||
|
if (_self getOrDefault ["useTaskStore", false]) then {
|
||||||
|
waitUntil {
|
||||||
|
sleep 1;
|
||||||
|
_self call ["refreshEntitiesFromStore", []];
|
||||||
|
count (_self getOrDefault ["ieds", []]) > 0
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
waitUntil {
|
||||||
|
sleep 1;
|
||||||
|
count (_self getOrDefault ["ieds", []]) > 0
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
true
|
||||||
|
}],
|
||||||
|
["startIedControllers", compileFinal {
|
||||||
|
if ((_self getOrDefault ["iedControllers", []]) isNotEqualTo []) exitWith { true };
|
||||||
|
|
||||||
|
private _taskID = _self getOrDefault ["taskID", ""];
|
||||||
|
private _defaultCountdown = _self getOrDefault ["iedTimer", 300];
|
||||||
|
private _controllers = [];
|
||||||
|
|
||||||
|
{
|
||||||
|
if (!isNull _x) then {
|
||||||
|
private _countdown = _x getVariable [QGVAR(iedCountdown), _defaultCountdown];
|
||||||
|
private _controller = createHashMapObject [
|
||||||
|
GVAR(IEDEntityController),
|
||||||
|
[
|
||||||
|
_taskID,
|
||||||
|
_x,
|
||||||
|
createHashMapFromArray [
|
||||||
|
["countdown", _countdown],
|
||||||
|
["waitForAcceptance", true]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
_controllers pushBack _controller;
|
||||||
|
[_controller] spawn {
|
||||||
|
params ["_controller"];
|
||||||
|
_controller call ["runLoop", []];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach (_self getOrDefault ["ieds", []]);
|
||||||
|
|
||||||
|
_self set ["iedControllers", _controllers];
|
||||||
|
true
|
||||||
|
}],
|
||||||
["countProtectedDestroyed", compileFinal {
|
["countProtectedDestroyed", compileFinal {
|
||||||
private _protected = _self getOrDefault ["protected", []];
|
private _protected = _self getOrDefault ["protected", []];
|
||||||
{ !alive _x } count _protected
|
{ !alive _x } count _protected
|
||||||
@ -156,9 +233,12 @@ GVAR(DefuseTaskBaseClass) = createHashMapFromArray [
|
|||||||
true
|
true
|
||||||
}],
|
}],
|
||||||
["runLoop", compileFinal {
|
["runLoop", compileFinal {
|
||||||
|
_self call ["waitForRequiredEntities", []];
|
||||||
|
_self call ["startIedControllers", []];
|
||||||
_self call ["markActive", []];
|
_self call ["markActive", []];
|
||||||
|
|
||||||
while { (_self call ["getStatus", []]) isEqualTo "active" } do {
|
while { (_self call ["getStatus", []]) isEqualTo "active" } do {
|
||||||
|
_self call ["trackParticipants", []];
|
||||||
private _snapshot = _self call ["tick", []];
|
private _snapshot = _self call ["tick", []];
|
||||||
|
|
||||||
if (_snapshot getOrDefault ["shouldFail", false]) exitWith {
|
if (_snapshot getOrDefault ["shouldFail", false]) exitWith {
|
||||||
@ -1,7 +1,7 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Review-only prototype delivery task class.
|
* Object-style delivery task class.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma hemtt ignore_variables ["_self"]
|
#pragma hemtt ignore_variables ["_self"]
|
||||||
@ -1,7 +1,7 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Review-only prototype destroy task class.
|
* Object-style destroy task class.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma hemtt ignore_variables ["_self"]
|
#pragma hemtt ignore_variables ["_self"]
|
||||||
@ -1,11 +1,11 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Review-only prototype base class for object-based entity controllers.
|
* Object-style base class for object-based entity controllers.
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* call compile preprocessFileLineNumbers
|
* call compile preprocessFileLineNumbers
|
||||||
* "\forge\forge_server\addons\task\prototypes\EntityControllerBaseClass.sqf";
|
* "\forge\forge_server\addons\task\objects\EntityControllerBaseClass.sqf";
|
||||||
*
|
*
|
||||||
* private _controller = createHashMapObject [
|
* private _controller = createHashMapObject [
|
||||||
* GVAR(EntityControllerBaseClass),
|
* GVAR(EntityControllerBaseClass),
|
||||||
@ -105,9 +105,9 @@ GVAR(EntityControllerBaseClass) = createHashMapFromArray [
|
|||||||
private _registryKey = _self call ["getRegistryKey", []];
|
private _registryKey = _self call ["getRegistryKey", []];
|
||||||
if (_registryKey isEqualTo "") exitWith { false };
|
if (_registryKey isEqualTo "") exitWith { false };
|
||||||
|
|
||||||
private _registry = missionNamespace getVariable [QGVAR(PrototypeControllerInstances), createHashMap];
|
private _registry = missionNamespace getVariable [QGVAR(ObjectControllerInstances), createHashMap];
|
||||||
_registry set [_registryKey, _self];
|
_registry set [_registryKey, _self];
|
||||||
missionNamespace setVariable [QGVAR(PrototypeControllerInstances), _registry];
|
missionNamespace setVariable [QGVAR(ObjectControllerInstances), _registry];
|
||||||
missionNamespace setVariable [_registryKey, _self];
|
missionNamespace setVariable [_registryKey, _self];
|
||||||
true
|
true
|
||||||
}],
|
}],
|
||||||
@ -115,7 +115,7 @@ GVAR(EntityControllerBaseClass) = createHashMapFromArray [
|
|||||||
private _registryKey = _self call ["getRegistryKey", []];
|
private _registryKey = _self call ["getRegistryKey", []];
|
||||||
if (_registryKey isEqualTo "") exitWith { false };
|
if (_registryKey isEqualTo "") exitWith { false };
|
||||||
|
|
||||||
private _registry = missionNamespace getVariable [QGVAR(PrototypeControllerInstances), createHashMap];
|
private _registry = missionNamespace getVariable [QGVAR(ObjectControllerInstances), createHashMap];
|
||||||
_registry deleteAt _registryKey;
|
_registry deleteAt _registryKey;
|
||||||
missionNamespace setVariable [_registryKey, nil];
|
missionNamespace setVariable [_registryKey, nil];
|
||||||
true
|
true
|
||||||
@ -1,7 +1,7 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Review-only prototype HVT entity controller.
|
* Object-style HVT entity controller.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma hemtt ignore_variables ["_self"]
|
#pragma hemtt ignore_variables ["_self"]
|
||||||
@ -1,7 +1,7 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Review-only prototype HVT task class.
|
* Object-style HVT task class.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma hemtt ignore_variables ["_self"]
|
#pragma hemtt ignore_variables ["_self"]
|
||||||
@ -42,6 +42,7 @@ GVAR(HVTTaskBaseClass) = createHashMapFromArray [
|
|||||||
_self set ["eliminate", _eliminate];
|
_self set ["eliminate", _eliminate];
|
||||||
_self set ["timeLimit", _taskParams getOrDefault ["timeLimit", 0]];
|
_self set ["timeLimit", _taskParams getOrDefault ["timeLimit", 0]];
|
||||||
_self set ["useTaskStore", _taskParams getOrDefault ["useTaskStore", false]];
|
_self set ["useTaskStore", _taskParams getOrDefault ["useTaskStore", false]];
|
||||||
|
_self set ["hvtControllers", []];
|
||||||
|
|
||||||
_self call ["registerInstance", []];
|
_self call ["registerInstance", []];
|
||||||
}],
|
}],
|
||||||
@ -90,6 +91,30 @@ GVAR(HVTTaskBaseClass) = createHashMapFromArray [
|
|||||||
_self set ["maxKilled", _maxKilled];
|
_self set ["maxKilled", _maxKilled];
|
||||||
true
|
true
|
||||||
}],
|
}],
|
||||||
|
["startHvtControllers", compileFinal {
|
||||||
|
if ((_self getOrDefault ["hvtControllers", []]) isNotEqualTo []) exitWith { true };
|
||||||
|
|
||||||
|
private _taskID = _self getOrDefault ["taskID", ""];
|
||||||
|
private _controllers = [];
|
||||||
|
|
||||||
|
{
|
||||||
|
if (!isNull _x) then {
|
||||||
|
private _controller = createHashMapObject [
|
||||||
|
GVAR(HVTEntityController),
|
||||||
|
[_taskID, _x, createHashMapFromArray [["captureRadius", 2]]]
|
||||||
|
];
|
||||||
|
|
||||||
|
_controllers pushBack _controller;
|
||||||
|
[_controller] spawn {
|
||||||
|
params ["_controller"];
|
||||||
|
_controller call ["runLoop", []];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach (_self getOrDefault ["hvts", []]);
|
||||||
|
|
||||||
|
_self set ["hvtControllers", _controllers];
|
||||||
|
true
|
||||||
|
}],
|
||||||
["waitForAssignmentIfTimed", compileFinal {
|
["waitForAssignmentIfTimed", compileFinal {
|
||||||
private _timeLimit = _self getOrDefault ["timeLimit", 0];
|
private _timeLimit = _self getOrDefault ["timeLimit", 0];
|
||||||
private _taskID = _self getOrDefault ["taskID", ""];
|
private _taskID = _self getOrDefault ["taskID", ""];
|
||||||
@ -185,6 +210,7 @@ GVAR(HVTTaskBaseClass) = createHashMapFromArray [
|
|||||||
}],
|
}],
|
||||||
["runLoop", compileFinal {
|
["runLoop", compileFinal {
|
||||||
_self call ["waitForRequiredEntities", []];
|
_self call ["waitForRequiredEntities", []];
|
||||||
|
_self call ["startHvtControllers", []];
|
||||||
_self call ["waitForAssignmentIfTimed", []];
|
_self call ["waitForAssignmentIfTimed", []];
|
||||||
_self call ["markActive", []];
|
_self call ["markActive", []];
|
||||||
|
|
||||||
@ -1,13 +1,13 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Review-only prototype hostage entity controller.
|
* Object-style hostage entity controller.
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* call compile preprocessFileLineNumbers
|
* call compile preprocessFileLineNumbers
|
||||||
* "\forge\forge_server\addons\task\prototypes\EntityControllerBaseClass.sqf";
|
* "\forge\forge_server\addons\task\objects\EntityControllerBaseClass.sqf";
|
||||||
* call compile preprocessFileLineNumbers
|
* call compile preprocessFileLineNumbers
|
||||||
* "\forge\forge_server\addons\task\prototypes\HostageEntityController.sqf";
|
* "\forge\forge_server\addons\task\objects\HostageEntityController.sqf";
|
||||||
*
|
*
|
||||||
* private _controller = createHashMapObject [
|
* private _controller = createHashMapObject [
|
||||||
* GVAR(HostageEntityController),
|
* GVAR(HostageEntityController),
|
||||||
@ -1,13 +1,13 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Review-only prototype hostage task class.
|
* Object-style hostage task class.
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* call compile preprocessFileLineNumbers
|
* call compile preprocessFileLineNumbers
|
||||||
* "\forge\forge_server\addons\task\prototypes\TaskInstanceBaseClass.sqf";
|
* "\forge\forge_server\addons\task\objects\TaskInstanceBaseClass.sqf";
|
||||||
* call compile preprocessFileLineNumbers
|
* call compile preprocessFileLineNumbers
|
||||||
* "\forge\forge_server\addons\task\prototypes\HostageTaskBaseClass.sqf";
|
* "\forge\forge_server\addons\task\objects\HostageTaskBaseClass.sqf";
|
||||||
*
|
*
|
||||||
* private _task = createHashMapObject [
|
* private _task = createHashMapObject [
|
||||||
* GVAR(HostageTaskBaseClass),
|
* GVAR(HostageTaskBaseClass),
|
||||||
@ -1,7 +1,7 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Review-only prototype IED entity controller.
|
* Object-style IED entity controller.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma hemtt ignore_variables ["_self"]
|
#pragma hemtt ignore_variables ["_self"]
|
||||||
@ -1,7 +1,7 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Review-only prototype protected entity controller.
|
* Object-style protected entity controller.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma hemtt ignore_variables ["_self"]
|
#pragma hemtt ignore_variables ["_self"]
|
||||||
@ -1,7 +1,7 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Review-only prototype shooter entity controller.
|
* Object-style shooter entity controller.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma hemtt ignore_variables ["_self"]
|
#pragma hemtt ignore_variables ["_self"]
|
||||||
@ -1,7 +1,7 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Review-only prototype target entity controller.
|
* Object-style target entity controller.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma hemtt ignore_variables ["_self"]
|
#pragma hemtt ignore_variables ["_self"]
|
||||||
@ -1,11 +1,11 @@
|
|||||||
#include "..\script_component.hpp"
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Review-only prototype base class for object-based task instances.
|
* Object-style base class for object-based task instances.
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* call compile preprocessFileLineNumbers
|
* call compile preprocessFileLineNumbers
|
||||||
* "\forge\forge_server\addons\task\prototypes\TaskInstanceBaseClass.sqf";
|
* "\forge\forge_server\addons\task\objects\TaskInstanceBaseClass.sqf";
|
||||||
*
|
*
|
||||||
* private _task = createHashMapObject [
|
* private _task = createHashMapObject [
|
||||||
* GVAR(TaskInstanceBaseClass),
|
* GVAR(TaskInstanceBaseClass),
|
||||||
@ -93,9 +93,9 @@ GVAR(TaskInstanceBaseClass) = createHashMapFromArray [
|
|||||||
private _registryKey = _self call ["getRegistryKey", []];
|
private _registryKey = _self call ["getRegistryKey", []];
|
||||||
if (_registryKey isEqualTo "") exitWith { false };
|
if (_registryKey isEqualTo "") exitWith { false };
|
||||||
|
|
||||||
private _registry = missionNamespace getVariable [QGVAR(PrototypeTaskInstances), createHashMap];
|
private _registry = missionNamespace getVariable [QGVAR(ObjectTaskInstances), createHashMap];
|
||||||
_registry set [_registryKey, _self];
|
_registry set [_registryKey, _self];
|
||||||
missionNamespace setVariable [QGVAR(PrototypeTaskInstances), _registry];
|
missionNamespace setVariable [QGVAR(ObjectTaskInstances), _registry];
|
||||||
missionNamespace setVariable [_registryKey, _self];
|
missionNamespace setVariable [_registryKey, _self];
|
||||||
true
|
true
|
||||||
}],
|
}],
|
||||||
@ -103,7 +103,7 @@ GVAR(TaskInstanceBaseClass) = createHashMapFromArray [
|
|||||||
private _registryKey = _self call ["getRegistryKey", []];
|
private _registryKey = _self call ["getRegistryKey", []];
|
||||||
if (_registryKey isEqualTo "") exitWith { false };
|
if (_registryKey isEqualTo "") exitWith { false };
|
||||||
|
|
||||||
private _registry = missionNamespace getVariable [QGVAR(PrototypeTaskInstances), createHashMap];
|
private _registry = missionNamespace getVariable [QGVAR(ObjectTaskInstances), createHashMap];
|
||||||
_registry deleteAt _registryKey;
|
_registry deleteAt _registryKey;
|
||||||
missionNamespace setVariable [_registryKey, nil];
|
missionNamespace setVariable [_registryKey, nil];
|
||||||
true
|
true
|
||||||
@ -1,66 +0,0 @@
|
|||||||
# Task Object Prototypes
|
|
||||||
|
|
||||||
This folder contains review-only `createHashMapObject` prototypes for task
|
|
||||||
instances. Their source now lives under `functions/prototypes/`, and they are
|
|
||||||
loaded for review with `[] call forge_server_task_fnc_initPrototypes;`.
|
|
||||||
|
|
||||||
Current prototypes:
|
|
||||||
- `TaskInstanceBaseClass`
|
|
||||||
- `EntityControllerBaseClass`
|
|
||||||
- `TargetEntityController`
|
|
||||||
- `ShooterEntityController`
|
|
||||||
- `AttackTaskBaseClass`
|
|
||||||
- `HostageTaskBaseClass`
|
|
||||||
- `HostageEntityController`
|
|
||||||
- `HVTEntityController`
|
|
||||||
- `CargoEntityController`
|
|
||||||
- `ProtectedEntityController`
|
|
||||||
- `IEDEntityController`
|
|
||||||
- `DefenseEnemyController`
|
|
||||||
- `DefuseTaskBaseClass`
|
|
||||||
- `DestroyTaskBaseClass`
|
|
||||||
- `DeliveryTaskBaseClass`
|
|
||||||
- `HVTTaskBaseClass`
|
|
||||||
- `DefendTaskBaseClass`
|
|
||||||
|
|
||||||
Review entry points:
|
|
||||||
- [taskObjectPrototypes.sqf](./taskObjectPrototypes.sqf)
|
|
||||||
- [fnc_initPrototypes.sqf](../functions/prototypes/fnc_initPrototypes.sqf)
|
|
||||||
- [fnc_TaskInstanceBaseClass.sqf](../functions/prototypes/fnc_TaskInstanceBaseClass.sqf)
|
|
||||||
- [fnc_EntityControllerBaseClass.sqf](../functions/prototypes/fnc_EntityControllerBaseClass.sqf)
|
|
||||||
- [fnc_TargetEntityController.sqf](../functions/prototypes/fnc_TargetEntityController.sqf)
|
|
||||||
- [fnc_ShooterEntityController.sqf](../functions/prototypes/fnc_ShooterEntityController.sqf)
|
|
||||||
- [fnc_AttackTaskBaseClass.sqf](../functions/prototypes/fnc_AttackTaskBaseClass.sqf)
|
|
||||||
- [fnc_HostageTaskBaseClass.sqf](../functions/prototypes/fnc_HostageTaskBaseClass.sqf)
|
|
||||||
- [fnc_HostageEntityController.sqf](../functions/prototypes/fnc_HostageEntityController.sqf)
|
|
||||||
- [fnc_HVTEntityController.sqf](../functions/prototypes/fnc_HVTEntityController.sqf)
|
|
||||||
- [fnc_CargoEntityController.sqf](../functions/prototypes/fnc_CargoEntityController.sqf)
|
|
||||||
- [fnc_ProtectedEntityController.sqf](../functions/prototypes/fnc_ProtectedEntityController.sqf)
|
|
||||||
- [fnc_IEDEntityController.sqf](../functions/prototypes/fnc_IEDEntityController.sqf)
|
|
||||||
- [fnc_DefenseEnemyController.sqf](../functions/prototypes/fnc_DefenseEnemyController.sqf)
|
|
||||||
- [fnc_DefuseTaskBaseClass.sqf](../functions/prototypes/fnc_DefuseTaskBaseClass.sqf)
|
|
||||||
- [fnc_DestroyTaskBaseClass.sqf](../functions/prototypes/fnc_DestroyTaskBaseClass.sqf)
|
|
||||||
- [fnc_DeliveryTaskBaseClass.sqf](../functions/prototypes/fnc_DeliveryTaskBaseClass.sqf)
|
|
||||||
- [fnc_HVTTaskBaseClass.sqf](../functions/prototypes/fnc_HVTTaskBaseClass.sqf)
|
|
||||||
- [fnc_DefendTaskBaseClass.sqf](../functions/prototypes/fnc_DefendTaskBaseClass.sqf)
|
|
||||||
|
|
||||||
Purpose:
|
|
||||||
- show what per-task instance objects could look like
|
|
||||||
- show what per-entity heartbeat/controller objects could look like
|
|
||||||
- separate state ownership from the current long procedural functions
|
|
||||||
- avoid committing the live addon to a large refactor before the model is
|
|
||||||
reviewed
|
|
||||||
- keep shared lifecycle and reward initialization in `TaskInstanceBaseClass`
|
|
||||||
so concrete task prototypes only define task-specific state
|
|
||||||
- keep heartbeat-style AI/object behavior in separate entity controllers instead
|
|
||||||
of mixing it into task outcome loops
|
|
||||||
|
|
||||||
Important design choice:
|
|
||||||
- these prototypes use explicit `markSucceeded`, `markFailed`, and `cleanup`
|
|
||||||
methods instead of relying on `#delete`
|
|
||||||
- task loops that use `sleep` or `waitUntil` with `sleep` must be started from
|
|
||||||
scheduled code, typically via `spawn`
|
|
||||||
|
|
||||||
That is intentional. `createHashMapObject` destructor timing is reference-based,
|
|
||||||
so `#delete` is not a good primitive for mission-critical task completion or
|
|
||||||
reward flow.
|
|
||||||
@ -1,64 +0,0 @@
|
|||||||
#include "..\script_component.hpp"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Review-only prototype initializer for object-based task instances.
|
|
||||||
*
|
|
||||||
* Usage in debug/testing:
|
|
||||||
* private _prototypes = [] call FUNC(initPrototypes);
|
|
||||||
*
|
|
||||||
* private _task = createHashMapObject [
|
|
||||||
* _prototypes get "HostageTaskBaseClass",
|
|
||||||
* [
|
|
||||||
* "task_hostage_review",
|
|
||||||
* createHashMapFromArray [
|
|
||||||
* ["hostages", [hostage1, hostage2]],
|
|
||||||
* ["shooters", [shooter1, shooter2]]
|
|
||||||
* ],
|
|
||||||
* createHashMapFromArray [
|
|
||||||
* ["extractionZone", "hostage_extract"],
|
|
||||||
* ["limitSuccess", 2],
|
|
||||||
* ["limitFail", 1],
|
|
||||||
* ["execution", true],
|
|
||||||
* ["timeLimit", 900]
|
|
||||||
* ]
|
|
||||||
* ]
|
|
||||||
* ];
|
|
||||||
*/
|
|
||||||
|
|
||||||
[] call FUNC(TaskInstanceBaseClass);
|
|
||||||
[] call FUNC(EntityControllerBaseClass);
|
|
||||||
[] call FUNC(AttackTaskBaseClass);
|
|
||||||
[] call FUNC(HostageTaskBaseClass);
|
|
||||||
[] call FUNC(HostageEntityController);
|
|
||||||
[] call FUNC(TargetEntityController);
|
|
||||||
[] call FUNC(ShooterEntityController);
|
|
||||||
[] call FUNC(HVTEntityController);
|
|
||||||
[] call FUNC(CargoEntityController);
|
|
||||||
[] call FUNC(ProtectedEntityController);
|
|
||||||
[] call FUNC(IEDEntityController);
|
|
||||||
[] call FUNC(DefenseEnemyController);
|
|
||||||
[] call FUNC(DefuseTaskBaseClass);
|
|
||||||
[] call FUNC(DestroyTaskBaseClass);
|
|
||||||
[] call FUNC(DeliveryTaskBaseClass);
|
|
||||||
[] call FUNC(HVTTaskBaseClass);
|
|
||||||
[] call FUNC(DefendTaskBaseClass);
|
|
||||||
|
|
||||||
createHashMapFromArray [
|
|
||||||
["TaskInstanceBaseClass", GVAR(TaskInstanceBaseClass)],
|
|
||||||
["EntityControllerBaseClass", GVAR(EntityControllerBaseClass)],
|
|
||||||
["AttackTaskBaseClass", GVAR(AttackTaskBaseClass)],
|
|
||||||
["HostageTaskBaseClass", GVAR(HostageTaskBaseClass)],
|
|
||||||
["HostageEntityController", GVAR(HostageEntityController)],
|
|
||||||
["TargetEntityController", GVAR(TargetEntityController)],
|
|
||||||
["ShooterEntityController", GVAR(ShooterEntityController)],
|
|
||||||
["HVTEntityController", GVAR(HVTEntityController)],
|
|
||||||
["CargoEntityController", GVAR(CargoEntityController)],
|
|
||||||
["ProtectedEntityController", GVAR(ProtectedEntityController)],
|
|
||||||
["IEDEntityController", GVAR(IEDEntityController)],
|
|
||||||
["DefenseEnemyController", GVAR(DefenseEnemyController)],
|
|
||||||
["DefuseTaskBaseClass", GVAR(DefuseTaskBaseClass)],
|
|
||||||
["DestroyTaskBaseClass", GVAR(DestroyTaskBaseClass)],
|
|
||||||
["DeliveryTaskBaseClass", GVAR(DeliveryTaskBaseClass)],
|
|
||||||
["HVTTaskBaseClass", GVAR(HVTTaskBaseClass)],
|
|
||||||
["DefendTaskBaseClass", GVAR(DefendTaskBaseClass)]
|
|
||||||
]
|
|
||||||
Loading…
x
Reference in New Issue
Block a user