big refactor, WIP!

This commit is contained in:
2024-02-06 01:52:25 -08:00
parent f588ffa4a0
commit 0a64d9e170
74 changed files with 1024 additions and 701 deletions

View File

@@ -13,21 +13,15 @@
{
params ["_value"];
[
QUOTE(COMPONENT),
"SETTING CHANGED",
[
[
"setting",
"milsim_fbcb2_assets_setting_detectionRangeFromBase"
],
["newValue", _value]
]
] call EFUNC(util,log);
QGVAR(setting_detectionRangeFromBase),
_value
] call EFUNC(common,logSettingChanged);
}
] call CBA_fnc_addSetting;
[
LEVEL_INFO,
QUOTE(COMPONENT),
"CREATED SETTINGS",
[]
] call EFUNC(util,log);
] call EFUNC(common,log);

View File

@@ -5,7 +5,7 @@ params [
];
// Get the approved assets config
private _approvedAssetsCfg = call EFUNC(util,getApprovedAssetsCfg);
private _approvedAssetsCfg = call EFUNC(common,getApprovedAssetsCfg);
if (isNull _approvedAssetsCfg) exitWith {""};
// Get the asset definition

View File

@@ -15,13 +15,14 @@ private _distinctStartingAssetsClassNames = [];
} forEach _startingAssets;
// get the approved assets config to identify callsigns
private _approvedAssetsCfg = call EFUNC(util,getApprovedAssetsCfg);
private _approvedAssetsCfg = call EFUNC(common,getApprovedAssetsCfg);
if (isNull _approvedAssetsCfg) exitWith {
[
LEVEL_ERROR,
QUOTE(COMPONENT),
"No approved assets defined.",
[]
] call EFUNC(util,log);
] call EFUNC(common,log);
[
"ERROR: No approved assets defined. See defines/ApprovedAssets.hpp"
] call BIS_fnc_error;

View File

@@ -7,3 +7,10 @@ if (!hasInterface) exitWith {};
[{missionNamespace getVariable [QGVAR(serverAssetsReady), false]}, {
call FUNC(updateAssetDiary);
}] call CBA_fnc_waitUntilAndExecute;
[
LEVEL_DEBUG,
QUOTE(COMPONENT),
"postInit complete",
[]
] call EFUNC(common,log);

View File

@@ -20,4 +20,12 @@ missionNamespace setVariable [QGVAR(serverAssetsReady), true, true];
addMissionEventHandler ["MPEnded", {
// log the "current" asset counts to RPT
[false, true] call FUNC(updateAssetsByBase);
}];
}];
[
LEVEL_DEBUG,
QUOTE(COMPONENT),
"postInit complete",
[]
] call EFUNC(common,log);

View File

@@ -2,7 +2,7 @@
params [["_asset", objNull, [objNull]]];
private _closestBase = [_asset] call EFUNC(util,getNearestBase);
private _closestBase = [_asset] call EFUNC(common,getNearestBase);
if (isNull _closestBase) exitWith {false};
(_asset distance2D _closestBase) <= GVAR(setting_detectionRangeFromBase)

View File

@@ -63,7 +63,7 @@ if (not (count _baseMarkerStore > 0)) then {
_newMarker setMarkerTypeLocal "mil_flag";
_newMarker setMarkerColorLocal "ColorGreen";
_newMarker setMarkerSizeLocal [0.7, 0.7];
_newMarker setMarkerTextLocal ([_base] call EFUNC(util,getNameOfBase));
_newMarker setMarkerTextLocal ([_base] call EFUNC(common,getNameOfBase));
_baseMarkerStore pushBack [
_base,

View File

@@ -248,6 +248,7 @@ private _randomColors = [
// log to RPT
[
LEVEL_INFO,
QUOTE(COMPONENT),
"UPDATED ASSET DIARY",
[
@@ -255,6 +256,6 @@ private _randomColors = [
["startingAssetCountDistinct", count _distinctVehiclesClassNames],
["currentassetCount", count _currentAssets]
]
] call EFUNC(util,log);
] call EFUNC(common,log);
true;

View File

@@ -17,7 +17,7 @@ private _allSaved = [];
private _assetsAtThisBaseVar = QGVAR(assetsAtThisBase);
private _assetsStartedAtThisBaseVar = QGVAR(assetsStartedAtThisBase);
private _approvedAssetsCfg = call EFUNC(util,getApprovedAssetsCfg);
private _approvedAssetsCfg = call EFUNC(common,getApprovedAssetsCfg);
if (isNull _approvedAssetsCfg) exitWith {};
{
@@ -34,7 +34,7 @@ if (isNull _approvedAssetsCfg) exitWith {};
// add to base's assets list
private _closestBase = [_asset] call EFUNC(util,getNearestBase);
private _closestBase = [_asset] call EFUNC(common,getNearestBase);
private _baseAssets = _closestBase getVariable [_assetsAtThisBaseVar, []];
_baseAssets pushBackUnique [
_asset call BIS_fnc_netId,
@@ -69,7 +69,7 @@ if (isNull _approvedAssetsCfg) exitWith {};
// add to base's assets list
private _closestBase = [_asset] call EFUNC(util,getNearestBase);
private _closestBase = [_asset] call EFUNC(common,getNearestBase);
private _baseAssets = _closestBase getVariable [_assetsAtThisBaseVar, []];
_baseAssets pushBackUnique [
_asset call BIS_fnc_netId,
@@ -142,13 +142,14 @@ if !(_isInit || _logCurrentAssets) exitWith {};
if (_logCurrentAssets) then {
{
[
LEVEL_INFO,
QUOTE(COMPONENT),
"CURRENT ASSETS",
[
["baseName", [[_base] call EFUNC(util,getNameOfBase)]],
["baseName", [[_base] call EFUNC(common,getNameOfBase)]],
["asset", _x]
]
] call EFUNC(util,log);
] call EFUNC(common,log);
} forEach _baseAssetsHashes;
};
@@ -156,13 +157,14 @@ if !(_isInit || _logCurrentAssets) exitWith {};
if (_isInit) then {
{
[
"fbcb2_assets",
LEVEL_INFO,
QUOTE(COMPONENT),
"STARTING ASSETS",
[
["baseName", [[_base] call EFUNC(util,getNameOfBase)]],
["baseName", [[_base] call EFUNC(common,getNameOfBase)]],
["asset", _x]
]
] call EFUNC(util,log);
] call EFUNC(common,log);
} forEach _baseAssetsHashes;
};
} forEach GVARMAIN(baseObjects);