Skip to content

Commit

Permalink
Enhance despawn task
Browse files Browse the repository at this point in the history
  • Loading branch information
Kexanone committed Feb 6, 2022
1 parent 3d4d85d commit 88be780
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
11 changes: 8 additions & 3 deletions components/common/fnc_taskDespawn.sqf
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#include "script_component.hpp"

params ["_vehicle", "_pos", ["_timeout", 0]];
params ["_group", "_pos", ["_timeout", 0]];

private _wp = (group _vehicle) addWaypoint [_pos, 0];
private _wp = _group addWaypoint [_pos, 0];
_wp setWaypointTimeout [_timeout, _timeout, _timeout];
_wp setWaypointStatements ["true", "deleteVehicle vehicle this; {deleteVehicle _x} forEach thisList"];
_wp setWaypointStatements ["true", format ["call %1", {
if !(local this) exitWith {};
private _group = group this;
private _vehicles = [_group, true] call BIS_fnc_groupVehicles;
{deleteVehicle _x} forEach (thisList + _vehicles);
}]];
6 changes: 3 additions & 3 deletions components/modules/init_deliverSupplies.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if (isNil "ACL_suppliesDelivererCache") then {
};

[
"Support", "Deliver Supplies",
"Task", "Deliver Supplies",
{
private _box = [_this] call ACL_fnc_checkModuleTarget;
if (isNil "_box") exitWith {};
Expand Down Expand Up @@ -48,12 +48,12 @@ if (isNil "ACL_suppliesDelivererCache") then {
private _aircraft = [_startPos, _startPos getDir _pos, _type, _side] call ACL_fnc_spawnVehicle;
if !([_aircraft, _box] call ACL_fnc_canLoadCargo) exitWith {
"AIRCRAFT CANNOT LOAD CARGO" call ACL_fnc_showZeusErrorMessage;
[_aircraft, _startPos] call ACL_fnc_taskDespawn;
[group _aircraft, _startPos] call ACL_fnc_taskDespawn;
};

[_aircraft, _box] call ACL_fnc_loadCargoInstant;
[_aircraft, _box, _pos] call ACL_fnc_taskDeliverCargo;
[_aircraft, _startPos, 2] call ACL_fnc_taskDespawn;
[group _aircraft, _startPos, 2] call ACL_fnc_taskDespawn;
};
}, [_side, _type]
] call ACL_fnc_selectPosition;
Expand Down
17 changes: 17 additions & 0 deletions components/modules/init_taskDespawn.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "script_component.hpp"

[
"Task", "Despawn",
{
private _unit = [_this, ["AllVehicles"], false] call ACL_fnc_checkModuleTarget;
if (isNil "_unit") exitWith {};

[[_unit], {
params ["_confirmed", "_objects", "_pos"];
if (_confirmed) then {
_objects params ["_unit"];
[group _unit, _pos, 2] call ACL_fnc_taskDespawn;
};
}] call ACL_fnc_selectPosition;
}
] call ACL_fnc_registerModule

0 comments on commit 88be780

Please sign in to comment.