2016-07-24 20:17:24 +00:00
|
|
|
diag_log format["createPickupLZ called, _this: %1", _this];
|
|
|
|
private _lzLocation = _this select 0;
|
|
|
|
private _assignExtra = _this select 1;
|
|
|
|
|
|
|
|
private _squad = [_lzLocation] call createSquad;
|
|
|
|
|
|
|
|
private _enemies = [];
|
|
|
|
private _lzhot = false;
|
|
|
|
//Make the LZ hot if the roll demands it
|
|
|
|
if ((random 1) < hotLZChance) then
|
|
|
|
{
|
|
|
|
_lzhot = true
|
|
|
|
};
|
|
|
|
private _lzAA = false;
|
|
|
|
if ((random 1) < AAChance) then
|
|
|
|
{
|
|
|
|
_lzhot = true;
|
|
|
|
_lzAA = true;
|
|
|
|
};
|
2016-07-24 21:32:45 +00:00
|
|
|
if (_lzhot) then
|
2016-07-24 20:17:24 +00:00
|
|
|
{
|
|
|
|
_enemies = _enemies + ([_lzLocation, _lzAA] call createEnemySquads);
|
|
|
|
};
|
|
|
|
|
|
|
|
lzCounter = lzCounter + 1;
|
|
|
|
publicVariable "lzCounter";
|
|
|
|
|
2016-07-25 21:58:29 +00:00
|
|
|
private _side = side _squad;
|
|
|
|
private _squadCmdr = (units _squad) select 0;
|
|
|
|
private _lzLocationName = text ((nearestLocations [getPos _lzLocation, ["NameCityCapital", "NameCity", "NameVillage"], 1500]) select 0);
|
|
|
|
[[_side, "HQ"], format["%1 is requesting pickup from near %2", groupId _squad, _lzLocationName]] remoteExec ["sideChat", _side];
|
|
|
|
|
|
|
|
|
2016-07-24 20:17:24 +00:00
|
|
|
private _shortestDesc = format["LZ %1", lzCounter];
|
|
|
|
private _longdesc = format["%1 wants a pickup from this location", _squad];
|
|
|
|
private _shortdesc = format["Pick up %1", _squad];
|
|
|
|
if (_lzAA and _lzhot) then
|
|
|
|
{
|
|
|
|
_longdesc = _longdesc + "<br/><strong>Be advised:</strong> Intel reports heavy enemy activity with AA assets at the location";
|
2016-07-25 21:58:29 +00:00
|
|
|
[_squadCmdr, "Be advised, LZ is very hot with AA assets present"] remoteExec ["sideChat", _side];
|
2016-07-24 20:17:24 +00:00
|
|
|
};
|
|
|
|
if (!_lzAA and _lzhot) then
|
|
|
|
{
|
|
|
|
_longdesc = _longdesc + "<br/><strong>Be advised:</strong> Intel reports enemy activity at the location";
|
2016-07-25 21:58:29 +00:00
|
|
|
[_squadCmdr, "Be advised, LZ is hot"] remoteExec ["sideChat", _side];
|
2016-07-24 20:17:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
private _assignTo = [west];
|
|
|
|
if (!(_assignExtra isEqualTo false)) then
|
|
|
|
{
|
|
|
|
_assignTo = _assignTo + _assignExtra;
|
|
|
|
};
|
|
|
|
|
2016-07-25 21:58:29 +00:00
|
|
|
|
|
|
|
|
2016-07-24 20:17:24 +00:00
|
|
|
// PONDER: make a parent task "ferry squad X" ??
|
|
|
|
private _taskid = format["pickup_%1", lzCounter];
|
2016-07-25 21:58:29 +00:00
|
|
|
[_assignTo,[_taskid],[_longdesc, _shortdesc, _shortestDesc],getPos _lzLocation,"AUTOASSIGNED",(STARTPRIORITY-lzCounter),true, "meet", true] call BIS_fnc_taskCreate;
|
|
|
|
(_assignExtra select 0) setCurrentTask _taskid;
|
2016-07-24 23:28:26 +00:00
|
|
|
|
2016-07-25 00:36:48 +00:00
|
|
|
if (bSmoke) then
|
|
|
|
{
|
|
|
|
[_squad, _lzLocation, 'green'] spawn spawnSmokeBySquad;
|
|
|
|
};
|
2016-07-24 20:17:24 +00:00
|
|
|
|
2016-07-25 17:49:54 +00:00
|
|
|
private _trg = createTrigger["EmptyDetector",getPos _lzLocation, false];
|
2016-07-24 20:17:24 +00:00
|
|
|
_trg setTriggerArea[lzSize,lzSize,0,false];
|
|
|
|
_trg setTriggerActivation["WEST","PRESENT",false];
|
|
|
|
_trg setTriggerTimeout [2.5, 2.5, 2.5, true];
|
2016-07-24 23:28:26 +00:00
|
|
|
_trg setTriggerStatements["([thisList] call playerVehicleInListBool)", "", ""];
|
2016-07-24 20:17:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
// TODO: implement deadline so the task doesn't linger forever
|
|
|
|
scopeName "main";
|
|
|
|
while {true} do
|
|
|
|
{
|
|
|
|
scopeName "mainloop";
|
2016-07-25 00:36:48 +00:00
|
|
|
diag_log format["createPickupLZ: ticking %1", _this];
|
|
|
|
|
|
|
|
if (( _taskid call BIS_fnc_taskCompleted)) then
|
|
|
|
{
|
|
|
|
diag_log format["createPickupLZ: task %1 was marked complete", _taskid];
|
|
|
|
breakOut "mainloop";
|
|
|
|
};
|
2016-07-24 20:17:24 +00:00
|
|
|
|
|
|
|
if ({alive _x} count units _squad == 0) then
|
|
|
|
{
|
2016-07-24 23:28:26 +00:00
|
|
|
diag_log format["createPickupLZ: Everyone from %1 is dead!", _squad];
|
2016-07-24 20:17:24 +00:00
|
|
|
// Everybody died before we got there :(
|
|
|
|
[_taskid, "FAILED" ,true] spawn BIS_fnc_taskSetState;
|
|
|
|
breakOut "mainloop";
|
2016-07-24 21:14:41 +00:00
|
|
|
};
|
2016-07-24 20:17:24 +00:00
|
|
|
|
2016-07-24 23:28:26 +00:00
|
|
|
if (triggerActivated _trg) then
|
2016-07-24 20:17:24 +00:00
|
|
|
{
|
2016-07-24 23:28:26 +00:00
|
|
|
diag_log format["createPickupLZ: triggedred, loading up %1", _squad];
|
2016-07-24 20:17:24 +00:00
|
|
|
private _newLZLocation = (lzList - [_lzLocation]) call BIS_fnc_SelectRandom;
|
|
|
|
private _veh = [list _trg] call playerVehicleInList;
|
2016-07-24 21:35:04 +00:00
|
|
|
private _handle = [_veh, _squad, _taskid] spawn loadSquad;
|
2016-07-24 20:17:24 +00:00
|
|
|
waitUntil {isNull _handle};
|
|
|
|
|
2016-07-24 21:35:04 +00:00
|
|
|
private _handle = [_newLZLocation, _veh, _squad, _taskid] spawn createDropoffLZ;
|
2016-07-24 20:17:24 +00:00
|
|
|
waitUntil {isNull _handle};
|
|
|
|
breakOut "mainloop";
|
|
|
|
};
|
2016-07-24 23:28:26 +00:00
|
|
|
sleep 2;
|
2016-07-24 20:17:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
deleteVehicle _trg;
|
|
|
|
// Make sure there are no lingering enemy or own units
|
|
|
|
[_enemies + [_squad]] call deleteSquads;
|