change root level folder name to framework, update resupply+vehicleflags
tested locally
This commit is contained in:
4
framework/fbcb2/assets/byBase/fn_getAssetsByBase.sqf
Normal file
4
framework/fbcb2/assets/byBase/fn_getAssetsByBase.sqf
Normal file
@@ -0,0 +1,4 @@
|
||||
// return each base with its assets
|
||||
milsim_baseObjects apply {
|
||||
[_x, _x getVariable ["milsim_fbcb2_assets_assetsAtThisBase", []]]
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
// return each base with its assets
|
||||
milsim_baseObjects apply {
|
||||
[_x, _x getVariable ["milsim_fbcb2_assets_assetsStartedAtThisBase", []]]
|
||||
};
|
||||
179
framework/fbcb2/assets/byBase/fn_updateAssetsByBase.sqf
Normal file
179
framework/fbcb2/assets/byBase/fn_updateAssetsByBase.sqf
Normal file
@@ -0,0 +1,179 @@
|
||||
params [
|
||||
["_isInit", false, [false]],
|
||||
["_logCurrentAssets", false, [false]]
|
||||
];
|
||||
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
// 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
|
||||
// This is to ensure bases with overlapping detection range don't have duplicate assets
|
||||
private _allVehicles = vehicles;
|
||||
private _allSaved = [];
|
||||
|
||||
private _assetsAtThisBaseVar = "milsim_fbcb2_assets_assetsAtThisBase";
|
||||
private _assetsStartedAtThisBaseVar = "milsim_fbcb2_assets_assetsStartedAtThisBase";
|
||||
|
||||
{
|
||||
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 milsim_util_fnc_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 ["milsim_fbcb2_assets_callsign", _callsign, true];
|
||||
|
||||
// add to base's assets list
|
||||
private _baseAssets = _closestBase getVariable [_assetsAtThisBaseVar, []];
|
||||
_baseAssets pushBackUnique _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 ((missionConfigFile >> "ApprovedAssets") call BIS_fnc_returnChildren);
|
||||
|
||||
// Add all ground vehicles (LandVehicle)
|
||||
{
|
||||
private _asset = _x;
|
||||
// avoid duplicates
|
||||
if (_asset in _allSaved) then {continue};
|
||||
|
||||
private _closestBase = [_asset] call milsim_util_fnc_getNearestBase;
|
||||
if (isNull _closestBase) then {
|
||||
// no base found
|
||||
continue;
|
||||
};
|
||||
|
||||
if (
|
||||
_asset distance _closestBase >
|
||||
milsim_fbcb2_assets_setting_detectionRangeFromBase
|
||||
) then {
|
||||
// not within range
|
||||
continue;
|
||||
};
|
||||
|
||||
// add to base's assets list
|
||||
private _baseAssets = _closestBase getVariable [_assetsAtThisBaseVar, []];
|
||||
_baseAssets pushBackUnique _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" });
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// publish updated base variables
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
{
|
||||
private _base = _x;
|
||||
|
||||
// save current assets
|
||||
private _baseAssets = _base getVariable [_assetsAtThisBaseVar, []];
|
||||
_base setVariable [_assetsAtThisBaseVar, _baseAssets, true];
|
||||
|
||||
// if init, save starting assets
|
||||
if (_isInit) then {
|
||||
_base setVariable [_assetsStartedAtThisBaseVar, _baseAssets, true];
|
||||
};
|
||||
} forEach milsim_baseObjects;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// log starting assets if init
|
||||
// log current assets if requested (for end of mission counts)
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
if !(_isInit || _logCurrentAssets) exitWith {};
|
||||
|
||||
{
|
||||
private _base = _x;
|
||||
|
||||
// get current assets
|
||||
private _baseAssets = _base getVariable [_assetsAtThisBaseVar, []];
|
||||
|
||||
// prepare key value for logging
|
||||
private _baseAssetsHashesPrep = _baseAssets apply {
|
||||
private _asset = _x;
|
||||
[
|
||||
["callsign", _asset getVariable [
|
||||
"milsim_fbcb2_assets_callsign",
|
||||
"N/A"
|
||||
]],
|
||||
["className", typeOf _asset],
|
||||
["displayName", (configOf _asset) call BIS_fnc_displayName]
|
||||
];
|
||||
};
|
||||
|
||||
_baseAssetsHashesPrep = _baseAssetsHashesPrep call BIS_fnc_consolidateArray;
|
||||
|
||||
private _baseAssetsHashes = [];
|
||||
{
|
||||
private _out = createHashMapFromArray (_x#0);
|
||||
_out set ["count", _x#1];
|
||||
_baseAssetsHashes pushBack _out;
|
||||
} forEach _baseAssetsHashesPrep;
|
||||
|
||||
// if logging current assets
|
||||
if (_logCurrentAssets) then {
|
||||
{
|
||||
[
|
||||
"fbcb2_assets",
|
||||
"CURRENT ASSETS",
|
||||
[
|
||||
["baseName", [[_base] call milsim_util_fnc_getNameOfBase]],
|
||||
["asset", _x]
|
||||
]
|
||||
] call milsim_util_fnc_log;
|
||||
} forEach _baseAssetsHashes;
|
||||
};
|
||||
|
||||
// if init, log starting assets
|
||||
if (_isInit) then {
|
||||
{
|
||||
[
|
||||
"fbcb2_assets",
|
||||
"STARTING ASSETS",
|
||||
[
|
||||
["baseName", [[_base] call milsim_util_fnc_getNameOfBase]],
|
||||
["asset", _x]
|
||||
]
|
||||
] call milsim_util_fnc_log;
|
||||
} forEach _baseAssetsHashes;
|
||||
};
|
||||
} forEach milsim_baseObjects;
|
||||
123
framework/fbcb2/assets/fn_getInventory.sqf
Normal file
123
framework/fbcb2/assets/fn_getInventory.sqf
Normal file
@@ -0,0 +1,123 @@
|
||||
params ["_vic"];
|
||||
|
||||
|
||||
_vicDispName = configOf _vic call BIS_fnc_displayName;
|
||||
private _thisArr = [];
|
||||
|
||||
// _thisArr pushBack getItemCargo _vic;
|
||||
// _thisArr pushBack getBackpackCargo _vic;
|
||||
// _thisArr pushBack getMagazineCargo _vic;
|
||||
// _thisArr pushBack getWeaponCargo _vic;
|
||||
|
||||
private _ItemCargo = [];
|
||||
private _MagazineCargo = [];
|
||||
private _WeaponCargo = [];
|
||||
private _BackpackCargo = [];
|
||||
|
||||
{
|
||||
private _config = _x call CBA_fnc_getItemConfig;
|
||||
_ItemCargo pushBack [
|
||||
getText (_config >> "displayName"),
|
||||
getText (_config >> "picture")
|
||||
];
|
||||
} forEach ItemCargo _vic;
|
||||
{
|
||||
private _config = _x call CBA_fnc_getItemConfig;
|
||||
_MagazineCargo pushBack [
|
||||
getText (_config >> "displayName"),
|
||||
getText (_config >> "picture")
|
||||
];
|
||||
} forEach MagazineCargo _vic;
|
||||
{
|
||||
// private _config = _x call CBA_fnc_getObjectConfig;
|
||||
_WeaponCargo pushBack [
|
||||
getText (configFile >> "CfgWeapons" >> _x >> "displayName"),
|
||||
getText (configFile >> "CfgWeapons" >> _x >> "picture")
|
||||
];
|
||||
} forEach WeaponCargo _vic;
|
||||
{
|
||||
private _config = _x call CBA_fnc_getObjectConfig;
|
||||
_BackpackCargo pushBack [
|
||||
getText (_config >> "displayName"),
|
||||
getText (_config >> "picture")
|
||||
];
|
||||
} forEach BackpackCargo _vic;
|
||||
|
||||
private _sortedItemCargo = ([_ItemCargo call BIS_fnc_consolidateArray, [], {_x # 0 # 0}] call BIS_fnc_sortBy) select {!(_x # 0 # 0 isEqualTo "")};
|
||||
private _sortedMagazineCargo = ([_MagazineCargo call BIS_fnc_consolidateArray, [], {_x # 0 # 0}] call BIS_fnc_sortBy) select {!(_x # 0 # 0 isEqualTo "")};
|
||||
private _sortedWeaponCargo = ([_WeaponCargo call BIS_fnc_consolidateArray, [], {_x # 0 # 0}] call BIS_fnc_sortBy) select {!(_x # 0 # 0 isEqualTo "")};
|
||||
private _sortedBackpackCargo = ([_BackpackCargo call BIS_fnc_consolidateArray, [], {_x # 0 # 0}] call BIS_fnc_sortBy) select {!(_x # 0 # 0 isEqualTo "")};
|
||||
|
||||
// "debug_console" callExtension(str _sortedItemCargo + "~0100");
|
||||
// "debug_console" callExtension(str _sortedMagazineCargo + "~0100");
|
||||
// "debug_console" callExtension(str _sortedWeaponCargo + "~0100");
|
||||
// "debug_console" callExtension(str _sortedBackpackCargo + "~0100");
|
||||
|
||||
if (count _sortedItemCargo > 0) then {
|
||||
_thisArr pushBack format["<font color='#ffffff' size='12' face='PuristaMedium'>Items:</font>"];
|
||||
private _itemCargoOut = [];
|
||||
{
|
||||
private _name = _x # 0 # 0;
|
||||
private _pic = _x # 0 # 1;
|
||||
private _count = _x # 1;
|
||||
if (_pic == "") then {
|
||||
_itemCargoOut pushBack format["<font color='#ffffff' size='12' face='EtelkaMonospacePro'><execute expression='systemChat ""%3"";'>%3 x%2</execute></font>", _pic, _count, _name];
|
||||
} else {
|
||||
_itemCargoOut pushBack format["<img height='30' image='%1'/><font color='#ffffff' size='10' face='EtelkaMonospacePro'><execute expression='systemChat ""%3"";'>x%2</execute></font>", _pic, _count, _name];
|
||||
};
|
||||
if ((_forEachIndex + 1) mod 6 == 0) then {_itemCargoOut pushBack "<br/>"};
|
||||
} forEach _sortedItemCargo;
|
||||
_thisArr pushBack (_itemCargoOut joinString "");
|
||||
};
|
||||
if (count _sortedMagazineCargo > 0) then {
|
||||
_thisArr pushBack format["<font color='#ffffff' size='12' face='PuristaMedium'>Magazines:</font>"];
|
||||
private _magCargoOut = [];
|
||||
{
|
||||
private _name = _x # 0 # 0;
|
||||
private _pic = _x # 0 # 1;
|
||||
private _count = _x # 1;
|
||||
if (_pic == "") then {
|
||||
_magCargoOut pushBack format["<font color='#ffffff' size='12' face='EtelkaMonospacePro'><execute expression='systemChat ""%3"";'>%3 x%2</execute></font>", _pic, _count, _name];
|
||||
} else {
|
||||
_magCargoOut pushBack format["<img height='30' image='%1'/><font color='#ffffff' size='10' face='EtelkaMonospacePro'><execute expression='systemChat ""%3"";'>x%2</execute></font>", _pic, _count, _name];
|
||||
};
|
||||
if ((_forEachIndex + 1) mod 6 == 0) then {_magCargoOut pushBack "<br/>"};
|
||||
} forEach _sortedMagazineCargo;
|
||||
_thisArr pushBack (_magCargoOut joinString "");
|
||||
};
|
||||
if (count _sortedWeaponCargo > 0) then {
|
||||
_thisArr pushBack format["<font color='#ffffff' size='12' face='PuristaMedium'>Weapons:</font>"];
|
||||
private _weaponCargoOut = [];
|
||||
{
|
||||
private _name = _x # 0 # 0;
|
||||
private _pic = _x # 0 # 1;
|
||||
private _count = _x # 1;
|
||||
if (_pic == "") then {
|
||||
_weaponCargoOut pushBack format["<font color='#ffffff' size='12' face='EtelkaMonospacePro'><execute expression='systemChat ""%3"";'>%3 x%2</execute></font>", _pic, _count, _name];
|
||||
} else {
|
||||
_weaponCargoOut pushBack format["<img height='50' image='%1'/><font color='#ffffff' size='10' face='EtelkaMonospacePro'><execute expression='systemChat ""%3"";'>x%2</execute></font>", _pic, _count, _name];
|
||||
};
|
||||
if ((_forEachIndex + 1) mod 3 == 0) then {_weaponCargoOut pushBack "<br/>"};
|
||||
} forEach _sortedWeaponCargo;
|
||||
_thisArr pushBack (_weaponCargoOut joinString "");
|
||||
};
|
||||
if (count _sortedBackpackCargo > 0) then {
|
||||
_thisArr pushBack format["<font color='#ffffff' size='12' face='PuristaMedium'>Backpacks:</font>"];
|
||||
private _backpackCargoOut = [];
|
||||
{
|
||||
private _name = _x # 0 # 0;
|
||||
private _pic = _x # 0 # 1;
|
||||
private _count = _x # 1;
|
||||
if (_pic == "") then {
|
||||
_backpackCargoOut pushBack format["<font color='#ffffff' size='12' face='EtelkaMonospacePro'><execute expression='systemChat ""%3"";'>%3 x%2</execute></font>", _pic, _count, _name];
|
||||
} else {
|
||||
_backpackCargoOut pushBack format["<img height='50' image='%1'/><font color='#ffffff' size='10' face='EtelkaMonospacePro'><execute expression='systemChat ""%3"";'>x%2</execute></font>", _pic, _count, _name];
|
||||
};
|
||||
if ((_forEachIndex + 1) mod 4 == 0) then {_backpackCargoOut pushBack "<br/>"};
|
||||
} forEach _sortedBackpackCargo;
|
||||
_thisArr pushBack (_backpackCargoOut joinString "");
|
||||
// "debug_console" callExtension(str _backpackCargoOut + "~0100");
|
||||
};
|
||||
|
||||
// "debug_console" callExtension(str _thisArr + "~1100");
|
||||
_thisArr;
|
||||
80
framework/fbcb2/assets/fn_getMagsForWeapon.sqf
Normal file
80
framework/fbcb2/assets/fn_getMagsForWeapon.sqf
Normal file
@@ -0,0 +1,80 @@
|
||||
params ["_vic", "_path", "_wep", "_magsHere", "_pylons"];
|
||||
|
||||
if (_path isEqualTo []) then {_path = [-1]};
|
||||
// "debug_console" callExtension (_wep + "#0100");
|
||||
if (_wep in [
|
||||
"rhs_weap_MASTERSAFE",
|
||||
"rhs_weap_fcs_ammo",
|
||||
"rhs_weap_laserDesignator_AI",
|
||||
"rhs_weap_fcs_ah64",
|
||||
"rhs_weap_DummyLauncher",
|
||||
"rhs_weap_fcs_nolrf_ammo",
|
||||
"rhsusf_weap_duke",
|
||||
"TruckHorn",
|
||||
"TruckHorn2",
|
||||
"TruckHorn3"
|
||||
]) exitWith {[[]]};
|
||||
|
||||
private _thisArr = [];
|
||||
_wepConfig = (configFile >> "CfgWeapons" >> _wep);
|
||||
_wepDisp = [(_wepConfig >> "displayName"), "STRING", "Weapon"] call CBA_fnc_getConfigEntry;
|
||||
if (_wep == "rhs_weap_smokegen") then {_wepDisp = "Smoke Generator"};
|
||||
if (_wepDisp isEqualTo "") exitWith {[[]]};
|
||||
|
||||
// "debug_console" callExtension (_wepDisp + "#0100");
|
||||
_magsToCheck = (_vic magazinesTurret _path);
|
||||
|
||||
|
||||
// See if the first default magazine in the config of this weapon is meant to be used on a pylon. If so, process differently
|
||||
// _mag1pylonWeapon = "";
|
||||
// _magsConfigArr = [(_wepConfig >> "magazines"), "ARRAY", []] call CBA_fnc_getConfigEntry;
|
||||
// if (_magsConfigArr isEqualTo []) then {
|
||||
// _mag1pylonWeapon = "";
|
||||
// } else {
|
||||
// _mag1Name = _magsConfigArr # 0;
|
||||
// _mag1pylonWeapon = [(configFile >> "CfgMagazines" >> _mag1Name >> "pylonWeapon"), "STRING", ""] call CBA_fnc_getConfigEntry;
|
||||
// };
|
||||
|
||||
_pylonMagNames = _pylons apply {_x # 3};
|
||||
|
||||
_compatMagsRef = [_wepConfig, true] call CBA_fnc_compatibleMagazines;
|
||||
_magsFound = _compatMagsRef select {_magsToCheck find _x != -1};
|
||||
|
||||
private _magsArr = [];
|
||||
|
||||
if (!((_magsFound # 0) in _pylonMagNames)) then {
|
||||
// Not a pylon weapon, so check mags in turret storage
|
||||
_thisArr pushBack format[" <font color='#87ffbb' face='PuristaSemiBold'>%1</font>", _wepDisp];
|
||||
{
|
||||
_thisMag = _x;
|
||||
_magAmmo = _vic magazineTurretAmmo [_x, _path];
|
||||
_magCount = (_magsHere select {_x # 0 == _thisMag} apply {_x # 1}) # 0;
|
||||
|
||||
private _magConfig = (configFile >> "CfgMagazines" >> _thisMag);
|
||||
private _magName = [(_magConfig >> "displayName"), "STRING", "Magazine"] call CBA_fnc_getConfigEntry;
|
||||
if (_magName isEqualTo "") then {_magName = "Magazine"};
|
||||
|
||||
|
||||
|
||||
_magsArr pushBack format[
|
||||
" + <font color='#4de4ff' size='12' face='PuristaMedium'><font color='#ffffff'>%1</font> <font color='#c2c2c2'>|</font> %2 <font color='#c2c2c2'>rounds</font> <font color='#c2c2c2'>|</font> %3 <font color='#c2c2c2'>mags</font></font>",
|
||||
_magName,
|
||||
_magAmmo,
|
||||
_magCount
|
||||
];
|
||||
} forEach _magsFound;
|
||||
} else {
|
||||
// This is a pylon weapon, so make a unique entry and directly check ammo on pylon
|
||||
_thisArr pushBack format[" <font color='#87ffbb' face='PuristaSemiBold'>%1</font> <font face='PuristaMedium'>[Pylon]</font>", _wepDisp];
|
||||
};
|
||||
|
||||
_thisArr pushBack _magsArr;
|
||||
// "debug_console" callExtension (str _magsArr + "#0100");
|
||||
_thisArr;
|
||||
// _thisArr;
|
||||
// "debug_console" callExtension (format[
|
||||
// " %1 | %2 rounds | %3 mags#0110",
|
||||
// getText(configFile >> "CfgMagazines" >> _thisMag >> "displayName"),
|
||||
// _magAmmo,
|
||||
// _magCount
|
||||
// ]);
|
||||
166
framework/fbcb2/assets/fn_getVehicleData.sqf
Normal file
166
framework/fbcb2/assets/fn_getVehicleData.sqf
Normal file
@@ -0,0 +1,166 @@
|
||||
params ["_vic"];
|
||||
|
||||
private _title = [];
|
||||
private _image = [];
|
||||
private _info = [];
|
||||
private _capacity = [];
|
||||
|
||||
// Excluded 2024-02-01
|
||||
// private _weapons = [];
|
||||
// private _pylonWeapons = [];
|
||||
// private _inventory = [];
|
||||
|
||||
|
||||
private _vicConfig = configOf _vic;
|
||||
private _class = configName _vicConfig;
|
||||
private _objType = (_vic call BIS_fnc_objectType) select 1;
|
||||
private _dispName = getText(_vicConfig >> 'displayName');
|
||||
|
||||
// "debug_console" callExtension (format["VehicleName = %1", _dispName] + "#0110");
|
||||
|
||||
private _cat = getText(_vicConfig >> 'category');
|
||||
private _fac = getText(_vicConfig >> 'faction');
|
||||
private _side = [getNumber(_vicConfig >> 'side')] call BIS_fnc_sideName;
|
||||
private _canFloat = (_vicConfig >> "canFloat") call BIS_fnc_getCfgDataBool;
|
||||
|
||||
private _totalSeats = [_class, true] call BIS_fnc_crewCount; // Number of total seats: crew + non-FFV cargo/passengers + FFV cargo/passengers
|
||||
private _crewSeats = [_class, false] call BIS_fnc_crewCount; // Number of crew seats only
|
||||
private _driverSeats = fullcrew [_vic, "driver", true];
|
||||
private _gunnerSeats = fullCrew [_vic, "gunner", true];
|
||||
private _commanderSeats = fullCrew [_vic, "commander", true];
|
||||
// _cargoSeats = fullCrew [_vic, "cargo", true];
|
||||
private _cargoSeats = _totalSeats - _crewSeats; // Number of total cargo/passenger seats: non-FFV + FFV
|
||||
private _turretSeatsRaw = fullCrew [_vic, "turret", true];
|
||||
private _turretSeats = _turretSeatsRaw select {(_x # 4) isEqualTo false};
|
||||
private _ffvSeats = _turretSeatsRaw select {(_x # 4) isEqualTo true};
|
||||
|
||||
private _pylons = getAllPylonsInfo _vic;
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// WRITE TITLE
|
||||
///////////////////////////////////////////////
|
||||
_title pushBack format["<font size='24' shadow='1' color='#e1701a' face='PuristaBold'>%1</font>", _dispName];
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// WRITE IMAGE
|
||||
///////////////////////////////////////////////
|
||||
// Editor preview image
|
||||
_image pushBack format["<img width='200' image='%1'/>", getText(_vicConfig >> 'editorPreview')];
|
||||
_image pushBack linebreak;
|
||||
// Thumbnail image
|
||||
// _image pushBack format["<img width='128' height='64' image='%1'/>", getText(_vicConfig >> 'picture')];
|
||||
// _image pushBack linebreak;
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// WRITE INFO
|
||||
///////////////////////////////////////////////
|
||||
_info pushBack format["<font size='14' color='#e1701a' face='PuristaBold'>INFO</font>"];
|
||||
_info pushBack format["<font face='PuristaMedium'> Classname: %1", _class];
|
||||
_info pushBack format[" Side: %1", _side];
|
||||
_info pushBack format[" Category: %1", _objType];
|
||||
_info pushBack format[" Faction: %1", _fac];
|
||||
_info pushBack format[" Can Float: %1", _canFloat];
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// WRITE CAPACITY
|
||||
///////////////////////////////////////////////
|
||||
_capacity pushBack format["<font size='14' color='#e1701a' face='PuristaBold'>CAPACITY: %1</font>", _totalSeats];
|
||||
_capacity pushBack format["<font face='PuristaMedium'> Driver Seats: %1", count _driverSeats];
|
||||
_capacity pushBack format[" Gunner Seats: %1", count _gunnerSeats];
|
||||
_capacity pushBack format[" Commander Seats: %1", count _commanderSeats];
|
||||
_capacity pushBack format[" Turret Seats: %1", count _turretSeats];
|
||||
_capacity pushBack format[" Cargo Seats: %1", _cargoSeats];
|
||||
_capacity pushBack format[" FFV Seats: %1</font>", count _ffvSeats];
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// GATHER WEAPONS AVAILABLE TO SEATS AND TURRETS
|
||||
// EXCLUDED 2024-02-01
|
||||
///////////////////////////////////////////////
|
||||
// _weapons pushBack format["<font size='14' color='#e1701a' face='PuristaBold'>WEAPONS</font>"];
|
||||
// // DRIVER
|
||||
// [_driverSeats apply {_x # 3}, "DRIVER/PILOT", _weapons] call milsim_fbcb2_assets_fnc_getWeaponry;
|
||||
|
||||
// //GUNNER
|
||||
// [_gunnerSeats apply {_x # 3}, "GUNNER/COPILOT", _weapons] call milsim_fbcb2_assets_fnc_getWeaponry;
|
||||
|
||||
// // COMMANDER
|
||||
// // "debug_console" callExtension ("COMMANDER" + "#1100");
|
||||
// [_commanderSeats apply {_x # 3}, "COMMANDER", _weapons] call milsim_fbcb2_assets_fnc_getWeaponry;
|
||||
|
||||
// // TURRETS
|
||||
// [_turretSeats apply {_x # 3}, "TURRET", _weapons] call milsim_fbcb2_assets_fnc_getWeaponry;
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// GATHER PYLON WEAPONS WITH AMMO
|
||||
// EXCLUDED 2024-02-01
|
||||
///////////////////////////////////////////////
|
||||
|
||||
// _pilotWeps = [];
|
||||
// _otherWeps = [];
|
||||
|
||||
// _parsePylonWeapons = {
|
||||
// params ["_input"];
|
||||
// _input params ["_index", "_name", "_turretPath", "_magazine","_ammoCount","_id"];
|
||||
// // "debug_console" callExtension (str _turretPath + "~0000");
|
||||
|
||||
// _magName = getText(configFile >> "CfgMagazines" >> _magazine >> "displayName");
|
||||
// if (_magName isEqualTo "") exitWith {};
|
||||
|
||||
// if (_turretPath isEqualTo [-1]) then {
|
||||
// _pilotWeps pushBack format[
|
||||
// " <font color='#87ffbb' face='PuristaSemiBold'>%1</font> <font face='PuristaMedium'><font color='#c2c2c2'>|</font> <font color='#4de4ff'>%2</font> <font color='#c2c2c2'>rounds</font></font>",
|
||||
// _magName,
|
||||
// _ammoCount
|
||||
// ];
|
||||
// } else {
|
||||
// _otherWeps pushBack format[
|
||||
// " <font color='#87ffbb' face='PuristaSemiBold'>%1</font> <font face='PuristaMedium'><font color='#c2c2c2'>|</font> <font color='#4de4ff'>%2</font> <font color='#c2c2c2'>rounds</font></font>",
|
||||
// _magName,
|
||||
// _ammoCount
|
||||
// ];
|
||||
// };
|
||||
// };
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// WRITE PYLON WEAPONS
|
||||
///////////////////////////////////////////////
|
||||
|
||||
// if (count _pylons > 0) then {
|
||||
// _pylonWeapons pushBack format["<font size='14' color='#e1701a' face='PuristaBold'>PYLON WEAPONS</font>"];
|
||||
// {
|
||||
// [_x] call _parsePylonWeapons;
|
||||
// } forEach _pylons;
|
||||
// _pylonWeapons pushBack format[" <font color='#f6dcbf' face='PuristaSemiBold'>PILOT</font>"];
|
||||
// {
|
||||
// _pylonWeapons pushBack _x;
|
||||
// } forEach _pilotWeps;
|
||||
// _pylonWeapons pushBack format[" <font color='#f6dcbf' face='PuristaSemiBold'>GUNNER</font>"];
|
||||
// {
|
||||
// _pylonWeapons pushBack _x;
|
||||
// } forEach _otherWeps;
|
||||
// };
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// GATHER INVENTORY
|
||||
// EXCLUDED 2024-02-01
|
||||
///////////////////////////////////////////////
|
||||
// _invLines = [_vic] call milsim_fbcb2_assets_fnc_getInventory;
|
||||
// if (count _invLines > 0) then {
|
||||
// _inventory pushBack format["<font size='14' color='#e1701a' face='PuristaBold'>INVENTORY</font>"];
|
||||
// _inventory append _invLines;
|
||||
// };
|
||||
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// CLOSE AND RETURN
|
||||
///////////////////////////////////////////////
|
||||
|
||||
[_vicConfig, _dispName, [
|
||||
_title joinString "<br/>",
|
||||
_image joinString "<br/>",
|
||||
_info joinString "<br/>",
|
||||
_capacity joinString "<br/>"
|
||||
// _weapons joinString "<br/>",
|
||||
// _pylonWeapons joinString "<br/>",
|
||||
// _inventory joinString "<br/>"
|
||||
]];
|
||||
55
framework/fbcb2/assets/fn_getWeaponry.sqf
Normal file
55
framework/fbcb2/assets/fn_getWeaponry.sqf
Normal file
@@ -0,0 +1,55 @@
|
||||
params ["_turretPaths", "_seatCategory", "_outArr"];
|
||||
{
|
||||
_path = _x;
|
||||
if (_path isEqualTo []) then {_path = [-1]};
|
||||
_weps = _vic weaponsTurret _path;
|
||||
private _thisArr = [];
|
||||
if (count _weps isNotEqualTo 0) then {
|
||||
_magsHere = _vic magazinesTurret _path call BIS_fnc_consolidateArray;
|
||||
|
||||
private _wepMags = [];
|
||||
{
|
||||
private _wepDet = [_vic, _path, _x, _magsHere, _pylons] call milsim_fbcb2_assets_fnc_getMagsForWeapon;
|
||||
if (!(_wepDet isEqualTo [[]])) then {
|
||||
_wepMags pushBack _wepDet;
|
||||
};
|
||||
} forEach _weps;
|
||||
|
||||
if (count _wepMags > 0) then {
|
||||
// "debug_console" callExtension (format["_wepMags Driver = %1", [_wepMags] call CBA_fnc_encodeJSON] + "#1100");
|
||||
{
|
||||
_thisArr pushBack _x # 0;
|
||||
if (count _x > 1) then {
|
||||
{
|
||||
_thisArr pushBack _x;
|
||||
} forEach (_x # 1);
|
||||
}
|
||||
} forEach _wepMags;
|
||||
};
|
||||
};// else {
|
||||
// "debug_console" callExtension (format["Running Mags Only."] + "#1100");
|
||||
// "debug_console" callExtension (format["Vic: %1",_vic] + "#1100");
|
||||
// "debug_console" callExtension (format["Path: %1", _path] + "#1100");
|
||||
// _mags = ([_vic, _path] call _getMags);
|
||||
|
||||
// if (count _mags > 0) then {
|
||||
// {
|
||||
// _thisArr pushBack _x;
|
||||
// } forEach _mags;
|
||||
// };
|
||||
// };
|
||||
|
||||
if (count _thisArr > 0) then {
|
||||
private _turretConfig = [_vic, _x] call BIS_fnc_turretConfig;
|
||||
private _turretDisplayName = [_turretConfig] call BIS_fnc_displayName;
|
||||
if (_turretDisplayName != "") then {
|
||||
_outArr pushBack format[" <font color='#f6dcbf' face='PuristaSemiBold'>%1 (""%2"")</font>", _seatCategory, _turretDisplayName];
|
||||
} else {
|
||||
_outArr pushBack format[" <font color='#f6dcbf' face='PuristaSemiBold'>%1</font>", _seatCategory];
|
||||
};
|
||||
|
||||
{
|
||||
_outArr pushBack _x;
|
||||
} forEach _thisArr;
|
||||
}
|
||||
} forEach _turretPaths;
|
||||
16
framework/fbcb2/assets/fn_removeAssetDiaryRecords.sqf
Normal file
16
framework/fbcb2/assets/fn_removeAssetDiaryRecords.sqf
Normal file
@@ -0,0 +1,16 @@
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
{
|
||||
private _diarySubject = _x;
|
||||
private _records = player allDiaryRecords _diarySubject;
|
||||
if (count _records isEqualTo 0) then {continue};
|
||||
|
||||
{
|
||||
private _diaryRecord = _x select -1;
|
||||
player removeDiaryRecord [_diarySubject, _diaryRecord];
|
||||
} forEach _records;
|
||||
} forEach [
|
||||
milsim_fbcb2_subjectAssetsFixedWingID,
|
||||
milsim_fbcb2_subjectAssetsRotaryID,
|
||||
milsim_fbcb2_subjectAssetsGroundID
|
||||
];
|
||||
185
framework/fbcb2/assets/fn_updateAssetDiary.sqf
Normal file
185
framework/fbcb2/assets/fn_updateAssetDiary.sqf
Normal file
@@ -0,0 +1,185 @@
|
||||
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 "<br/>";
|
||||
_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
|
||||
private _showMarkersText = format[
|
||||
"<execute expression='[""%1"",""%2"",""%3"",%4] call milsim_fbcb2_assets_fnc_showMarkersOnMap'>SHOW MARKERS at vehicle positions</execute> (in %5)",
|
||||
_className,
|
||||
_markerType,
|
||||
_randomColor#0,
|
||||
(_vehiclesOfThisKind apply {
|
||||
format["%1", _x call BIS_fnc_netId]
|
||||
}),
|
||||
format["<font color='%1'>%2</font>", _randomColor#1, _randomColor#2]
|
||||
];
|
||||
_recordText pushBack _showMarkersText;
|
||||
|
||||
// Link to hide markers
|
||||
_recordText pushBack "<execute expression=""call milsim_fbcb2_assets_fnc_removeMarkersOnMap"">REMOVE ALL MARKERS showing asset positions</execute>";
|
||||
|
||||
// Link to update asset diary entries
|
||||
_recordText pushBack "<execute expression=""call milsim_fbcb2_assets_fnc_updateAssetDiary"">UPDATE ENTRIES for all assets</execute>";
|
||||
|
||||
_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)."
|
||||
];
|
||||
|
||||
|
||||
|
||||
// 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 "<br/>",
|
||||
_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_util_fnc_log;
|
||||
|
||||
true;
|
||||
25
framework/fbcb2/assets/markers/fn_removeMarkersOnMap.sqf
Normal file
25
framework/fbcb2/assets/markers/fn_removeMarkersOnMap.sqf
Normal file
@@ -0,0 +1,25 @@
|
||||
private _baseMarkerStoreVar = "milsim_fbcb2_assets_baseMarkerStore";
|
||||
private _assetMarkerStoreVar = "milsim_fbcb2_assets_assetMarkerStore";
|
||||
|
||||
private _baseMarkerStore = localNamespace getVariable [
|
||||
_baseMarkerStoreVar,
|
||||
[]
|
||||
];
|
||||
private _assetMarkerStore = localNamespace getVariable [
|
||||
_assetMarkerStoreVar,
|
||||
[]
|
||||
];
|
||||
|
||||
// delete markers
|
||||
{
|
||||
deleteMarkerLocal (_x#1);
|
||||
} forEach (_baseMarkerStore + _assetMarkerStore);
|
||||
|
||||
localNamespace setVariable [
|
||||
_baseMarkerStoreVar,
|
||||
[]
|
||||
];
|
||||
localNamespace setVariable [
|
||||
_assetMarkerStoreVar,
|
||||
[]
|
||||
];
|
||||
106
framework/fbcb2/assets/markers/fn_showMarkersOnMap.sqf
Normal file
106
framework/fbcb2/assets/markers/fn_showMarkersOnMap.sqf
Normal file
@@ -0,0 +1,106 @@
|
||||
params [
|
||||
["_className", "", [""]],
|
||||
["_markerType", "hd_dot", [""]],
|
||||
["_markerColor", "", [""]],
|
||||
["_assetObjects", [], []]
|
||||
];
|
||||
|
||||
if (count _className isEqualTo 0) exitWith {
|
||||
["No class name provided!"] call BIS_fnc_error;
|
||||
};
|
||||
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;
|
||||
};
|
||||
|
||||
private _baseMarkerStoreVar = "milsim_fbcb2_assets_baseMarkerStore";
|
||||
private _assetMarkerStoreVar = "milsim_fbcb2_assets_assetMarkerStore";
|
||||
|
||||
private _baseMarkerStore = localNamespace getVariable [
|
||||
_baseMarkerStoreVar,
|
||||
[]
|
||||
];
|
||||
private _assetMarkerStore = localNamespace getVariable [
|
||||
_assetMarkerStoreVar,
|
||||
[]
|
||||
];
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Create base markers if not already present
|
||||
if (not (count _baseMarkerStore > 0)) then {
|
||||
{ // milsim_baseObjects is accessed directly, so are valid objects
|
||||
private _base = _x;
|
||||
|
||||
// create a circle marker with range as the detection range of assets
|
||||
_newMarker = createMarkerLocal [
|
||||
format["milsim_fbcb2_assets_base_marker_%1", _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
|
||||
];
|
||||
_newMarker setMarkerAlphaLocal 0.5;
|
||||
_newMarker setMarkerTextLocal str(_forEachIndex + 1);
|
||||
|
||||
_baseMarkerStore pushBack [
|
||||
_base,
|
||||
_newMarker
|
||||
];
|
||||
|
||||
// create a flag marker at base position
|
||||
_newMarker = createMarkerLocal [
|
||||
format["milsim_fbcb2_assets_base_flag_marker_%1", _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);
|
||||
|
||||
_baseMarkerStore pushBack [
|
||||
_base,
|
||||
_newMarker
|
||||
];
|
||||
} forEach milsim_baseObjects;
|
||||
|
||||
localNamespace setVariable [_baseMarkerStoreVar, _baseMarkerStore];
|
||||
};
|
||||
|
||||
|
||||
private _start = (count _assetMarkerStore) + 1;
|
||||
{ // _assetObjects is a serialized parameter, so we pass the netIds (strings)
|
||||
private _assetNetIdStr = _x;
|
||||
private _asset = _assetNetIdStr call BIS_fnc_objectFromNetId;
|
||||
// if asset was removed since last update
|
||||
if (isNull _asset) then {continue};
|
||||
// check if a marker is already placed for this asset
|
||||
if (
|
||||
(_assetMarkerStore findIf { _x select 0 isEqualTo _asset })
|
||||
> -1
|
||||
) then {continue};
|
||||
|
||||
// create a marker for the asset
|
||||
private _newMarker = createMarkerLocal [
|
||||
format["milsim_fbcb2_assets_marker_%1", _start],
|
||||
getPosASL _asset
|
||||
];
|
||||
_newMarker setMarkerAlphaLocal 1;
|
||||
_newMarker setMarkerTypeLocal _markerType;
|
||||
_newMarker setMarkerColorLocal _markerColor;
|
||||
// _newMarker setMarkerTextLocal ([configOf _asset] call BIS_fnc_displayName);
|
||||
|
||||
_assetMarkerStore pushBack [
|
||||
_asset,
|
||||
_newMarker
|
||||
];
|
||||
_start = _start + 1;
|
||||
} forEach _assetObjects;
|
||||
|
||||
// update store var
|
||||
localNamespace setVariable [_assetMarkerStoreVar, _assetMarkerStore];
|
||||
31
framework/fbcb2/fn_hintFBCB2AssetStatus.sqf
Normal file
31
framework/fbcb2/fn_hintFBCB2AssetStatus.sqf
Normal file
@@ -0,0 +1,31 @@
|
||||
_assetList = param [0, [objNull], [[objNull]]];
|
||||
|
||||
_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 ];
|
||||
|
||||
{
|
||||
_callSign = _x select 0;
|
||||
_asset = _x select 1;
|
||||
_assigned = _x select 2;
|
||||
_available = 0; //count (getMarkerPos "respawn_west" nearEntities [ _asset, 2000] );
|
||||
|
||||
_homes = allMissionObjects "ModuleRespawnPosition_F";
|
||||
|
||||
{
|
||||
_home = _x;
|
||||
_available = _available + count( _home nearEntities [ _asset, 750] );
|
||||
} forEach _homes;
|
||||
|
||||
|
||||
_image = getText(configFile >> "CfgVehicles" >> _asset >> "picture");
|
||||
|
||||
_name = getText(configFile >> "CfgVehicles" >> _asset >> "displayName") select [0, 24];
|
||||
_data = "<img size='1' align='left' image='" + _image + "'/><t size='1' align='left'> " + _name + "</t><t size='1' align='right'>" + str _available + " [ " + str _assigned +" ]</t>";
|
||||
_text = composeText[ _text, parseText _data, lineBreak ];
|
||||
|
||||
|
||||
} foreach _assetList;
|
||||
|
||||
hint _text;
|
||||
39
framework/fbcb2/fn_initFBCB2.sqf
Normal file
39
framework/fbcb2/fn_initFBCB2.sqf
Normal file
@@ -0,0 +1,39 @@
|
||||
|
||||
if ( !hasInterface ) exitWith {};
|
||||
|
||||
waitUntil { !isNil "milsim_complete" };
|
||||
|
||||
milsim_fbcb2_recordTitleColor = "#ff6666";
|
||||
milsim_fbcb2_recordTitleFont = "PuristaMedium";
|
||||
milsim_fbcb2_recordTitleSize = 20;
|
||||
|
||||
milsim_fbcb2_recordTextHeaderSize = 16;
|
||||
milsim_fbcb2_recordTextBodySize = 14;
|
||||
|
||||
milsim_fbcb2_subjectStatusID = "FBCB2_Status";
|
||||
milsim_fbcb2_subjectIntelID = "FBCB2_Intel";
|
||||
milsim_fbcb2_subjectMessagesID = "FBCB2_Messages";
|
||||
milsim_fbcb2_subjectFrequenciesID = "FBCB2_Frequencies";
|
||||
milsim_fbcb2_subjectAssetsFixedWingID = "FBCB2_Assets_FixedWing";
|
||||
milsim_fbcb2_subjectAssetsRotaryID = "FBCB2_Assets_Rotary";
|
||||
milsim_fbcb2_subjectAssetsGroundID = "FBCB2_Assets_Ground";
|
||||
|
||||
player createDiarySubject[milsim_fbcb2_subjectStatusID, "FBCB2 - Status"];
|
||||
player createDiarySubject[milsim_fbcb2_subjectMessagesID, "FBCB2 - Messages"];
|
||||
player createDiarySubject[milsim_fbcb2_subjectIntelID, "FBCB2 - Intel"];
|
||||
player createDiarySubject[milsim_fbcb2_subjectFrequenciesID, "FBCB2 - Frequencies"];
|
||||
player createDiarySubject[milsim_fbcb2_subjectAssetsFixedWingID, "FBCB2 - Assets Plane"];
|
||||
player createDiarySubject[milsim_fbcb2_subjectAssetsRotaryID, "FBCB2 - Assets Rotary"];
|
||||
player createDiarySubject[milsim_fbcb2_subjectAssetsGroundID, "FBCB2 - Assets Ground"];
|
||||
|
||||
// store records in format:
|
||||
// [subject, [
|
||||
// [title, diaryRecord]
|
||||
// ]]
|
||||
milsim_fbcb2_diaryRecords = createHashMap;
|
||||
|
||||
// populate diary
|
||||
[] call milsim_fnc_processFBCB2RadioFrequencies;
|
||||
[] call milsim_fnc_processFBCB2SmokeColors;
|
||||
[] call milsim_fnc_processFBCB2Environment;
|
||||
[] call milsim_fbcb2_assets_fnc_updateAssetDiary;
|
||||
45
framework/fbcb2/fn_processFBCB2Environment.sqf
Normal file
45
framework/fbcb2/fn_processFBCB2Environment.sqf
Normal file
@@ -0,0 +1,45 @@
|
||||
private _recordTitle = "MDS - INTEL - ENVIRONMENT";
|
||||
|
||||
private _text = [
|
||||
format[
|
||||
"<font size='%1' color='%2' face='%3'>%4</font><br/><br/>",
|
||||
milsim_fbcb2_recordTitleSize,
|
||||
milsim_fbcb2_recordTitleColor,
|
||||
milsim_fbcb2_recordTitleFont,
|
||||
_recordTitle
|
||||
]
|
||||
];
|
||||
|
||||
private _sunriseColor = "#4A86E8";
|
||||
private _sunsetColor = "#6AA84F";
|
||||
private _whiteColor = "#FFFFFF";
|
||||
|
||||
private _sunTimes = date call BIS_fnc_sunriseSunsetTime;
|
||||
|
||||
_text pushBack format[
|
||||
"<font size='%1' color='%2'>Local Sunrise</font><br/>
|
||||
<font size='%3' color='%4'>%5</font><br/><br/>",
|
||||
milsim_fbcb2_recordTextHeaderSize,
|
||||
_sunriseColor,
|
||||
milsim_fbcb2_recordTextBodySize,
|
||||
_whiteColor,
|
||||
([_sunTimes select 0, "HH:MM"] call BIS_fnc_timeToString)
|
||||
];
|
||||
|
||||
_text pushBack format[
|
||||
"<font size='%1' color='%2'>Local Sunset</font><br/>
|
||||
<font size='%3' color='%4'>%5</font><br/><br/>",
|
||||
milsim_fbcb2_recordTextHeaderSize,
|
||||
_sunsetColor,
|
||||
milsim_fbcb2_recordTextBodySize,
|
||||
_whiteColor,
|
||||
([_sunTimes select 1, "HH:MM"] call BIS_fnc_timeToString)
|
||||
];
|
||||
|
||||
_text = _text joinString "";
|
||||
|
||||
[
|
||||
milsim_fbcb2_subjectIntelID,
|
||||
_recordTitle,
|
||||
_text
|
||||
] call milsim_fnc_createOrUpdateDiaryRecord;
|
||||
50
framework/fbcb2/fn_processFBCB2RadioFrequencies.sqf
Normal file
50
framework/fbcb2/fn_processFBCB2RadioFrequencies.sqf
Normal file
@@ -0,0 +1,50 @@
|
||||
// updated 2024-02-01 by IndigoFox
|
||||
// now reads from the battalion config structure to generate the diary entries
|
||||
|
||||
////////////////////////////////////////
|
||||
// Get info from missionConfigFile
|
||||
////////////////////////////////////////
|
||||
private _battalionInfoCfg = call milsim_util_fnc_getBattalionCfg;
|
||||
private _battalionElementCfgs = [_battalionInfoCfg >> "Command"] call BIS_fnc_returnChildren;
|
||||
|
||||
////////////////////////////////////////
|
||||
// Define formatting constants
|
||||
////////////////////////////////////////
|
||||
private _ELEMENT_NAME_SIZE = 10;
|
||||
private _ELEMENT_NAME_FONT = "EtelkaMonospaceProBold";
|
||||
private _ELEMENT_FREQ_SIZE = 9;
|
||||
private _ELEMENT_FREQ_FONT = "EtelkaMonospacePro";
|
||||
private _FREQ_INDENT_CONSTANT = 6;
|
||||
private _FREQ_PAD_LENGTH = 17;
|
||||
private _FREQ_TEXT_COLOR = "#CCCCCC";
|
||||
// Note: Element colors are defined in the battalion config
|
||||
|
||||
////////////////////////////////////////
|
||||
// ADD DIARY ENTRIES
|
||||
////////////////////////////////////////
|
||||
|
||||
// First is all the battalion-level elements beneath command
|
||||
// To have the records listed in the order they appear in the battalion config, we need to reverse the array
|
||||
// Since each entry is added to the top of the list, this will result in the entries being added in the correct order
|
||||
reverse _battalionElementCfgs;
|
||||
|
||||
{
|
||||
// recursively generate diary text for all child elements of battalion-level elements
|
||||
private _diaryTitleText = [_x, true] call milsim_fnc_generateElementFrequencyRecordText;
|
||||
[
|
||||
milsim_fbcb2_subjectFrequenciesID,
|
||||
_diaryTitleText#0,
|
||||
_diaryTitleText#1
|
||||
] call milsim_fnc_createOrUpdateDiaryRecord;
|
||||
} forEach _battalionElementCfgs;
|
||||
|
||||
// add the battalion command to the top of the list
|
||||
// don't process child elements
|
||||
private _diaryTitleText = [_battalionInfoCfg >> "Command", false] call milsim_fnc_generateElementFrequencyRecordText;
|
||||
[
|
||||
milsim_fbcb2_subjectFrequenciesID,
|
||||
_diaryTitleText#0,
|
||||
_diaryTitleText#1
|
||||
] call milsim_fnc_createOrUpdateDiaryRecord;
|
||||
|
||||
true;
|
||||
41
framework/fbcb2/fn_processFBCB2SmokeColors.sqf
Normal file
41
framework/fbcb2/fn_processFBCB2SmokeColors.sqf
Normal file
@@ -0,0 +1,41 @@
|
||||
private _recordTitle = "MDS - INTEL - SMOKES";
|
||||
|
||||
private _text = [
|
||||
// Title
|
||||
format[
|
||||
"<font size='%1' color='%2' face='%3'>%4</font>",
|
||||
milsim_fbcb2_recordTitleSize,
|
||||
milsim_fbcb2_recordTitleColor,
|
||||
milsim_fbcb2_recordTitleFont,
|
||||
_recordTitle
|
||||
]
|
||||
];
|
||||
|
||||
private _smokeColors = [
|
||||
["#FFFFFF", "WHITE", "Concealment"],
|
||||
["#008800", "GREEN", "Friendly Forces"],
|
||||
["#0000FF", "BLUE", "LZ Markers"],
|
||||
["#FF0000", "RED", "Enemy Location"],
|
||||
["#FFA500", "ORANGE", "Resupply Marker"],
|
||||
["#FFFF00", "YELLOW", "Medical Emergency"],
|
||||
["#800080", "PURPLE", "Broken Arrow - 100m radius"]
|
||||
];
|
||||
|
||||
{
|
||||
_x params ["_color", "_name", "_description"];
|
||||
_text pushBack format[
|
||||
"<font size='%1'><font color='%2'>%3</font> - %4</font>",
|
||||
milsim_fbcb2_recordTextHeaderSize,
|
||||
_color,
|
||||
_name,
|
||||
_description
|
||||
];
|
||||
} forEach _smokeColors;
|
||||
|
||||
_text = _text joinString "<br/><br/>";
|
||||
|
||||
[
|
||||
milsim_fbcb2_subjectIntelID,
|
||||
_recordTitle,
|
||||
_text
|
||||
] call milsim_fnc_createOrUpdateDiaryRecord;
|
||||
@@ -0,0 +1,73 @@
|
||||
// called from milsim_fnc_processFBCB2RadioFrequencies
|
||||
params ["_cfg", ["_indentCount", 1, [5]]];
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Define leading space/hyphenation for element name
|
||||
//////////////////////////////////////////////////////
|
||||
private _leadingSpace = [
|
||||
format["<font size='%1' face='%2'>| ", _ELEMENT_NAME_SIZE, _ELEMENT_NAME_FONT]
|
||||
];
|
||||
for "_i" from 1 to _indentCount do {
|
||||
_leadingSpace pushBack "-";
|
||||
};
|
||||
_leadingSpace pushBack " | </font>";
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// Create the header line for the provided config entry
|
||||
/////////////////////////////////////////////////////////
|
||||
private _lines = [
|
||||
format[
|
||||
"<font color='%1'>%2%3</font>",
|
||||
getText(_cfg >> "textColor"),
|
||||
_leadingSpace joinString "",
|
||||
getText (_cfg >> "callsign")
|
||||
]
|
||||
];
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Create the frequency lines for the provided config entry
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
// Generate leading space
|
||||
private _freqLeadingSpace = [
|
||||
format["<font size='%1' face='%2'>| ", _ELEMENT_NAME_SIZE, _ELEMENT_NAME_FONT]
|
||||
];
|
||||
for "_i" from 1 to _FREQ_INDENT_CONSTANT do {
|
||||
_freqLeadingSpace pushBack " ";
|
||||
};
|
||||
_freqLeadingSpace pushBack "</font>";
|
||||
_freqLeadingSpace = _freqLeadingSpace joinString "";
|
||||
|
||||
// Process config values for frequencies
|
||||
{
|
||||
_x params ["_role", "_sr", "_lr"];
|
||||
|
||||
|
||||
private ["_srStr", "_lrStr"];
|
||||
if (count _sr > 0) then {
|
||||
_srStr = format["%1", _sr joinString " / "];
|
||||
} else {
|
||||
_srStr = "----";
|
||||
};
|
||||
if (count _lr > 0) then {
|
||||
_lrStr = format["%1", _lr joinString " / "];
|
||||
} else {
|
||||
_lrStr = "----";
|
||||
};
|
||||
|
||||
// Add formatted line to the array
|
||||
_lines pushBack format[
|
||||
"%1<font size='%2' face='%3' color='%4'>- %5%6%7</font>",
|
||||
_freqLeadingSpace,
|
||||
_ELEMENT_FREQ_SIZE,
|
||||
_ELEMENT_FREQ_FONT,
|
||||
_FREQ_TEXT_COLOR,
|
||||
[_role, "right", " ", _FREQ_PAD_LENGTH] call milsim_util_fnc_padString,
|
||||
[_srStr, "right", " ", _FREQ_PAD_LENGTH] call milsim_util_fnc_padString,
|
||||
_lrStr
|
||||
];
|
||||
} forEach (getArray (_cfg >> "frequencies"));
|
||||
// diag_log text (_lines joinString endl);
|
||||
|
||||
// Return the formatted lines in ARRAY format
|
||||
_lines;
|
||||
@@ -0,0 +1,87 @@
|
||||
// called from milsim_fnc_processFBCB2RadioFrequencies ONLY
|
||||
// this function is called recursively to process all child elements of a battalion element in missionConfigFile
|
||||
params [
|
||||
["_elementCfg", configNull, [configNull]],
|
||||
["_shouldProcessChildCfgs", true]
|
||||
];
|
||||
|
||||
if (isNull _elementCfg) exitWith {
|
||||
["_elementCfg parameter is NULL"] call BIS_fnc_error;
|
||||
};
|
||||
|
||||
// change reference variable for clarity
|
||||
private _battalionElement = _elementCfg;
|
||||
|
||||
// Generate title from callsign and shortDescription
|
||||
private _recordTitle = format[
|
||||
"%1 (%2)",
|
||||
getText(_battalionElement >> "callsign"),
|
||||
getText(_battalionElement >> "shortDescription")
|
||||
];
|
||||
// systemChat _recordTitle;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
// Generate frequency table header line's leading space
|
||||
//////////////////////////////////////////////////////////
|
||||
private _freqLeadingSpace = [
|
||||
format["<font size='%1' face='%2'>| ", _ELEMENT_NAME_SIZE, _ELEMENT_NAME_FONT]
|
||||
];
|
||||
for "_i" from 1 to _FREQ_INDENT_CONSTANT do {
|
||||
_freqLeadingSpace pushBack " ";
|
||||
};
|
||||
_freqLeadingSpace pushBack "</font>";
|
||||
_freqLeadingSpace = _freqLeadingSpace joinString "";
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
// Generate header line and frequency table header line
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
private _headers = [
|
||||
format[
|
||||
"<font size='%1' color='%2' face='%3'>%4</font>",
|
||||
milsim_fbcb2_recordTitleSize,
|
||||
milsim_fbcb2_recordTitleColor,
|
||||
milsim_fbcb2_recordTitleFont,
|
||||
_recordTitle
|
||||
],
|
||||
format[
|
||||
"%1<font size='%2' face='%3' color='%4'>- %5%6%7</font>",
|
||||
_freqLeadingSpace,
|
||||
_ELEMENT_FREQ_SIZE,
|
||||
_ELEMENT_FREQ_FONT,
|
||||
_FREQ_TEXT_COLOR,
|
||||
["ROLE", "right", " ", _FREQ_PAD_LENGTH] call milsim_util_fnc_padString,
|
||||
["SR", "right", " ", _FREQ_PAD_LENGTH] call milsim_util_fnc_padString,
|
||||
"LR"
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
// Generate the list of element headers and frequencies
|
||||
//////////////////////////////////////////////////////////
|
||||
private _allText = [];
|
||||
|
||||
// get all child elements recursively and format them
|
||||
if (_shouldProcessChildCfgs) then {
|
||||
[_battalionElement, {
|
||||
params ["_cfg", "_recurseCounter"];
|
||||
// add config
|
||||
private _lines = [_cfg, _recurseCounter+1] call milsim_fnc_formatRadioElementForDiary;
|
||||
// private _lines = [_cfg, _indentCount] call t;
|
||||
_allText pushBack (_lines joinString "<br/>");
|
||||
}] call milsim_util_fnc_recurseSubclasses;
|
||||
} else {
|
||||
// or if the param was false, just add the battalion element
|
||||
private _lines = [_battalionElement, 1] call milsim_fnc_formatRadioElementForDiary;
|
||||
// private _lines = [_cfg, _indentCount] call t;
|
||||
_allText pushBack (_lines joinString "<br/>");
|
||||
};
|
||||
|
||||
// add headers, add all other lines and format them as monospace
|
||||
_allText = format[
|
||||
"%1<br/><br/><font face='EtelkaMonospaceProBold'>%2</font>", _headers joinString "<br/>", _allText joinString "<br/><br/>"];
|
||||
|
||||
// return the title and all text
|
||||
[_recordTitle, _allText];
|
||||
28
framework/fbcb2/util/fn_createOrUpdateDiaryRecord.sqf
Normal file
28
framework/fbcb2/util/fn_createOrUpdateDiaryRecord.sqf
Normal file
@@ -0,0 +1,28 @@
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
params [
|
||||
["_subjectID", milsim_fbcb2_subjectStatusID, [""]],
|
||||
["_recordTitle", "", [""]],
|
||||
["_recordText", "", [""]],
|
||||
["_recordIcon", "", [""]]
|
||||
];
|
||||
|
||||
// Check if already created
|
||||
private _subjectRecords = milsim_fbcb2_diaryRecords getOrDefault [_subjectID, createHashMap, true];
|
||||
private _existingRecord = _subjectRecords getOrDefault [_recordTitle, diaryRecordNull, true];
|
||||
|
||||
if (!isNull _existingRecord) then {
|
||||
player setDiaryRecordText [[_subjectID, _existingRecord], [_recordTitle, _recordText, _recordIcon]];
|
||||
systemChat format ["Updated diary record: %1", _recordTitle];
|
||||
} else {
|
||||
private _new = player createDiaryRecord [
|
||||
_subjectID,
|
||||
[
|
||||
_recordTitle,
|
||||
_recordText,
|
||||
_recordIcon
|
||||
]
|
||||
];
|
||||
_subjectRecords set [_recordTitle, _new];
|
||||
milsim_fbcb2_diaryRecords set [_subjectID, _subjectRecords];
|
||||
};
|
||||
0
framework/fbcb2/util/fn_removeDiaryRecord.sqf
Normal file
0
framework/fbcb2/util/fn_removeDiaryRecord.sqf
Normal file
Reference in New Issue
Block a user