big CBA rework & improvements #19

Merged
hizumi merged 7 commits from implement-cba-macros-for-some-modules into develop 2024-02-06 23:14:48 -06:00
74 changed files with 1024 additions and 701 deletions
Showing only changes of commit 0a64d9e170 - Show all commits

44
defines/SignalColors.hpp Normal file
View File

@@ -0,0 +1,44 @@
class SignalColors {
class White {
name = "White";
hexCode = "#FFFFFF";
usage = "Concealment, Light";
itemExamples[] = {"SmokeShell", "1Rnd_Smoke_Grenade_shell", "ACE_Chemlight_White"};
};
class Green {
name = "Green";
hexCode = "#00FF00";
usage = "Friendly Forces";
itemExamples[] = {"SmokeShellGreen", "1Rnd_SmokeGreen_Grenade_shell", "Chemlight_green"};
};
class Blue {
name = "Blue";
hexCode = "#0000FF";
usage = "LZ Marking";
itemExamples[] = {"SmokeShellBlue", "1Rnd_SmokeBlue_Grenade_shell", "Chemlight_blue"};
};
class Red {
name = "Red";
hexCode = "#FF0000";
usage = "Enemy Location";
itemExamples[] = {"SmokeShellRed", "1Rnd_SmokeRed_Grenade_shell", "Chemlight_red"};
};
class Orange {
name = "Orange";
hexCode = "#FFA500";
usage = "Resupply Marker";
itemExamples[] = {"SmokeShellOrange", "1Rnd_SmokeOrange_Grenade_shell", "ACE_Chemlight_Orange"};
};
class Yellow {
name = "Yellow";
hexCode = "#FFFF00";
usage = "Medical Emergency";
itemExamples[] = {"SmokeShellYellow", "1Rnd_SmokeYellow_Grenade_shell", "Chemlight_yellow"};
};
class Purple {
name = "Purple";
hexCode = "#800080";
usage = "Broken Arrow - 100m radius";
itemExamples[] = {"SmokeShellPurple", "1Rnd_SmokePurple_Grenade_shell"};
};
};

View File

@@ -23,6 +23,7 @@
#include "defines\DisallowedEquipment.hpp"
#include "defines\SupplyCrates.hpp"
#include "defines\VehicleFlags.hpp"
#include "defines\SignalColors.hpp"
//-------------------------------------------MISSION INFO--------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@@ -1,51 +1,14 @@
#include "script_mod.hpp"
class CfgFunctions {
class PREFIX
{
class settings
{
file = "framework\settings";
class setDefaults { postInit = 1; };
class addCBASettings { preInit = 1; };
class addAARChatHandler { postInit = 1; };
class addRespawnChatHandler { postInit = 1; };
};
class init
{
file = "framework\init\functions";
class initServer { postInit = 1;}; //needs refactor
class initPlayerLocal { postInit = 1;};
};
class client {
file = "framework\client";
class addZenModules { postInit = 1; };
class addDNI_PlayerFPS { postInit = 1; }; // needs refactor
class bindEventHandlers { postInit = 1; };
class bindVehicleActions { postInit = 1; };
class addClientStatsPFH {};
class addMedicalOverlayPFH { postInit = 1; };
class calculateClientStats {};
class bindEmptyGroupGarbageCleanup { postInit = 1; };
};
class server {
file = "framework\server";
class addServerStatsPFH {};
class calculateServerStats {};
class logPlayerInventory {};
};
class PREFIX {
class ambience {
file = "framework\ambience";
class flakInitVehicle {};
class flakEH {};
};
class map
{
class map {
file = "framework\map";
class initMapCopy { postInit = 1; };
class copyMapFromPlayer {}; //needs refactor
@@ -56,7 +19,35 @@ class CfgFunctions {
};
};
class DOUBLES(PREFIX,client) {
class functions {
file = "framework\client\functions";
class addMedicalOverlayPFH { postInit = 1; };
class addZenModules { postInit = 1; };
class bindEmptyGroupGarbageCleanup { postInit = 1; };
class bindEventHandlers { postInit = 1; };
class bindVehicleActions { postInit = 1; };
};
};
class DOUBLES(PREFIX,common) {
class functions {
file = "framework\common\functions";
class addCBASettings { preInit = 1; };
class logMissionInfo { postInit = 1; };
class addPlayerInfoToArray {};
class getApprovedAssetsCfg {};
class getBattalionCfg {};
class getNameOfBase {};
class getNearestBase {};
class log {};
class logPlayerInventory {};
class logSettingChanged {};
class padString {};
class recurseSubclasses {};
};
};
class DOUBLES(PREFIX,fbcb2_assets) {
class functions {
@@ -86,10 +77,9 @@ class CfgFunctions {
class functions {
file = "framework\fbcb2_main\functions";
class init { postInit = 1; };
class processFBCB2Environment {};
class processFBCB2RadioFrequencies {};
class processFBCB2SmokeColors {};
class addEnvironmentRecord {};
class addFrequenciesRecord {};
class addSignalColorsRecord {};
};
class util {
file = "framework\fbcb2_main\util";
@@ -99,7 +89,33 @@ class CfgFunctions {
};
};
class DOUBLES(PREFIX,init) {
file = "framework\init\functions";
class addAARChatHandler { postInit = 1; };
class addRespawnChatHandler { postInit = 1; };
class initServer { postInit = 1;};
class initPlayerLocal { postInit = 1;};
class setDefaults { postInit = 1; };
};
class DOUBLES(PREFIX,performance) {
class functions {
file = "framework\performance\functions";
class addCBASettings {preInit=1;};
class init {postInit=1;};
class addDNI_PlayerFPS { postInit = 1; };
class addClientStatsPFH {};
class calculateClientStats {};
class addServerStatsPFH {};
class calculateServerStats {};
};
};
class DOUBLES(PREFIX,reinsert) {
class functions {
file = "framework\reinsert\functions";
class addCBASettings {preInit=1;};
};
class server {
file = "framework\reinsert\server";
class initServer { postInit = 1; };
@@ -129,21 +145,6 @@ class CfgFunctions {
};
};
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";
@@ -153,6 +154,4 @@ class CfgFunctions {
class isClassExcluded {};
};
};
};

View File

@@ -1,18 +0,0 @@
if (!hasInterface) exitWith {};
diag_log text "[MILSIM] (client) initializing Stats PFH";
_cpsPFH = [
{
[] call milsim_fnc_calculateClientStats;
},
"milsim_client_cps_interval" call CBA_settings_fnc_get,
[],
{ diag_log text format ["[MILSIM] (client) PFH loaded with interval %1 seconds", "milsim_client_cps_interval" call CBA_settings_fnc_get ] },
{ diag_log text format ["[MILSIM] (client) PFH unloaded"] },
{ "milsim_client_cps_enable" call CBA_settings_fnc_get },
{ false },
[]
] call CBA_fnc_createPerFrameHandlerObject;
player setVariable ["milsim_client_cps_handler", _cpsPFH];

View File

@@ -1,29 +0,0 @@
[] spawn {
// warning: while loop without suspension executes multiple times per frame
private _counter = 0;
private _endTime = diag_tickTime + 5;
private _frameNo = diag_frameNo;
while { diag_tickTime < _endTime } do
{
_counter = _counter + 1;
};
// in an empty mission, the _counter may go well over 2000 times per frame!
diag_log text format ["[MILSIM] (client) Average Execution: %1 times per frame", _counter / (diag_frameNo - _frameNo)];
player setVariable ["milsim_player_raw_cps", _counter / (diag_frameNo - _frameNo), true];
// with suspension
private _counter = 0;
private _endTime = diag_tickTime + 5;
private _frameNo = diag_frameNo;
while { diag_tickTime < _endTime } do
{
_counter = _counter + 1;
uiSleep 0.001; // waits at least 1 frame
};
// _counter says one per frame, as expected
diag_log text format ["[MILSIM] (client) Average Execution: %1 times per frame", _counter / (diag_frameNo - _frameNo)];
player setVariable ["milsim_player_cps", _counter / (diag_frameNo - _frameNo), true];
};
nil;

View File

@@ -1,3 +1,5 @@
#include "..\script_component.hpp"
if ( !hasInterface ) exitWith {};
player addEventHandler["Respawn",
@@ -6,10 +8,11 @@ player addEventHandler["Respawn",
private _killer = _corpse getVariable ["ace_medical_causeOfDeath", "#scripted"];
if (_killer == "respawn_button") then {
[
"client",
LEVEL_INFO
QUOTE(COMPONENT),
"RESPAWNED WHILE UNCONSCIOUS",
[_unit] call milsim_util_fnc_addPlayerInfoToArray
] remoteExec ["milsim_util_fnc_log", 2];
[_unit] call EFUNC(common,addPlayerInfoToArray)
] remoteExec [QEFUNC(common,log), 2];
// format["%1 was unconscious then clicked the respawn button", name _unit] remoteExec["systemChat", 0];
};
}
@@ -43,11 +46,11 @@ addMissionEventHandler ["HandleChatMessage",
["ace_arsenal_displayClosed", {
[player] remoteExec ["milsim_util_fnc_logPlayerInventory", 2];
[player] remoteExec [QEFUNC(common,logPlayerInventory), 2];
}] call CBA_fnc_addEventHandler;
[missionNamespace, "arsenalClosed", {
[player] remoteExec ["milsim_util_fnc_logPlayerInventory", 2];
[player] remoteExec [QEFUNC(common,logPlayerInventory), 2];
}] call BIS_fnc_addScriptedEventHandler;
diag_log text "[MILSIM] (client) event handlers bound";

View File

@@ -0,0 +1,3 @@
#define COMPONENT client
#define COMPONENT_BEAUTIFIED Client
#include "../script_mod.hpp"

View File

@@ -0,0 +1,50 @@
#include "..\script_component.hpp"
//---------------------
// Side Chat
//---------------------
[
QGVARMAIN(sideChat),
"CHECKBOX",
"Side Chat Text Enabled",
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)],
false, // default value
true, // requires restart
{
params ["_value"];
[
QGVARMAIN(sideChat),
_value
] call EFUNC(common,logSettingChanged);
}
] call CBA_fnc_addSetting;
[QGVARMAIN(sideChat), false] call CBA_settings_fnc_set;
//---------------------
// Medical Overlay
//---------------------
[
"milsim_client_medState3D_enabled", // variable
"CHECKBOX", // type
["Enable 3D Triage Card State", "Draws a colored dot over units within 10m indicating current ACE Triage State"], // title
["17th Battalion", "Medical"], // category
true // default value
] call CBA_fnc_addSetting;
[
"milsim_client_medState3D_drawRange", // variable
"LIST", // type
["Range To Draw Icons", "Determines range at which dots are visible"], // title
["17th Battalion", "Medical"], // category
[[2, 4, 6, 8, 10], ["2", "4", "6", "8", "10"], 4] // option values, option labels, default index
] call CBA_fnc_addSetting;
diag_log text "[MILSIM] (settings) Custom CBA settings initialized";
nil;

View File

@@ -4,10 +4,11 @@ private _approvedAssetsCfg = (missionConfigFile >> "ApprovedAssets");
if (!IS_CONFIG(_approvedAssetsCfg) || {!isClass _approvedAssetsCfg}) exitWith {
[
LEVEL_ERROR,
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);
] call EFUNC(common,log);
configNull;
};

View File

@@ -4,10 +4,11 @@ private _battalionInfoCfg = (missionConfigFile >> "BattalionInfo");
if (!IS_CONFIG(_battalionInfoCfg) || {!isClass _battalionInfoCfg}) exitWith {
[
LEVEL_ERROR,
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);
] call EFUNC(common,log);
configNull;
};

View File

@@ -5,18 +5,22 @@
Used to log messages to the server RPT file.
Parameters:
0: STRING - component name.
1: STRING - message to log.
2: ARRAY - Key value pairs of data to log.
0: NUMBER - log level.
1: STRING - component name.
2: STRING - message to log.
3: ARRAY - key value pairs of data to log.
*/
#include "..\script_component.hpp"
params [
["_logLevel", 1, [-1,0,1,2,3]], // script_mod.hpp
["_component", "", [""]],
["_message", "", [""]],
["_data", [], [[]]]
];
if (_logLevel < LOG_LEVEL) exitWith {};
private _hash = createHashMapFromArray _data;
// Replace square brackets with round brackets to avoid parsing issues.

View File

@@ -13,16 +13,19 @@
<ARRAY> - Array of strings to be logged.
*/
#include "..\script_component.hpp"
params [
["_player", objNull, [objNull]]
];
if (!isPlayer _player) exitWith {
[
"logPlayerInventory",
LEVEL_ERROR
QUOTE(COMPONENT),
"PARAM PLAYER IS NOT A PLAYER",
[["player", _player]]
] call milsim_util_fnc_log;
] call EFUNC(common,log);
};
// testing
@@ -53,10 +56,11 @@ _playerItems pushBack (uniform _player);
[
"logPlayerInventory",
LEVEL_INFO,
QUOTE(COMPONENT),
"CHECKING PLAYER INVENTORY",
[_player] call milsim_util_fnc_addPlayerInfoToArray
] call milsim_util_fnc_log;
[_player] call EFUNC(common,addPlayerInfoToArray)
] call EFUNC(common,log);
////////////////////////////////////////
// HARDCODED DISALLOWED ITEMS - see functions/definitions/DisallowedEquipment.hpp
@@ -115,10 +119,11 @@ private _thermalItems = _playerItems select {
// Only log compliance message if no non-compliant items were found
if (count _allFoundItemsSoFar isEqualTo 0) exitWith {
[
"logPlayerInventory",
LEVEL_INFO,
QUOTE(COMPONENT),
"PLAYER INVENTORY IS COMPLIANT",
[_player] call milsim_util_fnc_addPlayerInfoToArray
] call milsim_util_fnc_log;
[_player] call EFUNC(common,addPlayerInfoToArray)
] call EFUNC(common,log);
};
// Log all non-compliant items
@@ -132,13 +137,14 @@ if (count _allFoundItemsSoFar isEqualTo 0) exitWith {
private _itemConfig = _itemClassName call CBA_fnc_getItemConfig;
// Log to RPT
[
"logPlayerInventory",
LEVEL_WARNING,
QUOTE(COMPONENT),
"NON-COMPLIANT ITEM",
[_player, [
["category", _categoryLabel],
["className", _itemClassName],
["displayName", [_itemConfig] call BIS_fnc_displayName]
]] call milsim_util_fnc_addPlayerInfoToArray
] call milsim_util_fnc_log;
]] call EFUNC(common,addPlayerInfoToArray)
] call EFUNC(common,log);
} forEach _items;
} forEach _foundItemsKeyValue;

View File

@@ -0,0 +1,16 @@
#include "..\script_component.hpp"
params [
["_settingName", "", [""]],
"_newValue"
];
[
LEVEL_INFO,
QUOTE(COMPONENT),
"SETTING CHANGED",
[
["setting", _settingName],
["newValue", _value]
]
] call EFUNC(common,log);

View File

@@ -0,0 +1,3 @@
#define COMPONENT common
#define COMPONENT_BEAUTIFIED Common
#include "../script_mod.hpp"

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

View File

@@ -0,0 +1,112 @@
#include "..\script_component.hpp"
private _recordTitle = "ENVIRONMENTAL CONDITIONS";
private _text = [
format[
"<font size='%1' color='%2' face='%3'>%4</font>",
GVAR(recordTitleSize),
GVAR(recordTitleColor),
GVAR(recordTitleFont),
_recordTitle
]
];
private _sunriseColor = "#4A86E8";
private _sunsetColor = "#6AA84F";
private _whiteColor = "#FFFFFF";
private _sunTimes = date call BIS_fnc_sunriseSunsetTime;
private _nearestBase = [player] call EFUNC(common,getNearestBase);
if (isNull _nearestBase) exitWith {
[
LEVEL_WARNING,
QUOTE(COMPONENT),
"WARNING: No bases found nearby to report weather!",
[player, [
["position", getPos player]
]] call EFUNC(common,addPlayerInfoToArray)
] call EFUNC(common,log);
["WARNING: No bases found nearby to report weather!"] call BIS_fnc_error;
};
_text pushBack format[
"<font size='%1'>Current conditions at nearest weather station: %2</font><br/>",
GVAR(recordTextBodySize),
[_nearestBase] call EFUNC(common,getNameOfBase)
];
private _weatherData = [];
if (isClass (configFile >> "CfgPatches" >> "ace_weather")) then {
// get ace_weather data
private _barometricPressure = ((getPosASL _nearestBase)#2) call ace_weather_fnc_calculateBarometricPressure;
private _relHumidity = missionNamespace getVariable ["ace_weather_currentHumidity", 0.5];
private _temperature = ((getPosASL _nearestBase)#2) call ace_weather_fnc_calculateTemperatureAtHeight;
private _dewPoint = [_temperature, _relHumidity] call ace_weather_fnc_calculateDewPoint;
private _windSpeed = [getPosASL _nearestBase, false, false, false] call ace_weather_fnc_calculateWindSpeed;
private _windChill = [_temperature, _windSpeed] call ace_weather_fnc_calculateWindChill;
private _heatIndex = [_temperature, _relHumidity] call ace_weather_fnc_calculateHeatIndex;
toFixed 2;
private _aceData = [
["Temperature", format["%1°C / %2°F", _temperature, _temperature * (9/5) + 32]],
["Wind Chill", format["%1°C / %2°F", _windChill, _windChill * (9/5) + 32]],
["Heat Index", format["%1°C / %2°F", _heatIndex, _heatIndex * (9/5) + 32]],
["Dew Point", format["%1°C / %2°F", _dewPoint, _dewPoint * (9/5) + 32]],
["Wind Speed", format["%1mph / %2kph / %3kts", _windSpeed * 2.237, _windSpeed * 3.6, _windSpeed * 1.944]],
["Wind Direction", ""],
["Barometric Pressure", format["%1 hPA", _barometricPressure]],
["Relative Humidity", format["%1%2", _relHumidity * 100, "%"]],
["Fog Cover", ""],
["Rain", ""],
["Overcast", ""]
];
toFixed -1;
{
_x params ["_name", "_value"];
[_weatherData, _name, _value] call BIS_fnc_setToPairs;
} forEach _aceData;
};
// always add built-in weather
toFixed 2;
private _vanillaData = [
["Temperature", format["%1°C", (ambientTemperature)#0]],
["Fog Cover", format["%1%2", fog * 100, "%"]],
["Overcast", format["%1%2", overcast * 100, "%"]],
["Rain", format["%1%2", rain * 100, "%"]],
["Wind Speed", format["%1m/s", windStr]],
["Wind Direction", format["%1°", windDir]]
];
toFixed -1;
_vanillaData pushBack ["Sunrise", ([_sunTimes select 0, "HH:MM"] call BIS_fnc_timeToString)];
_vanillaData pushBack ["Sunset", ([_sunTimes select 1, "HH:MM"] call BIS_fnc_timeToString)];
// override or set keys for vanilla data into weather data
{
_x params ["_name", "_value"];
[_weatherData, _name, _value] call BIS_fnc_setToPairs;
} forEach _vanillaData;
// write lines
{
_x params ["_name", "_value"];
_text pushBack format[
"<font size='%1' face='EtelkaMonospacePro'>%2%3</font>",
GVAR(recordTextBodySize)-4,
[_name, "right", " ", 23] call EFUNC(common,padString),
_value
];
} forEach _weatherData;
_text = _text joinString "<br/>";
[
GVAR(subjectIntelID),
_recordTitle,
_text
] call FUNC(createOrUpdateDiaryRecord);

View File

@@ -6,22 +6,24 @@
////////////////////////////////////////
// Get info from missionConfigFile
////////////////////////////////////////
private _battalionInfoCfg = call EFUNC(util,getBattalionCfg);
private _battalionInfoCfg = call EFUNC(common,getBattalionCfg);
if (isNull _battalionInfoCfg) exitWith {
[
LEVEL_ERROR,
QUOTE(COMPONENT),
"Null Battalion Config",
[]
] call EFUNC(util,log);
] call EFUNC(common,log);
};
private _battalionElementCfgs = [_battalionInfoCfg >> "Command"] call BIS_fnc_returnChildren;
if (count _battalionElementCfgs == 0) exitWith {
[
LEVEL_ERROR,
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);
] call EFUNC(common,log);
};
////////////////////////////////////////

View File

@@ -0,0 +1,59 @@
#include "../script_component.hpp"
private _recordTitle = "SIGNAL COLORS";
private _text = [
// Title
format[
"<font size='%1' color='%2' face='%3'>%4</font>",
GVAR(recordTitleSize),
GVAR(recordTitleColor),
GVAR(recordTitleFont),
_recordTitle
]
];
private _signalColorDefs = (missionConfigFile >> "SignalColors") call BIS_fnc_returnChildren;
{
private _cfg = _x;
private _color = getText(_cfg >> "hexCode");
private _name = getText(_cfg >> "name");
private _usage = getText(_cfg >> "usage");
private _itemExamples = getArray(_cfg >> "itemExamples");
private _thisText = [];
_thisText pushBack format[
"<font size='%1'><font color='%2'>%3</font> - %4</font>",
GVAR(recordTextHeaderSize),
_color,
_name,
_usage
];
private _imagesLine = [];
{
private _itemClassname = _x;
private _itemCfg = [_itemClassname] call CBA_fnc_getItemConfig;
private _itemName = getText(_itemCfg >> "displayName");
private _itemImage = getText(_itemCfg >> "picture");
_imagesLine pushBack format[
"<img height='32' src='%1' title='%2'/>",
_itemImage,
_itemName
];
} forEach _itemExamples;
_thisText pushBack (_imagesLine joinString " ");
_text pushBack (_thisText joinString "<br/>");
} forEach _signalColorDefs;
_text = _text joinString "<br/><br/>";
[
GVAR(subjectIntelID),
_recordTitle,
_text
] call FUNC(createOrUpdateDiaryRecord);

View File

@@ -34,6 +34,21 @@ player createDiarySubject[GVAR(subjectAssetsGroundID), "FBCB2 Ground"];
GVAR(diaryRecords) = createHashMap;
// run main inits - assets handled in that component
[] call FUNC(processFBCB2RadioFrequencies);
[] call FUNC(processFBCB2SmokeColors);
[] call FUNC(processFBCB2Environment);
[] call FUNC(addFrequenciesRecord);
[] call FUNC(addSignalColorsRecord);
[] call FUNC(addEnvironmentRecord);
// starting 5 minutes after postInit, update weather diary record every 5 minutes
[{
[
{call FUNC(addEnvironmentRecord);},
60*5
] call CBA_fnc_addPerFrameHandler;
}, 60*5] call CBA_fnc_waitAndExecute;
[
LEVEL_DEBUG,
QUOTE(COMPONENT),
"postInit complete",
[]
] call EFUNC(common,log);

View File

@@ -1,47 +0,0 @@
#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);

View File

@@ -1,43 +0,0 @@
#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);

View File

@@ -15,7 +15,9 @@ private _existingRecord = _subjectRecords getOrDefault [_recordTitle, diaryRecor
if (!isNull _existingRecord) then {
player setDiaryRecordText [[_subjectID, _existingRecord], [_recordTitle, _recordText, _recordIcon]];
systemChat format ["Updated diary record: %1", _recordTitle];
if (DEBUG_ENABLED) then {
systemChat format ["Updated diary record: %1", _recordTitle];
};
} else {
private _new = player createDiaryRecord [
_subjectID,

View File

@@ -64,8 +64,8 @@ _freqLeadingSpace = _freqLeadingSpace joinString "";
_ELEMENT_FREQ_SIZE,
_ELEMENT_FREQ_FONT,
_FREQ_TEXT_COLOR,
[_role, "right", " ", _FREQ_PAD_LENGTH] call EFUNC(util,padString),
[_srStr, "right", " ", _FREQ_PAD_LENGTH] call EFUNC(util,padString),
[_role, "right", " ", _FREQ_PAD_LENGTH] call EFUNC(common,padString),
[_srStr, "right", " ", _FREQ_PAD_LENGTH] call EFUNC(common,padString),
_lrStr
];
} forEach (getArray (_cfg >> "frequencies"));

View File

@@ -54,8 +54,8 @@ private _headers = [
_ELEMENT_FREQ_SIZE,
_ELEMENT_FREQ_FONT,
_FREQ_TEXT_COLOR,
["ROLE", "right", " ", _FREQ_PAD_LENGTH] call EFUNC(util,padString),
["SR", "right", " ", _FREQ_PAD_LENGTH] call EFUNC(util,padString),
["ROLE", "right", " ", _FREQ_PAD_LENGTH] call EFUNC(common,padString),
["SR", "right", " ", _FREQ_PAD_LENGTH] call EFUNC(common,padString),
"LR"
]
];
@@ -68,26 +68,27 @@ private _allText = [];
// get all child elements recursively and format them
if (_shouldProcessChildCfgs) then {
diag_log text format[
"[%1] <%2> Processing %3",
QUOTE(PREFIX),
_fnc_scriptName,
configName _battalionElement
];
[
LEVEL_TRACE,
QUOTE(COMPONENT),
"Processing child elements for battalion element %1"
] call EFUNC(common,log);
[_battalionElement, {
params ["_cfg", "_recurseCounter"];
// add config
private _lines = [_cfg, _recurseCounter+1] call FUNC(formatRadioElementForDiary);
// private _lines = [_cfg, _indentCount] call t;
_allText pushBack (_lines joinString "<br/>");
}] call EFUNC(util,recurseSubclasses);
}] call EFUNC(common,recurseSubclasses);
} else {
diag_log text format[
"[%1] <%2> Processing %3",
QUOTE(PREFIX),
_fnc_scriptName,
configName _battalionElement
];
[
LEVEL_TRACE,
QUOTE(COMPONENT),
"Skipping processing of child elements for battalion element %1",
[]
] call EFUNC(common,log);
// or if the param was false, just add the battalion element
private _lines = [_battalionElement, 1] call FUNC(formatRadioElementForDiary);
// private _lines = [_cfg, _indentCount] call t;

View File

@@ -0,0 +1,16 @@
[
"saveaar",
{
[] remoteExec["ocap_fnc_exportData", 2];
},
"admin"
] call CBA_fnc_registerChatCommand;
[
LEVEL_INFO,
QUOTE(COMPONENT),
"OCAP chat handler registered",
[player] call EFUNC(common,addPlayerInfoToArray)
] call EFUNC(common,log);
nil;

View File

@@ -1,3 +1,5 @@
#include "..\script_component.hpp"
[
"respawn",
{
@@ -6,10 +8,11 @@
// log to server RPT
[
"init",
LEVEL_INFO,
QUOTE(COMPONENT),
"CHAT COMMAND RESPAWN",
[player] call milsim_util_fnc_addPlayerInfoToArray
] remoteExec ["milsim_util_fnc_log", 2];
[player] call EFUNC(common,addPlayerInfoToArray)
] remoteExec [QEFUNC(common,log), 2];
// systemChat to all remote machines
format["%1 claims they were glitched and respawned (%2)", name player, netID player] remoteExec["systemChat", -_clientID];
@@ -18,6 +21,11 @@
[clientOwner]
] call CBA_fnc_registerChatCommand;
diag_log text "[MILSIM] (settings) respawn chat handler registered";
[
LEVEL_INFO,
QUOTE(COMPONENT),
"Respawn chat handler registered",
[player] call EFUNC(common,addPlayerInfoToArray)
] call EFUNC(common,log);
nil;

View File

@@ -1,3 +1,5 @@
#include "..\script_component.hpp"
if ( !hasInterface ) exitWith {};
if (!isServer) then {
@@ -11,4 +13,11 @@ if (!isServer) then {
["InitializePlayer", [player, true]] call BIS_fnc_dynamicGroups;
[
LEVEL_DEBUG,
QUOTE(COMPONENT),
"postInit complete",
[]
] call EFUNC(common,log);
nil;

View File

@@ -2,6 +2,8 @@
if (!isServer) exitWith {};
// array of all respawn modules in the mission representing "bases"
GVARMAIN(baseObjects) = allMissionObjects "ModuleRespawnPosition_F";
publicVariable "milsim_baseObjects";
@@ -16,11 +18,18 @@ publicVariable "milsim_baseObjects";
}] call CBA_fnc_addEventHandler;
missionNamespace setVariable [QGVARMAIN(complete), true];
publicVariable QGVARMAIN(complete);
[
LEVEL_INFO,
QUOTE(COMPONENT),
format["%1: version %2", QGVARMAIN(complete), QUOTE(VERSION_STR)],
[["version", QUOTE(VERSION_STR)]]
] call EFUNC(util,log);
] call EFUNC(common,log);
publicVariable "milsim_complete";
[
LEVEL_DEBUG,
QUOTE(COMPONENT),
"postInit complete",
[]
] call EFUNC(common,log);

View File

@@ -0,0 +1,34 @@
#include "..\script_component.hpp"
enableSaving[false, false];
enableRadio false;
enableSentences false;
missionNamespace setVariable ["ACE_maxWeightDrag", 2400];
missionNamespace setVariable ["ACE_maxWeightCarry", 1800];
if(isClass(configfile >> "CfgPatches" >> "rhs_main")) then {
rhs_vehicleRadioChatter = 0;
};
waitUntil {time > 0};
enableEnvironment[false, true];
[
LEVEL_INFO,
QUOTE(COMPONENT),
"Defaults set",
[
["enableSaving", [false, false]],
["enableRadio", false],
["enableSentences", false],
["ACE_maxWeightDrag", 2400],
["ACE_maxWeightCarry", 1800],
["rhs_vehicleRadioChatter", 0],
["enableEnvironment", [false, true]]
]
] call EFUNC(common,log);
nil;

View File

@@ -0,0 +1,105 @@
#include "..\script_component.hpp"
//---------------------
// Server CPS
//---------------------
[
QGVAR(server_cps_enable),
"CHECKBOX",
"Server CPS Metrics Enabled",
["17th Battalion", "Server Metrics"],
true,
true,
{
params ["_value"];
[
QGVAR(cps_enable),
_value
] call EFUNC(common,logSettingChanged);
}
] call CBA_fnc_addSetting;
[QGVAR(cps_enable), true] call CBA_settings_fnc_set;
[
QGVAR(server_cps_interval),
"TIME",
"Server CPS Metrics Interval",
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)],
[60,300,120],
true,
{
if (!isServer) exitWith {};
params ["_value"];
[
QGVAR(cps_interval),
_value
] call EFUNC(common,logSettingChanged);
_cpsPFH = missionNamespace getVariable [QGVAR(server_cps_handler), ObjNull];
if (!isNull _cpsPFH) then {
_cpsPFH call CBA_fnc_deletePerFrameHandlerObject;
};
[] call FUNC(addServerStatsPFH);
}
] call CBA_fnc_addSetting;
//---------------------
// Client CPS
//---------------------
[
QGVAR(client_cps_enable),
"CHECKBOX",
"Client CPS Metrics Enabled",
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)],
true,
true,
{
params ["_value"];
[
QGVAR(client_cps_enable),
_value
] call EFUNC(common,logSettingChanged);
}
] call CBA_fnc_addSetting;
[QGVAR(client_cps_enable), true] call CBA_settings_fnc_set;
[
QGVAR(client_cps_interval),
"TIME",
"Client CPS Metrics Interval",
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)],
[60,300,120],
true,
{
if (!hasInterface) exitWith {};
params ["_value"];
[
QGVAR(client_cps_interval),
_value
] call EFUNC(common,logSettingChanged);
_cpsPFH = player getVariable [QGVAR(client_cps_handler), ObjNull];
if (!isNull _cpsPFH) then {
_cpsPFH call CBA_fnc_deletePerFrameHandlerObject;
};
[] call FUNC(addClientStatsPFH);
}
] call CBA_fnc_addSetting;
[
LEVEL_INFO,
QUOTE(COMPONENT),
"CREATED SETTINGS",
[]
] call EFUNC(common,log);

View File

@@ -0,0 +1,38 @@
#include "..\script_component.hpp"
if (!hasInterface) exitWith {};
[
LEVEL_INFO,
QUOTE(COMPONENT),
"Initializing client stats PFH",
[]
] call EFUNC(common,log);
_cpsPFH = [
{
[] call FUNC(calculateClientStats);
},
QGVAR(client_cps_interval) call CBA_settings_fnc_get,
[],
{
[
LEVEL_INFO,
QUOTE(COMPONENT),
"Client PFH loaded",
[["pfhInterval", QGVAR(client_cps_interval) call CBA_settings_fnc_get]]
] call EFUNC(common,log);
},
{ [
LEVEL_INFO,
QUOTE(COMPONENT),
"Client PFH unloaded",
[]
] call EFUNC(common,log);
},
{ QGVAR(client_cps_enable) call CBA_settings_fnc_get },
{ false },
[]
] call CBA_fnc_createPerFrameHandlerObject;
player setVariable [QGVAR(client_cps_handler), _cpsPFH];

View File

@@ -1,3 +1,5 @@
#include "..\script_component.hpp"
if ( !hasInterface ) exitWith {};
diag_log text "[MILSIM] (DNI) writing variable loop";

View File

@@ -1,28 +1,48 @@
#include "..\script_component.hpp"
if (!isServer) exitWith {};
missionNamespace setVariable["milsim_raw_cps", 0];
missionNamespace setVariable["milsim_cps", 0];
missionNamespace setVariable[QGVAR(raw_cps), 0];
missionNamespace setVariable[QGVAR(cps), 0];
publicVariable "milsim_raw_cps";
publicVariable "milsim_cps";
publicVariable QGVAR(raw_cps);
publicVariable QGVAR(cps);
diag_log text format ["[MILSIM] (server) initializing Server Stats PFH"];
[
LEVEL_INFO,
QUOTE(COMPONENT),
"Initializing server stats PFH",
[]
] call EFUNC(common,log);
_serverCpsPFH = [
{
[] call milsim_fnc_calculateServerStats;
[] call FUNC(calculateServerStats);
},
"milsim_server_cps_interval" call CBA_settings_fnc_get,
QGVAR(server_cps_interval) call CBA_settings_fnc_get,
[],
{ diag_log text format ["[MILSIM] (server) Server PFH loaded with interval %1 seconds", "milsim_server_cps_interval" call CBA_settings_fnc_get ] },
{ diag_log text format ["[MILSIM] (server) Server PFH unloaded"] },
{ "milsim_server_cps_enable" call CBA_settings_fnc_get },
{
[
LEVEL_INFO,
QUOTE(COMPONENT),
"Server PFH loaded",
[["pfhInterval", QGVAR(server_cps_interval) call CBA_settings_fnc_get]]
] call EFUNC(common,log);
},
{ [
LEVEL_INFO,
QUOTE(COMPONENT),
"Server PFH unloaded",
[]
] call EFUNC(common,log);
},
{ QGVAR(server_cps_enable) call CBA_settings_fnc_get },
{ false },
[]
] call CBA_fnc_createPerFrameHandlerObject;
missionNamespace setVariable ["milsim_server_cps_handler", _serverCpsPFH];
missionNamespace setVariable [QGVAR(server_cps_handler), _serverCpsPFH];
_playerCpsPFH = [
{

View File

@@ -0,0 +1,40 @@
#include "..\script_component.hpp"
[] spawn {
// warning: while loop without suspension executes multiple times per frame
private _counter = 0;
private _endTime = diag_tickTime + 5;
private _frameNo = diag_frameNo;
while { diag_tickTime < _endTime } do
{
_counter = _counter + 1;
};
// in an empty mission, the _counter may go well over 2000 times per frame!
[
LEVEL_INFO,
QUOTE(COMPONENT),
format ["Average Execution: %1 times per frame", _counter / (diag_frameNo - _frameNo)],
[["playerRawCPS", _counter / (diag_frameNo - _frameNo)]]
] call EFUNC(common,log);
player setVariable [QGVAR(player_raw_cps), _counter / (diag_frameNo - _frameNo), true];
// with suspension
private _counter = 0;
private _endTime = diag_tickTime + 5;
private _frameNo = diag_frameNo;
while { diag_tickTime < _endTime } do
{
_counter = _counter + 1;
uiSleep 0.001; // waits at least 1 frame
};
// _counter says one per frame, as expected
[
LEVEL_INFO,
QUOTE(COMPONENT),
format ["Average Execution: %1 times per frame", _counter / (diag_frameNo - _frameNo)],
[["playerCPS", _counter / (diag_frameNo - _frameNo)]]
] call EFUNC(common,log);
player setVariable [QGVAR(player_cps), _counter / (diag_frameNo - _frameNo), true];
};
nil;

View File

@@ -0,0 +1,3 @@
#define COMPONENT performance
#define COMPONENT_BEAUTIFIED Performance Monitoring
#include "../script_mod.hpp"

View File

@@ -1,36 +1,38 @@
#include "..\script_component.hpp"
params ["_type"]; // string of the object's classname
if (!(_type isKindOf "CAManBase")) exitWith {};
if (
(localNamespace getVariable ["milsim_reinsert_fileForReinsertClassesAdded", []])
(localNamespace getVariable [QGVAR(fileForReinsertClassesAdded), []])
find _type != -1
) exitWith {};
private _fileForReinsertAction = [
"milsim_reinsert_fileReinsertRequest",
QGVAR(fileReinsertRequestAction),
"File Re-insert Request",
"\A3\ui_f\data\igui\cfg\simpleTasks\types\takeoff_ca.paa",
{ // statement
params ["_target", "_player", "_params"];
// find nearest base or location
private _base = [_player] call milsim_util_fnc_getNearestBase;
private _baseName = [_base] call milsim_util_fnc_getNameOfBase;
private _base = [_player] call EFUNC(common,getNearestBase);
private _baseName = [_base] call EFUNC(common,getNameOfBase);
// send event to server
["milsim_reinsert_fileReinsertRequest", [_player, _base]] call CBA_fnc_serverEvent;
[QGVAR(fileReinsertRequest), [_player, _base]] call CBA_fnc_serverEvent;
// notify player their request was filed
[["Re-insert Request Filed"], [format["Location: %1", _baseName]]] call CBA_fnc_notify;
},
{ // condition
params ["_target", "_player", "_params"];
// find nearest base or location
private _base = [_player] call milsim_util_fnc_getNearestBase;
private _base = [_player] call EFUNC(common,getNearestBase);
private _baseDistance = _player distance _base;
private _maxRangeToReady = missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_maxRangeToReady", 400];
private _existingQueue = missionNamespace getVariable ["milsim_reinsert_reinsertionQueue", []];
private _maxRangeToReady = missionNamespace getVariable [QGVAR(setting_maxRangeToReady), 400];
private _existingQueue = missionNamespace getVariable [QGVAR(reinsertionQueue), []];
// check if module is enabled, player is near a base, and player is not already in the queue
// (serverTime - milsim_reinsert_missionStartServerTime) > 60*5 && // only allow after 15 minutes
// (serverTime - GVAR(missionStartServerTime)) > 60*5 && // only allow after 15 minutes
missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_enabled", true] &&
(_baseDistance < _maxRangeToReady) &&
not (_player in (_existingQueue apply {_x#0}))
@@ -39,29 +41,29 @@ private _fileForReinsertAction = [
[_type, 1, ["ACE_SelfActions"], _fileForReinsertAction, true] call ace_interact_menu_fnc_addActionToClass;
private _removeFileForReinsertAction = [
"milsim_reinsert_removeReinsertRequest",
QGVAR(removeReinsertRequestAction),
"Remove Re-insert Request",
"\A3\ui_f\data\igui\cfg\simpleTasks\types\land_ca.paa",
{ // statement
params ["_target", "_player", "_params"];
// send event to server
["milsim_reinsert_removeReinsertRequest", [_player]] call CBA_fnc_serverEvent;
[QGVAR(removeReinsertRequest), [_player]] call CBA_fnc_serverEvent;
// notify player their request was rescinded
"Re-insert Request Rescinded" call CBA_fnc_notify;
},
{ // condition
params ["_target", "_player", "_params"];
private _existingQueue = missionNamespace getVariable ["milsim_reinsert_reinsertionQueue", []];
private _existingQueue = missionNamespace getVariable [QGVAR(reinsertionQueue), []];
// check if module is enabled, player is in the queue
// (serverTime - milsim_reinsert_missionStartServerTime) > 60*5 && // only allow after 15 minutes
// (serverTime - GVAR(missionStartServerTime)) > 60*5 && // only allow after 15 minutes
missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_enabled", true] &&
(_player in (_existingQueue apply {_x#0}))
}
] call ace_interact_menu_fnc_createAction;
[_type, 1, ["ACE_SelfActions"], _removeFileForReinsertAction, true] call ace_interact_menu_fnc_addActionToClass;
private _classesActionsAddedTo = (localNamespace getVariable ["milsim_reinsert_fileForReinsertClassesAdded", []]);
private _classesActionsAddedTo = (localNamespace getVariable [QGVAR(fileForReinsertClassesAdded), []]);
_classesActionsAddedTo pushBackUnique _type;
localNamespace setVariable ["milsim_reinsert_fileForReinsertClassesAdded", _classesActionsAddedTo];
localNamespace setVariable [QGVAR(fileForReinsertClassesAdded), _classesActionsAddedTo];

View File

@@ -1,28 +1,30 @@
#include "..\script_component.hpp"
params ["_type"]; // string of the object's classname
if (!(_type isKindOf "CAManBase")) exitWith {};
if (
(localNamespace getVariable ["milsim_reinsert_checkReinsertQueueClassesAdded", []])
(localNamespace getVariable [QGVAR(checkReinsertQueueClassesAdded), []])
find _type != -1
) exitWith {};
private _checkReinsertQueueAction = [
"milsim_reinsert_checkReinsertQueue",
QGVAR(checkReinsertQueue),
"[PILOT] Check Re-insert Queue",
"\A3\ui_f\data\igui\cfg\simpleTasks\types\land_ca.paa",
{
params ["_target", "_player", "_params"];
// request notification from the server
call milsim_reinsert_fnc_requestShowQueue;
call FUNC(requestShowQueue);
// reset last check time
localNamespace setVariable ["milsim_reinsert_lastReinsertQueueCheck", diag_tickTime];
localNamespace setVariable [QGVAR(lastReinsertQueueCheck), diag_tickTime];
},
{
missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_enabled", true]
missionNamespace getVariable [QGVAR(setting_enabled), true]
} // always allow
] call ace_interact_menu_fnc_createAction;
[_type, 1, ["ACE_SelfActions"], _checkReinsertQueueAction, true] call ace_interact_menu_fnc_addActionToClass;
private _classesActionsAddedTo = (localNamespace getVariable ["milsim_reinsert_checkReinsertQueueClassesAdded", []]);
private _classesActionsAddedTo = (localNamespace getVariable [QGVAR(checkReinsertQueueClassesAdded), []]);
_classesActionsAddedTo pushBackUnique _type;
localNamespace setVariable ["milsim_reinsert_checkReinsertQueueClassesAdded", _classesActionsAddedTo];
localNamespace setVariable [QGVAR(checkReinsertQueueClassesAdded), _classesActionsAddedTo];

View File

@@ -1,26 +1,28 @@
#include "..\script_component.hpp"
if (!hasInterface) exitWith {};
// ACE SELF-INTERACTIONS FOR FILING AND RESCINDING REINSERT REQUESTS NEAR BASE - ALL PLAYERS
localNamespace setVariable ["milsim_reinsert_fileForReinsertClassesAdded", []];
localNamespace setVariable [QGVAR(fileForReinsertClassesAdded), []];
// add actions to current class
[typeOf player] call milsim_reinsert_fnc_addAceSelfActions;
[typeOf player] call FUNC(addAceSelfActions);
// add actions to future classes
["ace_interact_menu_newControllableObject", {
_this call milsim_reinsert_fnc_addAceSelfActions;
_this call FUNC(addAceSelfActions);
}] call CBA_fnc_addEventHandler;
/////////////////////////////////////////////////////
// PILOTS ONLY
// ACE SELF-INTERACTIONS FOR CHECKING REINSERT QUEUE - ONLY FOR PILOTS
if ((typeOf player) in ["B_Helipilot_F", "B_helicrew_F"]) then {
localNamespace setVariable ["milsim_reinsert_checkReinsertQueueClassesAdded", []];
localNamespace setVariable ["milsim_reinsert_lastReinsertQueueCheck", diag_tickTime];
localNamespace setVariable [QGVAR(checkReinsertQueueClassesAdded), []];
localNamespace setVariable [QGVAR(lastReinsertQueueCheck), diag_tickTime];
// add actions to current class
[typeOf player] call milsim_reinsert_fnc_addCheckQueueSelfAction;
[typeOf player] call FUNC(addCheckQueueSelfAction);
// add actions to future classes
["ace_interact_menu_newControllableObject", {
_this call milsim_reinsert_fnc_addCheckQueueSelfAction;
_this call FUNC(addCheckQueueSelfAction);
}] call CBA_fnc_addEventHandler;
};
/////////////////////////////////////////////////////
@@ -31,13 +33,13 @@ if ((typeOf player) in ["B_Helipilot_F", "B_helicrew_F"]) then {
[{
// if module not enabled and pilot forced check not enabled, exit
if (not (
missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_enabled", true] &&
missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_pilotForcedCheckEnabled", true]
missionNamespace getVariable [QGVAR(setting_enabled), true] &&
missionNamespace getVariable [QGVAR(setting_pilotForcedCheckEnabled), true]
)) exitWith {};
// if last check was less than X minutes ago, skip
private _lastCheck = localNamespace getVariable ["milsim_reinsert_lastReinsertQueueCheck", diag_tickTime];
private _requiredCheckInterval = missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_pilotForcedCheckInterval", 60*20];
private _lastCheck = localNamespace getVariable [QGVAR(lastReinsertQueueCheck), diag_tickTime];
private _requiredCheckInterval = missionNamespace getVariable [QGVAR(setting_pilotForcedCheckInterval), 60*20];
if (
diag_tickTime - _lastCheck <
_requiredCheckInterval
@@ -45,9 +47,16 @@ if ((typeOf player) in ["B_Helipilot_F", "B_helicrew_F"]) then {
// last check was greater than X minutes ago
// reset last check time
localNamespace setVariable ["milsim_reinsert_lastReinsertQueueCheck", diag_tickTime];
localNamespace setVariable [QGVAR(lastReinsertQueueCheck), diag_tickTime];
// request notification from the server
call milsim_reinsert_fnc_requestShowQueue;
call FUNC(requestShowQueue);
}, 30] call CBA_fnc_addPerFrameHandler;
};
/////////////////////////////////////////////////////
/////////////////////////////////////////////////////
[
LEVEL_DEBUG,
QUOTE(COMPONENT),
"postInit complete",
[]
] call EFUNC(common,log);

View File

@@ -1,3 +1,5 @@
#include "..\script_component.hpp"
if (!hasInterface) exitWith {};
[] remoteExec ["milsim_reinsert_fnc_returnReinsertQueueNotification", 2];
[] remoteExec [QFUNC(returnReinsertQueueNotification), 2];

View File

@@ -0,0 +1,83 @@
#include "..\script_component.hpp"
//---------------------
// Respawn Settings
[
QGVAR(setting_enabled), // variable
"CHECKBOX", // type
["Enabled", "Whether or not players can file for reinsert and pilots can check the reinsert queue"], // title
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
true, // default value
true, // global setting
{
params ["_value"];
[
QGVAR(setting_enabled),
_value
] call EFUNC(common,logSettingChanged);
}
] call CBA_fnc_addSetting;
[
QGVAR(setting_maxRangeToReady), // variable
"SLIDER", // type
["Max Request Filing Range", "Maximum distance from a respawn point a player can be to ready up"], // title
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
[0, 1000, 400, 0, false], // [_min, _max, _default, _trailingDecimals, _isPercentage]
true, // global setting
{
params ["_value"];
[
QGVAR(setting_maxRangeToReady),
_value
] call EFUNC(common,logSettingChanged);
}
] call CBA_fnc_addSetting;
[
QGVAR(setting_pilotForcedCheckEnabled), // variable
"CHECKBOX", // type
["Enabled", "Whether or not pilots are forced to view the contents of the reinsertion queue per interval"], // title
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
false, // default value
true, // global setting
{
params ["_value"];
[
QGVAR(setting_pilotForcedCheckEnabled),
_value
] call EFUNC(common,logSettingChanged);
}
] call CBA_fnc_addSetting;
[
QGVAR(setting_pilotForcedCheckInterval), // variable
"TIME", // type
["Pilot Forced Check Interval", "Pilots will be force shown the queue if they haven't checked it in X seconds"], // title
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
[60*5, 60*30, 60*10], // [_min, _max, _default]
true,
{
params ["_value"];
[
QGVAR(setting_pilotForcedCheckInterval),
_value
] call EFUNC(common,logSettingChanged);
}
] call CBA_fnc_addSetting;
[
QGVAR(setting_maxWait), // variable
"TIME", // type
["Max Wait Threshold", "How long should at least one person be waiting before prompting a global notification."], // title
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
[60*5, 60*30, 60*20], // [_min, _max, _default]
true,
{
params ["_value"];
[
QGVAR(setting_maxWait),
_value
] call EFUNC(common,logSettingChanged);
}
] call CBA_fnc_addSetting;

View File

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

View File

@@ -1,3 +1,5 @@
#include "..\script_component.hpp"
params [
["_player", objNull, [objNull]],
["_base", objNull, [objNull]],
@@ -6,51 +8,54 @@ params [
if (!isServer) exitWith {
[
"respawn_reinsertion",
LEVEL_ERROR,
QUOTE(COMPONENT),
"ATTEMPTED RUN ON CLIENT",
[
["player", _player],
["base", _base]
]
] call milsim_util_fnc_log;
] call EFUNC(common,log);
["ATTEMPTED RUN ON CLIENT"] call BIS_fnc_error;
};
if (
isNull _player ||
isNull _base
) exitWith {
[
"respawn_reinsertion",
LEVEL_ERROR,
QUOTE(COMPONENT),
"NULL PARAMETERS",
[
["player", _player],
["base", _base]
]
] call milsim_util_fnc_log;
] call EFUNC(common,log);
["NULL PARAMETERS"] call BIS_fnc_error;
};
private _maxRangeToReady = missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_maxRangeToReady", 400];
private _maxRangeToReady = missionNamespace getVariable [QGVAR(setting_maxRangeToReady), 400];
// nearest base here is the same as the base sent
private _nearestBase = _base;
milsim_reinsert_reinsertionQueue pushBackUnique [
GVAR(reinsertionQueue) pushBackUnique [
_player, _base, _timeFiled
];
// broadcast new list to all machines
publicVariable "milsim_reinsert_reinsertionQueue";
publicVariable QGVAR(reinsertionQueue);
// log to rpt
private _logParams = [
["filedAtBase", [_base] call milsim_util_fnc_getNameOfBase],
["filedAtBaseDistance", _player distance _base],
["closestBase", [_nearestBase] call milsim_util_fnc_getNameOfBase],
["closestBaseDistance", _player distance _nearestBase],
["maxDistanceSetting", _maxRangeToReady],
["inQueueDuration", diag_tickTime - _timeFiled]
];
_logParams = [_player, _logParams] call milsim_util_fnc_addPlayerInfoToArray;
[
"respawn_reinsertion",
LEVEL_INFO,
QUOTE(COMPONENT),
"PLAYER FILED REQUEST",
_logParams
] call milsim_util_fnc_log;
[_player, [
["filedAtBase", [_base] call EFUNC(common,getNameOfBase)],
["filedAtBaseDistance", _player distance _base],
["closestBase", [_nearestBase] call EFUNC(common,getNameOfBase)],
["closestBaseDistance", _player distance _nearestBase],
["maxDistanceSetting", _maxRangeToReady],
["inQueueDuration", diag_tickTime - _timeFiled]
]] call EFUNC(common,addPlayerInfoToArray)
] call EFUNC(common,log);

View File

@@ -1,8 +1,10 @@
#include "..\script_component.hpp"
if (!isServer) exitWith {};
// if at least 1 player in the queue has been waiting longer than the configured timeout, notify all players
private _timeout = missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_max_wait", 60*20]; // default 20 minutes
private _timeoutPlayers = milsim_reinsert_reinsertionQueue select {
private _timeout = missionNamespace getVariable [QGVAR(setting_maxWait), 60*20]; // default 20 minutes
private _timeoutPlayers = GVAR(reinsertionQueue) select {
_x params ["_player", "_base", "_timeFiled"];
alive (_player) &&
(diag_tickTime - (_timeFiled)) > _timeout
@@ -10,10 +12,10 @@ private _timeoutPlayers = milsim_reinsert_reinsertionQueue select {
if (count _timeoutPlayers > 0) then {
// GLOBAL CBA NOTIFY
private _playerLines = [["Players are still waiting for Re-insert!", 1.2, [1, 0.64, 0, 1]]];
private _maxRangeToReady = missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_maxRangeToReady", 400];
private _maxRangeToReady = missionNamespace getVariable [QGVAR(setting_maxRangeToReady), 400];
// get base objects from queue
private _basesWithPeople = (missionNamespace getVariable ["milsim_reinsert_reinsertionQueue", []]) apply {_x#1};
private _basesWithPeople = (missionNamespace getVariable [QGVAR(reinsertionQueue), []]) apply {_x#1};
// get unique base objects
private _basesWithPeople = _basesWithPeople arrayIntersect _basesWithPeople;
@@ -21,7 +23,7 @@ if (count _timeoutPlayers > 0) then {
private _thisBase = _x;
// Add line for base name
_playerLines pushBack ([[_thisBase] call milsim_util_fnc_getNameOfBase, 1, [0,1,0,1]]);
_playerLines pushBack ([[_thisBase] call EFUNC(common,getNameOfBase), 1, [0,1,0,1]]);
// Get players under this base
private _thisBasePlayers = _timeoutPlayers select {_x#1 isEqualTo _thisBase};
@@ -35,7 +37,7 @@ if (count _timeoutPlayers > 0) then {
{ // for each player under this base, add a line
_x params ["_player", "_base", "_timeFiled"];
// get the closest base to the player
private _nearestBase = [_player] call milsim_util_fnc_getNearestBase;
private _nearestBase = [_player] call EFUNC(common,getNearestBase);
// add player to array of players under bases
_playerLines pushBack ([format [
@@ -46,25 +48,24 @@ if (count _timeoutPlayers > 0) then {
], 0.8, [0.8, 0.8, 0.8, 1]]);
// log to rpt
private _logParams = [
["filedAtBase", [_base] call milsim_util_fnc_getNameOfBase],
["filedAtBaseDistance", _player distance _base],
["closestBase", [_nearestBase] call milsim_util_fnc_getNameOfBase],
["closestBaseDistance", _player distance _nearestBase],
["maxDistanceSetting", _maxRangeToReady],
["inQueueDuration", diag_tickTime - _timeFiled]
];
_logParams = [_player, _logParams] call milsim_util_fnc_addPlayerInfoToArray;
[
"respawn_reinsertion",
LEVEL_WARNING,
QUOTE(COMPONENT),
"PLAYER WAITING OVER TIMEOUT",
_logParams
] call milsim_util_fnc_log;
[_player, [
["filedAtBase", [_base] call EFUNC(common,getNameOfBase)],
["filedAtBaseDistance", _player distance _base],
["closestBase", [_nearestBase] call EFUNC(common,getNameOfBase)],
["closestBaseDistance", _player distance _nearestBase],
["maxDistanceSetting", _maxRangeToReady],
["inQueueDuration", diag_tickTime - _timeFiled]
]] call EFUNC(common,addPlayerInfoToArray)
] call EFUNC(common,log);
} forEach _thisBasePlayers;
} forEach _basesWithPeople;
// SEND NOTIFY
_playerLines remoteExec ["CBA_fnc_notify", [0, -2] select isDedicated];
// RESET NOTIFICATION TIMER
milsim_reinsert_reinsertionOverTimeoutLastNotificationTime = diag_tickTime;
GVAR(overTimeoutLastNotificationTime) = diag_tickTime;
};

View File

@@ -3,48 +3,51 @@
// if a player's time in the queue exceeds the configured timeout, a message will be posted every 5 minutes on a cycle based around
// the player's time in the queue stating how long they have been waiting, their name, and their group's name
#include "..\script_component.hpp"
if (!isServer) exitWith {};
// array of all respawn modules in the mission, used as 'base' locations for reinsertion
milsim_baseObjects = allMissionObjects "ModuleRespawnPosition_F";
publicVariable "milsim_baseObjects";
// register queue
milsim_reinsert_reinsertionQueue = [];
publicVariable "milsim_reinsert_reinsertionQueue";
GVAR(reinsertionQueue) = [];
publicVariable QGVAR(reinsertionQueue);
// server mission start time
milsim_reinsert_missionStartServerTime = serverTime;
GVAR(missionStartServerTime) = serverTime;
// FILE REQUEST CBA HANDLER
["milsim_reinsert_fileReinsertRequest", {
[QGVAR(fileReinsertRequest), {
params ["_player", "_base"];
[_player, _base] call milsim_reinsert_fnc_addToQueue;
[_player, _base] call FUNC(addToQueue);
}] call CBA_fnc_addEventHandler;
// REMOVE REQUEST CBA HANDLER
["milsim_reinsert_removeReinsertRequest", {
[QGVAR(removeReinsertRequest), {
params ["_player"];
[_player] call milsim_reinsert_fnc_removeFromQueue;
[_player] call FUNC(removeFromQueue);
}] call CBA_fnc_addEventHandler;
// automated wait threshold timer
milsim_reinsert_reinsertionOverTimeoutLastNotificationTime = 0;
GVAR(overTimeoutLastNotificationTime) = 0;
[{ // every 60 seconds
// validate queue
call milsim_reinsert_fnc_validateQueue;
call FUNC(validateQueue);
// check if last overTimeout notification was sent more than X minutes ago
if (
diag_tickTime - milsim_reinsert_reinsertionOverTimeoutLastNotificationTime > 60*5
diag_tickTime - GVAR(overTimeoutLastNotificationTime) > 60*5
) then {
// show global queue notification with any players that are over timeout
call milsim_reinsert_fnc_globalShowQueue;
call FUNC(globalShowQueue);
};
}, 60] call CBA_fnc_addPerFrameHandler;
[
LEVEL_DEBUG,
QUOTE(COMPONENT),
"postInit complete",
[]
] call EFUNC(common,log);

View File

@@ -1,3 +1,5 @@
#include "..\script_component.hpp"
params [["_player", objNull, [objNull]]];
if (!isServer) exitWith {
@@ -20,16 +22,16 @@ if (isNull _player) exitWith {
};
// get entries for this player from queue
private _unitArrs = milsim_reinsert_reinsertionQueue select {_x#0 isEqualTo _player};
private _unitArrs = GVAR(reinsertionQueue) select {_x#0 isEqualTo _player};
// if player not in queue, skip
if (count _unitArrs isEqualTo 0) exitWith {};
private _maxRangeToReady = missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_maxRangeToReady", 400];
private _maxRangeToReady = missionNamespace getVariable [QGVAR(setting_maxRangeToReady), 400];
// remove player from queue
milsim_reinsert_reinsertionQueue = milsim_reinsert_reinsertionQueue - _unitArrs;
GVAR(reinsertionQueue) = GVAR(reinsertionQueue) - _unitArrs;
// broadcast new list to all machines
publicVariable "milsim_reinsert_reinsertionQueue";
publicVariable QGVAR(reinsertionQueue);
// sort _unitArrs by time in queue, descending, to get longest wait (if for some reason there's a duplicate)
[_unitArrs, [], {
@@ -39,17 +41,17 @@ publicVariable "milsim_reinsert_reinsertionQueue";
// get first entry (longest wait)
(_unitArrs#0) params ["_player", "_base", "_timeFiled"]; // _unitArr = [unit, base, timeInQueue]
// get the closest base to the player
private _nearestBase = [_player] call milsim_util_fnc_getNearestBase;
private _nearestBase = [_player] call EFUNC(common,getNearestBase);
// log to rpt
private _logParams = [
["filedAtBase", [_base] call milsim_util_fnc_getNameOfBase],
["filedAtBase", [_base] call EFUNC(common,getNameOfBase)],
["filedAtBaseDistance", _player distance _base],
["closestBase", [_nearestBase] call milsim_util_fnc_getNameOfBase],
["closestBase", [_nearestBase] call EFUNC(common,getNameOfBase)],
["closestBaseDistance", _player distance _nearestBase],
["maxDistanceSetting", _maxRangeToReady],
["inQueueDuration", diag_tickTime - _timeFiled]
];
_logParams = [_player, _logParams] call milsim_util_fnc_addPlayerInfoToArray;
_logParams = [_player, _logParams] call EFUNC(common,addPlayerInfoToArray);
[
"respawn_reinsertion",
"PLAYER RESCINDED REQUEST",

View File

@@ -25,16 +25,16 @@ if (isNull _userObject) exitWith {
};
// log to rpt
private _logParams = [_userObject, []] call milsim_util_fnc_addPlayerInfoToArray;
private _logParams = [_userObject, []] call EFUNC(common,addPlayerInfoToArray);
[
"respawn_reinsertion",
"SHOW QUEUE REQUESTED",
_logParams
] call milsim_util_fnc_log;
private _queue = missionNamespace getVariable ["milsim_reinsert_reinsertionQueue", []];
private _queue = missionNamespace getVariable [QGVAR(reinsertionQueue), []];
// get base objects from queue
private _basesWithPeople = (missionNamespace getVariable ["milsim_reinsert_reinsertionQueue", []]) apply {_x#1};
private _basesWithPeople = (missionNamespace getVariable [QGVAR(reinsertionQueue), []]) apply {_x#1};
// get unique base objects
private _basesWithPeople = _basesWithPeople arrayIntersect _basesWithPeople;
@@ -48,7 +48,7 @@ if (count _basesWithPeople isEqualTo 0) then {
// forEach _basesWithPeople
{
private _thisBase = _x;
private _baseName = [_thisBase] call milsim_util_fnc_getNameOfBase;
private _baseName = [_thisBase] call EFUNC(common,getNameOfBase);
// generate player lines for this base
private _playerLines = _queue select {

View File

@@ -1,32 +1,35 @@
// revalidate any players in the queue
// compare their distance to the nearest base, and remove them if they're too far away (or dead)
#include "..\script_component.hpp"
private _stillValid = [];
private _maxRangeToReady = missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_maxRangeToReady", 400];
private _maxRangeToReady = missionNamespace getVariable [QGVAR(setting_maxRangeToReady), 400];
{
_x params ["_player", "_base", "_timeFiled"]; // _unitArr = [unit, baseName, timeInQueue]
private _distanceToOriginalBase = _player distance _base;
// get the closest base to the player
private _nearestBase = [_player] call milsim_util_fnc_getNearestBase;
private _nearestBase = [_player] call EFUNC(common,getNearestBase);
private _isCloseEnoughToAnyBase = (_player distance _nearestBase) < _maxRangeToReady;
if (not _isCloseEnoughToAnyBase || not (alive _player)) then {
// don't include player in updated queue
// log to rpt
private _logParams = [
["filedAtBase", [_base] call milsim_util_fnc_getNameOfBase],
["filedAtBaseDistance", _player distance _base],
["closestBase", [_nearestBase] call milsim_util_fnc_getNameOfBase],
["closestBaseDistance", _player distance _nearestBase],
["maxDistanceSetting", _maxRangeToReady],
["inQueueDuration", diag_tickTime - _timeFiled]
];
_logParams = [_player, _logParams] call milsim_util_fnc_addPlayerInfoToArray;
private _logParams = ;
_logParams = ;
[
"respawn_reinsertion",
LEVEL_INFO,
QUOTE(COMPONENT),
"PLAYER DEQUEUED AUTOMATICALLY",
_logParams
] call milsim_util_fnc_log;
[_player, [
["filedAtBase", [_base] call EFUNC(common,getNameOfBase)],
["filedAtBaseDistance", _player distance _base],
["closestBase", [_nearestBase] call EFUNC(common,getNameOfBase)],
["closestBaseDistance", _player distance _nearestBase],
["maxDistanceSetting", _maxRangeToReady],
["inQueueDuration", diag_tickTime - _timeFiled]
]] call EFUNC(common,addPlayerInfoToArray)
] call EFUNC(common,log);
// continue loop
continue
};
@@ -36,22 +39,22 @@ private _maxRangeToReady = missionNamespace getVariable ["milsim_reinsert_settin
// if player's base has changed, log to rpt
if (_base != _nearestBase) then {
private _logParams = [
["filedAtBase", [_base] call milsim_util_fnc_getNameOfBase],
["filedAtBase", [_base] call EFUNC(common,getNameOfBase)],
["filedAtBaseDistance", _player distance _base],
["closestBase", [_nearestBase] call milsim_util_fnc_getNameOfBase],
["closestBase", [_nearestBase] call EFUNC(common,getNameOfBase)],
["closestBaseDistance", _player distance _nearestBase],
["maxDistanceSetting", _maxRangeToReady],
["inQueueDuration", diag_tickTime - _timeFiled]
];
_logParams = [_player, _logParams] call milsim_util_fnc_addPlayerInfoToArray;
_logParams = [_player, _logParams] call EFUNC(common,addPlayerInfoToArray);
[
"respawn_reinsertion",
"PLAYER BASE WAS UPDATED",
_logParams
] call milsim_util_fnc_log;
};
} forEach milsim_reinsert_reinsertionQueue;
} forEach GVAR(reinsertionQueue);
// broadcast new list to all machines
milsim_reinsert_reinsertionQueue = _stillValid;
publicVariable "milsim_reinsert_reinsertionQueue";
GVAR(reinsertionQueue) = _stillValid;
publicVariable QGVAR(reinsertionQueue);

View File

@@ -10,22 +10,16 @@
{
params ["_value"];
[
QUOTE(COMPONENT),
"SETTING CHANGED",
[
[
"setting",
QGVAR(setting_allowSupplyBoxScrollWheelSpawning)
],
["newValue", _value]
]
] call EFUNC(util,log);
QGVAR(setting_allowSupplyBoxScrollWheelSpawning),
_value
] call EFUNC(common,logSettingChanged);
},
true // requires mission restart
] call CBA_fnc_addSetting;
[
LEVEL_INFO,
QUOTE(COMPONENT),
"CREATED SETTINGS",
[]
] call EFUNC(util,log);
] call EFUNC(common,log);

View File

@@ -1,5 +1,10 @@
// all text before cba include
#define SETTINGS_GROUP_NAME 17th Battalion
#define LEVEL_TRACE -1
#define LEVEL_DEBUG 0
#define LEVEL_INFO 1
#define LEVEL_WARNING 2
#define LEVEL_ERROR 3
#include "\x\cba\addons\main\script_macros_mission.hpp"

View File

@@ -6,5 +6,12 @@
#define VERSION_STR MAJOR.MINOR.PATCHLVL
#define VERSION_AR MAJOR,MINOR,PATCHLVL
// #define DEBUG_MODE -1 // TRACE
#define DEBUG_MODE 0 // DEBUG
// #define DEBUG_MODE 1 // INFO
// #define DEBUG_MODE 2 // WARNING
// #define DEBUG_MODE 3 // ERROR
// should always be last
#include "script_macros.hpp"

View File

@@ -0,0 +1,3 @@
#define COMPONENT server
#define COMPONENT_BEAUTIFIED Server
#include "../script_mod.hpp"

View File

@@ -1,11 +0,0 @@
[
"saveaar",
{
[] remoteExec["ocap_fnc_exportData", 2];
},
"admin"
] call CBA_fnc_registerChatCommand;
diag_log text "[MILSIM] (settings) OCAP chat handler registered";
nil;

View File

@@ -1,247 +0,0 @@
//---------------------
// Side Chat
//---------------------
[
"milsim_sideChat",
"CHECKBOX",
"Side Chat Text Enabled",
["17th Battalion", "Side Chat"],
false,
true,
{
params ["_value"];
diag_log format["side chat activation set to %1", _value];
}
] call CBA_fnc_addSetting;
["milsim_sideChat", false] call CBA_settings_fnc_set;
//---------------------
// Server CPS
//---------------------
[
"milsim_server_cps_enable",
"CHECKBOX",
"CPS Metrics Enabled",
["17th Battalion", "Server Metrics"],
true,
true,
{
params ["_value"];
diag_log format["server cps activation set to %1", _value];
}
] call CBA_fnc_addSetting;
["milsim_server_cps_enable", true] call CBA_settings_fnc_set;
[
"milsim_server_cps_interval",
"TIME",
"Metrics Interval",
["17th Battalion", "Server Metrics"],
[60,300,120],
true,
{
if (!isServer) exitWith {};
params ["_value"];
diag_log format["server cps interval set to %1", _value];
_cpsPFH = missionNamespace getVariable ["milsim_server_cps_handler", ObjNull];
if (!isNull _cpsPFH) then {
_cpsPFH call CBA_fnc_deletePerFrameHandlerObject;
};
_playerCpsPFH = missionNamespace getVariable ["milsim_player_cps_handler", ObjNull];
if (!isNull _playerCpsPFH) then {
_playerCpsPFH call CBA_fnc_deletePerFrameHandlerObject;
};
[] call milsim_fnc_addServerStatsPFH;
}
] call CBA_fnc_addSetting;
//---------------------
// Client CPS
//---------------------
[
"milsim_client_cps_enable",
"CHECKBOX",
"CPS Metrics Enabled",
["17th Battalion", "Client Metrics"],
true,
true,
{
params ["_value"];
diag_log format["client cps activation set to %1", _value];
}
] call CBA_fnc_addSetting;
["milsim_client_cps_enable", true] call CBA_settings_fnc_set;
[
"milsim_client_cps_interval",
"TIME",
"CPS Metrics Interval",
["17th Battalion", "Client Metrics"],
[60,300,120],
true,
{
if (!hasInterface) exitWith {};
params ["_value"];
diag_log format["client cps interval set to %1", _value];
_cpsPFH = player getVariable ["milsim_client_cps_handler", ObjNull];
if (!isNull _cpsPFH) then {
_cpsPFH call CBA_fnc_deletePerFrameHandlerObject;
};
[] call milsim_fnc_addClientStatsPFH;
}
] call CBA_fnc_addSetting;
//---------------------
// Medical Overlay
//---------------------
[
"milsim_client_medState3D_enabled", // variable
"CHECKBOX", // type
["Enable 3D Triage Card State", "Draws a colored dot over units within 10m indicating current ACE Triage State"], // title
["17th Battalion", "Medical"], // category
true // default value
] call CBA_fnc_addSetting;
[
"milsim_client_medState3D_drawRange", // variable
"LIST", // type
["Range To Draw Icons", "Determines range at which dots are visible"], // title
["17th Battalion", "Medical"], // category
[[2, 4, 6, 8, 10], ["2", "4", "6", "8", "10"], 4] // option values, option labels, default index
] call CBA_fnc_addSetting;
//---------------------
// Respawn Settings
[
"milsim_reinsert_setting_reinsertion_enabled", // variable
"CHECKBOX", // type
["Enabled", "Whether or not players can file for reinsert and pilots can check the reinsert queue"], // title
["17th Battalion", "Re-insert Queue"], // category
true, // default value
true, // global setting
{
params ["_value"];
[
"respawn_reinsertion",
"SETTING CHANGED",
[
[
"setting",
"milsim_reinsert_setting_reinsertion_enabled"
],
["newValue", _value]
]
] call milsim_util_fnc_log;
}
] call CBA_fnc_addSetting;
[
"milsim_reinsert_setting_reinsertion_maxRangeToReady", // variable
"SLIDER", // type
["Max Request Filing Range", "Maximum distance from a respawn point a player can be to ready up"], // title
["17th Battalion", "Re-insert Queue"], // category
[0, 1000, 400, 0, false], // [_min, _max, _default, _trailingDecimals, _isPercentage]
true, // global setting
{
params ["_value"];
[
"respawn_reinsertion",
"SETTING CHANGED",
[
[
"setting",
"milsim_reinsert_setting_reinsertion_maxRangeToReady"
],
["newValue", _value]
]
] call milsim_util_fnc_log;
}
] call CBA_fnc_addSetting;
[
"milsim_reinsert_setting_reinsertion_pilotForcedCheckEnabled", // variable
"CHECKBOX", // type
["Enabled", "Whether or not pilots are forced to view the contents of the reinsertion queue per interval"], // title
["17th Battalion", "Re-insert Queue"], // category
true, // default value
true, // global setting
{
params ["_value"];
[
"respawn_reinsertion",
"SETTING CHANGED",
[
[
"setting",
"milsim_reinsert_setting_reinsertion_pilotForcedCheckEnabled"
],
["newValue", _value]
]
] call milsim_util_fnc_log;
}
] call CBA_fnc_addSetting;
[
"milsim_reinsert_setting_reinsertion_pilotForcedCheckInterval", // variable
"TIME", // type
["Pilot Forced Check Interval", "Pilots will be force shown the queue if they haven't checked it in X seconds"], // title
["17th Battalion", "Re-insert Queue"], // category
[60*5, 60*30, 60*10], // [_min, _max, _default]
true,
{
params ["_value"];
[
"respawn_reinsertion",
"SETTING CHANGED",
[
[
"setting",
"milsim_reinsert_setting_reinsertion_pilotForcedCheckInterval"
],
["newValue", _value]
]
] call milsim_util_fnc_log;
}
] call CBA_fnc_addSetting;
[
"milsim_reinsert_setting_reinsertion_max_wait", // variable
"TIME", // type
["Max Wait Threshold", "How long should at least one person be waiting before prompting a global notification."], // title
["17th Battalion", "Re-insert Queue"], // category
[60*5, 60*30, 60*20], // [_min, _max, _default]
true,
{
params ["_value"];
[
"respawn_reinsertion",
"SETTING CHANGED",
[
[
"setting",
"milsim_reinsert_setting_reinsertion_max_wait"
],
["newValue", _value]
]
] call milsim_util_fnc_log;
}
] call CBA_fnc_addSetting;
diag_log text "[MILSIM] (settings) Custom CBA settings initialized";
nil;

View File

@@ -1,19 +0,0 @@
enableSaving[false, false];
enableRadio false;
enableSentences false;
missionNamespace setVariable ["ACE_maxWeightDrag", 2400];
missionNamespace setVariable ["ACE_maxWeightCarry", 1800];
if(isClass(configfile >> "CfgPatches" >> "rhs_main")) then {
rhs_vehicleRadioChatter = 0;
};
waitUntil {time > 0};
enableEnvironment[false, true];
diag_log text "[MILSIM] (settings) defaults set";
nil;

View File

@@ -1,3 +0,0 @@
#define COMPONENT util
#define COMPONENT_BEAUTIFIED Utilities
#include "../script_mod.hpp"