many changes. includes rework of baselocation-asset storage format

This commit is contained in:
2024-02-05 17:42:31 -08:00
parent f450f4611b
commit f588ffa4a0
32 changed files with 657 additions and 382 deletions

View File

@@ -229,8 +229,8 @@ class BattalionInfo {
}; };
}; };
class Attack { class Armor {
callsign = CALLSIGN_ELEMENT(ECHO_CALLSIGN, ATTACK); callsign = CALLSIGN_ELEMENT(ECHO_CALLSIGN, ARMOR);
textColor = LVL4_TEXT_COLOR; textColor = LVL4_TEXT_COLOR;
frequencies[] = { frequencies[] = {
{"Contact", {}, {FREQ_ECHO_GROUND, FREQ_ECHO_FLIGHT_CAS}}, {"Contact", {}, {FREQ_ECHO_GROUND, FREQ_ECHO_FLIGHT_CAS}},

View File

@@ -93,10 +93,9 @@ class Params
}; };
class cfgFunctions // CfgFunctions
{
#include "framework\CfgFunctions.hpp" #include "framework\CfgFunctions.hpp"
};
class CfgDebriefingSections { class CfgDebriefingSections {

View File

@@ -1,12 +1,13 @@
#include "script_mod.hpp" #include "script_mod.hpp"
class CfgFunctions {
class PREFIX class PREFIX
{ {
class settings class settings
{ {
file = "framework\settings"; file = "framework\settings";
class setDefaults { postInit = 1; }; class setDefaults { postInit = 1; };
class addCBASettings { postInit = 1; }; class addCBASettings { preInit = 1; };
class addAARChatHandler { postInit = 1; }; class addAARChatHandler { postInit = 1; };
class addRespawnChatHandler { postInit = 1; }; class addRespawnChatHandler { postInit = 1; };
}; };
@@ -18,24 +19,6 @@ class PREFIX
class initPlayerLocal { postInit = 1;}; class initPlayerLocal { postInit = 1;};
}; };
class fbcb2 {
file = "framework\fbcb2";
class initFBCB2 { postInit = 1; };
class processFBCB2RadioFrequencies {};
class processFBCB2SmokeColors {};
class processFBCB2Environment {};
class hintFBCB2AssetStatus {};
};
class fbcb2_util {
file = "framework\fbcb2\util";
class createOrUpdateDiaryRecord {};
};
class fbcb2_radioFrequencies {
file = "framework\fbcb2\radioFrequencies";
class formatRadioElementForDiary {};
class generateElementFrequencyRecordText {};
};
class client { class client {
file = "framework\client"; file = "framework\client";
class addZenModules { postInit = 1; }; class addZenModules { postInit = 1; };
@@ -73,56 +56,46 @@ class PREFIX
}; };
}; };
class DOUBLES(PREFIX,util) {
class functions {
file = "framework\util\functions";
class logMissionInfo { postInit = 1; };
class addPlayerInfoToArray {};
class log {};
class padString {};
class recurseSubclasses {};
class getBattalionCfg {};
class getNameOfBase {};
class getNearestBase {};
};
};
class DOUBLES(PREFIX,resupply) {
class functions {
file = "framework\resupply\functions";
class init {postInit=1;};
class createBox {};
class getSupplyCratesCfg {};
class addArsenalObjectSpawnBoxActions {};
class addCBASettings {postInit=1;};
};
};
class DOUBLES(PREFIX,fbcb2_assets) { class DOUBLES(PREFIX,fbcb2_assets) {
class functions { class functions {
file = "framework\fbcb2_assets\functions"; file = "framework\fbcb2_assets\functions";
class init {postInit=1;}; class addCBASettings {preInit=1;};
class updateAssetDiary {}; class initClient {postInit=1;};
class removeAssetDiaryRecords {}; class initServer {postInit=1;};
class getMagsForWeapon {};
class getWeaponry {};
class getInventory {};
class getVehicleData {};
class getAssetsByBase {}; class getAssetsByBase {};
class getInventory {};
class getMagsForWeapon {};
class getStartingAssetsByBase {}; class getStartingAssetsByBase {};
class updateAssetsByBase {}; class getVehicleData {};
class showMarkersOnMap {}; class getWeaponry {};
class hintAllApprovedAssets {};
class removeAssetDiaryRecords {};
class removeMarkersOnMap {}; class removeMarkersOnMap {};
class showMarkersOnMap {};
class updateAssetDiary {};
class updateAssetsByBase {};
class getCallsignFromClassname {};
class getStartingAndCurrentAssets {};
class isAssetInRangeOfBase {};
}; };
}; };
class DOUBLES(PREFIX,vehicleFlags) { class DOUBLES(PREFIX,fbcb2_main) {
class functions { class functions {
file = "framework\vehicleFlags\functions"; file = "framework\fbcb2_main\functions";
class init { postInit = 1; }; class init { postInit = 1; };
class getActionsFlagCategories {};
class getVehicleFlagsCfg {}; class processFBCB2Environment {};
class isClassExcluded {}; class processFBCB2RadioFrequencies {};
class processFBCB2SmokeColors {};
};
class util {
file = "framework\fbcb2_main\util";
class createOrUpdateDiaryRecord {};
class formatRadioElementForDiary {};
class generateElementFrequencyRecordText {};
}; };
}; };
@@ -144,3 +117,42 @@ class DOUBLES(PREFIX,reinsert) {
class requestShowQueue {}; class requestShowQueue {};
}; };
}; };
class DOUBLES(PREFIX,resupply) {
class functions {
file = "framework\resupply\functions";
class addCBASettings {preInit=1;};
class init {postInit=1;};
class createBox {};
class getSupplyCratesCfg {};
class addArsenalObjectSpawnBoxActions {};
};
};
class DOUBLES(PREFIX,util) {
class functions {
file = "framework\util\functions";
class logMissionInfo { postInit = 1; };
class addPlayerInfoToArray {};
class log {};
class padString {};
class recurseSubclasses {};
class getBattalionCfg {};
class getNameOfBase {};
class getNearestBase {};
class getApprovedAssetsCfg {};
};
};
class DOUBLES(PREFIX,vehicleFlags) {
class functions {
file = "framework\vehicleFlags\functions";
class init {postInit=1;};
class getActionsFlagCategories {};
class getVehicleFlagsCfg {};
class isClassExcluded {};
};
};
};

View File

@@ -1,31 +0,0 @@
_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;

View File

@@ -1,39 +0,0 @@
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;

View File

@@ -13,7 +13,7 @@
{ {
params ["_value"]; params ["_value"];
[ [
"fbcb2_assets", QUOTE(COMPONENT),
"SETTING CHANGED", "SETTING CHANGED",
[ [
[ [
@@ -22,6 +22,12 @@
], ],
["newValue", _value] ["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);

View File

@@ -1,4 +1,6 @@
#include "../script_component.hpp"
// return each base with its assets // return each base with its assets
milsim_baseObjects apply { GVARMAIN(baseObjects) apply {
[_x, _x getVariable ["milsim_fbcb2_assets_assetsAtThisBase", []]] [_x, _x getVariable [QGVAR(assetsAtThisBase), []]]
}; };

View File

@@ -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")};
"";

View File

@@ -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];

View File

@@ -1,4 +1,6 @@
#include "../script_component.hpp"
// return each base with its assets // return each base with its assets
milsim_baseObjects apply { GVARMAIN(baseObjects) apply {
[_x, _x getVariable ["milsim_fbcb2_assets_assetsStartedAtThisBase", []]] [_x, _x getVariable [QGVAR(assetsStartedAtThisBase), []]]
}; };

View File

@@ -39,7 +39,7 @@ private _pylons = getAllPylonsInfo _vic;
/////////////////////////////////////////////// ///////////////////////////////////////////////
// WRITE TITLE // WRITE TITLE
/////////////////////////////////////////////// ///////////////////////////////////////////////
_title pushBack format["<font size='24' shadow='1' color='#e1701a' face='PuristaBold'>%1</font>", _dispName]; _title pushBack format["%1", _dispName];
/////////////////////////////////////////////// ///////////////////////////////////////////////
// WRITE IMAGE // WRITE IMAGE

View File

@@ -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;

View File

@@ -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)

View File

@@ -1,3 +1,5 @@
#include "..\script_component.hpp"
if (!hasInterface) exitWith {}; if (!hasInterface) exitWith {};
{ {
@@ -10,7 +12,7 @@ if (!hasInterface) exitWith {};
player removeDiaryRecord [_diarySubject, _diaryRecord]; player removeDiaryRecord [_diarySubject, _diaryRecord];
} forEach _records; } forEach _records;
} forEach [ } forEach [
milsim_fbcb2_subjectAssetsFixedWingID, EGVAR(fbcb2_main,subjectAssetsFixedWingID),
milsim_fbcb2_subjectAssetsRotaryID, EGVAR(fbcb2_main,subjectAssetsRotaryID),
milsim_fbcb2_subjectAssetsGroundID EGVAR(fbcb2_main,subjectAssetsGroundID)
]; ];

View File

@@ -1,12 +1,11 @@
private _baseMarkerStoreVar = "milsim_fbcb2_assets_baseMarkerStore"; #include "..\script_component.hpp"
private _assetMarkerStoreVar = "milsim_fbcb2_assets_assetMarkerStore";
private _baseMarkerStore = localNamespace getVariable [ private _baseMarkerStore = localNamespace getVariable [
_baseMarkerStoreVar, QGVAR(baseMarkerStore),
[] []
]; ];
private _assetMarkerStore = localNamespace getVariable [ private _assetMarkerStore = localNamespace getVariable [
_assetMarkerStoreVar, QGVAR(assetMarkerStore),
[] []
]; ];
@@ -16,10 +15,10 @@ private _assetMarkerStore = localNamespace getVariable [
} forEach (_baseMarkerStore + _assetMarkerStore); } forEach (_baseMarkerStore + _assetMarkerStore);
localNamespace setVariable [ localNamespace setVariable [
_baseMarkerStoreVar, QGVAR(baseMarkerStore),
[] []
]; ];
localNamespace setVariable [ localNamespace setVariable [
_assetMarkerStoreVar, QGVAR(assetMarkerStore),
[] []
]; ];

View File

@@ -1,3 +1,5 @@
#include "..\script_component.hpp"
params [ params [
["_className", "", [""]], ["_className", "", [""]],
["_markerType", "hd_dot", [""]], ["_markerType", "hd_dot", [""]],
@@ -12,11 +14,11 @@ if (count _markerColor isEqualTo 0) exitWith {
["No marker color provided!"] call BIS_fnc_error; ["No marker color provided!"] call BIS_fnc_error;
}; };
if (count _assetObjects isEqualTo 0) exitWith { 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 _baseMarkerStoreVar = QGVAR(baseMarkerStore);
private _assetMarkerStoreVar = "milsim_fbcb2_assets_assetMarkerStore"; private _assetMarkerStoreVar = QGVAR(assetMarkerStore);
private _baseMarkerStore = localNamespace getVariable [ private _baseMarkerStore = localNamespace getVariable [
_baseMarkerStoreVar, _baseMarkerStoreVar,
@@ -35,15 +37,15 @@ if (not (count _baseMarkerStore > 0)) then {
// create a circle marker with range as the detection range of assets // create a circle marker with range as the detection range of assets
_newMarker = createMarkerLocal [ _newMarker = createMarkerLocal [
format["milsim_fbcb2_assets_base_marker_%1", _forEachIndex + 1], format["%1_%2", QGVAR(baseCircleMarker), _forEachIndex + 1],
getPosASL _base getPosASL _base
]; ];
_newMarker setMarkerTypeLocal "mil_dot"; _newMarker setMarkerTypeLocal "mil_dot";
_newMarker setMarkerColorLocal "ColorGreen"; _newMarker setMarkerColorLocal "ColorGreen";
_newMarker setMarkerShapeLocal "ELLIPSE"; _newMarker setMarkerShapeLocal "ELLIPSE";
_newMarker setMarkerSizeLocal [ _newMarker setMarkerSizeLocal [
milsim_fbcb2_assets_setting_detectionRangeFromBase, GVAR(setting_detectionRangeFromBase),
milsim_fbcb2_assets_setting_detectionRangeFromBase GVAR(setting_detectionRangeFromBase)
]; ];
_newMarker setMarkerAlphaLocal 0.5; _newMarker setMarkerAlphaLocal 0.5;
_newMarker setMarkerTextLocal str(_forEachIndex + 1); _newMarker setMarkerTextLocal str(_forEachIndex + 1);
@@ -55,19 +57,19 @@ if (not (count _baseMarkerStore > 0)) then {
// create a flag marker at base position // create a flag marker at base position
_newMarker = createMarkerLocal [ _newMarker = createMarkerLocal [
format["milsim_fbcb2_assets_base_flag_marker_%1", _forEachIndex + 1], format["%1_%2", QGVAR(baseFlagMarker), _forEachIndex + 1],
getPosASL _base getPosASL _base
]; ];
_newMarker setMarkerTypeLocal "mil_flag"; _newMarker setMarkerTypeLocal "mil_flag";
_newMarker setMarkerColorLocal "ColorGreen"; _newMarker setMarkerColorLocal "ColorGreen";
_newMarker setMarkerSizeLocal [0.7, 0.7]; _newMarker setMarkerSizeLocal [0.7, 0.7];
_newMarker setMarkerTextLocal ([_base] call milsim_util_fnc_getNameOfBase); _newMarker setMarkerTextLocal ([_base] call EFUNC(util,getNameOfBase));
_baseMarkerStore pushBack [ _baseMarkerStore pushBack [
_base, _base,
_newMarker _newMarker
]; ];
} forEach milsim_baseObjects; } forEach GVARMAIN(baseObjects);
localNamespace setVariable [_baseMarkerStoreVar, _baseMarkerStore]; localNamespace setVariable [_baseMarkerStoreVar, _baseMarkerStore];
}; };
@@ -85,9 +87,12 @@ private _start = (count _assetMarkerStore) + 1;
> -1 > -1
) then {continue}; ) 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 // create a marker for the asset
private _newMarker = createMarkerLocal [ private _newMarker = createMarkerLocal [
format["milsim_fbcb2_assets_marker_%1", _start], format["%1_%2", QGVAR(assetMarker), _start],
getPosASL _asset getPosASL _asset
]; ];
_newMarker setMarkerAlphaLocal 1; _newMarker setMarkerAlphaLocal 1;

View File

@@ -10,101 +10,145 @@ call FUNC(removeMarkersOnMap);
// remove existing asset records // remove existing asset records
call FUNC(removeAssetDiaryRecords); call FUNC(removeAssetDiaryRecords);
// get all vehicles by base (call FUNC(getStartingAndCurrentAssets)) params [
private _vehiclesByBase = call FUNC(getAssetsByBase); "_startingAssets",
if (count _vehiclesByBase isEqualTo 0) exitWith {false}; "_currentAssets"
];
// put vehicles from each base into a single array // get distinct vehicle class names
private _vehicles = [];
{
_vehicles append (_x#1);
} forEach _vehiclesByBase;
if (count _vehicles isEqualTo 0) exitWith {false};
private _distinctVehiclesClassNames = []; private _distinctVehiclesClassNames = [];
{ {
_distinctVehiclesClassNames pushBackUnique (typeOf _x); _x params ["_netId", "_cfg"];
} forEach _vehicles; 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 // ForEach unique vehicle class name, we'll find the first and gather its info
{ {
private _className = _x; 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 ( private _vehicleCallsign = toUpper (
_representativeVehicle getVariable [ [_className] call FUNC(getCallsignFromClassname)
QGVAR(callsign),
"NONE ASSIGNED"
]
); );
// 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 // Process the vehicle for extended info
// Exclusion list for display names // Exclusion list for display names
if ( if (
((configOf _representativeVehicle) call BIS_fnc_displayName) [_assetCfg] call BIS_fnc_displayName
in ["Helicopter"] in ["Helicopter"]
) then {continue}; ) then {continue};
// Get the vehicle data // Get the vehicle data
private _processed = [_representativeVehicle] call FUNC(getVehicleData); private _processed = [configNull, "", []];
if (!isNull _exampleVehicleToProcess) then {
if (isNil "_processed") then {continue}; _processed = [_exampleVehicleToProcess] call FUNC(getVehicleData);
_processed params ["_vehicleCfg", "_displayName", "_diaryTextSections"]; };
_processed params ["_processedVehicleCfg", "_displayName", "_diaryTextSections"];
_diaryTextSections params [ _diaryTextSections params [
"_title", ["_title", "", [""]],
"_image", ["_image", "", [""]],
"_info", ["_info", "", [""]],
"_capacity" ["_capacity", "", [""]]
// "_weapons", // ["_weapons", "", [""]],
// "_pylonWeapons", // ["_pylonWeapons", "", [""]],
// "_inventory" // ["_inventory", "", [""]]
]; ];
// Get what we can from the vehicle cfg
// Create the diary record // Create the diary record
private _recordText = []; private _recordText = [];
// Add the title and image // 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 _image;
_recordText pushBack "<br/>"; _recordText pushBack "<br/>";
_recordText pushBack format[ _recordText pushBack format[
"CALLSIGN: %1", "CALLSIGN: %1",
_vehicleCallsign _vehicleCallsign
]; ];
_recordText pushBack format[
"COUNT STARTED: %1",
count _startingAssetsOfThisType
];
_recordText pushBack format[ _recordText pushBack format[
"COUNT ACTIVE: %1", "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 // 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 // get 'picture' for record
private _icon = getText(_vehicleCfg >> "picture"); private _icon = getText(_assetCfg >> "picture");
// determine marker type // determine marker type
private _markerType = "mil_dot"; private _markerType = "mil_dot";
switch (true) do { switch (true) do {
case (_representativeVehicle isKindOf "Helicopter"): { case ("Helicopter" in _parentClassNames): {
_markerType = "loc_heli"; _markerType = "loc_heli";
}; };
case (_representativeVehicle isKindOf "Air"): { case ("Air" in _parentClassNames): {
_markerType = "loc_plane"; _markerType = "loc_plane";
}; };
case (_representativeVehicle isKindOf "Ship"): { case ("Ship" in _parentClassNames): {
_markerType = "loc_boat"; _markerType = "loc_boat";
}; };
case (_representativeVehicle isKindOf "Car"): { case ("Car" in _parentClassNames): {
_markerType = "loc_car"; _markerType = "loc_car";
}; };
default { 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 // Link to show markers
private _showMarkersText = format[ 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, _className,
_markerType, _markerType,
_randomColor#0, _randomColor#0,
(_vehiclesOfThisKind apply { (_currentAssetsOfThisType apply {
format["%1", _x call BIS_fnc_netId] _x params ["_netId", "_cfg"];
_netId;
}), }),
QFUNC(showMarkersOnMap),
format["<font color='%1'>%2</font>", _randomColor#1, _randomColor#2] format["<font color='%1'>%2</font>", _randomColor#1, _randomColor#2]
]; ];
_recordText pushBack _showMarkersText; _recordText pushBack _showMarkersText;
// Link to hide markers // 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 // 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[ _recordText pushBack format[
"<font size='10' color='#777777'>%1</font>", "<font size='10' color='#777777'>%1</font>",
"Notes:<br/> "Notes:<br/>
- Markers are only displayed on your local machine.<br/> - Markers are only displayed on your local machine.<br/>
- The REMOVE ALL option will remove all assets' markers from the map.<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 // Add info and capacity sections - exclude if no living examples were found
if (count _info > 0) then {
_recordText pushBack _info; _recordText pushBack _info;
};
if (count _capacity > 0) then {
_recordText pushBack _capacity; _recordText pushBack _capacity;
};
private _subjectID = ""; private _subjectID = "";
switch (true) do { switch (true) do {
case (_representativeVehicle isKindOf "Helicopter"): { case ("Helicopter" in _parentClassNames): {
_subjectID = EGVAR(fbcb2,subjectAssetsRotaryID); _subjectID = EGVAR(fbcb2_main,subjectAssetsRotaryID);
}; };
case (_representativeVehicle isKindOf "Air"): { case ("Air" in _parentClassNames): {
_subjectID = EGVAR(fbcb2,subjectAssetsFixedWingID); _subjectID = EGVAR(fbcb2_main,subjectAssetsFixedWingID);
}; };
default { default {
_subjectID = EGVAR(fbcb2,subjectAssetsGroundID); _subjectID = EGVAR(fbcb2_main,subjectAssetsGroundID);
}; };
}; };
[ [
_subjectID, _subjectID,
format[ format[
"%1x %2", "[%1/%2] %3",
count _vehiclesOfThisKind, count _currentAssetsOfThisType,
(configOf _representativeVehicle) call BIS_fnc_displayName count _startingAssetsOfThisType,
(_assetCfg) call BIS_fnc_displayName
], ],
_recordText joinString "<br/>", _recordText joinString "<br/>",
_icon _icon
] call milsim_fnc_createOrUpdateDiaryRecord; ] call EFUNC(fbcb2_main,createOrUpdateDiaryRecord);
// "\A3\ui_f\data\igui\cfg\simpleTasks\types\car_ca.paa" // "\A3\ui_f\data\igui\cfg\simpleTasks\types\car_ca.paa"
} forEach _distinctVehiclesClassNames; } forEach _distinctVehiclesClassNames;
@@ -178,8 +251,9 @@ private _distinctVehiclesClassNames = [];
QUOTE(COMPONENT), QUOTE(COMPONENT),
"UPDATED ASSET DIARY", "UPDATED ASSET DIARY",
[ [
["assetCount", count _vehicles], ["startingAssetCount", count _startingAssets],
["distinctAssetCount", count _distinctVehiclesClassNames] ["startingAssetCountDistinct", count _distinctVehiclesClassNames],
["currentassetCount", count _currentAssets]
] ]
] call EFUNC(util,log); ] call EFUNC(util,log);

View File

@@ -17,32 +17,29 @@ private _allSaved = [];
private _assetsAtThisBaseVar = QGVAR(assetsAtThisBase); private _assetsAtThisBaseVar = QGVAR(assetsAtThisBase);
private _assetsStartedAtThisBaseVar = QGVAR(assetsStartedAtThisBase); private _assetsStartedAtThisBaseVar = QGVAR(assetsStartedAtThisBase);
private _approvedAssetsCfg = call EFUNC(util,getApprovedAssetsCfg);
if (isNull _approvedAssetsCfg) exitWith {};
{ {
private _className = configName _x; private _className = configName _x;
private _callsign = getText(_x >> "callsign"); private _callsign = getText(_x >> "callsign");
private _found = _allVehicles select { typeOf _x == _className }; private _found = _allVehicles select { typeOf _x == _className };
{ {
private _asset = _x; private _asset = _x;
// avoid duplicates // avoid duplicates
if (_asset in _allSaved) then {continue}; 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 // add to base's assets list
private _closestBase = [_asset] call EFUNC(util,getNearestBase);
private _baseAssets = _closestBase getVariable [_assetsAtThisBaseVar, []]; 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 // broadcast later so we're not spamming network
_closestBase setVariable [ _closestBase setVariable [
_assetsAtThisBaseVar, _assetsAtThisBaseVar,
@@ -60,7 +57,7 @@ private _assetsStartedAtThisBaseVar = QGVAR(assetsStartedAtThisBase);
_allSaved pushBack _asset; _allSaved pushBack _asset;
} forEach _found; } forEach _found;
} forEach ((missionConfigFile >> "ApprovedAssets") call BIS_fnc_returnChildren); } forEach (_approvedAssetsCfg call BIS_fnc_returnChildren);
// Add all ground vehicles (LandVehicle) // Add all ground vehicles (LandVehicle)
{ {
@@ -68,23 +65,16 @@ private _assetsStartedAtThisBaseVar = QGVAR(assetsStartedAtThisBase);
// avoid duplicates // avoid duplicates
if (_asset in _allSaved) then {continue}; if (_asset in _allSaved) then {continue};
private _closestBase = [_asset] call EFUNC(util,getNearestBase); if (not ([_asset] call FUNC(isAssetInRangeOfBase))) then {continue};
if (isNull _closestBase) then {
// no base found
continue;
};
if (
_asset distance _closestBase >
GVAR(setting_detectionRangeFromBase)
) then {
// not within range
continue;
};
// add to base's assets list // add to base's assets list
private _closestBase = [_asset] call EFUNC(util,getNearestBase);
private _baseAssets = _closestBase getVariable [_assetsAtThisBaseVar, []]; 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 // broadcast later so we're not spamming network
_closestBase setVariable [ _closestBase setVariable [
_assetsAtThisBaseVar, _assetsAtThisBaseVar,
@@ -115,7 +105,7 @@ private _assetsStartedAtThisBaseVar = QGVAR(assetsStartedAtThisBase);
if (_isInit) then { if (_isInit) then {
_base setVariable [_assetsStartedAtThisBaseVar, _baseAssets, true]; _base setVariable [_assetsStartedAtThisBaseVar, _baseAssets, true];
}; };
} forEach milsim_baseObjects; } forEach GVARMAIN(baseObjects);
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// log starting assets if init // log starting assets if init
@@ -131,14 +121,11 @@ if !(_isInit || _logCurrentAssets) exitWith {};
// prepare key value for logging // prepare key value for logging
private _baseAssetsHashesPrep = _baseAssets apply { private _baseAssetsHashesPrep = _baseAssets apply {
private _asset = _x; _x params ["_netId", "_cfg"];
[ [
["callsign", _asset getVariable [ ["callsign", [configName _cfg] call FUNC(getCallsignFromClassname)],
QGVAR(callsign), ["className", configName _cfg],
"N/A" ["displayName", [_cfg] call BIS_fnc_displayName]
]],
["className", typeOf _asset],
["displayName", (configOf _asset) call BIS_fnc_displayName]
]; ];
}; };
@@ -155,13 +142,13 @@ if !(_isInit || _logCurrentAssets) exitWith {};
if (_logCurrentAssets) then { if (_logCurrentAssets) then {
{ {
[ [
"fbcb2_assets", QUOTE(COMPONENT),
"CURRENT ASSETS", "CURRENT ASSETS",
[ [
["baseName", [[_base] call milsim_util_fnc_getNameOfBase]], ["baseName", [[_base] call EFUNC(util,getNameOfBase)]],
["asset", _x] ["asset", _x]
] ]
] call milsim_util_fnc_log; ] call EFUNC(util,log);
} forEach _baseAssetsHashes; } forEach _baseAssetsHashes;
}; };
@@ -172,10 +159,10 @@ if !(_isInit || _logCurrentAssets) exitWith {};
"fbcb2_assets", "fbcb2_assets",
"STARTING ASSETS", "STARTING ASSETS",
[ [
["baseName", [[_base] call milsim_util_fnc_getNameOfBase]], ["baseName", [[_base] call EFUNC(util,getNameOfBase)]],
["asset", _x] ["asset", _x]
] ]
] call milsim_util_fnc_log; ] call EFUNC(util,log);
} forEach _baseAssetsHashes; } forEach _baseAssetsHashes;
}; };
} forEach milsim_baseObjects; } forEach GVARMAIN(baseObjects);

View File

@@ -0,0 +1,39 @@
#include "../script_component.hpp"
if ( !hasInterface ) exitWith {};
waitUntil { !isNil QGVARMAIN(complete) };
GVAR(recordTitleColor) = "#ff6666";
GVAR(recordTitleFont) = "PuristaMedium";
GVAR(recordTitleSize) = 20;
GVAR(recordTextHeaderSize) = 16;
GVAR(recordTextBodySize) = 14;
GVAR(subjectStatusID) = "FBCB2_Status";
GVAR(subjectIntelID) = "FBCB2_Intel";
GVAR(subjectMessagesID) = "FBCB2_Messages";
GVAR(subjectFrequenciesID) = "FBCB2_Frequencies";
GVAR(subjectAssetsFixedWingID) = "FBCB2_Assets_FixedWing";
GVAR(subjectAssetsRotaryID) = "FBCB2_Assets_Rotary";
GVAR(subjectAssetsGroundID) = "FBCB2_Assets_Ground";
player createDiarySubject[GVAR(subjectStatusID), "FBCB2 Status"];
player createDiarySubject[GVAR(subjectMessagesID), "FBCB2 Messages"];
player createDiarySubject[GVAR(subjectIntelID), "FBCB2 Intel"];
player createDiarySubject[GVAR(subjectFrequenciesID), "FBCB2 Frequencies"];
player createDiarySubject[GVAR(subjectAssetsFixedWingID), "FBCB2 Planes"];
player createDiarySubject[GVAR(subjectAssetsRotaryID), "FBCB2 Helicopters"];
player createDiarySubject[GVAR(subjectAssetsGroundID), "FBCB2 Ground"];
// store records in format:
// [subject, [
// [title, diaryRecord]
// ]]
GVAR(diaryRecords) = createHashMap;
// run main inits - assets handled in that component
[] call FUNC(processFBCB2RadioFrequencies);
[] call FUNC(processFBCB2SmokeColors);
[] call FUNC(processFBCB2Environment);

View File

@@ -1,11 +1,13 @@
#include "..\script_component.hpp"
private _recordTitle = "MDS - INTEL - ENVIRONMENT"; private _recordTitle = "MDS - INTEL - ENVIRONMENT";
private _text = [ private _text = [
format[ format[
"<font size='%1' color='%2' face='%3'>%4</font><br/><br/>", "<font size='%1' color='%2' face='%3'>%4</font><br/><br/>",
milsim_fbcb2_recordTitleSize, GVAR(recordTitleSize),
milsim_fbcb2_recordTitleColor, GVAR(recordTitleColor),
milsim_fbcb2_recordTitleFont, GVAR(recordTitleFont),
_recordTitle _recordTitle
] ]
]; ];
@@ -19,9 +21,9 @@ private _sunTimes = date call BIS_fnc_sunriseSunsetTime;
_text pushBack format[ _text pushBack format[
"<font size='%1' color='%2'>Local Sunrise</font><br/> "<font size='%1' color='%2'>Local Sunrise</font><br/>
<font size='%3' color='%4'>%5</font><br/><br/>", <font size='%3' color='%4'>%5</font><br/><br/>",
milsim_fbcb2_recordTextHeaderSize, GVAR(recordTextHeaderSize),
_sunriseColor, _sunriseColor,
milsim_fbcb2_recordTextBodySize, GVAR(recordTextBodySize),
_whiteColor, _whiteColor,
([_sunTimes select 0, "HH:MM"] call BIS_fnc_timeToString) ([_sunTimes select 0, "HH:MM"] call BIS_fnc_timeToString)
]; ];
@@ -29,9 +31,9 @@ _text pushBack format[
_text pushBack format[ _text pushBack format[
"<font size='%1' color='%2'>Local Sunset</font><br/> "<font size='%1' color='%2'>Local Sunset</font><br/>
<font size='%3' color='%4'>%5</font><br/><br/>", <font size='%3' color='%4'>%5</font><br/><br/>",
milsim_fbcb2_recordTextHeaderSize, GVAR(recordTextHeaderSize),
_sunsetColor, _sunsetColor,
milsim_fbcb2_recordTextBodySize, GVAR(recordTextBodySize),
_whiteColor, _whiteColor,
([_sunTimes select 1, "HH:MM"] call BIS_fnc_timeToString) ([_sunTimes select 1, "HH:MM"] call BIS_fnc_timeToString)
]; ];
@@ -39,7 +41,7 @@ _text pushBack format[
_text = _text joinString ""; _text = _text joinString "";
[ [
milsim_fbcb2_subjectIntelID, GVAR(subjectIntelID),
_recordTitle, _recordTitle,
_text _text
] call milsim_fnc_createOrUpdateDiaryRecord; ] call FUNC(createOrUpdateDiaryRecord);

View File

@@ -1,11 +1,28 @@
// updated 2024-02-01 by IndigoFox // updated 2024-02-01 by IndigoFox
// now reads from the battalion config structure to generate the diary entries // now reads from the battalion config structure to generate the diary entries
#include "../script_component.hpp"
//////////////////////////////////////// ////////////////////////////////////////
// Get info from missionConfigFile // Get info from missionConfigFile
//////////////////////////////////////// ////////////////////////////////////////
private _battalionInfoCfg = call milsim_util_fnc_getBattalionCfg; private _battalionInfoCfg = call EFUNC(util,getBattalionCfg);
if (isNull _battalionInfoCfg) exitWith {
[
QUOTE(COMPONENT),
"Null Battalion Config",
[]
] call EFUNC(util,log);
};
private _battalionElementCfgs = [_battalionInfoCfg >> "Command"] call BIS_fnc_returnChildren; private _battalionElementCfgs = [_battalionInfoCfg >> "Command"] call BIS_fnc_returnChildren;
if (count _battalionElementCfgs == 0) exitWith {
[
QUOTE(COMPONENT),
"ERROR: No battalion elements found. Check that the battalion config is correctly structured. See defines/BattalionInfo.hpp and framework/util/functions/getBattalionCfg.sqf.",
[]
] call EFUNC(util,log);
};
//////////////////////////////////////// ////////////////////////////////////////
// Define formatting constants // Define formatting constants
@@ -29,22 +46,28 @@ private _FREQ_TEXT_COLOR = "#CCCCCC";
reverse _battalionElementCfgs; reverse _battalionElementCfgs;
{ {
diag_log text format[
"[%1] <%2> Processing battalion element %3",
QUOTE(PREFIX),
_fnc_scriptName,
configName _x
];
// recursively generate diary text for all child elements of battalion-level elements // recursively generate diary text for all child elements of battalion-level elements
private _diaryTitleText = [_x, true] call milsim_fnc_generateElementFrequencyRecordText; private _diaryTitleText = [_x, true] call FUNC(generateElementFrequencyRecordText);
[ [
milsim_fbcb2_subjectFrequenciesID, GVAR(subjectFrequenciesID),
_diaryTitleText#0, _diaryTitleText#0,
_diaryTitleText#1 _diaryTitleText#1
] call milsim_fnc_createOrUpdateDiaryRecord; ] call FUNC(createOrUpdateDiaryRecord);
} forEach _battalionElementCfgs; } forEach _battalionElementCfgs;
// add the battalion command to the top of the list // add the battalion command to the top of the list
// don't process child elements // don't process child elements
private _diaryTitleText = [_battalionInfoCfg >> "Command", false] call milsim_fnc_generateElementFrequencyRecordText; private _diaryTitleText = [_battalionInfoCfg >> "Command", false] call FUNC(generateElementFrequencyRecordText);
[ [
milsim_fbcb2_subjectFrequenciesID, GVAR(subjectFrequenciesID),
_diaryTitleText#0, _diaryTitleText#0,
_diaryTitleText#1 _diaryTitleText#1
] call milsim_fnc_createOrUpdateDiaryRecord; ] call FUNC(createOrUpdateDiaryRecord);
true; true;

View File

@@ -1,12 +1,14 @@
#include "../script_component.hpp"
private _recordTitle = "MDS - INTEL - SMOKES"; private _recordTitle = "MDS - INTEL - SMOKES";
private _text = [ private _text = [
// Title // Title
format[ format[
"<font size='%1' color='%2' face='%3'>%4</font>", "<font size='%1' color='%2' face='%3'>%4</font>",
milsim_fbcb2_recordTitleSize, GVAR(recordTitleSize),
milsim_fbcb2_recordTitleColor, GVAR(recordTitleColor),
milsim_fbcb2_recordTitleFont, GVAR(recordTitleFont),
_recordTitle _recordTitle
] ]
]; ];
@@ -25,7 +27,7 @@ private _smokeColors = [
_x params ["_color", "_name", "_description"]; _x params ["_color", "_name", "_description"];
_text pushBack format[ _text pushBack format[
"<font size='%1'><font color='%2'>%3</font> - %4</font>", "<font size='%1'><font color='%2'>%3</font> - %4</font>",
milsim_fbcb2_recordTextHeaderSize, GVAR(recordTextHeaderSize),
_color, _color,
_name, _name,
_description _description
@@ -35,7 +37,7 @@ private _smokeColors = [
_text = _text joinString "<br/><br/>"; _text = _text joinString "<br/><br/>";
[ [
milsim_fbcb2_subjectIntelID, GVAR(subjectIntelID),
_recordTitle, _recordTitle,
_text _text
] call milsim_fnc_createOrUpdateDiaryRecord; ] call FUNC(createOrUpdateDiaryRecord);

View File

@@ -0,0 +1,3 @@
#define COMPONENT fbcb2_main
#define COMPONENT_BEAUTIFIED FBCB2 - Main
#include "../script_mod.hpp"

View File

@@ -1,14 +1,16 @@
#include "../script_component.hpp"
if (!hasInterface) exitWith {}; if (!hasInterface) exitWith {};
params [ params [
["_subjectID", milsim_fbcb2_subjectStatusID, [""]], ["_subjectID", GVAR(subjectStatusID), [""]],
["_recordTitle", "", [""]], ["_recordTitle", "", [""]],
["_recordText", "", [""]], ["_recordText", "", [""]],
["_recordIcon", "", [""]] ["_recordIcon", "", [""]]
]; ];
// Check if already created // Check if already created
private _subjectRecords = milsim_fbcb2_diaryRecords getOrDefault [_subjectID, createHashMap, true]; private _subjectRecords = GVAR(diaryRecords) getOrDefault [_subjectID, createHashMap, true];
private _existingRecord = _subjectRecords getOrDefault [_recordTitle, diaryRecordNull, true]; private _existingRecord = _subjectRecords getOrDefault [_recordTitle, diaryRecordNull, true];
if (!isNull _existingRecord) then { if (!isNull _existingRecord) then {
@@ -24,5 +26,5 @@ if (!isNull _existingRecord) then {
] ]
]; ];
_subjectRecords set [_recordTitle, _new]; _subjectRecords set [_recordTitle, _new];
milsim_fbcb2_diaryRecords set [_subjectID, _subjectRecords]; GVAR(diaryRecords) set [_subjectID, _subjectRecords];
}; };

View File

@@ -1,4 +1,6 @@
// called from milsim_fnc_processFBCB2RadioFrequencies // called from milsim_fnc_processFBCB2RadioFrequencies
#include "../script_component.hpp"
params ["_cfg", ["_indentCount", 1, [5]]]; params ["_cfg", ["_indentCount", 1, [5]]];
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
@@ -62,8 +64,8 @@ _freqLeadingSpace = _freqLeadingSpace joinString "";
_ELEMENT_FREQ_SIZE, _ELEMENT_FREQ_SIZE,
_ELEMENT_FREQ_FONT, _ELEMENT_FREQ_FONT,
_FREQ_TEXT_COLOR, _FREQ_TEXT_COLOR,
[_role, "right", " ", _FREQ_PAD_LENGTH] call milsim_util_fnc_padString, [_role, "right", " ", _FREQ_PAD_LENGTH] call EFUNC(util,padString),
[_srStr, "right", " ", _FREQ_PAD_LENGTH] call milsim_util_fnc_padString, [_srStr, "right", " ", _FREQ_PAD_LENGTH] call EFUNC(util,padString),
_lrStr _lrStr
]; ];
} forEach (getArray (_cfg >> "frequencies")); } forEach (getArray (_cfg >> "frequencies"));

View File

@@ -1,5 +1,8 @@
// called from milsim_fnc_processFBCB2RadioFrequencies ONLY // called from milsim_fnc_processFBCB2RadioFrequencies ONLY
// this function is called recursively to process all child elements of a battalion element in missionConfigFile // this function is called recursively to process all child elements of a battalion element in missionConfigFile
#include "../script_component.hpp"
params [ params [
["_elementCfg", configNull, [configNull]], ["_elementCfg", configNull, [configNull]],
["_shouldProcessChildCfgs", true] ["_shouldProcessChildCfgs", true]
@@ -40,9 +43,9 @@ _freqLeadingSpace = _freqLeadingSpace joinString "";
private _headers = [ private _headers = [
format[ format[
"<font size='%1' color='%2' face='%3'>%4</font>", "<font size='%1' color='%2' face='%3'>%4</font>",
milsim_fbcb2_recordTitleSize, GVAR(recordTitleSize),
milsim_fbcb2_recordTitleColor, GVAR(recordTitleColor),
milsim_fbcb2_recordTitleFont, GVAR(recordTitleFont),
_recordTitle _recordTitle
], ],
format[ format[
@@ -51,8 +54,8 @@ private _headers = [
_ELEMENT_FREQ_SIZE, _ELEMENT_FREQ_SIZE,
_ELEMENT_FREQ_FONT, _ELEMENT_FREQ_FONT,
_FREQ_TEXT_COLOR, _FREQ_TEXT_COLOR,
["ROLE", "right", " ", _FREQ_PAD_LENGTH] call milsim_util_fnc_padString, ["ROLE", "right", " ", _FREQ_PAD_LENGTH] call EFUNC(util,padString),
["SR", "right", " ", _FREQ_PAD_LENGTH] call milsim_util_fnc_padString, ["SR", "right", " ", _FREQ_PAD_LENGTH] call EFUNC(util,padString),
"LR" "LR"
] ]
]; ];
@@ -65,16 +68,28 @@ private _allText = [];
// get all child elements recursively and format them // get all child elements recursively and format them
if (_shouldProcessChildCfgs) then { if (_shouldProcessChildCfgs) then {
diag_log text format[
"[%1] <%2> Processing %3",
QUOTE(PREFIX),
_fnc_scriptName,
configName _battalionElement
];
[_battalionElement, { [_battalionElement, {
params ["_cfg", "_recurseCounter"]; params ["_cfg", "_recurseCounter"];
// add config // add config
private _lines = [_cfg, _recurseCounter+1] call milsim_fnc_formatRadioElementForDiary; private _lines = [_cfg, _recurseCounter+1] call FUNC(formatRadioElementForDiary);
// private _lines = [_cfg, _indentCount] call t; // private _lines = [_cfg, _indentCount] call t;
_allText pushBack (_lines joinString "<br/>"); _allText pushBack (_lines joinString "<br/>");
}] call milsim_util_fnc_recurseSubclasses; }] call EFUNC(util,recurseSubclasses);
} else { } else {
diag_log text format[
"[%1] <%2> Processing %3",
QUOTE(PREFIX),
_fnc_scriptName,
configName _battalionElement
];
// or if the param was false, just add the battalion element // or if the param was false, just add the battalion element
private _lines = [_battalionElement, 1] call milsim_fnc_formatRadioElementForDiary; private _lines = [_battalionElement, 1] call FUNC(formatRadioElementForDiary);
// private _lines = [_cfg, _indentCount] call t; // private _lines = [_cfg, _indentCount] call t;
_allText pushBack (_lines joinString "<br/>"); _allText pushBack (_lines joinString "<br/>");
}; };

View File

@@ -2,7 +2,7 @@
if (!isServer) exitWith {}; if (!isServer) exitWith {};
milsim_baseObjects = allMissionObjects "ModuleRespawnPosition_F"; GVARMAIN(baseObjects) = allMissionObjects "ModuleRespawnPosition_F";
publicVariable "milsim_baseObjects"; publicVariable "milsim_baseObjects";
// Initializes the Dynamic Groups framework and groups // Initializes the Dynamic Groups framework and groups

View File

@@ -0,0 +1,3 @@
#define COMPONENT fbcb2_reinsert
#define COMPONENT_BEAUTIFIED FBCB2 - Reinsertion
#include "../script_mod.hpp"

View File

@@ -23,3 +23,9 @@
}, },
true // requires mission restart true // requires mission restart
] call CBA_fnc_addSetting; ] call CBA_fnc_addSetting;
[
QUOTE(COMPONENT),
"CREATED SETTINGS",
[]
] call EFUNC(util,log);

View File

@@ -0,0 +1,14 @@
#include "../script_component.hpp"
private _approvedAssetsCfg = (missionConfigFile >> "ApprovedAssets");
if (!IS_CONFIG(_approvedAssetsCfg) || {!isClass _approvedAssetsCfg}) exitWith {
[
QUOTE(COMPONENT),
"ERROR: Approved assets config not found. Check that the config is present and correctly named in the mission config file. See defines/ApprovedAssets.hpp and framework/util/functions/getApprovedAssetsCfg.sqf.",
[]
] call EFUNC(util,log);
configNull;
};
_approvedAssetsCfg;

View File

@@ -1 +1,14 @@
(missionConfigFile >> "BattalionInfo") #include "../script_component.hpp"
private _battalionInfoCfg = (missionConfigFile >> "BattalionInfo");
if (!IS_CONFIG(_battalionInfoCfg) || {!isClass _battalionInfoCfg}) exitWith {
[
QUOTE(COMPONENT),
"ERROR: Battalion config not found. Check that the battalion config is present and correctly named in the mission config file. See defines/BattalionInfo.hpp and framework/util/functions/getBattalionCfg.sqf.",
[]
] call EFUNC(util,log);
configNull;
};
_battalionInfoCfg;