move-battalion-struct-to-missioncfg #15

Merged
hizumi merged 4 commits from move-battalion-struct-to-missioncfg into main 2024-02-01 23:19:36 -06:00
12 changed files with 173 additions and 86 deletions
Showing only changes of commit 1e4a5a79a8 - Show all commits

View File

@@ -21,7 +21,7 @@ class milsim
class processFBCB2RadioFrequencies {};
class processFBCB2SmokeColors {};
class processFBCB2Environment {};
class messageFBCB2AssetStatus {};
class hintFBCB2AssetStatus {};
};
class fbcb2_util {
file = "functions\fbcb2\util";

View File

@@ -99,7 +99,7 @@ class BattalionInfo {
shortDescription = "Special Weapons Squad";
textColor = LVL2_TEXT_COLOR;
frequencies[] = {
{"Contact", {}, {FREQ_BATTALION, FREQ_ECHO_FLIGHT_CAS}}
{"Contact", {}, {FREQ_BATTALION}}
};
};
@@ -203,6 +203,7 @@ class BattalionInfo {
callsign = CALLSIGN_ELEMENT(ECHO_CALLSIGN, FLIGHT);
textColor = LVL3_TEXT_COLOR;
frequencies[] = {
{"Contact", {}, {FREQ_BATTALION}},
{"Actual", {}, {FREQ_ECHO_FLIGHT_INTERCOM, FREQ_BATTALION}},
{"CAS Support", {}, {FREQ_ECHO_FLIGHT_INTERCOM, FREQ_ECHO_FLIGHT_CAS}},
{"Logistics", {}, {FREQ_ECHO_FLIGHT_INTERCOM, FREQ_ECHO_FLIGHT_LOGISTICS}}
@@ -213,6 +214,7 @@ class BattalionInfo {
callsign = CALLSIGN_ELEMENT(ECHO_CALLSIGN, GROUND);
textColor = LVL3_TEXT_COLOR;
frequencies[] = {
{"Contact", {}, {FREQ_BATTALION}},
{"Actual", {}, {FREQ_ECHO_GROUND, FREQ_BATTALION}}
};
@@ -220,6 +222,7 @@ class BattalionInfo {
callsign = CALLSIGN_ELEMENT(ECHO_CALLSIGN, LOGISTICS);
textColor = LVL4_TEXT_COLOR;
frequencies[] = {
{"Contact", {}, {FREQ_ECHO_GROUND}},
{"Actual", {}, {FREQ_ECHO_GROUND_LOGISTICS, FREQ_ECHO_GROUND}},
{"General", {}, {FREQ_ECHO_GROUND_LOGISTICS}},
{"Convoy", {}, {FREQ_CONVOY}}
@@ -230,6 +233,8 @@ class BattalionInfo {
callsign = CALLSIGN_ELEMENT(ECHO_CALLSIGN, ATTACK);
textColor = LVL4_TEXT_COLOR;
frequencies[] = {
{"Contact", {}, {FREQ_ECHO_GROUND, FREQ_ECHO_FLIGHT_CAS}},
{"Actual", {}, {FREQ_ECHO_GROUND}},
{"General", {}, {FREQ_ECHO_GROUND}},
{"Convoy", {}, {FREQ_CONVOY}}
};

View File

@@ -7,6 +7,9 @@ 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";

View File

@@ -1,27 +1,42 @@
private _recordTitle = "MDS - INTEL - ENVIRONMENT";
_sunTimes = date call BIS_fnc_sunriseSunsetTime;
_text = format[
"<font size='%1' color='%2' face='%3'>%4</font><br/><br/>",
milsim_fbcb2_recordTitleSize,
milsim_fbcb2_recordTitleColor,
milsim_fbcb2_recordTitleFont,
_recordTitle
private _text = [
format[
"<font size='%1' color='%2' face='%3'>%4</font><br/><br/>",
milsim_fbcb2_recordTitleSize,
milsim_fbcb2_recordTitleColor,
milsim_fbcb2_recordTitleFont,
_recordTitle
]
];
_text = _text + "
<font size='16' color='#4A86E8'>Local Sunrise</font>
<br/>
<font size='20' color='#FF0000'>" + ([_sunTimes select 0, "HH:MM"] call BIS_fnc_timeToString) + "</font>
<br/><br/>
<font size='16' color='#6AA84F'>Local Sunset</font>
<br/>
<font size='20' color='#FF0000'>" + ([_sunTimes select 1, "HH:MM"] call BIS_fnc_timeToString) + "</font>
<br/><br/>
";
player createDiaryRecord ["Status", ["MDS - INTEL - ENVIRONMENT", _text]];
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,

View File

@@ -1,4 +1,6 @@
_assetList = missionNamespace getVariable "milsim_var_fixedAssets";
private _recordTitle = "MDS - ASSETS - FIXED";
private _assetList = missionNamespace getVariable "milsim_var_fixedAssets";
_text = "<font size='24' color='#ff0000'>=======------ Mission Data Set ------=======</font>";
@@ -14,6 +16,11 @@ _text = "<font size='24' color='#ff0000'>=======------ Mission Data Set ----
} foreach _assetList;
_text = _text + "<br/><br/><execute expression='[missionNamespace getVariable ""milsim_var_fixedAssets""] call milsim_fnc_messageFBCB2AssetStatus'>Run Report on local node?</execute>";
_text = _text + "<br/><br/><execute expression='[missionNamespace getVariable ""milsim_var_fixedAssets""] call milsim_fnc_hintFBCB2AssetStatus'>Run Report on local node?</execute>";
player createDiaryRecord ["Status", ["MDS - ASSETS - FIXED", _text]];
[
milsim_fbcb2_subjectStatusID,
_recordTitle,
_text
] call milsim_fnc_createOrUpdateDiaryRecord;

View File

@@ -1,16 +1,15 @@
// updated 2024-02-01 by IndigoFox
// now reads from the battalion config structure
private _addToAllText = {
params [["_lines", []]];
_allText pushBack (_lines joinString "<br/>");
};
// now reads from the battalion config structure to generate the diary entries
////////////////////////////////////////
// Get info from missionConfigFile
////////////////////////////////////////
private _battalionInfoCfg = call milsim_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;
@@ -18,21 +17,17 @@ 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
////////////////////////////////////////
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 "";
// reverse the list so diary records are filed in the correct order
// 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;
@@ -50,4 +45,6 @@ private _diaryTitleText = [_battalionInfoCfg >> "Command", false] call milsim_fn
milsim_fbcb2_subjectFrequenciesID,
_diaryTitleText#0,
_diaryTitleText#1
] call milsim_fnc_createOrUpdateDiaryRecord;
] call milsim_fnc_createOrUpdateDiaryRecord;
true;

View File

@@ -1,4 +1,6 @@
_assetList = missionNamespace getVariable "milsim_var_rotaryAssets";
private _recordTitle = "MDS - ASSETS - ROTARY";
_assetList = missionNamespace getVariable "milsim_var_rotaryAssets";
_text = "<font size='24' color='#ff0000'>=======------ Mission Data Set ------=======</font>";
@@ -14,6 +16,11 @@ _text = "<font size='24' color='#ff0000'>=======------ Mission Data Set ----
} foreach _assetList;
_text = _text + "<br/><br/><execute expression='[missionNamespace getVariable ""milsim_var_rotaryAssets""] call milsim_fnc_messageFBCB2AssetStatus'>Run Report on local node?</execute>";
_text = _text + "<br/><br/><execute expression='[missionNamespace getVariable ""milsim_var_rotaryAssets""] call milsim_fnc_hintFBCB2AssetStatus'>Run Report on local node?</execute>";
player createDiaryRecord ["Status", ["MDS - ASSETS - ROTARY", _text]];
[
milsim_fbcb2_subjectStatusID,
_recordTitle,
_text
] call milsim_fnc_createOrUpdateDiaryRecord;

View File

@@ -1,30 +1,41 @@
private _recordTitle = "MDS - INTEL - SMOKES";
_text = "
<font size='24' color='#ff0000'>=======------ Mission Data Set ------=======</font>
<br/><br/>
Smoke is a Guideline Not a Rule
<br/><br/>
<font color='#FFFFFF' size='16'>WHITE</font><br/>
Concealment
<br/><br/>
<font color='#008800' size='16'>GREEN</font><br/>
Friendly Forces
<br/><br/>
<font color='#0000FF' size='16'>BLUE</font><br/>
LZ Markers
<br/><br/>
<font color='#FF0000' size='16'>RED</font><br/>
Enemy Location
<br/><br/>
<font color='#FFA500' size='16'>ORANGE</font><br/>
Resupply Marker
<br/><br/>
<font color='#FFFF00' size='16'>YELLOW</font><br/>
Medical Emergency
<br/><br/>
<font color='#800080' size='16'>PURPLE</font><br/>
Broken Arrow - 100m radius
<br/><br/>
";
private _text = [
// Title
format[
"<font size='%1' color='%2' face='%3'>%4</font>",
milsim_fbcb2_recordTitleSize,
milsim_fbcb2_recordTitleColor,
milsim_fbcb2_recordTitleFont,
_recordTitle
]
];
player createDiaryRecord ["Status", ["MDS - INTEL - SMOKES", _text]];
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;

View File

@@ -1,6 +1,9 @@
// 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]
];
@@ -9,7 +12,9 @@ for "_i" from 1 to _indentCount do {
};
_leadingSpace pushBack " | </font>";
// make header line
/////////////////////////////////////////////////////////
// Create the header line for the provided config entry
/////////////////////////////////////////////////////////
private _lines = [
format[
"<font color='%1'>%2%3</font>",
@@ -19,7 +24,11 @@ private _lines = [
]
];
// make frequency lines
////////////////////////////////////////////////////////////
// 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]
];
@@ -29,6 +38,7 @@ for "_i" from 1 to _FREQ_INDENT_CONSTANT do {
_freqLeadingSpace pushBack "</font>";
_freqLeadingSpace = _freqLeadingSpace joinString "";
// Process config values for frequencies
{
_x params ["_role", "_sr", "_lr"];
@@ -45,7 +55,7 @@ _freqLeadingSpace = _freqLeadingSpace joinString "";
_lrStr = "----";
};
// Add formatted line to the array
_lines pushBack format[
"%1<font size='%2' face='%3' color='%4'>- %5%6%7</font>",
_freqLeadingSpace,
@@ -59,4 +69,5 @@ _freqLeadingSpace = _freqLeadingSpace joinString "";
} forEach (getArray (_cfg >> "frequencies"));
// diag_log text (_lines joinString endl);
// Return the formatted lines in ARRAY format
_lines;

View File

@@ -1,4 +1,5 @@
// called from milsim_fnc_processFBCB2RadioFrequencies
// 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]
@@ -8,8 +9,10 @@ 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"),
@@ -17,16 +20,33 @@ private _recordTitle = format[
];
// 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><br/><br/>",
"<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><br/><br/>",
"%1<font size='%2' face='%3' color='%4'>- %5%6%7</font>",
_freqLeadingSpace,
_ELEMENT_FREQ_SIZE,
_ELEMENT_FREQ_FONT,
@@ -37,6 +57,10 @@ private _headers = [
]
];
//////////////////////////////////////////////////////////
// Generate the list of element headers and frequencies
//////////////////////////////////////////////////////////
private _allText = [];
// get all child elements recursively and format them
@@ -49,12 +73,15 @@ if (_shouldProcessChildCfgs) then {
_allText pushBack (_lines joinString "<br/>");
}] call milsim_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/>"];
_allText = format["%1<font face='EtelkaMonospaceProBold'>%2</font>", _headers joinString "<br/>", _allText joinString "<br/>"];
// return the title and all text
[_recordTitle, _allText];

View File

@@ -18,7 +18,11 @@ params [
private _hash = createHashMapFromArray _data;
// Replace square brackets with round brackets to avoid parsing issues.
_message regexReplace ["\[", "("];
_message regexReplace ["\]", ")"];
private _json = [_hash] call CBA_fnc_encodeJSON;
_log = format ["[milsim] (%1) (%2) (%3) :: %4", _component, _fnc_scriptNameParent, _message, _json];
_log = format ["[milsim] [%1] [%2] [%3] :: %4", _component, _fnc_scriptNameParent, _message, _json];
diag_log text _log;