if (!hasInterface) exitWith {};
// create diary records
// remove any existing asset map markers
call milsim_fbcb2_assets_fnc_removeMarkersOnMap;
// remove existing asset records
call milsim_fbcb2_assets_fnc_removeAssetDiaryRecords;
// get all vehicles by base
private _vehiclesByBase = call milsim_fbcb2_assets_fnc_getAssetsByBase;
if (count _vehiclesByBase isEqualTo 0) exitWith {false};
// put vehicles from each base into a single array
private _vehicles = [];
{
_vehicles append (_x#1);
} forEach _vehiclesByBase;
if (count _vehicles isEqualTo 0) exitWith {false};
private _distinctVehiclesClassNames = [];
{
_distinctVehiclesClassNames pushBackUnique (typeOf _x);
} forEach _vehicles;
// 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 [
"milsim_fbcb2_assets_callsign",
"NONE ASSIGNED"
]
);
// Process the vehicle for extended info
// Exclusion list for display names
if (
((configOf _representativeVehicle) call BIS_fnc_displayName)
in ["Helicopter"]
) then {continue};
// Get the vehicle data
private _processed = [_representativeVehicle] call milsim_fbcb2_assets_fnc_getVehicleData;
if (isNil "_processed") then {continue};
_processed params ["_vehicleCfg", "_displayName", "_diaryTextSections"];
_diaryTextSections params [
"_title",
"_image",
"_info",
"_capacity"
// "_weapons",
// "_pylonWeapons",
// "_inventory"
];
// Create the diary record
private _recordText = [];
// Add the title and image
_recordText pushBack _title;
_recordText pushBack _image;
_recordText pushBack "
";
_recordText pushBack format[
"CALLSIGN: %1",
_vehicleCallsign
];
_recordText pushBack format[
"COUNT ACTIVE: %1",
count _vehiclesOfThisKind
];
// 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");
// determine marker type
private _markerType = "mil_dot";
switch (true) do {
case (_representativeVehicle isKindOf "Helicopter"): {
_markerType = "loc_heli";
};
case (_representativeVehicle isKindOf "Air"): {
_markerType = "loc_plane";
};
case (_representativeVehicle isKindOf "Ship"): {
_markerType = "loc_boat";
};
case (_representativeVehicle isKindOf "Car"): {
_markerType = "loc_car";
};
default {
_markerType = "loc_truck";
};
};
// Link to show markers
_recordText pushBack format[
"SHOW MARKERS at vehicle positions (in %5)",
_className,
_markerType,
_randomColor#0,
_vehiclesOfThisKind,
format["%2", _randomColor#1, _randomColor#2]
];
// Link to hide markers
_recordText pushBack "REMOVE ALL MARKERS showing asset positions";
// Link to update asset diary entries
_recordText pushBack "UPDATE ENTRIES for all assets";
_recordText pushBack format[
"%1",
"Notes:
- Markers are only displayed on your local machine.
- The REMOVE ALL option will remove all assets' markers from the map.
- UPDATE ENTRIES will update the asset diary with the latest information (~5 minutes at most)."
];
// Add info and capacity sections
_recordText pushBack _info;
_recordText pushBack _capacity;
private _subjectID = "";
switch (true) do {
case (_representativeVehicle isKindOf "Helicopter"): {
_subjectID = milsim_fbcb2_subjectAssetsRotaryID;
};
case (_representativeVehicle isKindOf "Air"): {
_subjectID = milsim_fbcb2_subjectAssetsFixedWingID;
};
default {
_subjectID = milsim_fbcb2_subjectAssetsGroundID;
};
};
[
_subjectID,
format[
"%1x %2",
count _vehiclesOfThisKind,
(configOf _representativeVehicle) call BIS_fnc_displayName
],
_recordText joinString "
",
_icon
] call milsim_fnc_createOrUpdateDiaryRecord;
// "\A3\ui_f\data\igui\cfg\simpleTasks\types\car_ca.paa"
} forEach _distinctVehiclesClassNames;
// log to RPT
[
"fbcb2_assets",
"UPDATED ASSET DIARY",
[
["assetCount", count _vehicles],
["distinctAssetCount", count _distinctVehiclesClassNames]
]
] call milsim_fnc_log;
true;