59 lines
1.8 KiB
Plaintext
59 lines
1.8 KiB
Plaintext
#include "..\script_component.hpp"
|
|
|
|
// adds default base locations to players' microDAGR as waypoints
|
|
|
|
if (!hasInterface) exitWith {};
|
|
|
|
[{!isNull player}, {
|
|
|
|
// add base locations (respawn modules)
|
|
{
|
|
private _wpName = [_x] call EFUNC(common,getNameOfBase);
|
|
private _posASL = getPosASL _x;
|
|
[_wpName, _posASL] call ace_microdagr_fnc_deviceAddWaypoint;
|
|
} forEach GVARMAIN(baseObjects);
|
|
|
|
// add custom waypoints from mission_settings.hpp
|
|
private _customWaypoints = [missionConfigFile >> "custom_microdagr_waypoints", "ARRAY", []] call CBA_fnc_getConfigEntry;
|
|
{
|
|
_x params [
|
|
["_wpName", ""],
|
|
["_pos", [0, 0, 0], [[], ""]],
|
|
["_object", "", [""]]
|
|
];
|
|
private _realPos = nil;
|
|
// if pos was provided, process
|
|
if (count _pos > 0) then {
|
|
if (typeName _pos == "STRING") then {
|
|
_realPos = [_pos, true] call ACE_common_fnc_getMapPosFromGrid;
|
|
_realPos set [2, getTerrainHeightASL _realPos];
|
|
} else {_realPos = _pos;};
|
|
};
|
|
// if object was provided, process and override any pos
|
|
if (count _object > 0) then {
|
|
// object is provided as a string variable name
|
|
private _realObject = missionNamespace getVariable _object;
|
|
if (isNull _realObject) then {
|
|
[
|
|
LEVEL_WARNING,
|
|
QUOTE(COMPONENT),
|
|
format["Invalid object for custom microDAGR waypoint: %1", _wpName],
|
|
[["name", _wpName], ["pos", _pos], ["object", _object]]] call EFUNC(common,log);
|
|
continue;
|
|
};
|
|
_realPos = getPosASL (missionNamespace getVariable _object);
|
|
};
|
|
if (isNil "_realPos") then {
|
|
[
|
|
LEVEL_WARNING,
|
|
QUOTE(COMPONENT),
|
|
format["Invalid waypoint position for custom microDAGR waypoint: %1", _wpName],
|
|
[["name", _wpName], ["pos", _pos], ["object", _object]]] call EFUNC(common,log);
|
|
continue;
|
|
};
|
|
|
|
[_wpName, _realPos] call ace_microdagr_fnc_deviceAddWaypoint;
|
|
} forEach _customWaypoints;
|
|
}] call CBA_fnc_waitUntilAndExecute;
|
|
|
|
nil; |