|
|
|
|
@@ -7,6 +7,8 @@ params [
|
|
|
|
|
|
|
|
|
|
if (!isServer) exitWith {};
|
|
|
|
|
|
|
|
|
|
GVARMAIN(baseObjects) = allMissionObjects "ModuleRespawnPosition_F";
|
|
|
|
|
|
|
|
|
|
// Get all approved assets on map, find the closest base
|
|
|
|
|
// Then determine if it's within range
|
|
|
|
|
// If it is, add it to the base's assets list
|
|
|
|
|
@@ -14,12 +16,14 @@ if (!isServer) exitWith {};
|
|
|
|
|
private _allVehicles = vehicles;
|
|
|
|
|
private _allSaved = [];
|
|
|
|
|
|
|
|
|
|
private _assetsAtThisBaseVar = QGVAR(assetsAtThisBase);
|
|
|
|
|
private _assetsStartedAtThisBaseVar = QGVAR(assetsStartedAtThisBase);
|
|
|
|
|
private _assetsAtThisBaseVar = QGVAR(assetsAtThisBase);
|
|
|
|
|
|
|
|
|
|
private _approvedAssetsCfg = call EFUNC(common,getApprovedAssetsCfg);
|
|
|
|
|
if (isNull _approvedAssetsCfg) exitWith {};
|
|
|
|
|
|
|
|
|
|
private _currentBaseAssetsGathered = GVARMAIN(baseObjects) apply {[_x, []]};;
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
private _className = configName _x;
|
|
|
|
|
private _callsign = getText(_x >> "callsign");
|
|
|
|
|
@@ -27,68 +31,34 @@ if (isNull _approvedAssetsCfg) exitWith {};
|
|
|
|
|
{
|
|
|
|
|
private _asset = _x;
|
|
|
|
|
|
|
|
|
|
// avoid duplicates
|
|
|
|
|
if (_asset in _allSaved) then {continue};
|
|
|
|
|
|
|
|
|
|
// ignore assets beyond the range of bases
|
|
|
|
|
if (not ([_asset] call FUNC(isAssetInRangeOfBase))) then {continue};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// add to base's assets list
|
|
|
|
|
private _closestBase = [_asset] call EFUNC(common,getNearestBase);
|
|
|
|
|
private _baseAssets = _closestBase getVariable [_assetsAtThisBaseVar, []];
|
|
|
|
|
_baseAssets pushBackUnique [
|
|
|
|
|
private _closestBaseCurrentAssets = (_currentBaseAssetsGathered select { _x select 0 isEqualTo _closestBase })#0#1;
|
|
|
|
|
_closestBaseCurrentAssets pushBackUnique [
|
|
|
|
|
_asset call BIS_fnc_netId,
|
|
|
|
|
configOf _asset
|
|
|
|
|
];
|
|
|
|
|
// broadcast later so we're not spamming network
|
|
|
|
|
_closestBase setVariable [
|
|
|
|
|
_assetsAtThisBaseVar,
|
|
|
|
|
_baseAssets
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
// if this is the init, set the base's assets started at this base
|
|
|
|
|
if (_isInit) then {
|
|
|
|
|
// broadcast later so we're not spamming network
|
|
|
|
|
_closestBase setVariable [
|
|
|
|
|
_assetsStartedAtThisBaseVar,
|
|
|
|
|
_baseAssets
|
|
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
_allSaved pushBack _asset;
|
|
|
|
|
} forEach _found;
|
|
|
|
|
} forEach (_approvedAssetsCfg call BIS_fnc_returnChildren);
|
|
|
|
|
|
|
|
|
|
// Add all ground vehicles (LandVehicle)
|
|
|
|
|
{
|
|
|
|
|
private _asset = _x;
|
|
|
|
|
// avoid duplicates
|
|
|
|
|
if (_asset in _allSaved) then {continue};
|
|
|
|
|
|
|
|
|
|
// ignore assets beyond the range of bases
|
|
|
|
|
if (not ([_asset] call FUNC(isAssetInRangeOfBase))) then {continue};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// add to base's assets list
|
|
|
|
|
private _closestBase = [_asset] call EFUNC(common,getNearestBase);
|
|
|
|
|
private _baseAssets = _closestBase getVariable [_assetsAtThisBaseVar, []];
|
|
|
|
|
_baseAssets pushBackUnique [
|
|
|
|
|
private _closestBaseCurrentAssets = (_currentBaseAssetsGathered select { _x select 0 isEqualTo _closestBase })#0#1;
|
|
|
|
|
_closestBaseCurrentAssets pushBackUnique [
|
|
|
|
|
_asset call BIS_fnc_netId,
|
|
|
|
|
configOf _asset
|
|
|
|
|
];
|
|
|
|
|
// broadcast later so we're not spamming network
|
|
|
|
|
_closestBase setVariable [
|
|
|
|
|
_assetsAtThisBaseVar,
|
|
|
|
|
_baseAssets
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
// if this is the init, set the base's assets started at this base
|
|
|
|
|
if (_isInit) then {
|
|
|
|
|
// broadcast later so we're not spamming network
|
|
|
|
|
_closestBase setVariable [
|
|
|
|
|
_assetsStartedAtThisBaseVar,
|
|
|
|
|
_baseAssets
|
|
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
} forEach (_allVehicles select { _x isKindOf "LandVehicle" });
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
@@ -97,16 +67,17 @@ if (isNull _approvedAssetsCfg) exitWith {};
|
|
|
|
|
{
|
|
|
|
|
private _base = _x;
|
|
|
|
|
|
|
|
|
|
// save current assets
|
|
|
|
|
private _baseAssets = _base getVariable [_assetsAtThisBaseVar, []];
|
|
|
|
|
_base setVariable [_assetsAtThisBaseVar, _baseAssets, true];
|
|
|
|
|
private _thisBaseCurrentAssets = (_currentBaseAssetsGathered select { _x select 0 isEqualTo _base })#0#1;
|
|
|
|
|
_base setVariable [_assetsAtThisBaseVar, _thisBaseCurrentAssets, true];
|
|
|
|
|
|
|
|
|
|
// if init, save starting assets
|
|
|
|
|
if (_isInit) then {
|
|
|
|
|
_base setVariable [_assetsStartedAtThisBaseVar, _baseAssets, true];
|
|
|
|
|
_base setVariable [_assetsStartedAtThisBaseVar, _thisBaseCurrentAssets, true];
|
|
|
|
|
};
|
|
|
|
|
} forEach GVARMAIN(baseObjects);
|
|
|
|
|
|
|
|
|
|
// send a CBA event to let other scripts know that assets have been gathered
|
|
|
|
|
[{[QGVAR(assetsGathered)] call CBA_fnc_globalEvent;}, 2] call CBA_fnc_waitAndExecute;
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// log starting assets if init
|
|
|
|
|
// log current assets if requested (for end of mission counts)
|
|
|
|
|
@@ -117,7 +88,7 @@ if !(_isInit || _logCurrentAssets) exitWith {};
|
|
|
|
|
private _base = _x;
|
|
|
|
|
|
|
|
|
|
// get current assets
|
|
|
|
|
private _baseAssets = _base getVariable [_assetsAtThisBaseVar, []];
|
|
|
|
|
private _baseAssets = (_currentBaseAssetsGathered select { _x select 0 isEqualTo _base })#0#1;
|
|
|
|
|
|
|
|
|
|
// prepare key value for logging
|
|
|
|
|
private _baseAssetsHashesPrep = _baseAssets apply {
|
|
|
|
|
|