many changes. includes rework of baselocation-asset storage format
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
"fbcb2_assets",
|
||||
QUOTE(COMPONENT),
|
||||
"SETTING CHANGED",
|
||||
[
|
||||
[
|
||||
@@ -22,6 +22,12 @@
|
||||
],
|
||||
["newValue", _value]
|
||||
]
|
||||
] call milsim_util_fnc_log;
|
||||
] call EFUNC(util,log);
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
QUOTE(COMPONENT),
|
||||
"CREATED SETTINGS",
|
||||
[]
|
||||
] call EFUNC(util,log);
|
||||
@@ -1,4 +1,6 @@
|
||||
#include "../script_component.hpp"
|
||||
|
||||
// return each base with its assets
|
||||
milsim_baseObjects apply {
|
||||
[_x, _x getVariable ["milsim_fbcb2_assets_assetsAtThisBase", []]]
|
||||
GVARMAIN(baseObjects) apply {
|
||||
[_x, _x getVariable [QGVAR(assetsAtThisBase), []]]
|
||||
};
|
||||
@@ -0,0 +1,15 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
params [
|
||||
["_className", "", [""]]
|
||||
];
|
||||
|
||||
// Get the approved assets config
|
||||
private _approvedAssetsCfg = call EFUNC(util,getApprovedAssetsCfg);
|
||||
if (isNull _approvedAssetsCfg) exitWith {""};
|
||||
|
||||
// Get the asset definition
|
||||
private _assetDef = (_approvedAssetsCfg >> _className);
|
||||
if (isClass _assetDef) exitWith {getText(_assetDef >> "callsign")};
|
||||
|
||||
"";
|
||||
@@ -0,0 +1,17 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
// get all starting assets at each base and combine to array
|
||||
private _startingAssetsByBase = call FUNC(getStartingAssetsByBase);
|
||||
private _startingAssets = [];
|
||||
{
|
||||
_startingAssets append (_x#1);
|
||||
} forEach _startingAssetsByBase;
|
||||
|
||||
// get all current assets at each base and combine to array
|
||||
private _assetsByBase = call FUNC(getAssetsByBase);
|
||||
private _assets = [];
|
||||
{
|
||||
_assets append (_x#1);
|
||||
} forEach _assetsByBase;
|
||||
|
||||
[_startingAssets, _assets];
|
||||
@@ -1,4 +1,6 @@
|
||||
#include "../script_component.hpp"
|
||||
|
||||
// return each base with its assets
|
||||
milsim_baseObjects apply {
|
||||
[_x, _x getVariable ["milsim_fbcb2_assets_assetsStartedAtThisBase", []]]
|
||||
GVARMAIN(baseObjects) apply {
|
||||
[_x, _x getVariable [QGVAR(assetsStartedAtThisBase), []]]
|
||||
};
|
||||
@@ -39,7 +39,7 @@ private _pylons = getAllPylonsInfo _vic;
|
||||
///////////////////////////////////////////////
|
||||
// WRITE TITLE
|
||||
///////////////////////////////////////////////
|
||||
_title pushBack format["<font size='24' shadow='1' color='#e1701a' face='PuristaBold'>%1</font>", _dispName];
|
||||
_title pushBack format["%1", _dispName];
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// WRITE IMAGE
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
// get vehicles the mission started with at base locations
|
||||
(call FUNC(getStartingAndCurrentAssets)) params [
|
||||
"_startingAssets",
|
||||
"_currentAssets"
|
||||
];
|
||||
|
||||
// get distinct classnames to group by
|
||||
private _distinctStartingAssetsClassNames = [];
|
||||
{
|
||||
_x params ["_netId", "_cfg"];
|
||||
private _className = configName _cfg;
|
||||
_distinctStartingAssetsClassNames pushBackUnique _className;
|
||||
} forEach _startingAssets;
|
||||
|
||||
// get the approved assets config to identify callsigns
|
||||
private _approvedAssetsCfg = call EFUNC(util,getApprovedAssetsCfg);
|
||||
if (isNull _approvedAssetsCfg) exitWith {
|
||||
[
|
||||
QUOTE(COMPONENT),
|
||||
"No approved assets defined.",
|
||||
[]
|
||||
] call EFUNC(util,log);
|
||||
[
|
||||
"ERROR: No approved assets defined. See defines/ApprovedAssets.hpp"
|
||||
] call BIS_fnc_error;
|
||||
};
|
||||
|
||||
_text = parseText "<t size='4'>MESSAGE</t>";
|
||||
_text = composeText [_text, lineBreak ];
|
||||
|
||||
_text = composeText [_text, parseText "<t align='left' size='2'>Asset</t><t align='right' size='2'>Available</t>", lineBreak ];
|
||||
|
||||
{
|
||||
private _className = _x;
|
||||
// only approved assets
|
||||
if (!isClass (_approvedAssetsCfg >> _className)) then {continue};
|
||||
|
||||
private _callsign = [_className] call FUNC(getCallsignFromClassname);
|
||||
|
||||
private _startingAssetsOfThisType = _startingAssets select {
|
||||
// select all starting assets of this type
|
||||
_x params ["_netId", "_cfg"];
|
||||
_className isEqualTo (configName _cfg);
|
||||
};
|
||||
private _currentAssetsOfThisType = _currentAssets select {
|
||||
_x params ["_netId", "_cfg"];
|
||||
private _object = _netId call BIS_fnc_objectFromNetId;
|
||||
// objNull if deleted, then check classname and if alive
|
||||
!isNull _object && {
|
||||
_className isEqualTo (typeOf _object) &&
|
||||
alive _object
|
||||
};
|
||||
};
|
||||
|
||||
(_startingAssetsOfThisType#0) params [
|
||||
"_assetNetId",
|
||||
"_assetCfg"
|
||||
];
|
||||
|
||||
_assigned = count _startingAssetsOfThisType;
|
||||
_available = count _currentAssetsOfThisType;
|
||||
// count (getMarkerPos "respawn_west" nearEntities [ _asset, 2000] );
|
||||
|
||||
|
||||
_image = getText(_assetCfg >> "picture");
|
||||
|
||||
_name = getText(_assetCfg >> "displayName") select [0, 22];
|
||||
private _data = format[
|
||||
"<img size='1' align='left' image='%1'/><t size='1' align='left'> %2</t><t size='1' align='right'>%3 [ %4 ]</t>",
|
||||
_image,
|
||||
_name,
|
||||
_available,
|
||||
_assigned
|
||||
];
|
||||
|
||||
// private _data = format[
|
||||
// "<img size='1' align='left' image='%1'/>
|
||||
// <t size='1' align='left'> %2</t>
|
||||
// <t size='1' align='middle'>%3</t>
|
||||
// <t size='1' align='right'>%4</t>",
|
||||
// _image,
|
||||
// _name,
|
||||
// _assigned,
|
||||
// _available
|
||||
// ];
|
||||
_text = composeText[ _text, parseText _data, lineBreak ];
|
||||
|
||||
|
||||
} foreach _distinctStartingAssetsClassNames;
|
||||
|
||||
hint _text;
|
||||
@@ -0,0 +1,8 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
params [["_asset", objNull, [objNull]]];
|
||||
|
||||
private _closestBase = [_asset] call EFUNC(util,getNearestBase);
|
||||
if (isNull _closestBase) exitWith {false};
|
||||
|
||||
(_asset distance2D _closestBase) <= GVAR(setting_detectionRangeFromBase)
|
||||
@@ -1,3 +1,5 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
{
|
||||
@@ -10,7 +12,7 @@ if (!hasInterface) exitWith {};
|
||||
player removeDiaryRecord [_diarySubject, _diaryRecord];
|
||||
} forEach _records;
|
||||
} forEach [
|
||||
milsim_fbcb2_subjectAssetsFixedWingID,
|
||||
milsim_fbcb2_subjectAssetsRotaryID,
|
||||
milsim_fbcb2_subjectAssetsGroundID
|
||||
EGVAR(fbcb2_main,subjectAssetsFixedWingID),
|
||||
EGVAR(fbcb2_main,subjectAssetsRotaryID),
|
||||
EGVAR(fbcb2_main,subjectAssetsGroundID)
|
||||
];
|
||||
@@ -1,12 +1,11 @@
|
||||
private _baseMarkerStoreVar = "milsim_fbcb2_assets_baseMarkerStore";
|
||||
private _assetMarkerStoreVar = "milsim_fbcb2_assets_assetMarkerStore";
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
private _baseMarkerStore = localNamespace getVariable [
|
||||
_baseMarkerStoreVar,
|
||||
QGVAR(baseMarkerStore),
|
||||
[]
|
||||
];
|
||||
private _assetMarkerStore = localNamespace getVariable [
|
||||
_assetMarkerStoreVar,
|
||||
QGVAR(assetMarkerStore),
|
||||
[]
|
||||
];
|
||||
|
||||
@@ -16,10 +15,10 @@ private _assetMarkerStore = localNamespace getVariable [
|
||||
} forEach (_baseMarkerStore + _assetMarkerStore);
|
||||
|
||||
localNamespace setVariable [
|
||||
_baseMarkerStoreVar,
|
||||
QGVAR(baseMarkerStore),
|
||||
[]
|
||||
];
|
||||
localNamespace setVariable [
|
||||
_assetMarkerStoreVar,
|
||||
QGVAR(assetMarkerStore),
|
||||
[]
|
||||
];
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
params [
|
||||
["_className", "", [""]],
|
||||
["_markerType", "hd_dot", [""]],
|
||||
@@ -12,11 +14,11 @@ if (count _markerColor isEqualTo 0) exitWith {
|
||||
["No marker color provided!"] call BIS_fnc_error;
|
||||
};
|
||||
if (count _assetObjects isEqualTo 0) exitWith {
|
||||
["No vehicles provided!"] call BIS_fnc_error;
|
||||
["No vehicles to draw markers for!"] call BIS_fnc_error;
|
||||
};
|
||||
|
||||
private _baseMarkerStoreVar = "milsim_fbcb2_assets_baseMarkerStore";
|
||||
private _assetMarkerStoreVar = "milsim_fbcb2_assets_assetMarkerStore";
|
||||
private _baseMarkerStoreVar = QGVAR(baseMarkerStore);
|
||||
private _assetMarkerStoreVar = QGVAR(assetMarkerStore);
|
||||
|
||||
private _baseMarkerStore = localNamespace getVariable [
|
||||
_baseMarkerStoreVar,
|
||||
@@ -35,15 +37,15 @@ if (not (count _baseMarkerStore > 0)) then {
|
||||
|
||||
// create a circle marker with range as the detection range of assets
|
||||
_newMarker = createMarkerLocal [
|
||||
format["milsim_fbcb2_assets_base_marker_%1", _forEachIndex + 1],
|
||||
format["%1_%2", QGVAR(baseCircleMarker), _forEachIndex + 1],
|
||||
getPosASL _base
|
||||
];
|
||||
_newMarker setMarkerTypeLocal "mil_dot";
|
||||
_newMarker setMarkerColorLocal "ColorGreen";
|
||||
_newMarker setMarkerShapeLocal "ELLIPSE";
|
||||
_newMarker setMarkerSizeLocal [
|
||||
milsim_fbcb2_assets_setting_detectionRangeFromBase,
|
||||
milsim_fbcb2_assets_setting_detectionRangeFromBase
|
||||
GVAR(setting_detectionRangeFromBase),
|
||||
GVAR(setting_detectionRangeFromBase)
|
||||
];
|
||||
_newMarker setMarkerAlphaLocal 0.5;
|
||||
_newMarker setMarkerTextLocal str(_forEachIndex + 1);
|
||||
@@ -55,19 +57,19 @@ if (not (count _baseMarkerStore > 0)) then {
|
||||
|
||||
// create a flag marker at base position
|
||||
_newMarker = createMarkerLocal [
|
||||
format["milsim_fbcb2_assets_base_flag_marker_%1", _forEachIndex + 1],
|
||||
format["%1_%2", QGVAR(baseFlagMarker), _forEachIndex + 1],
|
||||
getPosASL _base
|
||||
];
|
||||
_newMarker setMarkerTypeLocal "mil_flag";
|
||||
_newMarker setMarkerColorLocal "ColorGreen";
|
||||
_newMarker setMarkerSizeLocal [0.7, 0.7];
|
||||
_newMarker setMarkerTextLocal ([_base] call milsim_util_fnc_getNameOfBase);
|
||||
_newMarker setMarkerTextLocal ([_base] call EFUNC(util,getNameOfBase));
|
||||
|
||||
_baseMarkerStore pushBack [
|
||||
_base,
|
||||
_newMarker
|
||||
];
|
||||
} forEach milsim_baseObjects;
|
||||
} forEach GVARMAIN(baseObjects);
|
||||
|
||||
localNamespace setVariable [_baseMarkerStoreVar, _baseMarkerStore];
|
||||
};
|
||||
@@ -85,9 +87,12 @@ private _start = (count _assetMarkerStore) + 1;
|
||||
> -1
|
||||
) then {continue};
|
||||
|
||||
// check if the asset is within base detection range
|
||||
if (not ([_asset] call FUNC(isAssetInRangeOfBase))) then {continue};
|
||||
|
||||
// create a marker for the asset
|
||||
private _newMarker = createMarkerLocal [
|
||||
format["milsim_fbcb2_assets_marker_%1", _start],
|
||||
format["%1_%2", QGVAR(assetMarker), _start],
|
||||
getPosASL _asset
|
||||
];
|
||||
_newMarker setMarkerAlphaLocal 1;
|
||||
|
||||
@@ -10,101 +10,145 @@ call FUNC(removeMarkersOnMap);
|
||||
// remove existing asset records
|
||||
call FUNC(removeAssetDiaryRecords);
|
||||
|
||||
// get all vehicles by base
|
||||
private _vehiclesByBase = call FUNC(getAssetsByBase);
|
||||
if (count _vehiclesByBase isEqualTo 0) exitWith {false};
|
||||
(call FUNC(getStartingAndCurrentAssets)) params [
|
||||
"_startingAssets",
|
||||
"_currentAssets"
|
||||
];
|
||||
|
||||
// put vehicles from each base into a single array
|
||||
private _vehicles = [];
|
||||
{
|
||||
_vehicles append (_x#1);
|
||||
} forEach _vehiclesByBase;
|
||||
|
||||
if (count _vehicles isEqualTo 0) exitWith {false};
|
||||
// get distinct vehicle class names
|
||||
private _distinctVehiclesClassNames = [];
|
||||
{
|
||||
_distinctVehiclesClassNames pushBackUnique (typeOf _x);
|
||||
} forEach _vehicles;
|
||||
_x params ["_netId", "_cfg"];
|
||||
private _className = configName _cfg;
|
||||
_distinctVehiclesClassNames pushBackUnique _className;
|
||||
} forEach _startingAssets;
|
||||
|
||||
|
||||
// for random color cycling
|
||||
private _colorSelectionIndex = 0;
|
||||
private _randomColors = [
|
||||
["ColorRed", "#FF0000", "Red"],
|
||||
["ColorGreen", "#00FF00", "Green"],
|
||||
["ColorBlue", "#0000FF", "Blue"],
|
||||
["ColorYellow", "#FFFF00", "Yellow"],
|
||||
["ColorWhite", "#FFFFFF", "White"]
|
||||
];
|
||||
|
||||
// ForEach unique vehicle class name, we'll find the first and gather its info
|
||||
{
|
||||
private _className = _x;
|
||||
private _vehiclesOfThisKind = _vehicles select {typeOf _x isEqualTo _className};
|
||||
// This should never happen, but...
|
||||
if (count _vehiclesOfThisKind isEqualTo 0) then {continue};
|
||||
|
||||
// Take the first vehicle as a representative
|
||||
private _representativeVehicle = _vehiclesOfThisKind#0;
|
||||
private _vehicleCfg = configOf _representativeVehicle;
|
||||
private _vehicleCallsign = toUpper (
|
||||
_representativeVehicle getVariable [
|
||||
QGVAR(callsign),
|
||||
"NONE ASSIGNED"
|
||||
]
|
||||
[_className] call FUNC(getCallsignFromClassname)
|
||||
);
|
||||
|
||||
// Get all starting assets of this type
|
||||
private _startingAssetsOfThisType = _startingAssets select {
|
||||
_x params ["_netId", "_cfg"];
|
||||
_className isEqualTo (configName _cfg);
|
||||
};
|
||||
// Get all current assets of this type
|
||||
private _currentAssetsOfThisType = _currentAssets select {
|
||||
_x params ["_netId", "_cfg"];
|
||||
private _object = _netId call BIS_fnc_objectFromNetId;
|
||||
// objNull if deleted, then check classname and if alive
|
||||
!isNull _object && {_className isEqualTo (typeOf _object) && alive _object};
|
||||
};
|
||||
// This should never happen, but...
|
||||
if (count _startingAssetsOfThisType isEqualTo 0) then {continue};
|
||||
|
||||
// Try to find a not null vehicle that can be processed
|
||||
private _exampleVehicleToProcess = objNull;
|
||||
private _assetCfg = configNull;
|
||||
|
||||
private _exampleVehicleToProcessIndex = _startingAssetsOfThisType findIf {
|
||||
_x params ["_netId", "_cfg"];
|
||||
!isNull (_netId call BIS_fnc_objectFromNetId);
|
||||
};
|
||||
// If found, get the data
|
||||
if (_exampleVehicleToProcessIndex > -1) then {
|
||||
private _exampleData = _startingAssetsOfThisType select _exampleVehicleToProcessIndex;
|
||||
_assetNetId = _exampleData#0;
|
||||
_assetCfg = _exampleData#1;
|
||||
_exampleVehicleToProcess = _assetNetId call BIS_fnc_objectFromNetId;
|
||||
} else {
|
||||
// otherwise, we only have the config to work with
|
||||
private _exampleData = _startingAssetsOfThisType#0;
|
||||
_assetCfg = _exampleData#1;
|
||||
};
|
||||
|
||||
private _parentClassNames = [_assetCfg, true] call BIS_fnc_returnParents;
|
||||
|
||||
|
||||
|
||||
// Process the vehicle for extended info
|
||||
// Exclusion list for display names
|
||||
if (
|
||||
((configOf _representativeVehicle) call BIS_fnc_displayName)
|
||||
[_assetCfg] call BIS_fnc_displayName
|
||||
in ["Helicopter"]
|
||||
) then {continue};
|
||||
|
||||
// Get the vehicle data
|
||||
private _processed = [_representativeVehicle] call FUNC(getVehicleData);
|
||||
|
||||
if (isNil "_processed") then {continue};
|
||||
_processed params ["_vehicleCfg", "_displayName", "_diaryTextSections"];
|
||||
private _processed = [configNull, "", []];
|
||||
if (!isNull _exampleVehicleToProcess) then {
|
||||
_processed = [_exampleVehicleToProcess] call FUNC(getVehicleData);
|
||||
};
|
||||
_processed params ["_processedVehicleCfg", "_displayName", "_diaryTextSections"];
|
||||
_diaryTextSections params [
|
||||
"_title",
|
||||
"_image",
|
||||
"_info",
|
||||
"_capacity"
|
||||
// "_weapons",
|
||||
// "_pylonWeapons",
|
||||
// "_inventory"
|
||||
["_title", "", [""]],
|
||||
["_image", "", [""]],
|
||||
["_info", "", [""]],
|
||||
["_capacity", "", [""]]
|
||||
// ["_weapons", "", [""]],
|
||||
// ["_pylonWeapons", "", [""]],
|
||||
// ["_inventory", "", [""]]
|
||||
];
|
||||
|
||||
// Get what we can from the vehicle cfg
|
||||
|
||||
// Create the diary record
|
||||
private _recordText = [];
|
||||
// Add the title and image
|
||||
_recordText pushBack _title;
|
||||
if (count _title isEqualTo 0) then {
|
||||
_title = format["%1", [_assetCfg] call BIS_fnc_displayName];
|
||||
};
|
||||
_recordText pushBack format[
|
||||
"<font size='24' shadow='1' color='#e1701a' face='PuristaBold'>%1</font>",
|
||||
_title
|
||||
];
|
||||
if (count _image isEqualTo 0) then {
|
||||
_image = format["<img width='200' image='%1'/>", getText(_assetCfg >> 'editorPreview')];
|
||||
};
|
||||
_recordText pushBack _image;
|
||||
_recordText pushBack "<br/>";
|
||||
_recordText pushBack format[
|
||||
"CALLSIGN: %1",
|
||||
_vehicleCallsign
|
||||
];
|
||||
_recordText pushBack format[
|
||||
"COUNT STARTED: %1",
|
||||
count _startingAssetsOfThisType
|
||||
];
|
||||
_recordText pushBack format[
|
||||
"COUNT ACTIVE: %1",
|
||||
count _vehiclesOfThisKind
|
||||
count _currentAssetsOfThisType
|
||||
];
|
||||
|
||||
// Here, we'll create a link to show markers on the map for all vehicles of this kind
|
||||
private _randomColor = selectRandom [
|
||||
["ColorRed", "#FF0000", "Red"],
|
||||
["ColorGreen", "#00FF00", "Green"],
|
||||
["ColorBlue", "#0000FF", "Blue"],
|
||||
["ColorYellow", "#FFFF00", "Yellow"],
|
||||
["ColorWhite", "#FFFFFF", "White"]
|
||||
];
|
||||
private _vehicleCfg = configFile >> "CfgVehicles" >> _className;
|
||||
// get 'picture' for record
|
||||
private _icon = getText(_vehicleCfg >> "picture");
|
||||
private _icon = getText(_assetCfg >> "picture");
|
||||
// determine marker type
|
||||
private _markerType = "mil_dot";
|
||||
switch (true) do {
|
||||
case (_representativeVehicle isKindOf "Helicopter"): {
|
||||
case ("Helicopter" in _parentClassNames): {
|
||||
_markerType = "loc_heli";
|
||||
};
|
||||
case (_representativeVehicle isKindOf "Air"): {
|
||||
case ("Air" in _parentClassNames): {
|
||||
_markerType = "loc_plane";
|
||||
};
|
||||
case (_representativeVehicle isKindOf "Ship"): {
|
||||
case ("Ship" in _parentClassNames): {
|
||||
_markerType = "loc_boat";
|
||||
};
|
||||
case (_representativeVehicle isKindOf "Car"): {
|
||||
case ("Car" in _parentClassNames): {
|
||||
_markerType = "loc_car";
|
||||
};
|
||||
default {
|
||||
@@ -112,63 +156,92 @@ private _distinctVehiclesClassNames = [];
|
||||
};
|
||||
};
|
||||
|
||||
private "_randomColor";
|
||||
if (_colorSelectionIndex < count _randomColors) then {
|
||||
_randomColor = _randomColors select _colorSelectionIndex;
|
||||
INC(_colorSelectionIndex);
|
||||
} else {
|
||||
_colorSelectionIndex = 0;
|
||||
_randomColor = _randomColors select _colorSelectionIndex;
|
||||
};
|
||||
|
||||
// Link to show markers
|
||||
private _showMarkersText = format[
|
||||
"<execute expression='[""%1"",""%2"",""%3"",%4] call FUNC(showMarkersOnMap'>SHOW MARKERS at vehicle positions</execute> (in %5)",
|
||||
"<execute expression='[""%1"",""%2"",""%3"",%4] call %5'>SHOW MARKERS for vehicles at base</execute> (in %6)",
|
||||
_className,
|
||||
_markerType,
|
||||
_randomColor#0,
|
||||
(_vehiclesOfThisKind apply {
|
||||
format["%1", _x call BIS_fnc_netId]
|
||||
(_currentAssetsOfThisType apply {
|
||||
_x params ["_netId", "_cfg"];
|
||||
_netId;
|
||||
}),
|
||||
QFUNC(showMarkersOnMap),
|
||||
format["<font color='%1'>%2</font>", _randomColor#1, _randomColor#2]
|
||||
];
|
||||
_recordText pushBack _showMarkersText;
|
||||
|
||||
// Link to hide markers
|
||||
_recordText pushBack "<execute expression=""call FUNC(removeMarkersOnMap"">REMOVE ALL MARKERS showing asset positions</execute>";
|
||||
_recordText pushBack format[
|
||||
"<execute expression=""call %1"">REMOVE ALL MARKERS showing asset positions</execute>",
|
||||
QFUNC(removeMarkersOnMap)
|
||||
];
|
||||
|
||||
// Link to update asset diary entries
|
||||
_recordText pushBack "<execute expression=""call FUNC(updateAssetDiary"">UPDATE ENTRIES for all assets</execute>";
|
||||
_recordText pushBack format[
|
||||
"<execute expression=""call %1"">UPDATE ENTRIES for all assets</execute>",
|
||||
QFUNC(updateAssetDiary)
|
||||
];
|
||||
|
||||
// link to display hint with all assets
|
||||
_recordText pushBack format[
|
||||
"<execute expression=""call %1"">SHOW APPROVED ASSET COUNTS via hint</execute>",
|
||||
QFUNC(hintAllApprovedAssets)
|
||||
];
|
||||
|
||||
_recordText pushBack format[
|
||||
"<font size='10' color='#777777'>%1</font>",
|
||||
"Notes:<br/>
|
||||
- Markers are only displayed on your local machine.<br/>
|
||||
- The REMOVE ALL option will remove all assets' markers from the map.<br/>
|
||||
- UPDATE ENTRIES will update the asset diary with the latest information (~5 minutes at most)."
|
||||
- UPDATE ENTRIES will update the asset diary with the latest information.<br/>
|
||||
- Markers will only be displayed for assets that are within a certain distance of a base."
|
||||
];
|
||||
|
||||
|
||||
|
||||
// Add info and capacity sections
|
||||
_recordText pushBack _info;
|
||||
_recordText pushBack _capacity;
|
||||
// Add info and capacity sections - exclude if no living examples were found
|
||||
if (count _info > 0) then {
|
||||
_recordText pushBack _info;
|
||||
};
|
||||
if (count _capacity > 0) then {
|
||||
_recordText pushBack _capacity;
|
||||
};
|
||||
|
||||
|
||||
private _subjectID = "";
|
||||
switch (true) do {
|
||||
case (_representativeVehicle isKindOf "Helicopter"): {
|
||||
_subjectID = EGVAR(fbcb2,subjectAssetsRotaryID);
|
||||
case ("Helicopter" in _parentClassNames): {
|
||||
_subjectID = EGVAR(fbcb2_main,subjectAssetsRotaryID);
|
||||
};
|
||||
case (_representativeVehicle isKindOf "Air"): {
|
||||
_subjectID = EGVAR(fbcb2,subjectAssetsFixedWingID);
|
||||
case ("Air" in _parentClassNames): {
|
||||
_subjectID = EGVAR(fbcb2_main,subjectAssetsFixedWingID);
|
||||
};
|
||||
default {
|
||||
_subjectID = EGVAR(fbcb2,subjectAssetsGroundID);
|
||||
_subjectID = EGVAR(fbcb2_main,subjectAssetsGroundID);
|
||||
};
|
||||
};
|
||||
|
||||
[
|
||||
_subjectID,
|
||||
format[
|
||||
"%1x %2",
|
||||
count _vehiclesOfThisKind,
|
||||
(configOf _representativeVehicle) call BIS_fnc_displayName
|
||||
"[%1/%2] %3",
|
||||
count _currentAssetsOfThisType,
|
||||
count _startingAssetsOfThisType,
|
||||
(_assetCfg) call BIS_fnc_displayName
|
||||
],
|
||||
_recordText joinString "<br/>",
|
||||
_icon
|
||||
] call milsim_fnc_createOrUpdateDiaryRecord;
|
||||
] call EFUNC(fbcb2_main,createOrUpdateDiaryRecord);
|
||||
|
||||
// "\A3\ui_f\data\igui\cfg\simpleTasks\types\car_ca.paa"
|
||||
} forEach _distinctVehiclesClassNames;
|
||||
@@ -178,8 +251,9 @@ private _distinctVehiclesClassNames = [];
|
||||
QUOTE(COMPONENT),
|
||||
"UPDATED ASSET DIARY",
|
||||
[
|
||||
["assetCount", count _vehicles],
|
||||
["distinctAssetCount", count _distinctVehiclesClassNames]
|
||||
["startingAssetCount", count _startingAssets],
|
||||
["startingAssetCountDistinct", count _distinctVehiclesClassNames],
|
||||
["currentassetCount", count _currentAssets]
|
||||
]
|
||||
] call EFUNC(util,log);
|
||||
|
||||
|
||||
@@ -17,32 +17,29 @@ private _allSaved = [];
|
||||
private _assetsAtThisBaseVar = QGVAR(assetsAtThisBase);
|
||||
private _assetsStartedAtThisBaseVar = QGVAR(assetsStartedAtThisBase);
|
||||
|
||||
private _approvedAssetsCfg = call EFUNC(util,getApprovedAssetsCfg);
|
||||
if (isNull _approvedAssetsCfg) exitWith {};
|
||||
|
||||
{
|
||||
private _className = configName _x;
|
||||
private _callsign = getText(_x >> "callsign");
|
||||
private _found = _allVehicles select { typeOf _x == _className };
|
||||
{
|
||||
private _asset = _x;
|
||||
|
||||
// avoid duplicates
|
||||
if (_asset in _allSaved) then {continue};
|
||||
private _closestBase = [_asset] call EFUNC(util,getNearestBase);
|
||||
if (isNull _closestBase) then {
|
||||
// no base found
|
||||
continue;
|
||||
};
|
||||
if (
|
||||
_asset distance _closestBase >
|
||||
milsim_fbcb2_assets_setting_detectionRangeFromBase
|
||||
) then {
|
||||
// not within range
|
||||
continue;
|
||||
};
|
||||
|
||||
_asset setVariable [QGVAR(callsign), _callsign, true];
|
||||
if (not ([_asset] call FUNC(isAssetInRangeOfBase))) then {continue};
|
||||
|
||||
|
||||
// add to base's assets list
|
||||
private _closestBase = [_asset] call EFUNC(util,getNearestBase);
|
||||
private _baseAssets = _closestBase getVariable [_assetsAtThisBaseVar, []];
|
||||
_baseAssets pushBackUnique _asset;
|
||||
_baseAssets pushBackUnique [
|
||||
_asset call BIS_fnc_netId,
|
||||
configOf _asset
|
||||
];
|
||||
// broadcast later so we're not spamming network
|
||||
_closestBase setVariable [
|
||||
_assetsAtThisBaseVar,
|
||||
@@ -60,7 +57,7 @@ private _assetsStartedAtThisBaseVar = QGVAR(assetsStartedAtThisBase);
|
||||
|
||||
_allSaved pushBack _asset;
|
||||
} forEach _found;
|
||||
} forEach ((missionConfigFile >> "ApprovedAssets") call BIS_fnc_returnChildren);
|
||||
} forEach (_approvedAssetsCfg call BIS_fnc_returnChildren);
|
||||
|
||||
// Add all ground vehicles (LandVehicle)
|
||||
{
|
||||
@@ -68,23 +65,16 @@ private _assetsStartedAtThisBaseVar = QGVAR(assetsStartedAtThisBase);
|
||||
// avoid duplicates
|
||||
if (_asset in _allSaved) then {continue};
|
||||
|
||||
private _closestBase = [_asset] call EFUNC(util,getNearestBase);
|
||||
if (isNull _closestBase) then {
|
||||
// no base found
|
||||
continue;
|
||||
};
|
||||
if (not ([_asset] call FUNC(isAssetInRangeOfBase))) then {continue};
|
||||
|
||||
if (
|
||||
_asset distance _closestBase >
|
||||
GVAR(setting_detectionRangeFromBase)
|
||||
) then {
|
||||
// not within range
|
||||
continue;
|
||||
};
|
||||
|
||||
// add to base's assets list
|
||||
private _closestBase = [_asset] call EFUNC(util,getNearestBase);
|
||||
private _baseAssets = _closestBase getVariable [_assetsAtThisBaseVar, []];
|
||||
_baseAssets pushBackUnique _asset;
|
||||
_baseAssets pushBackUnique [
|
||||
_asset call BIS_fnc_netId,
|
||||
configOf _asset
|
||||
];
|
||||
// broadcast later so we're not spamming network
|
||||
_closestBase setVariable [
|
||||
_assetsAtThisBaseVar,
|
||||
@@ -115,7 +105,7 @@ private _assetsStartedAtThisBaseVar = QGVAR(assetsStartedAtThisBase);
|
||||
if (_isInit) then {
|
||||
_base setVariable [_assetsStartedAtThisBaseVar, _baseAssets, true];
|
||||
};
|
||||
} forEach milsim_baseObjects;
|
||||
} forEach GVARMAIN(baseObjects);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// log starting assets if init
|
||||
@@ -131,14 +121,11 @@ if !(_isInit || _logCurrentAssets) exitWith {};
|
||||
|
||||
// prepare key value for logging
|
||||
private _baseAssetsHashesPrep = _baseAssets apply {
|
||||
private _asset = _x;
|
||||
_x params ["_netId", "_cfg"];
|
||||
[
|
||||
["callsign", _asset getVariable [
|
||||
QGVAR(callsign),
|
||||
"N/A"
|
||||
]],
|
||||
["className", typeOf _asset],
|
||||
["displayName", (configOf _asset) call BIS_fnc_displayName]
|
||||
["callsign", [configName _cfg] call FUNC(getCallsignFromClassname)],
|
||||
["className", configName _cfg],
|
||||
["displayName", [_cfg] call BIS_fnc_displayName]
|
||||
];
|
||||
};
|
||||
|
||||
@@ -155,13 +142,13 @@ if !(_isInit || _logCurrentAssets) exitWith {};
|
||||
if (_logCurrentAssets) then {
|
||||
{
|
||||
[
|
||||
"fbcb2_assets",
|
||||
QUOTE(COMPONENT),
|
||||
"CURRENT ASSETS",
|
||||
[
|
||||
["baseName", [[_base] call milsim_util_fnc_getNameOfBase]],
|
||||
["baseName", [[_base] call EFUNC(util,getNameOfBase)]],
|
||||
["asset", _x]
|
||||
]
|
||||
] call milsim_util_fnc_log;
|
||||
] call EFUNC(util,log);
|
||||
} forEach _baseAssetsHashes;
|
||||
};
|
||||
|
||||
@@ -172,10 +159,10 @@ if !(_isInit || _logCurrentAssets) exitWith {};
|
||||
"fbcb2_assets",
|
||||
"STARTING ASSETS",
|
||||
[
|
||||
["baseName", [[_base] call milsim_util_fnc_getNameOfBase]],
|
||||
["baseName", [[_base] call EFUNC(util,getNameOfBase)]],
|
||||
["asset", _x]
|
||||
]
|
||||
] call milsim_util_fnc_log;
|
||||
] call EFUNC(util,log);
|
||||
} forEach _baseAssetsHashes;
|
||||
};
|
||||
} forEach milsim_baseObjects;
|
||||
} forEach GVARMAIN(baseObjects);
|
||||
Reference in New Issue
Block a user