many changes. includes rework of baselocation-asset storage format
This commit is contained in:
39
framework/fbcb2_main/functions/fn_init.sqf
Normal file
39
framework/fbcb2_main/functions/fn_init.sqf
Normal 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);
|
||||
@@ -0,0 +1,47 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
private _recordTitle = "MDS - INTEL - ENVIRONMENT";
|
||||
|
||||
private _text = [
|
||||
format[
|
||||
"<font size='%1' color='%2' face='%3'>%4</font><br/><br/>",
|
||||
GVAR(recordTitleSize),
|
||||
GVAR(recordTitleColor),
|
||||
GVAR(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/>",
|
||||
GVAR(recordTextHeaderSize),
|
||||
_sunriseColor,
|
||||
GVAR(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/>",
|
||||
GVAR(recordTextHeaderSize),
|
||||
_sunsetColor,
|
||||
GVAR(recordTextBodySize),
|
||||
_whiteColor,
|
||||
([_sunTimes select 1, "HH:MM"] call BIS_fnc_timeToString)
|
||||
];
|
||||
|
||||
_text = _text joinString "";
|
||||
|
||||
[
|
||||
GVAR(subjectIntelID),
|
||||
_recordTitle,
|
||||
_text
|
||||
] call FUNC(createOrUpdateDiaryRecord);
|
||||
@@ -0,0 +1,73 @@
|
||||
// updated 2024-02-01 by IndigoFox
|
||||
// now reads from the battalion config structure to generate the diary entries
|
||||
|
||||
#include "../script_component.hpp"
|
||||
|
||||
////////////////////////////////////////
|
||||
// Get info from missionConfigFile
|
||||
////////////////////////////////////////
|
||||
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;
|
||||
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
|
||||
////////////////////////////////////////
|
||||
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;
|
||||
|
||||
{
|
||||
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
|
||||
private _diaryTitleText = [_x, true] call FUNC(generateElementFrequencyRecordText);
|
||||
[
|
||||
GVAR(subjectFrequenciesID),
|
||||
_diaryTitleText#0,
|
||||
_diaryTitleText#1
|
||||
] call FUNC(createOrUpdateDiaryRecord);
|
||||
} forEach _battalionElementCfgs;
|
||||
|
||||
// add the battalion command to the top of the list
|
||||
// don't process child elements
|
||||
private _diaryTitleText = [_battalionInfoCfg >> "Command", false] call FUNC(generateElementFrequencyRecordText);
|
||||
[
|
||||
GVAR(subjectFrequenciesID),
|
||||
_diaryTitleText#0,
|
||||
_diaryTitleText#1
|
||||
] call FUNC(createOrUpdateDiaryRecord);
|
||||
|
||||
true;
|
||||
@@ -0,0 +1,43 @@
|
||||
#include "../script_component.hpp"
|
||||
|
||||
private _recordTitle = "MDS - INTEL - SMOKES";
|
||||
|
||||
private _text = [
|
||||
// Title
|
||||
format[
|
||||
"<font size='%1' color='%2' face='%3'>%4</font>",
|
||||
GVAR(recordTitleSize),
|
||||
GVAR(recordTitleColor),
|
||||
GVAR(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>",
|
||||
GVAR(recordTextHeaderSize),
|
||||
_color,
|
||||
_name,
|
||||
_description
|
||||
];
|
||||
} forEach _smokeColors;
|
||||
|
||||
_text = _text joinString "<br/><br/>";
|
||||
|
||||
[
|
||||
GVAR(subjectIntelID),
|
||||
_recordTitle,
|
||||
_text
|
||||
] call FUNC(createOrUpdateDiaryRecord);
|
||||
Reference in New Issue
Block a user