move local diary mgmt to common module, clarify clientInit complete msg

This commit is contained in:
2024-02-08 15:04:22 -08:00
parent fba423e38d
commit 2db018103c
15 changed files with 56 additions and 23 deletions

View File

@@ -12,7 +12,6 @@ class CfgFunctions {
class addRespawnChatHandler { postInit = 1; };
};
};
class PREFIX {
class ambience {
@@ -38,6 +37,7 @@ class CfgFunctions {
class addCBASettings { preInit = 1; };
class logMissionInfo {};
class addPlayerInfoToArray {};
class createOrUpdateDiaryRecord {};
class getApprovedAssetsCfg {};
class getBattalionCfg {};
class getNameOfBase {};
@@ -84,7 +84,6 @@ class CfgFunctions {
};
class util {
file = "framework\fbcb2_main\util";
class createOrUpdateDiaryRecord {};
class formatRadioElementForDiary {};
class generateElementFrequencyRecordText {};
};

View File

@@ -3,12 +3,21 @@
if (!hasInterface) exitWith {};
params [
["_subjectID", GVAR(subjectStatusID), [""]],
["_subjectID", "", [""]],
["_recordTitle", "", [""]],
["_recordText", "", [""]],
["_recordIcon", "", [""]]
];
// Check if all parameters are provided
if (
count _subjectID isEqualTo 0 ||
count _recordTitle isEqualTo 0 ||
count _recordText isEqualTo 0
) exitWith {
[LEVEL_ERROR, QUOTE(COMPONENT), "Not all parameters provided"] call EFUNC(common,log);
};
// Check if already created
private _subjectRecords = GVAR(diaryRecords) getOrDefault [_subjectID, createHashMap, true];
private _existingRecord = _subjectRecords getOrDefault [_recordTitle, diaryRecordNull, true];

View File

@@ -21,7 +21,7 @@ call FUNC(updateAssetDiary);
[
LEVEL_DEBUG,
QUOTE(COMPONENT),
"postInit complete",
"initClient complete",
[]
] call EFUNC(common,log);

View File

@@ -241,7 +241,7 @@ private _randomColors = [
],
_recordText joinString "<br/>",
_icon
] call EFUNC(fbcb2_main,createOrUpdateDiaryRecord);
] call EFUNC(common,createOrUpdateDiaryRecord);
// "\A3\ui_f\data\igui\cfg\simpleTasks\types\car_ca.paa"
} forEach _distinctVehiclesClassNames;

View File

@@ -109,4 +109,4 @@ _text = _text joinString "<br/>";
GVAR(subjectIntelID),
_recordTitle,
_text
] call FUNC(createOrUpdateDiaryRecord);
] call EFUNC(common,createOrUpdateDiaryRecord);

View File

@@ -62,7 +62,7 @@ reverse _battalionElementCfgs;
GVAR(subjectFrequenciesID),
_diaryTitleText#0,
_diaryTitleText#1
] call FUNC(createOrUpdateDiaryRecord);
] call EFUNC(common,createOrUpdateDiaryRecord);
} forEach _battalionElementCfgs;
// add the battalion command to the top of the list
@@ -72,6 +72,6 @@ private _diaryTitleText = [_battalionInfoCfg >> "Command", false] call FUNC(gene
GVAR(subjectFrequenciesID),
_diaryTitleText#0,
_diaryTitleText#1
] call FUNC(createOrUpdateDiaryRecord);
] call EFUNC(common,createOrUpdateDiaryRecord);
true;

View File

@@ -56,4 +56,4 @@ _text = _text joinString "<br/><br/>";
GVAR(subjectIntelID),
_recordTitle,
_text
] call FUNC(createOrUpdateDiaryRecord);
] call EFUNC(common,createOrUpdateDiaryRecord);

View File

@@ -25,12 +25,6 @@ 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
[] call FUNC(addFrequenciesRecord);
[] call FUNC(addSignalColorsRecord);
@@ -47,7 +41,7 @@ GVAR(diaryRecords) = createHashMap;
[
LEVEL_DEBUG,
QUOTE(COMPONENT),
"postInit complete",
"initClient complete",
[]
] call EFUNC(common,log);

View File

@@ -24,7 +24,7 @@
[
LEVEL_INFO,
QUOTE(COMPONENT),
"Respawn chat handler registered",
"respawn chat handler registered",
[player] call EFUNC(common,addPlayerInfoToArray)
] call EFUNC(common,log);

View File

@@ -14,9 +14,17 @@ waitUntil {!isNil QGVARMAIN(complete)};
["InitializePlayer", [player, true]] call BIS_fnc_dynamicGroups;
// Initialize a holder for managing local diary records
// store records in format:
// [subject, [
// [title, diaryRecord]
// ]]
EGVAR(common,diaryRecords) = createHashMap;
// initialize other modules
call EFUNC(mapcopy,initClient);
call EFUNC(rasptools,initClient);
call EFUNC(reinsert,initClient);
call EFUNC(resupply,initClient);
call EFUNC(triageIcons,initClient);
@@ -28,8 +36,10 @@ call EFUNC(fbcb2_assets,initClient);
[
LEVEL_DEBUG,
QUOTE(COMPONENT),
"postInit complete",
"initClient complete",
[]
] call EFUNC(common,log);
localNamespace setVariable [QGVAR(complete), true];
nil;

View File

@@ -45,4 +45,13 @@ private _mapCopyAction =
} else {
format["You need a map to copy onto!"] call CBA_fnc_notify;
};
}] call CBA_fnc_addEventHandler;
}] call CBA_fnc_addEventHandler;
[
LEVEL_DEBUG,
QUOTE(COMPONENT),
"initClient complete",
[]
] call EFUNC(common,log);
localNamespace setVariable [QGVAR(complete), true];

View File

@@ -47,6 +47,8 @@ if ((typeOf player) in ["B_Helipilot_F", "B_helicrew_F"]) then {
[
LEVEL_DEBUG,
QUOTE(COMPONENT),
"postInit complete",
"initClient complete",
[]
] call EFUNC(common,log);
] call EFUNC(common,log);
localNamespace setVariable [QGVAR(complete), true];

View File

@@ -7,7 +7,7 @@ call FUNC(addArsenalObjectSpawnBoxActions);
[
LEVEL_DEBUG,
QUOTE(COMPONENT),
"postInit complete",
"initClient complete",
[]
] call EFUNC(common,log);

View File

@@ -6,7 +6,8 @@ GVAR(drawTargets) = [];
[
LEVEL_DEBUG,
QUOTE(COMPONENT),
"postInit complete",
"initClient complete",
[]
] call EFUNC(common,log);
localNamespace setVariable [QGVAR(complete), true];

View File

@@ -98,4 +98,13 @@ private _flagCategoryCfgs = (_vehicleFlagsCfg >> "FlagCategories") call BIS_fnc_
} forEach _baseClassesToApplyActionsFor;
[
LEVEL_DEBUG,
QUOTE(COMPONENT),
"initClient complete",
[]
] call EFUNC(common,log);
localNamespace setVariable [QGVAR(complete), true];
nil;