big CBA rework & improvements #19
23
README.md
23
README.md
@@ -1,22 +1,27 @@
|
|||||||
# Installation Instructions
|
# Installation Instructions
|
||||||
|
|
||||||
Once your mission has been created and saved in the Arma 3 Eden Editor, download the latest mission template zip and copy its contents to the folder where your mission file lives.
|
The only file which should be pre-existing in your mission folder is `mission.sqm`, once freshly saved from Arma 3's EDEN Editor.
|
||||||
|
|
||||||
The only file which should be pre-existing in your mission folder is `mission.sqm`
|
Download the latest mission template zip from the [latest release](https://17th-gs.iceberg-gaming.com:5443/hizumi/MissionTemplate/releases/latest) and copy its contents to the folder where your mission file lives.
|
||||||
|
|
||||||
Once copied, the final structure should appear similar to the following:
|
Once copied, the final structure should appear similar to the following:
|
||||||
```markdown
|
```markdown
|
||||||
├── functions/
|
├── aaFrameworkUtils/
|
||||||
|
├── defines/
|
||||||
|
├── framework/
|
||||||
├── images/
|
├── images/
|
||||||
├── scripts/
|
├── scripts/
|
||||||
├── sounds/
|
├── sounds/
|
||||||
├── textures/
|
├── textures/
|
||||||
|
├── CHANGELOG.md
|
||||||
├── description.ext
|
├── description.ext
|
||||||
|
├── mission_settings.hpp
|
||||||
├── mission.jpg
|
├── mission.jpg
|
||||||
├── mission.sqm
|
├── mission.sqm
|
||||||
├── mission_settings.hpp
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you're building a mission for use in an op, please delete "aaFrameworkUtils" and "framework\x". These are for the purposes of development and add size bloat to the mission download when players connect to your mission.
|
||||||
|
|
||||||
After the requisite configuration file edits have been made, your mission is ready to be packed into a pbo for deployment.
|
After the requisite configuration file edits have been made, your mission is ready to be packed into a pbo for deployment.
|
||||||
|
|
||||||
# Files
|
# Files
|
||||||
@@ -56,4 +61,12 @@ This directory is for organizational purposes for any custom scripts you wish to
|
|||||||
|
|
||||||
## textures/
|
## textures/
|
||||||
|
|
||||||
This directory is for organizational purposes for textures files used by mission scripts
|
This directory is for organizational purposes for textures files used by mission scripts.
|
||||||
|
|
||||||
|
## DEV NOTES
|
||||||
|
|
||||||
|
All modules are broken apart as such in /framework. Client and server inits are managed in /framework/init.
|
||||||
|
|
||||||
|
Pay attention to framework/script_mod.hpp prior to deployment of releases, as the debug settings within will determine what is logged during prod missions.
|
||||||
|
|
||||||
|
CfgFunctions is sensitive to the folder/script_component.hpp of each module.
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
#define RRC_CALLSIGN TIGER
|
#define RRC_CALLSIGN TIGER
|
||||||
#define MEDIC_CALLSIGN LIFELINE
|
#define MEDIC_CALLSIGN LIFELINE
|
||||||
#define ALPHA_CALLSIGN BLACKJACK
|
#define ALPHA_CALLSIGN BLACKJACK
|
||||||
#define ECHO_CALLSIGN ZOOMER
|
#define ECHO_CALLSIGN FIREBRAND
|
||||||
#define WPN_CALLSIGN BLACKFOOT
|
#define WPN_CALLSIGN BLACKFOOT
|
||||||
|
|
||||||
// Define the frequencies for the Battalion
|
// Define the frequencies for the Battalion
|
||||||
@@ -229,8 +229,8 @@ class BattalionInfo {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class Attack {
|
class Armor {
|
||||||
callsign = CALLSIGN_ELEMENT(ECHO_CALLSIGN, ATTACK);
|
callsign = CALLSIGN_ELEMENT(ECHO_CALLSIGN, ARMOR);
|
||||||
textColor = LVL4_TEXT_COLOR;
|
textColor = LVL4_TEXT_COLOR;
|
||||||
frequencies[] = {
|
frequencies[] = {
|
||||||
{"Contact", {}, {FREQ_ECHO_GROUND, FREQ_ECHO_FLIGHT_CAS}},
|
{"Contact", {}, {FREQ_ECHO_GROUND, FREQ_ECHO_FLIGHT_CAS}},
|
||||||
|
|||||||
44
defines/SignalColors.hpp
Normal file
44
defines/SignalColors.hpp
Normal 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"};
|
||||||
|
};
|
||||||
|
};
|
||||||
@@ -17,11 +17,13 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "mission_settings.hpp"
|
#include "mission_settings.hpp"
|
||||||
|
#include "framework\script_mod.hpp"
|
||||||
#include "defines\ApprovedAssets.hpp"
|
#include "defines\ApprovedAssets.hpp"
|
||||||
#include "defines\BattalionInfo.hpp"
|
#include "defines\BattalionInfo.hpp"
|
||||||
#include "defines\DisallowedEquipment.hpp"
|
#include "defines\DisallowedEquipment.hpp"
|
||||||
#include "defines\SupplyCrates.hpp"
|
#include "defines\SupplyCrates.hpp"
|
||||||
#include "defines\VehicleFlags.hpp"
|
#include "defines\VehicleFlags.hpp"
|
||||||
|
#include "defines\SignalColors.hpp"
|
||||||
|
|
||||||
//-------------------------------------------MISSION INFO--------------------------------------------------------------------
|
//-------------------------------------------MISSION INFO--------------------------------------------------------------------
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -92,10 +94,9 @@ class Params
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class cfgFunctions
|
// CfgFunctions
|
||||||
{
|
#include "framework\CfgFunctions.hpp"
|
||||||
#include "functions\CfgFunctions.hpp"
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CfgDebriefingSections {
|
class CfgDebriefingSections {
|
||||||
|
|||||||
172
framework/CfgFunctions.hpp
Normal file
172
framework/CfgFunctions.hpp
Normal file
@@ -0,0 +1,172 @@
|
|||||||
|
#include "script_mod.hpp"
|
||||||
|
|
||||||
|
class CfgFunctions {
|
||||||
|
|
||||||
|
class DOUBLES(PREFIX,init) {
|
||||||
|
class functions {
|
||||||
|
file = "framework\init\functions";
|
||||||
|
class initServer { postInit = 1;};
|
||||||
|
class initClient { postInit = 1;};
|
||||||
|
class setDefaults { postInit = 1; };
|
||||||
|
class addAARChatHandler { postInit = 1; };
|
||||||
|
class addRespawnChatHandler { postInit = 1; };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class PREFIX {
|
||||||
|
class ambience {
|
||||||
|
file = "framework\ambience";
|
||||||
|
class flakInitVehicle {};
|
||||||
|
class flakEH {};
|
||||||
|
};
|
||||||
|
|
||||||
|
class map {
|
||||||
|
file = "framework\map";
|
||||||
|
class initMapCopy { postInit = 1; };
|
||||||
|
class copyMapFromPlayer {}; //needs refactor
|
||||||
|
class getPlayerMapMarkers {}; //needs refactor
|
||||||
|
class loadMapMarkers {}; //needs refactor
|
||||||
|
class mapMarkerToString {}; //needs refactor
|
||||||
|
class stringToMapMarker {}; //needs refactor
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
class DOUBLES(PREFIX,client) {
|
||||||
|
class functions {
|
||||||
|
file = "framework\client\functions";
|
||||||
|
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 {};
|
||||||
|
class addPlayerInfoToArray {};
|
||||||
|
class getApprovedAssetsCfg {};
|
||||||
|
class getBattalionCfg {};
|
||||||
|
class getNameOfBase {};
|
||||||
|
class getNearestBase {};
|
||||||
|
class log {};
|
||||||
|
class checkPlayerInventory {};
|
||||||
|
class logSettingChanged {};
|
||||||
|
class padString {};
|
||||||
|
class recurseSubclasses {};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
class DOUBLES(PREFIX,fbcb2_assets) {
|
||||||
|
class functions {
|
||||||
|
file = "framework\fbcb2_assets\functions";
|
||||||
|
class addCBASettings {preInit=1;};
|
||||||
|
class initServer {};
|
||||||
|
class initClient {};
|
||||||
|
class getCallsignFromClassname {};
|
||||||
|
class getCurrentAssetsByBase {};
|
||||||
|
class getInventory {};
|
||||||
|
class getMagsForWeapon {};
|
||||||
|
class getStartingAndCurrentAssets {};
|
||||||
|
class getStartingAssetsByBase {};
|
||||||
|
class getVehicleData {};
|
||||||
|
class getWeaponry {};
|
||||||
|
class hintAllApprovedAssets {};
|
||||||
|
class isAssetInRangeOfBase {};
|
||||||
|
class removeAssetDiaryRecords {};
|
||||||
|
class removeMarkersOnMap {};
|
||||||
|
class showMarkersOnMap {};
|
||||||
|
class updateAssetDiary {};
|
||||||
|
class updateAssetsByBase {};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
class DOUBLES(PREFIX,fbcb2_main) {
|
||||||
|
class functions {
|
||||||
|
file = "framework\fbcb2_main\functions";
|
||||||
|
class initClient {};
|
||||||
|
class addEnvironmentRecord {};
|
||||||
|
class addFrequenciesRecord {};
|
||||||
|
class addSignalColorsRecord {};
|
||||||
|
};
|
||||||
|
class util {
|
||||||
|
file = "framework\fbcb2_main\util";
|
||||||
|
class createOrUpdateDiaryRecord {};
|
||||||
|
class formatRadioElementForDiary {};
|
||||||
|
class generateElementFrequencyRecordText {};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
class DOUBLES(PREFIX,performance) {
|
||||||
|
class functions {
|
||||||
|
file = "framework\performance\functions";
|
||||||
|
class addCBASettings {preInit=1;};
|
||||||
|
class addDNI_PlayerFPS { postInit = 1; };
|
||||||
|
|
||||||
|
// PFHs managed in addCBASettings onChange code
|
||||||
|
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 {};
|
||||||
|
class addToQueue {};
|
||||||
|
class globalShowQueue {};
|
||||||
|
class removeFromQueue {};
|
||||||
|
class returnReinsertQueueNotification {};
|
||||||
|
class validateQueue {};
|
||||||
|
};
|
||||||
|
class client {
|
||||||
|
file = "framework\reinsert\client";
|
||||||
|
class initClient {};
|
||||||
|
class addAceSelfActions {};
|
||||||
|
class addCheckQueueSelfAction {};
|
||||||
|
class requestShowQueue {};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
class DOUBLES(PREFIX,resupply) {
|
||||||
|
class functions {
|
||||||
|
file = "framework\resupply\functions";
|
||||||
|
class addCBASettings {preInit=1;};
|
||||||
|
class initClient {};
|
||||||
|
class createBox {};
|
||||||
|
class getSupplyCratesCfg {};
|
||||||
|
class addArsenalObjectSpawnBoxActions {};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
class DOUBLES(PREFIX,triageIcons) {
|
||||||
|
class functions {
|
||||||
|
file = "framework\triageIcons\functions";
|
||||||
|
class addCBASettings {preInit=1;};
|
||||||
|
class initClient {};
|
||||||
|
class addDrawIconsPFH {};
|
||||||
|
class addGetEntitiesPFH {};
|
||||||
|
class updateColors {};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
class DOUBLES(PREFIX,vehicleFlags) {
|
||||||
|
class functions {
|
||||||
|
file = "framework\vehicleFlags\functions";
|
||||||
|
class initClient {};
|
||||||
|
class getActionsFlagCategories {};
|
||||||
|
class getVehicleFlagsCfg {};
|
||||||
|
class isClassExcluded {};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
@@ -1,12 +1,14 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
if ( !hasInterface ) exitWith {};
|
if ( !hasInterface ) exitWith {};
|
||||||
|
|
||||||
[
|
[
|
||||||
"17th Battalion",
|
QUOTE(MODULE_CATEGORY_NAME),
|
||||||
"Create Resupply Box",
|
"Create Resupply Box",
|
||||||
{
|
{
|
||||||
params [["_pos", [0,0,0], [[]], 3], ["_target", objNull, [objNull]]];
|
params [["_pos", [0,0,0], [[]], 3], ["_target", objNull, [objNull]]];
|
||||||
// get parent definition
|
// get parent definition
|
||||||
private _supplyCratesCfg = call milsim_resupply_fnc_getSupplyCratesCfg;
|
private _supplyCratesCfg = call EFUNC(resupply,getSupplyCratesCfg);
|
||||||
// get the subclass names
|
// get the subclass names
|
||||||
private _boxTypesAvailable = _supplyCratesCfg call BIS_fnc_getCfgSubClasses;
|
private _boxTypesAvailable = _supplyCratesCfg call BIS_fnc_getCfgSubClasses;
|
||||||
|
|
||||||
@@ -36,11 +38,17 @@ if ( !hasInterface ) exitWith {};
|
|||||||
_args params ["_pos", "_target", "_keysSorted"];
|
_args params ["_pos", "_target", "_keysSorted"];
|
||||||
|
|
||||||
|
|
||||||
private _box = [_target, _typeOptionSelected, _pos] call milsim_resupply_fnc_createBox;
|
private _box = [_target, _typeOptionSelected, _pos] call EFUNC(resupply,createBox);
|
||||||
if (isNull _box) exitWith {
|
if (isNull _box) exitWith {
|
||||||
["Resupply Box", "WARNING: Failed to locate or create box!"] call BIS_fnc_curatorHint;
|
["Resupply Box", "WARNING: Failed to locate or create box!"] call BIS_fnc_curatorHint;
|
||||||
};
|
};
|
||||||
["Resupply Box", format["Created box from class %1", _typeOptionSelected]] call BIS_fnc_curatorHint;
|
[
|
||||||
|
"Resupply Box",
|
||||||
|
format[
|
||||||
|
"Created %1",
|
||||||
|
getText((call EFUNC(resupply,getSupplyCratesCfg)) >> _typeOptionSelected >> "displayName")
|
||||||
|
]
|
||||||
|
] call BIS_fnc_curatorHint;
|
||||||
},
|
},
|
||||||
{},
|
{},
|
||||||
[_pos, _target]
|
[_pos, _target]
|
||||||
@@ -50,7 +58,7 @@ if ( !hasInterface ) exitWith {};
|
|||||||
|
|
||||||
|
|
||||||
[
|
[
|
||||||
"17th Battalion",
|
QUOTE(MODULE_CATEGORY_NAME),
|
||||||
"Grounds Cleanup",
|
"Grounds Cleanup",
|
||||||
{
|
{
|
||||||
params [["_pos", [0,0,0], [[]], 3], ["_target", objNull, [objNull]]];
|
params [["_pos", [0,0,0], [[]], 3], ["_target", objNull, [objNull]]];
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
[
|
||||||
|
LEVEL_INFO,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
"Initializing empty group deletion PFH",
|
||||||
|
[]
|
||||||
|
] call EFUNC(common,log);
|
||||||
|
|
||||||
|
_emptyGroupPFH = [
|
||||||
|
{
|
||||||
|
{
|
||||||
|
if (local _x) then {
|
||||||
|
if ((count units _x) == 0) then {
|
||||||
|
deleteGroup _x;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach allGroups;
|
||||||
|
},
|
||||||
|
300,
|
||||||
|
[],
|
||||||
|
{
|
||||||
|
[
|
||||||
|
LEVEL_INFO,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
"Empty group deletion PFH loaded",
|
||||||
|
[]
|
||||||
|
] call EFUNC(common,log);
|
||||||
|
},
|
||||||
|
{ [
|
||||||
|
LEVEL_INFO,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
"Empty group deletion PFH unloaded",
|
||||||
|
[]
|
||||||
|
] call EFUNC(common,log);
|
||||||
|
},
|
||||||
|
{ true },
|
||||||
|
{ false },
|
||||||
|
[]
|
||||||
|
] call CBA_fnc_createPerFrameHandlerObject;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
if ( !hasInterface ) exitWith {};
|
if ( !hasInterface ) exitWith {};
|
||||||
|
|
||||||
player addEventHandler["Respawn",
|
player addEventHandler["Respawn",
|
||||||
@@ -6,10 +8,11 @@ player addEventHandler["Respawn",
|
|||||||
private _killer = _corpse getVariable ["ace_medical_causeOfDeath", "#scripted"];
|
private _killer = _corpse getVariable ["ace_medical_causeOfDeath", "#scripted"];
|
||||||
if (_killer == "respawn_button") then {
|
if (_killer == "respawn_button") then {
|
||||||
[
|
[
|
||||||
"client",
|
LEVEL_INFO,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
"RESPAWNED WHILE UNCONSCIOUS",
|
"RESPAWNED WHILE UNCONSCIOUS",
|
||||||
[_unit] call milsim_fnc_addPlayerInfoToArray
|
[_unit] call EFUNC(common,addPlayerInfoToArray)
|
||||||
] remoteExec ["milsim_fnc_log", 2];
|
] remoteExec [QEFUNC(common,log), 2];
|
||||||
// format["%1 was unconscious then clicked the respawn button", name _unit] remoteExec["systemChat", 0];
|
// format["%1 was unconscious then clicked the respawn button", name _unit] remoteExec["systemChat", 0];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -43,11 +46,11 @@ addMissionEventHandler ["HandleChatMessage",
|
|||||||
|
|
||||||
|
|
||||||
["ace_arsenal_displayClosed", {
|
["ace_arsenal_displayClosed", {
|
||||||
[player] remoteExec ["milsim_fnc_logPlayerInventory", 2];
|
[player] remoteExec [QEFUNC(common,checkPlayerInventory), 2];
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
[missionNamespace, "arsenalClosed", {
|
[missionNamespace, "arsenalClosed", {
|
||||||
[player] remoteExec ["milsim_fnc_logPlayerInventory", 2];
|
[player] remoteExec [QEFUNC(common,checkPlayerInventory), 2];
|
||||||
}] call BIS_fnc_addScriptedEventHandler;
|
}] call BIS_fnc_addScriptedEventHandler;
|
||||||
|
|
||||||
diag_log text "[MILSIM] (client) event handlers bound";
|
diag_log text "[MILSIM] (client) event handlers bound";
|
||||||
@@ -56,7 +56,7 @@ _patchTire =
|
|||||||
"Patching"
|
"Patching"
|
||||||
] call ace_common_fnc_progressBar
|
] call ace_common_fnc_progressBar
|
||||||
},
|
},
|
||||||
{ ( alive _target ) && ( [_player, "ToolKit"] call ace_common_fnc_hasItem ) && ( getDammage _target > 0.2 ) && ( _target getVariable["milsim_ace_repair_wheel_canPatch", true] ) }
|
{ ( alive _target ) && ( [_player, "ToolKit"] call ace_common_fnc_hasItem ) && ( damage _target > 0.2 ) && ( _target getVariable["milsim_ace_repair_wheel_canPatch", true] ) }
|
||||||
] call ace_interact_menu_fnc_createAction;
|
] call ace_interact_menu_fnc_createAction;
|
||||||
|
|
||||||
["ACE_Wheel", 0, ["ACE_MainActions"], _patchTire, true] call ace_interact_menu_fnc_addActionToClass;
|
["ACE_Wheel", 0, ["ACE_MainActions"], _patchTire, true] call ace_interact_menu_fnc_addActionToClass;
|
||||||
3
framework/client/script_component.hpp
Normal file
3
framework/client/script_component.hpp
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#define COMPONENT client
|
||||||
|
#define COMPONENT_BEAUTIFIED Client
|
||||||
|
#include "../script_mod.hpp"
|
||||||
27
framework/common/functions/fn_addCBASettings.sqf
Normal file
27
framework/common/functions/fn_addCBASettings.sqf
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#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;
|
||||||
|
|
||||||
|
diag_log text "[MILSIM] (settings) Custom CBA settings initialized";
|
||||||
|
|
||||||
|
nil;
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
params [["_playerObj", objNull], ["_arrayToModify", [], [[]]]];
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
params [["_playerObj", objNull, [nil, objNull]], ["_arrayToModify", [], [[]]]];
|
||||||
|
|
||||||
if (isNull _playerObj) exitWith {_arrayToModify};
|
if (isNull _playerObj) exitWith {_arrayToModify};
|
||||||
|
|
||||||
@@ -8,7 +10,7 @@ if (isNull _playerObj) exitWith {_arrayToModify};
|
|||||||
["playerName", name _playerObj],
|
["playerName", name _playerObj],
|
||||||
["playerUID", getPlayerUID _playerObj],
|
["playerUID", getPlayerUID _playerObj],
|
||||||
["playerGroup", groupId (group _playerObj)],
|
["playerGroup", groupId (group _playerObj)],
|
||||||
["playerNetID", [_playerObj] call BIS_fnc_netId]
|
["playerNetID", _playerObj call BIS_fnc_netId]
|
||||||
];
|
];
|
||||||
|
|
||||||
_arrayToModify;
|
_arrayToModify;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Function: milsim_fnc_logPlayerInventory
|
Function: milsim_common_fnc_checkPlayerInventory
|
||||||
|
|
||||||
Description:
|
Description:
|
||||||
Checks a player's inventory for non-compliant items and logs results to all machines.
|
Checks a player's inventory for non-compliant items and logs results to all machines.
|
||||||
@@ -13,16 +13,19 @@
|
|||||||
<ARRAY> - Array of strings to be logged.
|
<ARRAY> - Array of strings to be logged.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
params [
|
params [
|
||||||
["_player", objNull, [objNull]]
|
["_player", objNull, [objNull]]
|
||||||
];
|
];
|
||||||
|
|
||||||
if (!isPlayer _player) exitWith {
|
if (!isPlayer _player) exitWith {
|
||||||
[
|
[
|
||||||
"logPlayerInventory",
|
LEVEL_ERROR,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
"PARAM PLAYER IS NOT A PLAYER",
|
"PARAM PLAYER IS NOT A PLAYER",
|
||||||
[["player", _player]]
|
[["player", _player]]
|
||||||
] call milsim_fnc_log;
|
] call EFUNC(common,log);
|
||||||
};
|
};
|
||||||
|
|
||||||
// testing
|
// testing
|
||||||
@@ -53,10 +56,11 @@ _playerItems pushBack (uniform _player);
|
|||||||
|
|
||||||
|
|
||||||
[
|
[
|
||||||
"logPlayerInventory",
|
LEVEL_DEBUG,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
"CHECKING PLAYER INVENTORY",
|
"CHECKING PLAYER INVENTORY",
|
||||||
[_player] call milsim_fnc_addPlayerInfoToArray
|
[_player] call EFUNC(common,addPlayerInfoToArray)
|
||||||
] call milsim_fnc_log;
|
] call EFUNC(common,log);
|
||||||
|
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
// HARDCODED DISALLOWED ITEMS - see functions/definitions/DisallowedEquipment.hpp
|
// 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
|
// Only log compliance message if no non-compliant items were found
|
||||||
if (count _allFoundItemsSoFar isEqualTo 0) exitWith {
|
if (count _allFoundItemsSoFar isEqualTo 0) exitWith {
|
||||||
[
|
[
|
||||||
"logPlayerInventory",
|
LEVEL_INFO,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
"PLAYER INVENTORY IS COMPLIANT",
|
"PLAYER INVENTORY IS COMPLIANT",
|
||||||
[_player] call milsim_fnc_addPlayerInfoToArray
|
[_player] call EFUNC(common,addPlayerInfoToArray)
|
||||||
] call milsim_fnc_log;
|
] call EFUNC(common,log);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Log all non-compliant items
|
// Log all non-compliant items
|
||||||
@@ -132,13 +137,14 @@ if (count _allFoundItemsSoFar isEqualTo 0) exitWith {
|
|||||||
private _itemConfig = _itemClassName call CBA_fnc_getItemConfig;
|
private _itemConfig = _itemClassName call CBA_fnc_getItemConfig;
|
||||||
// Log to RPT
|
// Log to RPT
|
||||||
[
|
[
|
||||||
"logPlayerInventory",
|
LEVEL_WARNING,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
"NON-COMPLIANT ITEM",
|
"NON-COMPLIANT ITEM",
|
||||||
[_player, [
|
[_player, [
|
||||||
["category", _categoryLabel],
|
["category", _categoryLabel],
|
||||||
["className", _itemClassName],
|
["className", _itemClassName],
|
||||||
["displayName", [_itemConfig] call BIS_fnc_displayName]
|
["displayName", [_itemConfig] call BIS_fnc_displayName]
|
||||||
]] call milsim_fnc_addPlayerInfoToArray
|
]] call EFUNC(common,addPlayerInfoToArray)
|
||||||
] call milsim_fnc_log;
|
] call EFUNC(common,log);
|
||||||
} forEach _items;
|
} forEach _items;
|
||||||
} forEach _foundItemsKeyValue;
|
} forEach _foundItemsKeyValue;
|
||||||
15
framework/common/functions/fn_getApprovedAssetsCfg.sqf
Normal file
15
framework/common/functions/fn_getApprovedAssetsCfg.sqf
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#include "../script_component.hpp"
|
||||||
|
|
||||||
|
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(common,log);
|
||||||
|
configNull;
|
||||||
|
};
|
||||||
|
|
||||||
|
_approvedAssetsCfg;
|
||||||
15
framework/common/functions/fn_getBattalionCfg.sqf
Normal file
15
framework/common/functions/fn_getBattalionCfg.sqf
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#include "../script_component.hpp"
|
||||||
|
|
||||||
|
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(common,log);
|
||||||
|
configNull;
|
||||||
|
};
|
||||||
|
|
||||||
|
_battalionInfoCfg;
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
params [["_base", objNull, [objNull]]];
|
params [["_base", objNull, [objNull]]];
|
||||||
if (_base == objNull) exitWith {""};
|
if (_base == objNull) exitWith {""};
|
||||||
|
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
params [["_object", objNull, [objNull]]];
|
params [["_object", objNull, [objNull]]];
|
||||||
if (isNull _object) exitWith {objNull};
|
if (isNull _object) exitWith {objNull};
|
||||||
|
|
||||||
33
framework/common/functions/fn_log.sqf
Normal file
33
framework/common/functions/fn_log.sqf
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
Function: milsim_common_fnc_log
|
||||||
|
|
||||||
|
Description:
|
||||||
|
Used to log messages to the server RPT file.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
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 < DEBUG_MODE) exitWith {};
|
||||||
|
|
||||||
|
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 ["[%1] [%2] [%3] [%4] :: %5", QUOTE(PREFIX), _component, _fnc_scriptNameParent, _message, _json];
|
||||||
|
|
||||||
|
diag_log text _log;
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
[
|
[
|
||||||
"init",
|
LEVEL_INFO,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
"MISSION INFO",
|
"MISSION INFO",
|
||||||
[
|
[
|
||||||
["serverName", serverName],
|
["serverName", serverName],
|
||||||
@@ -20,4 +23,4 @@
|
|||||||
["LOGIC", playableSlotsNumber sideLogic] // 5 is LOGIC side
|
["LOGIC", playableSlotsNumber sideLogic] // 5 is LOGIC side
|
||||||
]]
|
]]
|
||||||
]
|
]
|
||||||
] call milsim_fnc_log;
|
] call FUNC(log);
|
||||||
16
framework/common/functions/fn_logSettingChanged.sqf
Normal file
16
framework/common/functions/fn_logSettingChanged.sqf
Normal 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);
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
params [
|
params [
|
||||||
["_text", "", [""]],
|
["_text", "", [""]],
|
||||||
["_padSide", "left", ["left", "right"]],
|
["_padSide", "left", ["left", "right"]],
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
params [
|
params [
|
||||||
["_cfg", configNull, [configNull]],
|
["_cfg", configNull, [configNull]],
|
||||||
["_code", {}, [{}]]
|
["_code", {}, [{}]]
|
||||||
3
framework/common/script_component.hpp
Normal file
3
framework/common/script_component.hpp
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#define COMPONENT common
|
||||||
|
#define COMPONENT_BEAUTIFIED Common
|
||||||
|
#include "../script_mod.hpp"
|
||||||
27
framework/fbcb2_assets/functions/fn_addCBASettings.sqf
Normal file
27
framework/fbcb2_assets/functions/fn_addCBASettings.sqf
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
//---------------------
|
||||||
|
// Asset Diary and Markers Settings
|
||||||
|
|
||||||
|
[
|
||||||
|
QGVAR(setting_detectionRangeFromBase), // variable
|
||||||
|
"SLIDER", // type
|
||||||
|
["Detection Range From Base", "The range from a base that assets will be detected"], // title
|
||||||
|
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||||
|
[0, 1000, 750, 0, false], // [_min, _max, _default, _trailingDecimals, _isPercentage]
|
||||||
|
true, // global setting
|
||||||
|
{
|
||||||
|
params ["_value"];
|
||||||
|
[
|
||||||
|
QGVAR(setting_detectionRangeFromBase),
|
||||||
|
_value
|
||||||
|
] call EFUNC(common,logSettingChanged);
|
||||||
|
}
|
||||||
|
] call CBA_fnc_addSetting;
|
||||||
|
|
||||||
|
[
|
||||||
|
LEVEL_INFO,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
"CREATED SETTINGS",
|
||||||
|
[]
|
||||||
|
] call EFUNC(common,log);
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
params [
|
||||||
|
["_className", "", [""]]
|
||||||
|
];
|
||||||
|
|
||||||
|
// Get the approved assets config
|
||||||
|
private _approvedAssetsCfg = call EFUNC(common,getApprovedAssetsCfg);
|
||||||
|
if (isNull _approvedAssetsCfg) exitWith {""};
|
||||||
|
|
||||||
|
// Get the asset definition
|
||||||
|
private _assetDef = (_approvedAssetsCfg >> _className);
|
||||||
|
if (isClass _assetDef) exitWith {getText(_assetDef >> "callsign")};
|
||||||
|
|
||||||
|
"";
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
#include "../script_component.hpp"
|
||||||
|
|
||||||
|
// return each base with its assets
|
||||||
|
GVARMAIN(baseObjects) apply {
|
||||||
|
[_x, _x getVariable [QGVAR(assetsAtThisBase), []]]
|
||||||
|
};
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
// get all starting assets at each base and combine to array
|
||||||
|
private _startingAssetsByBase = call FUNC(getStartingAssetsByBase);
|
||||||
|
private _startingAssets = [];
|
||||||
|
{
|
||||||
|
_startingAssets append (_x#1);
|
||||||
|
} forEach _startingAssetsByBase;
|
||||||
|
|
||||||
|
// get all current assets at each base and combine to array
|
||||||
|
private _assetsByBase = call FUNC(getCurrentAssetsByBase);
|
||||||
|
private _assets = [];
|
||||||
|
{
|
||||||
|
_assets append (_x#1);
|
||||||
|
} forEach _assetsByBase;
|
||||||
|
|
||||||
|
[_startingAssets, _assets];
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
#include "../script_component.hpp"
|
||||||
|
|
||||||
|
// return each base with its assets
|
||||||
|
GVARMAIN(baseObjects) apply {
|
||||||
|
[_x, _x getVariable [QGVAR(assetsStartedAtThisBase), []]]
|
||||||
|
};
|
||||||
@@ -39,7 +39,7 @@ private _pylons = getAllPylonsInfo _vic;
|
|||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
// WRITE TITLE
|
// WRITE TITLE
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
_title pushBack format["<font size='24' shadow='1' color='#e1701a' face='PuristaBold'>%1</font>", _dispName];
|
_title pushBack format["%1", _dispName];
|
||||||
|
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
// WRITE IMAGE
|
// WRITE IMAGE
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
// get vehicles the mission started with at base locations
|
||||||
|
(call FUNC(getStartingAndCurrentAssets)) params [
|
||||||
|
"_startingAssets",
|
||||||
|
"_currentAssets"
|
||||||
|
];
|
||||||
|
|
||||||
|
// get distinct classnames to group by
|
||||||
|
private _distinctStartingAssetsClassNames = [];
|
||||||
|
{
|
||||||
|
_x params ["_netId", "_cfg"];
|
||||||
|
private _className = configName _cfg;
|
||||||
|
_distinctStartingAssetsClassNames pushBackUnique _className;
|
||||||
|
} forEach _startingAssets;
|
||||||
|
|
||||||
|
// get the approved assets config to identify callsigns
|
||||||
|
private _approvedAssetsCfg = call EFUNC(common,getApprovedAssetsCfg);
|
||||||
|
if (isNull _approvedAssetsCfg) exitWith {
|
||||||
|
[
|
||||||
|
LEVEL_ERROR,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
"No approved assets defined.",
|
||||||
|
[]
|
||||||
|
] call EFUNC(common,log);
|
||||||
|
[
|
||||||
|
"ERROR: No approved assets defined. See defines/ApprovedAssets.hpp"
|
||||||
|
] call BIS_fnc_error;
|
||||||
|
};
|
||||||
|
|
||||||
|
_text = parseText "<t size='4'>MESSAGE</t>";
|
||||||
|
_text = composeText [_text, lineBreak ];
|
||||||
|
|
||||||
|
_text = composeText [_text, parseText "<t align='left' size='2'>Asset</t><t align='right' size='2'>Available</t>", lineBreak ];
|
||||||
|
|
||||||
|
{
|
||||||
|
private _className = _x;
|
||||||
|
// only approved assets
|
||||||
|
if (!isClass (_approvedAssetsCfg >> _className)) then {continue};
|
||||||
|
|
||||||
|
private _callsign = [_className] call FUNC(getCallsignFromClassname);
|
||||||
|
|
||||||
|
private _startingAssetsOfThisType = _startingAssets select {
|
||||||
|
// select all starting assets of this type
|
||||||
|
_x params ["_netId", "_cfg"];
|
||||||
|
_className isEqualTo (configName _cfg);
|
||||||
|
};
|
||||||
|
private _currentAssetsOfThisType = _currentAssets select {
|
||||||
|
_x params ["_netId", "_cfg"];
|
||||||
|
private _object = _netId call BIS_fnc_objectFromNetId;
|
||||||
|
// objNull if deleted, then check classname and if alive
|
||||||
|
!isNull _object && {
|
||||||
|
_className isEqualTo (typeOf _object) &&
|
||||||
|
alive _object
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
(_startingAssetsOfThisType#0) params [
|
||||||
|
"_assetNetId",
|
||||||
|
"_assetCfg"
|
||||||
|
];
|
||||||
|
|
||||||
|
_assigned = count _startingAssetsOfThisType;
|
||||||
|
_available = count _currentAssetsOfThisType;
|
||||||
|
// count (getMarkerPos "respawn_west" nearEntities [ _asset, 2000] );
|
||||||
|
|
||||||
|
|
||||||
|
_image = getText(_assetCfg >> "picture");
|
||||||
|
|
||||||
|
_name = getText(_assetCfg >> "displayName") select [0, 22];
|
||||||
|
private _data = format[
|
||||||
|
"<img size='1' align='left' image='%1'/><t size='1' align='left'> %2</t><t size='1' align='right'>%3 [ %4 ]</t>",
|
||||||
|
_image,
|
||||||
|
_name,
|
||||||
|
_available,
|
||||||
|
_assigned
|
||||||
|
];
|
||||||
|
|
||||||
|
// private _data = format[
|
||||||
|
// "<img size='1' align='left' image='%1'/>
|
||||||
|
// <t size='1' align='left'> %2</t>
|
||||||
|
// <t size='1' align='middle'>%3</t>
|
||||||
|
// <t size='1' align='right'>%4</t>",
|
||||||
|
// _image,
|
||||||
|
// _name,
|
||||||
|
// _assigned,
|
||||||
|
// _available
|
||||||
|
// ];
|
||||||
|
_text = composeText[ _text, parseText _data, lineBreak ];
|
||||||
|
|
||||||
|
|
||||||
|
} foreach _distinctStartingAssetsClassNames;
|
||||||
|
|
||||||
|
hint _text;
|
||||||
28
framework/fbcb2_assets/functions/fn_initClient.sqf
Normal file
28
framework/fbcb2_assets/functions/fn_initClient.sqf
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
if (!hasInterface) exitWith {};
|
||||||
|
|
||||||
|
call FUNC(updateAssetDiary);
|
||||||
|
|
||||||
|
// once the server has published that assets have been gathered and distributed to bases (respawn modules),
|
||||||
|
// we can update the asset diary on our end using that data
|
||||||
|
[QGVAR(assetsGathered), {
|
||||||
|
[
|
||||||
|
LEVEL_DEBUG,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
"Received gathered base asset data from server",
|
||||||
|
[]
|
||||||
|
] call EFUNC(common,log);
|
||||||
|
|
||||||
|
// update the asset diary with the data we've received
|
||||||
|
FUNC(updateAssetDiary);
|
||||||
|
}] call CBA_fnc_addEventHandlerArgs;
|
||||||
|
|
||||||
|
[
|
||||||
|
LEVEL_DEBUG,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
"postInit complete",
|
||||||
|
[]
|
||||||
|
] call EFUNC(common,log);
|
||||||
|
|
||||||
|
localNamespace setVariable [QGVAR(complete), true];
|
||||||
29
framework/fbcb2_assets/functions/fn_initServer.sqf
Normal file
29
framework/fbcb2_assets/functions/fn_initServer.sqf
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
if (!isServer) exitWith {};
|
||||||
|
|
||||||
|
// init asset stores at bases
|
||||||
|
[true] call FUNC(updateAssetsByBase);
|
||||||
|
|
||||||
|
// starting 5 minutes after postInit, update asset stores every 5 minutes
|
||||||
|
[{
|
||||||
|
[
|
||||||
|
{[false] call FUNC(updateAssetsByBase);},
|
||||||
|
60*5
|
||||||
|
] call CBA_fnc_addPerFrameHandler;
|
||||||
|
}, 60*5] call CBA_fnc_waitAndExecute;
|
||||||
|
|
||||||
|
|
||||||
|
// add end mission EH
|
||||||
|
addMissionEventHandler ["MPEnded", {
|
||||||
|
// log the "current" asset counts to RPT
|
||||||
|
[false, true] call FUNC(updateAssetsByBase);
|
||||||
|
}];
|
||||||
|
|
||||||
|
|
||||||
|
[
|
||||||
|
LEVEL_DEBUG,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
"postInit complete",
|
||||||
|
[]
|
||||||
|
] call EFUNC(common,log);
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
params [["_asset", objNull, [objNull]]];
|
||||||
|
|
||||||
|
private _closestBase = [_asset] call EFUNC(common,getNearestBase);
|
||||||
|
if (isNull _closestBase) exitWith {false};
|
||||||
|
|
||||||
|
(_asset distance2D _closestBase) <= GVAR(setting_detectionRangeFromBase)
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
if (!hasInterface) exitWith {};
|
if (!hasInterface) exitWith {};
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -10,7 +12,7 @@ if (!hasInterface) exitWith {};
|
|||||||
player removeDiaryRecord [_diarySubject, _diaryRecord];
|
player removeDiaryRecord [_diarySubject, _diaryRecord];
|
||||||
} forEach _records;
|
} forEach _records;
|
||||||
} forEach [
|
} forEach [
|
||||||
milsim_fbcb2_subjectAssetsFixedWingID,
|
EGVAR(fbcb2_main,subjectAssetsFixedWingID),
|
||||||
milsim_fbcb2_subjectAssetsRotaryID,
|
EGVAR(fbcb2_main,subjectAssetsRotaryID),
|
||||||
milsim_fbcb2_subjectAssetsGroundID
|
EGVAR(fbcb2_main,subjectAssetsGroundID)
|
||||||
];
|
];
|
||||||
@@ -1,12 +1,11 @@
|
|||||||
private _baseMarkerStoreVar = "milsim_fbcb2_assets_baseMarkerStore";
|
#include "..\script_component.hpp"
|
||||||
private _assetMarkerStoreVar = "milsim_fbcb2_assets_assetMarkerStore";
|
|
||||||
|
|
||||||
private _baseMarkerStore = localNamespace getVariable [
|
private _baseMarkerStore = localNamespace getVariable [
|
||||||
_baseMarkerStoreVar,
|
QGVAR(baseMarkerStore),
|
||||||
[]
|
[]
|
||||||
];
|
];
|
||||||
private _assetMarkerStore = localNamespace getVariable [
|
private _assetMarkerStore = localNamespace getVariable [
|
||||||
_assetMarkerStoreVar,
|
QGVAR(assetMarkerStore),
|
||||||
[]
|
[]
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -16,10 +15,10 @@ private _assetMarkerStore = localNamespace getVariable [
|
|||||||
} forEach (_baseMarkerStore + _assetMarkerStore);
|
} forEach (_baseMarkerStore + _assetMarkerStore);
|
||||||
|
|
||||||
localNamespace setVariable [
|
localNamespace setVariable [
|
||||||
_baseMarkerStoreVar,
|
QGVAR(baseMarkerStore),
|
||||||
[]
|
[]
|
||||||
];
|
];
|
||||||
localNamespace setVariable [
|
localNamespace setVariable [
|
||||||
_assetMarkerStoreVar,
|
QGVAR(assetMarkerStore),
|
||||||
[]
|
[]
|
||||||
];
|
];
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
params [
|
params [
|
||||||
["_className", "", [""]],
|
["_className", "", [""]],
|
||||||
["_markerType", "hd_dot", [""]],
|
["_markerType", "hd_dot", [""]],
|
||||||
@@ -12,11 +14,11 @@ if (count _markerColor isEqualTo 0) exitWith {
|
|||||||
["No marker color provided!"] call BIS_fnc_error;
|
["No marker color provided!"] call BIS_fnc_error;
|
||||||
};
|
};
|
||||||
if (count _assetObjects isEqualTo 0) exitWith {
|
if (count _assetObjects isEqualTo 0) exitWith {
|
||||||
["No vehicles provided!"] call BIS_fnc_error;
|
["No vehicles to draw markers for!"] call BIS_fnc_error;
|
||||||
};
|
};
|
||||||
|
|
||||||
private _baseMarkerStoreVar = "milsim_fbcb2_assets_baseMarkerStore";
|
private _baseMarkerStoreVar = QGVAR(baseMarkerStore);
|
||||||
private _assetMarkerStoreVar = "milsim_fbcb2_assets_assetMarkerStore";
|
private _assetMarkerStoreVar = QGVAR(assetMarkerStore);
|
||||||
|
|
||||||
private _baseMarkerStore = localNamespace getVariable [
|
private _baseMarkerStore = localNamespace getVariable [
|
||||||
_baseMarkerStoreVar,
|
_baseMarkerStoreVar,
|
||||||
@@ -35,15 +37,15 @@ if (not (count _baseMarkerStore > 0)) then {
|
|||||||
|
|
||||||
// create a circle marker with range as the detection range of assets
|
// create a circle marker with range as the detection range of assets
|
||||||
_newMarker = createMarkerLocal [
|
_newMarker = createMarkerLocal [
|
||||||
format["milsim_fbcb2_assets_base_marker_%1", _forEachIndex + 1],
|
format["%1_%2", QGVAR(baseCircleMarker), _forEachIndex + 1],
|
||||||
getPosASL _base
|
getPosASL _base
|
||||||
];
|
];
|
||||||
_newMarker setMarkerTypeLocal "mil_dot";
|
_newMarker setMarkerTypeLocal "mil_dot";
|
||||||
_newMarker setMarkerColorLocal "ColorGreen";
|
_newMarker setMarkerColorLocal "ColorGreen";
|
||||||
_newMarker setMarkerShapeLocal "ELLIPSE";
|
_newMarker setMarkerShapeLocal "ELLIPSE";
|
||||||
_newMarker setMarkerSizeLocal [
|
_newMarker setMarkerSizeLocal [
|
||||||
milsim_fbcb2_assets_setting_detectionRangeFromBase,
|
GVAR(setting_detectionRangeFromBase),
|
||||||
milsim_fbcb2_assets_setting_detectionRangeFromBase
|
GVAR(setting_detectionRangeFromBase)
|
||||||
];
|
];
|
||||||
_newMarker setMarkerAlphaLocal 0.5;
|
_newMarker setMarkerAlphaLocal 0.5;
|
||||||
_newMarker setMarkerTextLocal str(_forEachIndex + 1);
|
_newMarker setMarkerTextLocal str(_forEachIndex + 1);
|
||||||
@@ -55,19 +57,19 @@ if (not (count _baseMarkerStore > 0)) then {
|
|||||||
|
|
||||||
// create a flag marker at base position
|
// create a flag marker at base position
|
||||||
_newMarker = createMarkerLocal [
|
_newMarker = createMarkerLocal [
|
||||||
format["milsim_fbcb2_assets_base_flag_marker_%1", _forEachIndex + 1],
|
format["%1_%2", QGVAR(baseFlagMarker), _forEachIndex + 1],
|
||||||
getPosASL _base
|
getPosASL _base
|
||||||
];
|
];
|
||||||
_newMarker setMarkerTypeLocal "mil_flag";
|
_newMarker setMarkerTypeLocal "mil_flag";
|
||||||
_newMarker setMarkerColorLocal "ColorGreen";
|
_newMarker setMarkerColorLocal "ColorGreen";
|
||||||
_newMarker setMarkerSizeLocal [0.7, 0.7];
|
_newMarker setMarkerSizeLocal [0.7, 0.7];
|
||||||
_newMarker setMarkerTextLocal ([_base] call milsim_fnc_getNameOfBase);
|
_newMarker setMarkerTextLocal ([_base] call EFUNC(common,getNameOfBase));
|
||||||
|
|
||||||
_baseMarkerStore pushBack [
|
_baseMarkerStore pushBack [
|
||||||
_base,
|
_base,
|
||||||
_newMarker
|
_newMarker
|
||||||
];
|
];
|
||||||
} forEach milsim_baseObjects;
|
} forEach GVARMAIN(baseObjects);
|
||||||
|
|
||||||
localNamespace setVariable [_baseMarkerStoreVar, _baseMarkerStore];
|
localNamespace setVariable [_baseMarkerStoreVar, _baseMarkerStore];
|
||||||
};
|
};
|
||||||
@@ -85,9 +87,12 @@ private _start = (count _assetMarkerStore) + 1;
|
|||||||
> -1
|
> -1
|
||||||
) then {continue};
|
) then {continue};
|
||||||
|
|
||||||
|
// check if the asset is within base detection range
|
||||||
|
if (not ([_asset] call FUNC(isAssetInRangeOfBase))) then {continue};
|
||||||
|
|
||||||
// create a marker for the asset
|
// create a marker for the asset
|
||||||
private _newMarker = createMarkerLocal [
|
private _newMarker = createMarkerLocal [
|
||||||
format["milsim_fbcb2_assets_marker_%1", _start],
|
format["%1_%2", QGVAR(assetMarker), _start],
|
||||||
getPosASL _asset
|
getPosASL _asset
|
||||||
];
|
];
|
||||||
_newMarker setMarkerAlphaLocal 1;
|
_newMarker setMarkerAlphaLocal 1;
|
||||||
261
framework/fbcb2_assets/functions/fn_updateAssetDiary.sqf
Normal file
261
framework/fbcb2_assets/functions/fn_updateAssetDiary.sqf
Normal file
@@ -0,0 +1,261 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
if (!hasInterface) exitWith {};
|
||||||
|
|
||||||
|
// create diary records
|
||||||
|
|
||||||
|
// remove any existing asset map markers
|
||||||
|
call FUNC(removeMarkersOnMap);
|
||||||
|
|
||||||
|
// remove existing asset records
|
||||||
|
call FUNC(removeAssetDiaryRecords);
|
||||||
|
|
||||||
|
(call FUNC(getStartingAndCurrentAssets)) params [
|
||||||
|
"_startingAssets",
|
||||||
|
"_currentAssets"
|
||||||
|
];
|
||||||
|
|
||||||
|
// get distinct vehicle class names
|
||||||
|
private _distinctVehiclesClassNames = [];
|
||||||
|
{
|
||||||
|
_x params ["_netId", "_cfg"];
|
||||||
|
private _className = configName _cfg;
|
||||||
|
_distinctVehiclesClassNames pushBackUnique _className;
|
||||||
|
} forEach _startingAssets;
|
||||||
|
|
||||||
|
|
||||||
|
// for random color cycling
|
||||||
|
private _colorSelectionIndex = 0;
|
||||||
|
private _randomColors = [
|
||||||
|
["ColorRed", "#FF0000", "Red"],
|
||||||
|
["ColorGreen", "#00FF00", "Green"],
|
||||||
|
["ColorBlue", "#0000FF", "Blue"],
|
||||||
|
["ColorYellow", "#FFFF00", "Yellow"],
|
||||||
|
["ColorWhite", "#FFFFFF", "White"]
|
||||||
|
];
|
||||||
|
|
||||||
|
// ForEach unique vehicle class name, we'll find the first and gather its info
|
||||||
|
{
|
||||||
|
private _className = _x;
|
||||||
|
private _vehicleCallsign = toUpper (
|
||||||
|
[_className] call FUNC(getCallsignFromClassname)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Get all starting assets of this type
|
||||||
|
private _startingAssetsOfThisType = _startingAssets select {
|
||||||
|
_x params ["_netId", "_cfg"];
|
||||||
|
_className isEqualTo (configName _cfg);
|
||||||
|
};
|
||||||
|
// Get all current assets of this type
|
||||||
|
private _currentAssetsOfThisType = _currentAssets select {
|
||||||
|
_x params ["_netId", "_cfg"];
|
||||||
|
private _object = _netId call BIS_fnc_objectFromNetId;
|
||||||
|
// objNull if deleted, then check classname and if alive
|
||||||
|
!isNull _object && {_className isEqualTo (typeOf _object) && alive _object};
|
||||||
|
};
|
||||||
|
// This should never happen, but...
|
||||||
|
if (count _startingAssetsOfThisType isEqualTo 0) then {continue};
|
||||||
|
|
||||||
|
// Try to find a not null vehicle that can be processed
|
||||||
|
private _exampleVehicleToProcess = objNull;
|
||||||
|
private _assetCfg = configNull;
|
||||||
|
|
||||||
|
private _exampleVehicleToProcessIndex = _startingAssetsOfThisType findIf {
|
||||||
|
_x params ["_netId", "_cfg"];
|
||||||
|
!isNull (_netId call BIS_fnc_objectFromNetId);
|
||||||
|
};
|
||||||
|
// If found, get the data
|
||||||
|
if (_exampleVehicleToProcessIndex > -1) then {
|
||||||
|
private _exampleData = _startingAssetsOfThisType select _exampleVehicleToProcessIndex;
|
||||||
|
_assetNetId = _exampleData#0;
|
||||||
|
_assetCfg = _exampleData#1;
|
||||||
|
_exampleVehicleToProcess = _assetNetId call BIS_fnc_objectFromNetId;
|
||||||
|
} else {
|
||||||
|
// otherwise, we only have the config to work with
|
||||||
|
private _exampleData = _startingAssetsOfThisType#0;
|
||||||
|
_assetCfg = _exampleData#1;
|
||||||
|
};
|
||||||
|
|
||||||
|
private _parentClassNames = [_assetCfg, true] call BIS_fnc_returnParents;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Process the vehicle for extended info
|
||||||
|
// Exclusion list for display names
|
||||||
|
if (
|
||||||
|
[_assetCfg] call BIS_fnc_displayName
|
||||||
|
in ["Helicopter"]
|
||||||
|
) then {continue};
|
||||||
|
|
||||||
|
// Get the vehicle data
|
||||||
|
private _processed = [configNull, "", []];
|
||||||
|
if (!isNull _exampleVehicleToProcess) then {
|
||||||
|
_processed = [_exampleVehicleToProcess] call FUNC(getVehicleData);
|
||||||
|
};
|
||||||
|
_processed params ["_processedVehicleCfg", "_displayName", "_diaryTextSections"];
|
||||||
|
_diaryTextSections params [
|
||||||
|
["_title", "", [""]],
|
||||||
|
["_image", "", [""]],
|
||||||
|
["_info", "", [""]],
|
||||||
|
["_capacity", "", [""]]
|
||||||
|
// ["_weapons", "", [""]],
|
||||||
|
// ["_pylonWeapons", "", [""]],
|
||||||
|
// ["_inventory", "", [""]]
|
||||||
|
];
|
||||||
|
|
||||||
|
// Get what we can from the vehicle cfg
|
||||||
|
|
||||||
|
// Create the diary record
|
||||||
|
private _recordText = [];
|
||||||
|
// Add the title and image
|
||||||
|
if (count _title isEqualTo 0) then {
|
||||||
|
_title = format["%1", [_assetCfg] call BIS_fnc_displayName];
|
||||||
|
};
|
||||||
|
_recordText pushBack format[
|
||||||
|
"<font size='24' shadow='1' color='#e1701a' face='PuristaBold'>%1</font>",
|
||||||
|
_title
|
||||||
|
];
|
||||||
|
if (count _image isEqualTo 0) then {
|
||||||
|
_image = format["<img width='200' image='%1'/>", getText(_assetCfg >> 'editorPreview')];
|
||||||
|
};
|
||||||
|
_recordText pushBack _image;
|
||||||
|
_recordText pushBack "<br/>";
|
||||||
|
_recordText pushBack format[
|
||||||
|
"CALLSIGN: %1",
|
||||||
|
_vehicleCallsign
|
||||||
|
];
|
||||||
|
_recordText pushBack format[
|
||||||
|
"COUNT STARTED: %1",
|
||||||
|
count _startingAssetsOfThisType
|
||||||
|
];
|
||||||
|
_recordText pushBack format[
|
||||||
|
"COUNT ACTIVE: %1",
|
||||||
|
count _currentAssetsOfThisType
|
||||||
|
];
|
||||||
|
|
||||||
|
// Here, we'll create a link to show markers on the map for all vehicles of this kind
|
||||||
|
// get 'picture' for record
|
||||||
|
private _icon = getText(_assetCfg >> "picture");
|
||||||
|
// determine marker type
|
||||||
|
private _markerType = "mil_dot";
|
||||||
|
switch (true) do {
|
||||||
|
case ("Helicopter" in _parentClassNames): {
|
||||||
|
_markerType = "loc_heli";
|
||||||
|
};
|
||||||
|
case ("Air" in _parentClassNames): {
|
||||||
|
_markerType = "loc_plane";
|
||||||
|
};
|
||||||
|
case ("Ship" in _parentClassNames): {
|
||||||
|
_markerType = "loc_boat";
|
||||||
|
};
|
||||||
|
case ("Car" in _parentClassNames): {
|
||||||
|
_markerType = "loc_car";
|
||||||
|
};
|
||||||
|
default {
|
||||||
|
_markerType = "loc_truck";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
private "_randomColor";
|
||||||
|
if (_colorSelectionIndex < count _randomColors) then {
|
||||||
|
_randomColor = _randomColors select _colorSelectionIndex;
|
||||||
|
INC(_colorSelectionIndex);
|
||||||
|
} else {
|
||||||
|
_colorSelectionIndex = 0;
|
||||||
|
_randomColor = _randomColors select _colorSelectionIndex;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Link to show markers
|
||||||
|
private _showMarkersText = format[
|
||||||
|
"<execute expression='[""%1"",""%2"",""%3"",%4] call %5'>SHOW MARKERS for vehicles at base</execute> (in %6)",
|
||||||
|
_className,
|
||||||
|
_markerType,
|
||||||
|
_randomColor#0,
|
||||||
|
(_currentAssetsOfThisType apply {
|
||||||
|
_x params ["_netId", "_cfg"];
|
||||||
|
_netId;
|
||||||
|
}),
|
||||||
|
QFUNC(showMarkersOnMap),
|
||||||
|
format["<font color='%1'>%2</font>", _randomColor#1, _randomColor#2]
|
||||||
|
];
|
||||||
|
_recordText pushBack _showMarkersText;
|
||||||
|
|
||||||
|
// Link to hide markers
|
||||||
|
_recordText pushBack format[
|
||||||
|
"<execute expression=""call %1"">REMOVE ALL MARKERS showing asset positions</execute>",
|
||||||
|
QFUNC(removeMarkersOnMap)
|
||||||
|
];
|
||||||
|
|
||||||
|
// Link to update asset diary entries
|
||||||
|
_recordText pushBack format[
|
||||||
|
"<execute expression=""call %1"">UPDATE ENTRIES for all assets</execute>",
|
||||||
|
QFUNC(updateAssetDiary)
|
||||||
|
];
|
||||||
|
|
||||||
|
// link to display hint with all assets
|
||||||
|
_recordText pushBack format[
|
||||||
|
"<execute expression=""call %1"">SHOW APPROVED ASSET COUNTS via hint</execute>",
|
||||||
|
QFUNC(hintAllApprovedAssets)
|
||||||
|
];
|
||||||
|
|
||||||
|
_recordText pushBack format[
|
||||||
|
"<font size='10' color='#777777'>%1</font>",
|
||||||
|
"Notes:<br/>
|
||||||
|
- Markers are only displayed on your local machine.<br/>
|
||||||
|
- The REMOVE ALL option will remove all assets' markers from the map.<br/>
|
||||||
|
- UPDATE ENTRIES will update the asset diary with the latest information.<br/>
|
||||||
|
- Markers will only be displayed for assets that are within a certain distance of a base."
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Add info and capacity sections - exclude if no living examples were found
|
||||||
|
if (count _info > 0) then {
|
||||||
|
_recordText pushBack _info;
|
||||||
|
};
|
||||||
|
if (count _capacity > 0) then {
|
||||||
|
_recordText pushBack _capacity;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
private _subjectID = "";
|
||||||
|
switch (true) do {
|
||||||
|
case ("Helicopter" in _parentClassNames): {
|
||||||
|
_subjectID = EGVAR(fbcb2_main,subjectAssetsRotaryID);
|
||||||
|
};
|
||||||
|
case ("Air" in _parentClassNames): {
|
||||||
|
_subjectID = EGVAR(fbcb2_main,subjectAssetsFixedWingID);
|
||||||
|
};
|
||||||
|
default {
|
||||||
|
_subjectID = EGVAR(fbcb2_main,subjectAssetsGroundID);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
[
|
||||||
|
_subjectID,
|
||||||
|
format[
|
||||||
|
"[%1/%2] %3",
|
||||||
|
count _currentAssetsOfThisType,
|
||||||
|
count _startingAssetsOfThisType,
|
||||||
|
(_assetCfg) call BIS_fnc_displayName
|
||||||
|
],
|
||||||
|
_recordText joinString "<br/>",
|
||||||
|
_icon
|
||||||
|
] call EFUNC(fbcb2_main,createOrUpdateDiaryRecord);
|
||||||
|
|
||||||
|
// "\A3\ui_f\data\igui\cfg\simpleTasks\types\car_ca.paa"
|
||||||
|
} forEach _distinctVehiclesClassNames;
|
||||||
|
|
||||||
|
// log to RPT
|
||||||
|
[
|
||||||
|
LEVEL_INFO,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
"UPDATED ASSET DIARY",
|
||||||
|
[
|
||||||
|
["startingAssetCount", count _startingAssets],
|
||||||
|
["startingAssetCountDistinct", count _distinctVehiclesClassNames],
|
||||||
|
["currentassetCount", count _currentAssets]
|
||||||
|
]
|
||||||
|
] call EFUNC(common,log);
|
||||||
|
|
||||||
|
true;
|
||||||
141
framework/fbcb2_assets/functions/fn_updateAssetsByBase.sqf
Normal file
141
framework/fbcb2_assets/functions/fn_updateAssetsByBase.sqf
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
params [
|
||||||
|
["_isInit", false, [false]],
|
||||||
|
["_logCurrentAssets", false, [false]]
|
||||||
|
];
|
||||||
|
|
||||||
|
if (!isServer) exitWith {};
|
||||||
|
|
||||||
|
GVARMAIN(baseObjects) = allMissionObjects "ModuleRespawnPosition_F";
|
||||||
|
|
||||||
|
// Get all approved assets on map, find the closest base
|
||||||
|
// Then determine if it's within range
|
||||||
|
// If it is, add it to the base's assets list
|
||||||
|
// This is to ensure bases with overlapping detection range don't have duplicate assets
|
||||||
|
private _allVehicles = vehicles;
|
||||||
|
private _allSaved = [];
|
||||||
|
|
||||||
|
private _assetsStartedAtThisBaseVar = QGVAR(assetsStartedAtThisBase);
|
||||||
|
private _assetsAtThisBaseVar = QGVAR(assetsAtThisBase);
|
||||||
|
|
||||||
|
private _approvedAssetsCfg = call EFUNC(common,getApprovedAssetsCfg);
|
||||||
|
if (isNull _approvedAssetsCfg) exitWith {};
|
||||||
|
|
||||||
|
private _currentBaseAssetsGathered = GVARMAIN(baseObjects) apply {[_x, []]};;
|
||||||
|
|
||||||
|
{
|
||||||
|
private _className = configName _x;
|
||||||
|
private _callsign = getText(_x >> "callsign");
|
||||||
|
private _found = _allVehicles select { typeOf _x == _className };
|
||||||
|
{
|
||||||
|
private _asset = _x;
|
||||||
|
|
||||||
|
// ignore assets beyond the range of bases
|
||||||
|
if (not ([_asset] call FUNC(isAssetInRangeOfBase))) then {continue};
|
||||||
|
|
||||||
|
|
||||||
|
// add to base's assets list
|
||||||
|
private _closestBase = [_asset] call EFUNC(common,getNearestBase);
|
||||||
|
private _closestBaseCurrentAssets = (_currentBaseAssetsGathered select { _x select 0 isEqualTo _closestBase })#0#1;
|
||||||
|
_closestBaseCurrentAssets pushBackUnique [
|
||||||
|
_asset call BIS_fnc_netId,
|
||||||
|
configOf _asset
|
||||||
|
];
|
||||||
|
} forEach _found;
|
||||||
|
} forEach (_approvedAssetsCfg call BIS_fnc_returnChildren);
|
||||||
|
|
||||||
|
// Add all ground vehicles (LandVehicle)
|
||||||
|
{
|
||||||
|
private _asset = _x;
|
||||||
|
|
||||||
|
// ignore assets beyond the range of bases
|
||||||
|
if (not ([_asset] call FUNC(isAssetInRangeOfBase))) then {continue};
|
||||||
|
|
||||||
|
// add to base's assets list
|
||||||
|
private _closestBase = [_asset] call EFUNC(common,getNearestBase);
|
||||||
|
private _closestBaseCurrentAssets = (_currentBaseAssetsGathered select { _x select 0 isEqualTo _closestBase })#0#1;
|
||||||
|
_closestBaseCurrentAssets pushBackUnique [
|
||||||
|
_asset call BIS_fnc_netId,
|
||||||
|
configOf _asset
|
||||||
|
];
|
||||||
|
} forEach (_allVehicles select { _x isKindOf "LandVehicle" });
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
// publish updated base variables
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
{
|
||||||
|
private _base = _x;
|
||||||
|
|
||||||
|
private _thisBaseCurrentAssets = (_currentBaseAssetsGathered select { _x select 0 isEqualTo _base })#0#1;
|
||||||
|
_base setVariable [_assetsAtThisBaseVar, _thisBaseCurrentAssets, true];
|
||||||
|
|
||||||
|
if (_isInit) then {
|
||||||
|
_base setVariable [_assetsStartedAtThisBaseVar, _thisBaseCurrentAssets, true];
|
||||||
|
};
|
||||||
|
} forEach GVARMAIN(baseObjects);
|
||||||
|
|
||||||
|
// send a CBA event to let other scripts know that assets have been gathered
|
||||||
|
[{[QGVAR(assetsGathered)] call CBA_fnc_globalEvent;}, 2] call CBA_fnc_waitAndExecute;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
// log starting assets if init
|
||||||
|
// log current assets if requested (for end of mission counts)
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
if !(_isInit || _logCurrentAssets) exitWith {};
|
||||||
|
|
||||||
|
{
|
||||||
|
private _base = _x;
|
||||||
|
|
||||||
|
// get current assets
|
||||||
|
private _baseAssets = (_currentBaseAssetsGathered select { _x select 0 isEqualTo _base })#0#1;
|
||||||
|
|
||||||
|
// prepare key value for logging
|
||||||
|
private _baseAssetsHashesPrep = _baseAssets apply {
|
||||||
|
_x params ["_netId", "_cfg"];
|
||||||
|
[
|
||||||
|
["callsign", [configName _cfg] call FUNC(getCallsignFromClassname)],
|
||||||
|
["className", configName _cfg],
|
||||||
|
["displayName", [_cfg] call BIS_fnc_displayName]
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
_baseAssetsHashesPrep = _baseAssetsHashesPrep call BIS_fnc_consolidateArray;
|
||||||
|
|
||||||
|
private _baseAssetsHashes = [];
|
||||||
|
{
|
||||||
|
private _out = createHashMapFromArray (_x#0);
|
||||||
|
_out set ["count", _x#1];
|
||||||
|
_baseAssetsHashes pushBack _out;
|
||||||
|
} forEach _baseAssetsHashesPrep;
|
||||||
|
|
||||||
|
// if logging current assets
|
||||||
|
if (_logCurrentAssets) then {
|
||||||
|
{
|
||||||
|
[
|
||||||
|
LEVEL_INFO,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
"CURRENT ASSETS",
|
||||||
|
[
|
||||||
|
["baseName", [[_base] call EFUNC(common,getNameOfBase)]],
|
||||||
|
["asset", _x]
|
||||||
|
]
|
||||||
|
] call EFUNC(common,log);
|
||||||
|
} forEach _baseAssetsHashes;
|
||||||
|
};
|
||||||
|
|
||||||
|
// if init, log starting assets
|
||||||
|
if (_isInit) then {
|
||||||
|
{
|
||||||
|
[
|
||||||
|
LEVEL_INFO,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
"STARTING ASSETS",
|
||||||
|
[
|
||||||
|
["baseName", [[_base] call EFUNC(common,getNameOfBase)]],
|
||||||
|
["asset", _x]
|
||||||
|
]
|
||||||
|
] call EFUNC(common,log);
|
||||||
|
} forEach _baseAssetsHashes;
|
||||||
|
};
|
||||||
|
} forEach GVARMAIN(baseObjects);
|
||||||
3
framework/fbcb2_assets/script_component.hpp
Normal file
3
framework/fbcb2_assets/script_component.hpp
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#define COMPONENT fbcb2_assets
|
||||||
|
#define COMPONENT_BEAUTIFIED FBCB2 - Assets
|
||||||
|
#include "../script_mod.hpp"
|
||||||
112
framework/fbcb2_main/functions/fn_addEnvironmentRecord.sqf
Normal file
112
framework/fbcb2_main/functions/fn_addEnvironmentRecord.sqf
Normal 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);
|
||||||
@@ -1,11 +1,32 @@
|
|||||||
// updated 2024-02-01 by IndigoFox
|
// updated 2024-02-01 by IndigoFox
|
||||||
// now reads from the battalion config structure to generate the diary entries
|
// now reads from the battalion config structure to generate the diary entries
|
||||||
|
|
||||||
|
#include "../script_component.hpp"
|
||||||
|
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
// Get info from missionConfigFile
|
// Get info from missionConfigFile
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
private _battalionInfoCfg = call milsim_fnc_getBattalionCfg;
|
private _battalionInfoCfg = call EFUNC(common,getBattalionCfg);
|
||||||
|
if (isNull _battalionInfoCfg) exitWith {
|
||||||
|
[
|
||||||
|
LEVEL_ERROR,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
"Null Battalion Config",
|
||||||
|
[]
|
||||||
|
] call EFUNC(common,log);
|
||||||
|
["Null Battalion Config"] call BIS_fnc_error;
|
||||||
|
};
|
||||||
|
|
||||||
private _battalionElementCfgs = [_battalionInfoCfg >> "Command"] call BIS_fnc_returnChildren;
|
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(common,log);
|
||||||
|
["ERROR: No battalion elements found. Check that the battalion config is correctly structured. See defines/BattalionInfo.hpp and framework/util/functions/getBattalionCfg.sqf."] call BIS_fnc_error;
|
||||||
|
};
|
||||||
|
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
// Define formatting constants
|
// Define formatting constants
|
||||||
@@ -29,22 +50,28 @@ private _FREQ_TEXT_COLOR = "#CCCCCC";
|
|||||||
reverse _battalionElementCfgs;
|
reverse _battalionElementCfgs;
|
||||||
|
|
||||||
{
|
{
|
||||||
// recursively generate diary text for all child elements of battalion-level elements
|
|
||||||
private _diaryTitleText = [_x, true] call milsim_fnc_generateElementFrequencyRecordText;
|
|
||||||
[
|
[
|
||||||
milsim_fbcb2_subjectFrequenciesID,
|
LEVEL_TRACE,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
format["Processing battalion element %1", configName _x],
|
||||||
|
[]
|
||||||
|
] call EFUNC(common,log);
|
||||||
|
// recursively generate diary text for all child elements of battalion-level elements
|
||||||
|
private _diaryTitleText = [_x, true] call FUNC(generateElementFrequencyRecordText);
|
||||||
|
[
|
||||||
|
GVAR(subjectFrequenciesID),
|
||||||
_diaryTitleText#0,
|
_diaryTitleText#0,
|
||||||
_diaryTitleText#1
|
_diaryTitleText#1
|
||||||
] call milsim_fnc_createOrUpdateDiaryRecord;
|
] call FUNC(createOrUpdateDiaryRecord);
|
||||||
} forEach _battalionElementCfgs;
|
} forEach _battalionElementCfgs;
|
||||||
|
|
||||||
// add the battalion command to the top of the list
|
// add the battalion command to the top of the list
|
||||||
// don't process child elements
|
// don't process child elements
|
||||||
private _diaryTitleText = [_battalionInfoCfg >> "Command", false] call milsim_fnc_generateElementFrequencyRecordText;
|
private _diaryTitleText = [_battalionInfoCfg >> "Command", false] call FUNC(generateElementFrequencyRecordText);
|
||||||
[
|
[
|
||||||
milsim_fbcb2_subjectFrequenciesID,
|
GVAR(subjectFrequenciesID),
|
||||||
_diaryTitleText#0,
|
_diaryTitleText#0,
|
||||||
_diaryTitleText#1
|
_diaryTitleText#1
|
||||||
] call milsim_fnc_createOrUpdateDiaryRecord;
|
] call FUNC(createOrUpdateDiaryRecord);
|
||||||
|
|
||||||
true;
|
true;
|
||||||
59
framework/fbcb2_main/functions/fn_addSignalColorsRecord.sqf
Normal file
59
framework/fbcb2_main/functions/fn_addSignalColorsRecord.sqf
Normal 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);
|
||||||
54
framework/fbcb2_main/functions/fn_initClient.sqf
Normal file
54
framework/fbcb2_main/functions/fn_initClient.sqf
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
#include "../script_component.hpp"
|
||||||
|
|
||||||
|
if ( !hasInterface ) exitWith {};
|
||||||
|
|
||||||
|
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
|
||||||
|
[] 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);
|
||||||
|
|
||||||
|
localNamespace setVariable [QGVAR(complete), true];
|
||||||
3
framework/fbcb2_main/script_component.hpp
Normal file
3
framework/fbcb2_main/script_component.hpp
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#define COMPONENT fbcb2_main
|
||||||
|
#define COMPONENT_BEAUTIFIED FBCB2 - Main
|
||||||
|
#include "../script_mod.hpp"
|
||||||
49
framework/fbcb2_main/util/fn_createOrUpdateDiaryRecord.sqf
Normal file
49
framework/fbcb2_main/util/fn_createOrUpdateDiaryRecord.sqf
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
#include "../script_component.hpp"
|
||||||
|
|
||||||
|
if (!hasInterface) exitWith {};
|
||||||
|
|
||||||
|
params [
|
||||||
|
["_subjectID", GVAR(subjectStatusID), [""]],
|
||||||
|
["_recordTitle", "", [""]],
|
||||||
|
["_recordText", "", [""]],
|
||||||
|
["_recordIcon", "", [""]]
|
||||||
|
];
|
||||||
|
|
||||||
|
// Check if already created
|
||||||
|
private _subjectRecords = GVAR(diaryRecords) getOrDefault [_subjectID, createHashMap, true];
|
||||||
|
private _existingRecord = _subjectRecords getOrDefault [_recordTitle, diaryRecordNull, true];
|
||||||
|
|
||||||
|
if (!isNull _existingRecord) then {
|
||||||
|
player setDiaryRecordText [[_subjectID, _existingRecord], [_recordTitle, _recordText, _recordIcon]];
|
||||||
|
|
||||||
|
[
|
||||||
|
LEVEL_DEBUG,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
format ["Updated diary record: %1", _recordTitle],
|
||||||
|
[
|
||||||
|
["subjectID", _subjectID],
|
||||||
|
["recordTitle", _recordTitle]
|
||||||
|
]
|
||||||
|
] call EFUNC(common,log);
|
||||||
|
} else {
|
||||||
|
private _new = player createDiaryRecord [
|
||||||
|
_subjectID,
|
||||||
|
[
|
||||||
|
_recordTitle,
|
||||||
|
_recordText,
|
||||||
|
_recordIcon
|
||||||
|
]
|
||||||
|
];
|
||||||
|
_subjectRecords set [_recordTitle, _new];
|
||||||
|
GVAR(diaryRecords) set [_subjectID, _subjectRecords];
|
||||||
|
|
||||||
|
[
|
||||||
|
LEVEL_DEBUG,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
format ["Created diary record: %1", _recordTitle],
|
||||||
|
[
|
||||||
|
["subjectID", _subjectID],
|
||||||
|
["recordTitle", _recordTitle]
|
||||||
|
]
|
||||||
|
] call EFUNC(common,log);
|
||||||
|
};
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
// called from milsim_fnc_processFBCB2RadioFrequencies
|
// called from milsim_fnc_processFBCB2RadioFrequencies
|
||||||
|
#include "../script_component.hpp"
|
||||||
|
|
||||||
params ["_cfg", ["_indentCount", 1, [5]]];
|
params ["_cfg", ["_indentCount", 1, [5]]];
|
||||||
|
|
||||||
//////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////
|
||||||
@@ -62,8 +64,8 @@ _freqLeadingSpace = _freqLeadingSpace joinString "";
|
|||||||
_ELEMENT_FREQ_SIZE,
|
_ELEMENT_FREQ_SIZE,
|
||||||
_ELEMENT_FREQ_FONT,
|
_ELEMENT_FREQ_FONT,
|
||||||
_FREQ_TEXT_COLOR,
|
_FREQ_TEXT_COLOR,
|
||||||
[_role, "right", " ", _FREQ_PAD_LENGTH] call milsim_fnc_padString,
|
[_role, "right", " ", _FREQ_PAD_LENGTH] call EFUNC(common,padString),
|
||||||
[_srStr, "right", " ", _FREQ_PAD_LENGTH] call milsim_fnc_padString,
|
[_srStr, "right", " ", _FREQ_PAD_LENGTH] call EFUNC(common,padString),
|
||||||
_lrStr
|
_lrStr
|
||||||
];
|
];
|
||||||
} forEach (getArray (_cfg >> "frequencies"));
|
} forEach (getArray (_cfg >> "frequencies"));
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
// called from milsim_fnc_processFBCB2RadioFrequencies ONLY
|
// called from milsim_fnc_processFBCB2RadioFrequencies ONLY
|
||||||
// this function is called recursively to process all child elements of a battalion element in missionConfigFile
|
// this function is called recursively to process all child elements of a battalion element in missionConfigFile
|
||||||
|
|
||||||
|
#include "../script_component.hpp"
|
||||||
|
|
||||||
params [
|
params [
|
||||||
["_elementCfg", configNull, [configNull]],
|
["_elementCfg", configNull, [configNull]],
|
||||||
["_shouldProcessChildCfgs", true]
|
["_shouldProcessChildCfgs", true]
|
||||||
@@ -40,9 +43,9 @@ _freqLeadingSpace = _freqLeadingSpace joinString "";
|
|||||||
private _headers = [
|
private _headers = [
|
||||||
format[
|
format[
|
||||||
"<font size='%1' color='%2' face='%3'>%4</font>",
|
"<font size='%1' color='%2' face='%3'>%4</font>",
|
||||||
milsim_fbcb2_recordTitleSize,
|
GVAR(recordTitleSize),
|
||||||
milsim_fbcb2_recordTitleColor,
|
GVAR(recordTitleColor),
|
||||||
milsim_fbcb2_recordTitleFont,
|
GVAR(recordTitleFont),
|
||||||
_recordTitle
|
_recordTitle
|
||||||
],
|
],
|
||||||
format[
|
format[
|
||||||
@@ -51,8 +54,8 @@ private _headers = [
|
|||||||
_ELEMENT_FREQ_SIZE,
|
_ELEMENT_FREQ_SIZE,
|
||||||
_ELEMENT_FREQ_FONT,
|
_ELEMENT_FREQ_FONT,
|
||||||
_FREQ_TEXT_COLOR,
|
_FREQ_TEXT_COLOR,
|
||||||
["ROLE", "right", " ", _FREQ_PAD_LENGTH] call milsim_fnc_padString,
|
["ROLE", "right", " ", _FREQ_PAD_LENGTH] call EFUNC(common,padString),
|
||||||
["SR", "right", " ", _FREQ_PAD_LENGTH] call milsim_fnc_padString,
|
["SR", "right", " ", _FREQ_PAD_LENGTH] call EFUNC(common,padString),
|
||||||
"LR"
|
"LR"
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
@@ -65,16 +68,30 @@ private _allText = [];
|
|||||||
|
|
||||||
// get all child elements recursively and format them
|
// get all child elements recursively and format them
|
||||||
if (_shouldProcessChildCfgs) then {
|
if (_shouldProcessChildCfgs) then {
|
||||||
|
[
|
||||||
|
LEVEL_TRACE,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
"Processing child elements for battalion element %1",
|
||||||
|
[]
|
||||||
|
] call EFUNC(common,log);
|
||||||
|
|
||||||
[_battalionElement, {
|
[_battalionElement, {
|
||||||
params ["_cfg", "_recurseCounter"];
|
params ["_cfg", "_recurseCounter"];
|
||||||
// add config
|
// add config
|
||||||
private _lines = [_cfg, _recurseCounter+1] call milsim_fnc_formatRadioElementForDiary;
|
private _lines = [_cfg, _recurseCounter+1] call FUNC(formatRadioElementForDiary);
|
||||||
// private _lines = [_cfg, _indentCount] call t;
|
// private _lines = [_cfg, _indentCount] call t;
|
||||||
_allText pushBack (_lines joinString "<br/>");
|
_allText pushBack (_lines joinString "<br/>");
|
||||||
}] call milsim_fnc_recurseSubclasses;
|
}] call EFUNC(common,recurseSubclasses);
|
||||||
} else {
|
} else {
|
||||||
|
[
|
||||||
|
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
|
// or if the param was false, just add the battalion element
|
||||||
private _lines = [_battalionElement, 1] call milsim_fnc_formatRadioElementForDiary;
|
private _lines = [_battalionElement, 1] call FUNC(formatRadioElementForDiary);
|
||||||
// private _lines = [_cfg, _indentCount] call t;
|
// private _lines = [_cfg, _indentCount] call t;
|
||||||
_allText pushBack (_lines joinString "<br/>");
|
_allText pushBack (_lines joinString "<br/>");
|
||||||
};
|
};
|
||||||
18
framework/init/functions/fn_addAARChatHandler.sqf
Normal file
18
framework/init/functions/fn_addAARChatHandler.sqf
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
[
|
||||||
|
"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;
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
[
|
[
|
||||||
"respawn",
|
"respawn",
|
||||||
{
|
{
|
||||||
@@ -6,10 +8,11 @@
|
|||||||
|
|
||||||
// log to server RPT
|
// log to server RPT
|
||||||
[
|
[
|
||||||
"init",
|
LEVEL_INFO,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
"CHAT COMMAND RESPAWN",
|
"CHAT COMMAND RESPAWN",
|
||||||
[player] call milsim_fnc_addPlayerInfoToArray
|
[player] call EFUNC(common,addPlayerInfoToArray)
|
||||||
] remoteExec ["milsim_fnc_log", 2];
|
] remoteExec [QEFUNC(common,log), 2];
|
||||||
|
|
||||||
// systemChat to all remote machines
|
// systemChat to all remote machines
|
||||||
format["%1 claims they were glitched and respawned (%2)", name player, netID player] remoteExec["systemChat", -_clientID];
|
format["%1 claims they were glitched and respawned (%2)", name player, netID player] remoteExec["systemChat", -_clientID];
|
||||||
@@ -18,6 +21,11 @@
|
|||||||
[clientOwner]
|
[clientOwner]
|
||||||
] call CBA_fnc_registerChatCommand;
|
] 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;
|
nil;
|
||||||
34
framework/init/functions/fn_initClient.sqf
Normal file
34
framework/init/functions/fn_initClient.sqf
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
if ( !hasInterface ) exitWith {};
|
||||||
|
|
||||||
|
["milsim_logText", {
|
||||||
|
params [["_strArray", [""], [[]]]];
|
||||||
|
{
|
||||||
|
diag_log text _x;
|
||||||
|
} forEach _strArray;
|
||||||
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
|
// make sure the server has finished init
|
||||||
|
waitUntil {!isNil QGVARMAIN(complete)};
|
||||||
|
|
||||||
|
["InitializePlayer", [player, true]] call BIS_fnc_dynamicGroups;
|
||||||
|
|
||||||
|
|
||||||
|
// initialize other modules
|
||||||
|
call EFUNC(reinsert,initClient);
|
||||||
|
call EFUNC(resupply,initClient);
|
||||||
|
call EFUNC(triageIcons,initClient);
|
||||||
|
call EFUNC(vehicleFlags,initClient);
|
||||||
|
call EFUNC(fbcb2_main,initClient);
|
||||||
|
call EFUNC(fbcb2_assets,initClient);
|
||||||
|
|
||||||
|
|
||||||
|
[
|
||||||
|
LEVEL_DEBUG,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
"postInit complete",
|
||||||
|
[]
|
||||||
|
] call EFUNC(common,log);
|
||||||
|
|
||||||
|
nil;
|
||||||
42
framework/init/functions/fn_initServer.sqf
Normal file
42
framework/init/functions/fn_initServer.sqf
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
if (!isServer) exitWith {};
|
||||||
|
|
||||||
|
// array of all respawn modules in the mission representing "bases"
|
||||||
|
GVARMAIN(baseObjects) = allMissionObjects "ModuleRespawnPosition_F";
|
||||||
|
publicVariable QGVARMAIN(baseObjects);
|
||||||
|
|
||||||
|
// Initializes the Dynamic Groups framework and groups
|
||||||
|
["Initialize", [true]] call BIS_fnc_dynamicGroups;
|
||||||
|
|
||||||
|
if (isDedicated) then {
|
||||||
|
["milsim_logText", {
|
||||||
|
params [["_strArray", [""], [[]]]];
|
||||||
|
{
|
||||||
|
diag_log text _x;
|
||||||
|
} forEach _strArray;
|
||||||
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// initialize other modules
|
||||||
|
call EFUNC(common,logMissionInfo);
|
||||||
|
call EFUNC(fbcb2_assets,initServer);
|
||||||
|
call EFUNC(reinsert,initServer);
|
||||||
|
|
||||||
|
// declare init complete to other modules
|
||||||
|
missionNamespace setVariable [QGVARMAIN(complete), true, true];
|
||||||
|
|
||||||
|
[
|
||||||
|
LEVEL_INFO,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
format["%1: version %2", QGVARMAIN(complete), QUOTE(VERSION_STR)],
|
||||||
|
[["version", QUOTE(VERSION_STR)]]
|
||||||
|
] call EFUNC(common,log);
|
||||||
|
|
||||||
|
[
|
||||||
|
LEVEL_DEBUG,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
"postInit complete",
|
||||||
|
[]
|
||||||
|
] call EFUNC(common,log);
|
||||||
34
framework/init/functions/fn_setDefaults.sqf
Normal file
34
framework/init/functions/fn_setDefaults.sqf
Normal 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;
|
||||||
3
framework/init/script_component.hpp
Normal file
3
framework/init/script_component.hpp
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#define COMPONENT init
|
||||||
|
#define COMPONENT_BEAUTIFIED Init
|
||||||
|
#include "../script_mod.hpp"
|
||||||
105
framework/performance/functions/fn_addCBASettings.sqf
Normal file
105
framework/performance/functions/fn_addCBASettings.sqf
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
//---------------------
|
||||||
|
// Server CPS
|
||||||
|
//---------------------
|
||||||
|
|
||||||
|
[
|
||||||
|
QGVAR(server_cps_enable),
|
||||||
|
"CHECKBOX",
|
||||||
|
"Server CPS Metrics Enabled",
|
||||||
|
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)],
|
||||||
|
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);
|
||||||
38
framework/performance/functions/fn_addClientStatsPFH.sqf
Normal file
38
framework/performance/functions/fn_addClientStatsPFH.sqf
Normal 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];
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
if ( !hasInterface ) exitWith {};
|
if ( !hasInterface ) exitWith {};
|
||||||
|
|
||||||
diag_log text "[MILSIM] (DNI) writing variable loop";
|
diag_log text "[MILSIM] (DNI) writing variable loop";
|
||||||
@@ -1,28 +1,48 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
if (!isServer) exitWith {};
|
if (!isServer) exitWith {};
|
||||||
|
|
||||||
missionNamespace setVariable["milsim_raw_cps", 0];
|
missionNamespace setVariable[QGVAR(raw_cps), 0];
|
||||||
missionNamespace setVariable["milsim_cps", 0];
|
missionNamespace setVariable[QGVAR(cps), 0];
|
||||||
|
|
||||||
publicVariable "milsim_raw_cps";
|
publicVariable QGVAR(raw_cps);
|
||||||
publicVariable "milsim_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 = [
|
_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 },
|
{ false },
|
||||||
[]
|
[]
|
||||||
] call CBA_fnc_createPerFrameHandlerObject;
|
] call CBA_fnc_createPerFrameHandlerObject;
|
||||||
|
|
||||||
|
|
||||||
missionNamespace setVariable ["milsim_server_cps_handler", _serverCpsPFH];
|
missionNamespace setVariable [QGVAR(server_cps_handler), _serverCpsPFH];
|
||||||
|
|
||||||
_playerCpsPFH = [
|
_playerCpsPFH = [
|
||||||
{
|
{
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
[] spawn {
|
[] spawn {
|
||||||
// warning: while loop without suspension executes multiple times per frame
|
// warning: while loop without suspension executes multiple times per frame
|
||||||
private _counter = 0;
|
private _counter = 0;
|
||||||
@@ -8,8 +10,8 @@
|
|||||||
_counter = _counter + 1;
|
_counter = _counter + 1;
|
||||||
};
|
};
|
||||||
// in an empty mission, the _counter may go well over 2000 times per frame!
|
// 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)];
|
private _rawCPS = _counter / (diag_frameNo - _frameNo);
|
||||||
player setVariable ["milsim_player_raw_cps", _counter / (diag_frameNo - _frameNo), true];
|
player setVariable [QGVAR(player_raw_cps), _rawCPS, true];
|
||||||
|
|
||||||
// with suspension
|
// with suspension
|
||||||
private _counter = 0;
|
private _counter = 0;
|
||||||
@@ -21,9 +23,23 @@
|
|||||||
uiSleep 0.001; // waits at least 1 frame
|
uiSleep 0.001; // waits at least 1 frame
|
||||||
};
|
};
|
||||||
// _counter says one per frame, as expected
|
// _counter says one per frame, as expected
|
||||||
diag_log text format ["[MILSIM] (client) Average Execution: %1 times per frame", _counter / (diag_frameNo - _frameNo)];
|
private _playerCPS = _counter / (diag_frameNo - _frameNo);
|
||||||
player setVariable ["milsim_player_cps", _counter / (diag_frameNo - _frameNo), true];
|
player setVariable [QGVAR(player_cps), _playerCPS, true];
|
||||||
|
|
||||||
|
// log to RPT
|
||||||
|
[
|
||||||
|
|
||||||
|
{_this call EFUNC(common,log);},
|
||||||
|
[
|
||||||
|
LEVEL_INFO,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
format ["Average Execution: %1 times per frame", _playerCPS],
|
||||||
|
[
|
||||||
|
["playerRawCPS", _rawCPS],
|
||||||
|
["playerCPS", _playerCPS]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
] call CBA_fnc_directCall;
|
||||||
};
|
};
|
||||||
|
|
||||||
nil;
|
nil;
|
||||||
54
framework/performance/functions/fn_calculateServerStats.sqf
Normal file
54
framework/performance/functions/fn_calculateServerStats.sqf
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
#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;
|
||||||
|
};
|
||||||
|
|
||||||
|
private _rawCPS = _counter / (diag_frameNo - _frameNo);
|
||||||
|
missionNamespace setVariable [QGVAR(server_raw_cps), _rawCPS];
|
||||||
|
publicVariable QGVAR(server_raw_cps);
|
||||||
|
|
||||||
|
// 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
|
||||||
|
};
|
||||||
|
|
||||||
|
private _serverCPS = _counter / (diag_frameNo - _frameNo);
|
||||||
|
missionNamespace setVariable [QGVAR(server_cps), _counter / (diag_frameNo - _frameNo)];
|
||||||
|
publicVariable QGVAR(server_cps);
|
||||||
|
|
||||||
|
// log to RPT
|
||||||
|
[
|
||||||
|
|
||||||
|
{_this call EFUNC(common,log);},
|
||||||
|
[
|
||||||
|
LEVEL_INFO,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
format ["Average Server Execution: %1 times per frame", _serverCPS],
|
||||||
|
[
|
||||||
|
["serverRawCPS", _rawCPS],
|
||||||
|
["serverCPS", _serverCPS]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
] call CBA_fnc_directCall;
|
||||||
|
|
||||||
|
[QGVARMAIN(serverEfficiency), [
|
||||||
|
[
|
||||||
|
["float", QGVARMAIN(raw_cps), missionNamespace getVariable [QGVAR(server_raw_cps), -1]],
|
||||||
|
["float", QGVARMAIN(cps), missionNamespace getVariable [QGVAR(server_cps), -1]]
|
||||||
|
]
|
||||||
|
]] call CBA_fnc_localEvent;
|
||||||
|
};
|
||||||
|
|
||||||
|
nil;
|
||||||
3
framework/performance/script_component.hpp
Normal file
3
framework/performance/script_component.hpp
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#define COMPONENT performance
|
||||||
|
#define COMPONENT_BEAUTIFIED Performance Monitoring
|
||||||
|
#include "../script_mod.hpp"
|
||||||
@@ -1,36 +1,38 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
params ["_type"]; // string of the object's classname
|
params ["_type"]; // string of the object's classname
|
||||||
if (!(_type isKindOf "CAManBase")) exitWith {};
|
if (!(_type isKindOf "CAManBase")) exitWith {};
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(localNamespace getVariable ["milsim_reinsert_fileForReinsertClassesAdded", []])
|
(localNamespace getVariable [QGVAR(fileForReinsertClassesAdded), []])
|
||||||
find _type != -1
|
find _type != -1
|
||||||
) exitWith {};
|
) exitWith {};
|
||||||
|
|
||||||
private _fileForReinsertAction = [
|
private _fileForReinsertAction = [
|
||||||
"milsim_reinsert_fileReinsertRequest",
|
QGVAR(fileReinsertRequestAction),
|
||||||
"File Re-insert Request",
|
"File Re-insert Request",
|
||||||
"\A3\ui_f\data\igui\cfg\simpleTasks\types\takeoff_ca.paa",
|
"\A3\ui_f\data\igui\cfg\simpleTasks\types\takeoff_ca.paa",
|
||||||
{ // statement
|
{ // statement
|
||||||
params ["_target", "_player", "_params"];
|
params ["_target", "_player", "_params"];
|
||||||
// find nearest base or location
|
// find nearest base or location
|
||||||
private _base = [_player] call milsim_fnc_getNearestBase;
|
private _base = [_player] call EFUNC(common,getNearestBase);
|
||||||
private _baseName = [_base] call milsim_fnc_getNameOfBase;
|
private _baseName = [_base] call EFUNC(common,getNameOfBase);
|
||||||
// send event to server
|
// 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
|
// notify player their request was filed
|
||||||
[["Re-insert Request Filed"], [format["Location: %1", _baseName]]] call CBA_fnc_notify;
|
[["Re-insert Request Filed"], [format["Location: %1", _baseName]]] call CBA_fnc_notify;
|
||||||
},
|
},
|
||||||
{ // condition
|
{ // condition
|
||||||
params ["_target", "_player", "_params"];
|
params ["_target", "_player", "_params"];
|
||||||
// find nearest base or location
|
// find nearest base or location
|
||||||
private _base = [_player] call milsim_fnc_getNearestBase;
|
private _base = [_player] call EFUNC(common,getNearestBase);
|
||||||
private _baseDistance = _player distance _base;
|
private _baseDistance = _player distance _base;
|
||||||
|
|
||||||
private _maxRangeToReady = missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_maxRangeToReady", 400];
|
private _maxRangeToReady = missionNamespace getVariable [QGVAR(setting_maxRangeToReady), 400];
|
||||||
private _existingQueue = missionNamespace getVariable ["milsim_reinsert_reinsertionQueue", []];
|
private _existingQueue = missionNamespace getVariable [QGVAR(reinsertionQueue), []];
|
||||||
|
|
||||||
// check if module is enabled, player is near a base, and player is not already in the queue
|
// 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] &&
|
missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_enabled", true] &&
|
||||||
(_baseDistance < _maxRangeToReady) &&
|
(_baseDistance < _maxRangeToReady) &&
|
||||||
not (_player in (_existingQueue apply {_x#0}))
|
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;
|
[_type, 1, ["ACE_SelfActions"], _fileForReinsertAction, true] call ace_interact_menu_fnc_addActionToClass;
|
||||||
|
|
||||||
private _removeFileForReinsertAction = [
|
private _removeFileForReinsertAction = [
|
||||||
"milsim_reinsert_removeReinsertRequest",
|
QGVAR(removeReinsertRequestAction),
|
||||||
"Remove Re-insert Request",
|
"Remove Re-insert Request",
|
||||||
"\A3\ui_f\data\igui\cfg\simpleTasks\types\land_ca.paa",
|
"\A3\ui_f\data\igui\cfg\simpleTasks\types\land_ca.paa",
|
||||||
{ // statement
|
{ // statement
|
||||||
params ["_target", "_player", "_params"];
|
params ["_target", "_player", "_params"];
|
||||||
// send event to server
|
// 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
|
// notify player their request was rescinded
|
||||||
"Re-insert Request Rescinded" call CBA_fnc_notify;
|
"Re-insert Request Rescinded" call CBA_fnc_notify;
|
||||||
},
|
},
|
||||||
{ // condition
|
{ // condition
|
||||||
params ["_target", "_player", "_params"];
|
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
|
// 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] &&
|
missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_enabled", true] &&
|
||||||
(_player in (_existingQueue apply {_x#0}))
|
(_player in (_existingQueue apply {_x#0}))
|
||||||
}
|
}
|
||||||
] call ace_interact_menu_fnc_createAction;
|
] call ace_interact_menu_fnc_createAction;
|
||||||
[_type, 1, ["ACE_SelfActions"], _removeFileForReinsertAction, true] call ace_interact_menu_fnc_addActionToClass;
|
[_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;
|
_classesActionsAddedTo pushBackUnique _type;
|
||||||
localNamespace setVariable ["milsim_reinsert_fileForReinsertClassesAdded", _classesActionsAddedTo];
|
localNamespace setVariable [QGVAR(fileForReinsertClassesAdded), _classesActionsAddedTo];
|
||||||
|
|
||||||
@@ -1,28 +1,30 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
params ["_type"]; // string of the object's classname
|
params ["_type"]; // string of the object's classname
|
||||||
if (!(_type isKindOf "CAManBase")) exitWith {};
|
if (!(_type isKindOf "CAManBase")) exitWith {};
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(localNamespace getVariable ["milsim_reinsert_checkReinsertQueueClassesAdded", []])
|
(localNamespace getVariable [QGVAR(checkReinsertQueueClassesAdded), []])
|
||||||
find _type != -1
|
find _type != -1
|
||||||
) exitWith {};
|
) exitWith {};
|
||||||
|
|
||||||
private _checkReinsertQueueAction = [
|
private _checkReinsertQueueAction = [
|
||||||
"milsim_reinsert_checkReinsertQueue",
|
QGVAR(checkReinsertQueue),
|
||||||
"[PILOT] Check Re-insert Queue",
|
"[PILOT] Check Re-insert Queue",
|
||||||
"\A3\ui_f\data\igui\cfg\simpleTasks\types\land_ca.paa",
|
"\A3\ui_f\data\igui\cfg\simpleTasks\types\land_ca.paa",
|
||||||
{
|
{
|
||||||
params ["_target", "_player", "_params"];
|
params ["_target", "_player", "_params"];
|
||||||
// request notification from the server
|
// request notification from the server
|
||||||
call milsim_reinsert_fnc_requestShowQueue;
|
call FUNC(requestShowQueue);
|
||||||
// reset last check time
|
// 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
|
} // always allow
|
||||||
] call ace_interact_menu_fnc_createAction;
|
] call ace_interact_menu_fnc_createAction;
|
||||||
[_type, 1, ["ACE_SelfActions"], _checkReinsertQueueAction, true] call ace_interact_menu_fnc_addActionToClass;
|
[_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;
|
_classesActionsAddedTo pushBackUnique _type;
|
||||||
localNamespace setVariable ["milsim_reinsert_checkReinsertQueueClassesAdded", _classesActionsAddedTo];
|
localNamespace setVariable [QGVAR(checkReinsertQueueClassesAdded), _classesActionsAddedTo];
|
||||||
@@ -1,26 +1,28 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
if (!hasInterface) exitWith {};
|
if (!hasInterface) exitWith {};
|
||||||
|
|
||||||
// ACE SELF-INTERACTIONS FOR FILING AND RESCINDING REINSERT REQUESTS NEAR BASE - ALL PLAYERS
|
// 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
|
// add actions to current class
|
||||||
[typeOf player] call milsim_reinsert_fnc_addAceSelfActions;
|
[typeOf player] call FUNC(addAceSelfActions);
|
||||||
// add actions to future classes
|
// add actions to future classes
|
||||||
["ace_interact_menu_newControllableObject", {
|
["ace_interact_menu_newControllableObject", {
|
||||||
_this call milsim_reinsert_fnc_addAceSelfActions;
|
_this call FUNC(addAceSelfActions);
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
// PILOTS ONLY
|
// PILOTS ONLY
|
||||||
// ACE SELF-INTERACTIONS FOR CHECKING REINSERT QUEUE - ONLY FOR PILOTS
|
// ACE SELF-INTERACTIONS FOR CHECKING REINSERT QUEUE - ONLY FOR PILOTS
|
||||||
if ((typeOf player) in ["B_Helipilot_F", "B_helicrew_F"]) then {
|
if ((typeOf player) in ["B_Helipilot_F", "B_helicrew_F"]) then {
|
||||||
localNamespace setVariable ["milsim_reinsert_checkReinsertQueueClassesAdded", []];
|
localNamespace setVariable [QGVAR(checkReinsertQueueClassesAdded), []];
|
||||||
localNamespace setVariable ["milsim_reinsert_lastReinsertQueueCheck", diag_tickTime];
|
localNamespace setVariable [QGVAR(lastReinsertQueueCheck), diag_tickTime];
|
||||||
|
|
||||||
// add actions to current class
|
// add actions to current class
|
||||||
[typeOf player] call milsim_reinsert_fnc_addCheckQueueSelfAction;
|
[typeOf player] call FUNC(addCheckQueueSelfAction);
|
||||||
// add actions to future classes
|
// add actions to future classes
|
||||||
["ace_interact_menu_newControllableObject", {
|
["ace_interact_menu_newControllableObject", {
|
||||||
_this call milsim_reinsert_fnc_addCheckQueueSelfAction;
|
_this call FUNC(addCheckQueueSelfAction);
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] 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 module not enabled and pilot forced check not enabled, exit
|
||||||
if (not (
|
if (not (
|
||||||
missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_enabled", true] &&
|
missionNamespace getVariable [QGVAR(setting_enabled), true] &&
|
||||||
missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_pilotForcedCheckEnabled", true]
|
missionNamespace getVariable [QGVAR(setting_pilotForcedCheckEnabled), true]
|
||||||
)) exitWith {};
|
)) exitWith {};
|
||||||
|
|
||||||
// if last check was less than X minutes ago, skip
|
// if last check was less than X minutes ago, skip
|
||||||
private _lastCheck = localNamespace getVariable ["milsim_reinsert_lastReinsertQueueCheck", diag_tickTime];
|
private _lastCheck = localNamespace getVariable [QGVAR(lastReinsertQueueCheck), diag_tickTime];
|
||||||
private _requiredCheckInterval = missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_pilotForcedCheckInterval", 60*20];
|
private _requiredCheckInterval = missionNamespace getVariable [QGVAR(setting_pilotForcedCheckInterval), 60*20];
|
||||||
if (
|
if (
|
||||||
diag_tickTime - _lastCheck <
|
diag_tickTime - _lastCheck <
|
||||||
_requiredCheckInterval
|
_requiredCheckInterval
|
||||||
@@ -45,9 +47,16 @@ if ((typeOf player) in ["B_Helipilot_F", "B_helicrew_F"]) then {
|
|||||||
|
|
||||||
// last check was greater than X minutes ago
|
// last check was greater than X minutes ago
|
||||||
// reset last check time
|
// reset last check time
|
||||||
localNamespace setVariable ["milsim_reinsert_lastReinsertQueueCheck", diag_tickTime];
|
localNamespace setVariable [QGVAR(lastReinsertQueueCheck), diag_tickTime];
|
||||||
// request notification from the server
|
// request notification from the server
|
||||||
call milsim_reinsert_fnc_requestShowQueue;
|
call FUNC(requestShowQueue);
|
||||||
}, 30] call CBA_fnc_addPerFrameHandler;
|
}, 30] call CBA_fnc_addPerFrameHandler;
|
||||||
};
|
};
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
[
|
||||||
|
LEVEL_DEBUG,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
"postInit complete",
|
||||||
|
[]
|
||||||
|
] call EFUNC(common,log);
|
||||||
5
framework/reinsert/client/fn_requestShowQueue.sqf
Normal file
5
framework/reinsert/client/fn_requestShowQueue.sqf
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
if (!hasInterface) exitWith {};
|
||||||
|
|
||||||
|
[] remoteExec [QFUNC(returnReinsertQueueNotification), 2];
|
||||||
83
framework/reinsert/functions/fn_addCBASettings.sqf
Normal file
83
framework/reinsert/functions/fn_addCBASettings.sqf
Normal 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_maxWait), // variable
|
||||||
|
"TIME", // type
|
||||||
|
["Max Wait Before Global Notify", "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;
|
||||||
|
|
||||||
|
[
|
||||||
|
QGVAR(setting_pilotForcedCheckEnabled), // variable
|
||||||
|
"CHECKBOX", // type
|
||||||
|
["Force Queue Checks for Pilots", "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;
|
||||||
3
framework/reinsert/script_component.hpp
Normal file
3
framework/reinsert/script_component.hpp
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#define COMPONENT reinsert
|
||||||
|
#define COMPONENT_BEAUTIFIED Reinsertion
|
||||||
|
#include "../script_mod.hpp"
|
||||||
61
framework/reinsert/server/fn_addToQueue.sqf
Normal file
61
framework/reinsert/server/fn_addToQueue.sqf
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
params [
|
||||||
|
["_player", objNull, [objNull]],
|
||||||
|
["_base", objNull, [objNull]],
|
||||||
|
["_timeFiled", diag_tickTime, [25]]
|
||||||
|
];
|
||||||
|
|
||||||
|
if (!isServer) exitWith {
|
||||||
|
[
|
||||||
|
LEVEL_ERROR,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
"ATTEMPTED RUN ON CLIENT",
|
||||||
|
[
|
||||||
|
["player", _player],
|
||||||
|
["base", _base]
|
||||||
|
]
|
||||||
|
] call EFUNC(common,log);
|
||||||
|
["ATTEMPTED RUN ON CLIENT"] call BIS_fnc_error;
|
||||||
|
};
|
||||||
|
if (
|
||||||
|
isNull _player ||
|
||||||
|
isNull _base
|
||||||
|
) exitWith {
|
||||||
|
[
|
||||||
|
LEVEL_ERROR,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
"NULL PARAMETERS",
|
||||||
|
[
|
||||||
|
["player", _player],
|
||||||
|
["base", _base]
|
||||||
|
]
|
||||||
|
] call EFUNC(common,log);
|
||||||
|
["NULL PARAMETERS"] call BIS_fnc_error;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
private _maxRangeToReady = missionNamespace getVariable [QGVAR(setting_maxRangeToReady), 400];
|
||||||
|
// nearest base here is the same as the base sent
|
||||||
|
private _nearestBase = _base;
|
||||||
|
|
||||||
|
GVAR(reinsertionQueue) pushBackUnique [
|
||||||
|
_player, _base, _timeFiled
|
||||||
|
];
|
||||||
|
// broadcast new list to all machines
|
||||||
|
publicVariable QGVAR(reinsertionQueue);
|
||||||
|
|
||||||
|
// log to rpt
|
||||||
|
[
|
||||||
|
LEVEL_INFO,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
"PLAYER FILED REQUEST",
|
||||||
|
[_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);
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
if (!isServer) exitWith {};
|
if (!isServer) exitWith {};
|
||||||
|
|
||||||
// if at least 1 player in the queue has been waiting longer than the configured timeout, notify all players
|
// 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 _timeout = missionNamespace getVariable [QGVAR(setting_maxWait), 60*20]; // default 20 minutes
|
||||||
private _timeoutPlayers = milsim_reinsert_reinsertionQueue select {
|
private _timeoutPlayers = GVAR(reinsertionQueue) select {
|
||||||
_x params ["_player", "_base", "_timeFiled"];
|
_x params ["_player", "_base", "_timeFiled"];
|
||||||
alive (_player) &&
|
alive (_player) &&
|
||||||
(diag_tickTime - (_timeFiled)) > _timeout
|
(diag_tickTime - (_timeFiled)) > _timeout
|
||||||
@@ -10,10 +12,10 @@ private _timeoutPlayers = milsim_reinsert_reinsertionQueue select {
|
|||||||
if (count _timeoutPlayers > 0) then {
|
if (count _timeoutPlayers > 0) then {
|
||||||
// GLOBAL CBA NOTIFY
|
// GLOBAL CBA NOTIFY
|
||||||
private _playerLines = [["Players are still waiting for Re-insert!", 1.2, [1, 0.64, 0, 1]]];
|
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
|
// 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
|
// get unique base objects
|
||||||
private _basesWithPeople = _basesWithPeople arrayIntersect _basesWithPeople;
|
private _basesWithPeople = _basesWithPeople arrayIntersect _basesWithPeople;
|
||||||
|
|
||||||
@@ -21,7 +23,7 @@ if (count _timeoutPlayers > 0) then {
|
|||||||
private _thisBase = _x;
|
private _thisBase = _x;
|
||||||
|
|
||||||
// Add line for base name
|
// Add line for base name
|
||||||
_playerLines pushBack ([[_thisBase] call milsim_fnc_getNameOfBase, 1, [0,1,0,1]]);
|
_playerLines pushBack ([[_thisBase] call EFUNC(common,getNameOfBase), 1, [0,1,0,1]]);
|
||||||
|
|
||||||
// Get players under this base
|
// Get players under this base
|
||||||
private _thisBasePlayers = _timeoutPlayers select {_x#1 isEqualTo _thisBase};
|
private _thisBasePlayers = _timeoutPlayers select {_x#1 isEqualTo _thisBase};
|
||||||
@@ -35,36 +37,35 @@ if (count _timeoutPlayers > 0) then {
|
|||||||
{ // for each player under this base, add a line
|
{ // for each player under this base, add a line
|
||||||
_x params ["_player", "_base", "_timeFiled"];
|
_x params ["_player", "_base", "_timeFiled"];
|
||||||
// get the closest base to the player
|
// get the closest base to the player
|
||||||
private _nearestBase = [_player] call milsim_fnc_getNearestBase;
|
private _nearestBase = [_player] call EFUNC(common,getNearestBase);
|
||||||
|
|
||||||
// add player to array of players under bases
|
// add player to array of players under bases
|
||||||
_playerLines pushBack ([format [
|
_playerLines pushBack ([format [
|
||||||
"%1: %2 [%3]",
|
"%1: %2 [%3]",
|
||||||
groupID (group (_player)),
|
groupID (group (_player)),
|
||||||
name (_player),
|
name _player,
|
||||||
[diag_tickTime - (_timeFiled), "MM:SS"] call BIS_fnc_secondsToString
|
[diag_tickTime - (_timeFiled), "MM:SS"] call BIS_fnc_secondsToString
|
||||||
], 0.8, [0.8, 0.8, 0.8, 1]]);
|
], 0.8, [0.8, 0.8, 0.8, 1]]);
|
||||||
|
|
||||||
// log to rpt
|
// log to rpt
|
||||||
private _logParams = [
|
|
||||||
["filedAtBase", [_base] call milsim_fnc_getNameOfBase],
|
|
||||||
["filedAtBaseDistance", _player distance _base],
|
|
||||||
["closestBase", [_nearestBase] call milsim_fnc_getNameOfBase],
|
|
||||||
["closestBaseDistance", _player distance _nearestBase],
|
|
||||||
["maxDistanceSetting", _maxRangeToReady],
|
|
||||||
["inQueueDuration", diag_tickTime - _timeFiled]
|
|
||||||
];
|
|
||||||
_logParams = [_player, _logParams] call milsim_fnc_addPlayerInfoToArray;
|
|
||||||
[
|
[
|
||||||
"respawn_reinsertion",
|
LEVEL_WARNING,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
"PLAYER WAITING OVER TIMEOUT",
|
"PLAYER WAITING OVER TIMEOUT",
|
||||||
_logParams
|
[_player, [
|
||||||
] call milsim_fnc_log;
|
["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 _thisBasePlayers;
|
||||||
} forEach _basesWithPeople;
|
} forEach _basesWithPeople;
|
||||||
|
|
||||||
// SEND NOTIFY
|
// SEND NOTIFY
|
||||||
_playerLines remoteExec ["CBA_fnc_notify", [0, -2] select isDedicated];
|
_playerLines remoteExec ["CBA_fnc_notify", [0, -2] select isDedicated];
|
||||||
// RESET NOTIFICATION TIMER
|
// RESET NOTIFICATION TIMER
|
||||||
milsim_reinsert_reinsertionOverTimeoutLastNotificationTime = diag_tickTime;
|
GVAR(overTimeoutLastNotificationTime) = diag_tickTime;
|
||||||
};
|
};
|
||||||
@@ -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
|
// 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
|
// 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 {};
|
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
|
// register queue
|
||||||
milsim_reinsert_reinsertionQueue = [];
|
GVAR(reinsertionQueue) = [];
|
||||||
publicVariable "milsim_reinsert_reinsertionQueue";
|
publicVariable QGVAR(reinsertionQueue);
|
||||||
|
|
||||||
|
|
||||||
// server mission start time
|
// server mission start time
|
||||||
milsim_reinsert_missionStartServerTime = serverTime;
|
GVAR(missionStartServerTime) = serverTime;
|
||||||
|
|
||||||
// FILE REQUEST CBA HANDLER
|
// FILE REQUEST CBA HANDLER
|
||||||
["milsim_reinsert_fileReinsertRequest", {
|
[QGVAR(fileReinsertRequest), {
|
||||||
params ["_player", "_base"];
|
params ["_player", "_base"];
|
||||||
[_player, _base] call milsim_reinsert_fnc_addToQueue;
|
[_player, _base] call FUNC(addToQueue);
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
// REMOVE REQUEST CBA HANDLER
|
// REMOVE REQUEST CBA HANDLER
|
||||||
["milsim_reinsert_removeReinsertRequest", {
|
[QGVAR(removeReinsertRequest), {
|
||||||
params ["_player"];
|
params ["_player"];
|
||||||
[_player] call milsim_reinsert_fnc_removeFromQueue;
|
[_player] call FUNC(removeFromQueue);
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
|
|
||||||
// automated wait threshold timer
|
// automated wait threshold timer
|
||||||
milsim_reinsert_reinsertionOverTimeoutLastNotificationTime = 0;
|
GVAR(overTimeoutLastNotificationTime) = 0;
|
||||||
|
|
||||||
[{ // every 60 seconds
|
[{ // every 60 seconds
|
||||||
|
|
||||||
// validate queue
|
// validate queue
|
||||||
call milsim_reinsert_fnc_validateQueue;
|
call FUNC(validateQueue);
|
||||||
|
|
||||||
// check if last overTimeout notification was sent more than X minutes ago
|
// check if last overTimeout notification was sent more than X minutes ago
|
||||||
if (
|
if (
|
||||||
diag_tickTime - milsim_reinsert_reinsertionOverTimeoutLastNotificationTime > 60*5
|
diag_tickTime - GVAR(overTimeoutLastNotificationTime) > 60*5
|
||||||
) then {
|
) then {
|
||||||
// show global queue notification with any players that are over timeout
|
// show global queue notification with any players that are over timeout
|
||||||
call milsim_reinsert_fnc_globalShowQueue;
|
call FUNC(globalShowQueue);
|
||||||
};
|
};
|
||||||
|
|
||||||
}, 60] call CBA_fnc_addPerFrameHandler;
|
}, 60] call CBA_fnc_addPerFrameHandler;
|
||||||
|
|
||||||
|
[
|
||||||
|
LEVEL_DEBUG,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
"postInit complete",
|
||||||
|
[]
|
||||||
|
] call EFUNC(common,log);
|
||||||
60
framework/reinsert/server/fn_removeFromQueue.sqf
Normal file
60
framework/reinsert/server/fn_removeFromQueue.sqf
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
params [["_player", objNull, [objNull]]];
|
||||||
|
|
||||||
|
if (!isServer) exitWith {
|
||||||
|
[
|
||||||
|
LEVEL_ERROR,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
"ATTEMPTED RUN ON CLIENT",
|
||||||
|
[
|
||||||
|
["player", _player]
|
||||||
|
]
|
||||||
|
] call EFUNC(common,log);
|
||||||
|
};
|
||||||
|
if (isNull _player) exitWith {
|
||||||
|
[
|
||||||
|
LEVEL_ERROR,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
"NULL PARAMETERS",
|
||||||
|
[
|
||||||
|
["player", _player]
|
||||||
|
]
|
||||||
|
] call EFUNC(common,log);
|
||||||
|
};
|
||||||
|
|
||||||
|
// get entries for this player from queue
|
||||||
|
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 [QGVAR(setting_maxRangeToReady), 400];
|
||||||
|
|
||||||
|
// remove player from queue
|
||||||
|
GVAR(reinsertionQueue) = GVAR(reinsertionQueue) - _unitArrs;
|
||||||
|
// broadcast new list to all machines
|
||||||
|
publicVariable QGVAR(reinsertionQueue);
|
||||||
|
|
||||||
|
// sort _unitArrs by time in queue, descending, to get longest wait (if for some reason there's a duplicate)
|
||||||
|
[_unitArrs, [], {
|
||||||
|
_x#2
|
||||||
|
}, "DESCEND"] call BIS_fnc_sortBy;
|
||||||
|
|
||||||
|
// 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 EFUNC(common,getNearestBase);
|
||||||
|
// log to rpt
|
||||||
|
[
|
||||||
|
LEVEL_INFO,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
"PLAYER RESCINDED REQUEST",
|
||||||
|
[_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);
|
||||||
@@ -7,6 +7,8 @@
|
|||||||
Author: IndigoFox
|
Author: IndigoFox
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
if (not isRemoteExecuted) exitWith {
|
if (not isRemoteExecuted) exitWith {
|
||||||
diag_log text format ["[milsim] (respawn_reinsertion) SHOW QUEUE NOT REMOTE EXECUTED"];
|
diag_log text format ["[milsim] (respawn_reinsertion) SHOW QUEUE NOT REMOTE EXECUTED"];
|
||||||
};
|
};
|
||||||
@@ -25,16 +27,16 @@ if (isNull _userObject) exitWith {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// log to rpt
|
// log to rpt
|
||||||
private _logParams = [_userObject, []] call milsim_fnc_addPlayerInfoToArray;
|
|
||||||
[
|
[
|
||||||
"respawn_reinsertion",
|
LEVEL_INFO,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
"SHOW QUEUE REQUESTED",
|
"SHOW QUEUE REQUESTED",
|
||||||
_logParams
|
[_userObject] call EFUNC(common,addPlayerInfoToArray)
|
||||||
] call milsim_fnc_log;
|
] call EFUNC(common,log);
|
||||||
|
|
||||||
private _queue = missionNamespace getVariable ["milsim_reinsert_reinsertionQueue", []];
|
private _queue = missionNamespace getVariable [QGVAR(reinsertionQueue), []];
|
||||||
// get base objects from queue
|
// 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
|
// get unique base objects
|
||||||
private _basesWithPeople = _basesWithPeople arrayIntersect _basesWithPeople;
|
private _basesWithPeople = _basesWithPeople arrayIntersect _basesWithPeople;
|
||||||
|
|
||||||
@@ -48,7 +50,7 @@ if (count _basesWithPeople isEqualTo 0) then {
|
|||||||
// forEach _basesWithPeople
|
// forEach _basesWithPeople
|
||||||
{
|
{
|
||||||
private _thisBase = _x;
|
private _thisBase = _x;
|
||||||
private _baseName = [_thisBase] call milsim_fnc_getNameOfBase;
|
private _baseName = [_thisBase] call EFUNC(common,getNameOfBase);
|
||||||
|
|
||||||
// generate player lines for this base
|
// generate player lines for this base
|
||||||
private _playerLines = _queue select {
|
private _playerLines = _queue select {
|
||||||
57
framework/reinsert/server/fn_validateQueue.sqf
Normal file
57
framework/reinsert/server/fn_validateQueue.sqf
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
// 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 [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 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
|
||||||
|
[
|
||||||
|
LEVEL_INFO,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
"PLAYER DEQUEUED AUTOMATICALLY",
|
||||||
|
[_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
|
||||||
|
};
|
||||||
|
|
||||||
|
// include player in updated queue, and update their location to nearest base
|
||||||
|
_stillValid pushBackUnique [_player, _nearestBase, _timeFiled];
|
||||||
|
// if player's base has changed, log to rpt
|
||||||
|
if (_base != _nearestBase) then {
|
||||||
|
[
|
||||||
|
LEVEL_INFO,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
"PLAYER BASE WAS UPDATED",
|
||||||
|
[_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 GVAR(reinsertionQueue);
|
||||||
|
|
||||||
|
// broadcast new list to all machines
|
||||||
|
GVAR(reinsertionQueue) = _stillValid;
|
||||||
|
publicVariable QGVAR(reinsertionQueue);
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
// adds a scroll wheel action to all arsenal boxes to spawn different supply crate types
|
||||||
|
|
||||||
|
private _arsenalBoxClassName = "Land_PaperBox_open_full_F";
|
||||||
|
|
||||||
|
// get all instances of the arsenal item
|
||||||
|
private _arsenalBoxes = (allMissionObjects _arsenalBoxClassName) select {
|
||||||
|
// only select the ones that already have user actions attached
|
||||||
|
count (actionIDs _x) > 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
private _supplyCratesCfg = call FUNC(getSupplyCratesCfg);
|
||||||
|
private _supplyCrateTypesCfgs = _supplyCratesCfg call BIS_fnc_returnChildren;
|
||||||
|
|
||||||
|
{
|
||||||
|
// add scroll wheel action to spawn different supply box types
|
||||||
|
private _arsenalBox = _x;
|
||||||
|
|
||||||
|
// always remove old actions if they exist
|
||||||
|
private _actionIDs = _arsenalBox getVariable [QGVAR(supplyCrateActionIDs), []];
|
||||||
|
{
|
||||||
|
_arsenalBox removeAction _x;
|
||||||
|
} forEach _actionIDs;
|
||||||
|
_arsenalBox setVariable [QGVAR(supplyCrateActionIDs), []];
|
||||||
|
|
||||||
|
|
||||||
|
// if setting disabled, skip adding actions
|
||||||
|
if (not (
|
||||||
|
[QGVAR(setting_allowSupplyBoxScrollWheelSpawning)] call CBA_settings_fnc_get
|
||||||
|
)) then {continue};
|
||||||
|
|
||||||
|
|
||||||
|
{ // add an action for each supply crate type
|
||||||
|
private _cfg = _x;
|
||||||
|
private _supplyCrateDisplayName = (_cfg >> "displayName") call BIS_fnc_getCfgData;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private _actionID = _arsenalBox addAction [format ["<t color='#ffffff'>Spawn %1</t>", _supplyCrateDisplayName], {
|
||||||
|
params ["_target", "_caller", "_actionId", "_arguments"];
|
||||||
|
_arguments params ["_supplyCrateCfg"];
|
||||||
|
[
|
||||||
|
objNull,
|
||||||
|
configName _supplyCrateCfg,
|
||||||
|
getPos _target
|
||||||
|
] call FUNC(createBox);
|
||||||
|
// log action use in server RPT
|
||||||
|
[
|
||||||
|
LEVEL_INFO,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
"Supply crate spawned",
|
||||||
|
[player, [
|
||||||
|
["supplyCrateType", _supplyCrateDisplayName],
|
||||||
|
["position", getPos _target]
|
||||||
|
]] call EFUNC(common,addPlayerInfoToArray)
|
||||||
|
] remoteExec [QEFUNC(common,log), 2];
|
||||||
|
}, [_cfg], 0, false, true, "", ""];
|
||||||
|
(_arsenalBox getVariable [QGVAR(supplyCrateActionIDs), []]) pushBack _actionID;
|
||||||
|
} forEach _supplyCrateTypesCfgs;
|
||||||
|
} forEach _arsenalBoxes;
|
||||||
29
framework/resupply/functions/fn_addCBASettings.sqf
Normal file
29
framework/resupply/functions/fn_addCBASettings.sqf
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
[
|
||||||
|
QGVAR(setting_allowSupplyBoxScrollWheelSpawning), // variable
|
||||||
|
"CHECKBOX", // type
|
||||||
|
["Allow Spawning Boxes from Arsenal Box", "If true, adds scroll wheel options to arsenal boxes to spawn supply boxes"], // title
|
||||||
|
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||||
|
false, // default value
|
||||||
|
true, // global setting
|
||||||
|
{
|
||||||
|
params ["_value"];
|
||||||
|
[
|
||||||
|
QGVAR(setting_allowSupplyBoxScrollWheelSpawning),
|
||||||
|
_value
|
||||||
|
] call EFUNC(common,logSettingChanged);
|
||||||
|
|
||||||
|
if (_value && hasInterface && time > 0) then {
|
||||||
|
[] call FUNC(addArsenalObjectSpawnBoxActions);
|
||||||
|
};
|
||||||
|
},
|
||||||
|
true // requires mission restart
|
||||||
|
] call CBA_fnc_addSetting;
|
||||||
|
|
||||||
|
[
|
||||||
|
LEVEL_INFO,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
"CREATED SETTINGS",
|
||||||
|
[]
|
||||||
|
] call EFUNC(common,log);
|
||||||
@@ -28,6 +28,7 @@
|
|||||||
]];
|
]];
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
params [
|
params [
|
||||||
["_box", objNull, [objNull]],
|
["_box", objNull, [objNull]],
|
||||||
@@ -36,7 +37,7 @@ params [
|
|||||||
];
|
];
|
||||||
|
|
||||||
// get defs class
|
// get defs class
|
||||||
private _supplyCratesCfg = call milsim_resupply_fnc_getSupplyCratesCfg;
|
private _supplyCratesCfg = call FUNC(getSupplyCratesCfg);
|
||||||
if (!isClass _supplyCratesCfg) exitWith {
|
if (!isClass _supplyCratesCfg) exitWith {
|
||||||
["Resupply Boxes: Failed to load crate definitions, possibly a bad edit?"] call BIS_fnc_error;
|
["Resupply Boxes: Failed to load crate definitions, possibly a bad edit?"] call BIS_fnc_error;
|
||||||
objNull;
|
objNull;
|
||||||
2
framework/resupply/functions/fn_getSupplyCratesCfg.sqf
Normal file
2
framework/resupply/functions/fn_getSupplyCratesCfg.sqf
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
(missionConfigFile >> "SupplyCrates");
|
||||||
13
framework/resupply/functions/fn_initClient.sqf
Normal file
13
framework/resupply/functions/fn_initClient.sqf
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
if (!hasInterface) exitWith {};
|
||||||
|
|
||||||
|
call FUNC(addArsenalObjectSpawnBoxActions);
|
||||||
|
|
||||||
|
[
|
||||||
|
LEVEL_DEBUG,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
"postInit complete",
|
||||||
|
[]
|
||||||
|
] call EFUNC(common,log);
|
||||||
|
localNamespace setVariable [QGVAR(complete), true];
|
||||||
3
framework/resupply/script_component.hpp
Normal file
3
framework/resupply/script_component.hpp
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#define COMPONENT resupply
|
||||||
|
#define COMPONENT_BEAUTIFIED Resupply
|
||||||
|
#include "../script_mod.hpp"
|
||||||
11
framework/script_macros.hpp
Normal file
11
framework/script_macros.hpp
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
// all text before cba include
|
||||||
|
#define SETTINGS_GROUP_NAME 17th Battalion
|
||||||
|
#define MODULE_CATEGORY_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"
|
||||||
17
framework/script_mod.hpp
Normal file
17
framework/script_mod.hpp
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#define PREFIX milsim
|
||||||
|
|
||||||
|
#include "script_version.hpp"
|
||||||
|
|
||||||
|
#define VERSION MAJOR.MINOR.PATCHLVL
|
||||||
|
#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"
|
||||||
4
framework/script_version.hpp
Normal file
4
framework/script_version.hpp
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#define MAJOR 3
|
||||||
|
#define MINOR 2
|
||||||
|
#define PATCHLVL 1
|
||||||
|
#define BUILD 0
|
||||||
138
framework/triageIcons/functions/fn_addCBASettings.sqf
Normal file
138
framework/triageIcons/functions/fn_addCBASettings.sqf
Normal file
@@ -0,0 +1,138 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
//---------------------
|
||||||
|
// Medical Overlay
|
||||||
|
//---------------------
|
||||||
|
|
||||||
|
[
|
||||||
|
QGVAR(setting_enabled), // variable
|
||||||
|
"CHECKBOX", // type
|
||||||
|
["Enable 3D Triage Card State", "For players with medic perms, a colored dot will be shown over unconscious units within Xm indicating current ACE Triage State"], // title
|
||||||
|
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||||
|
true, // default value
|
||||||
|
false, // isGlobal
|
||||||
|
{
|
||||||
|
params ["_value"];
|
||||||
|
[
|
||||||
|
QGVAR(setting_enabled),
|
||||||
|
_value
|
||||||
|
] call EFUNC(common,logSettingChanged);
|
||||||
|
|
||||||
|
call FUNC(addGetEntitiesPFH);
|
||||||
|
call FUNC(addDrawIconsPFH);
|
||||||
|
}
|
||||||
|
] call CBA_fnc_addSetting;
|
||||||
|
|
||||||
|
[
|
||||||
|
QGVAR(setting_drawRange), // variable
|
||||||
|
"LIST", // type
|
||||||
|
["Range To Draw Icons", "Determines range at which dots are visible"], // title
|
||||||
|
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||||
|
[[2, 4, 6, 8, 10], ["2", "4", "6", "8", "10"], 4], // option values, option labels, default index
|
||||||
|
false, // isGlobal
|
||||||
|
{
|
||||||
|
params ["_value"];
|
||||||
|
[
|
||||||
|
QGVAR(setting_drawRange),
|
||||||
|
_value
|
||||||
|
] call EFUNC(common,logSettingChanged);
|
||||||
|
}
|
||||||
|
] call CBA_fnc_addSetting;
|
||||||
|
|
||||||
|
[
|
||||||
|
QGVAR(setting_colorMinimal), // variable
|
||||||
|
"COLOR", // type
|
||||||
|
["Minimal State Color", "Color of the dot for MINIMAL state"], // title
|
||||||
|
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||||
|
[0, 0.5, 0], // default value
|
||||||
|
false, // isGlobal
|
||||||
|
{
|
||||||
|
params ["_value"];
|
||||||
|
[
|
||||||
|
QGVAR(setting_colorMinimal),
|
||||||
|
str _value
|
||||||
|
] call EFUNC(common,logSettingChanged);
|
||||||
|
|
||||||
|
call FUNC(updateColors);
|
||||||
|
}
|
||||||
|
] call CBA_fnc_addSetting;
|
||||||
|
|
||||||
|
[
|
||||||
|
QGVAR(setting_colorDelayed), // variable
|
||||||
|
"COLOR", // type
|
||||||
|
["Delayed State Color", "Color of the dot for DELAYED state"], // title
|
||||||
|
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||||
|
[1, 0.84, 0], // default value
|
||||||
|
false, // isGlobal
|
||||||
|
{
|
||||||
|
params ["_value"];
|
||||||
|
[
|
||||||
|
QGVAR(setting_colorDelayed),
|
||||||
|
str _value
|
||||||
|
] call EFUNC(common,logSettingChanged);
|
||||||
|
|
||||||
|
call FUNC(updateColors);
|
||||||
|
}
|
||||||
|
] call CBA_fnc_addSetting;
|
||||||
|
|
||||||
|
[
|
||||||
|
QGVAR(setting_colorImmediate), // variable
|
||||||
|
"COLOR", // type
|
||||||
|
["Immediate State Color", "Color of the dot for IMMEDIATE state"], // title
|
||||||
|
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||||
|
[1, 0, 0], // default value
|
||||||
|
false, // isGlobal
|
||||||
|
{
|
||||||
|
params ["_value"];
|
||||||
|
[
|
||||||
|
QGVAR(setting_colorImmediate),
|
||||||
|
str _value
|
||||||
|
] call EFUNC(common,logSettingChanged);
|
||||||
|
|
||||||
|
call FUNC(updateColors);
|
||||||
|
}
|
||||||
|
] call CBA_fnc_addSetting;
|
||||||
|
|
||||||
|
[
|
||||||
|
QGVAR(setting_colorDeceased), // variable
|
||||||
|
"COLOR", // type
|
||||||
|
["Deceased State Color", "Color of the dot for DECEASED state"], // title
|
||||||
|
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||||
|
[0.15, 0.15, 0.15], // default value
|
||||||
|
false, // isGlobal
|
||||||
|
{
|
||||||
|
params ["_value"];
|
||||||
|
[
|
||||||
|
QGVAR(setting_colorDeceased),
|
||||||
|
str _value
|
||||||
|
] call EFUNC(common,logSettingChanged);
|
||||||
|
|
||||||
|
call FUNC(updateColors);
|
||||||
|
}
|
||||||
|
] call CBA_fnc_addSetting;
|
||||||
|
|
||||||
|
[
|
||||||
|
QGVAR(setting_colorNone), // variable
|
||||||
|
"COLOR", // type
|
||||||
|
["None State Color", "Color of the dot for NONE state, when a card is not set"], // title
|
||||||
|
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||||
|
[0.5, 0.5, 0.5], // default value
|
||||||
|
false, // isGlobal
|
||||||
|
{
|
||||||
|
params ["_value"];
|
||||||
|
[
|
||||||
|
QGVAR(setting_colorNone),
|
||||||
|
str _value
|
||||||
|
] call EFUNC(common,logSettingChanged);
|
||||||
|
|
||||||
|
call FUNC(updateColors);
|
||||||
|
}
|
||||||
|
] call CBA_fnc_addSetting;
|
||||||
|
|
||||||
|
|
||||||
|
[
|
||||||
|
LEVEL_INFO,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
"CREATED SETTINGS",
|
||||||
|
[]
|
||||||
|
] call EFUNC(common,log);
|
||||||
62
framework/triageIcons/functions/fn_addDrawIconsPFH.sqf
Normal file
62
framework/triageIcons/functions/fn_addDrawIconsPFH.sqf
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
milsim_fnc_addMedicalOverlayPFH
|
||||||
|
|
||||||
|
Author: IndigoFox
|
||||||
|
|
||||||
|
Description:
|
||||||
|
Affects players with medical permissions. Will see a 3D colored dot over nearby (5-10m)
|
||||||
|
unconscious players who are not in a vehicle
|
||||||
|
which indicates their current ACE Triage Card status.
|
||||||
|
Designed to increase efficiency of CCPs.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
// Per-frame handler to draw icons
|
||||||
|
// cleanup
|
||||||
|
if (!isNil QGVAR(drawIconsPfh)) then {
|
||||||
|
[GVAR(drawIconsPfh)] call CBA_fnc_removePerFrameHandler;
|
||||||
|
};
|
||||||
|
// add pfh
|
||||||
|
GVAR(drawIconsPfh) = [{
|
||||||
|
// if disabled, skip processing
|
||||||
|
if (!GVAR(setting_enabled)) exitWith {false};
|
||||||
|
// if no targets, skip processing
|
||||||
|
if (count GVAR(drawTargets) == 0) exitWith {false};
|
||||||
|
// if the player doesn't have medical perms, skip processing
|
||||||
|
if !([player] call ace_medical_treatment_fnc_isMedic) exitWith {false};
|
||||||
|
{
|
||||||
|
private _unit = _x;
|
||||||
|
// distance within X meters
|
||||||
|
if (player distance _unit > GVAR(setting_drawRange)) then {continue};
|
||||||
|
// check unit not null, not conscious, and not in a vehicle
|
||||||
|
if (
|
||||||
|
!(_unit getVariable ["ACE_isUnconscious", false]) ||
|
||||||
|
!isNull (objectParent _unit)
|
||||||
|
) then {continue};
|
||||||
|
|
||||||
|
// color based on triage level
|
||||||
|
private _triageLevel = _unit getVariable ["ace_medical_triageLevel", 4];
|
||||||
|
if (_triageLevel == -1) then {continue};
|
||||||
|
private _color = GVAR(colors) select (_triageLevel - 1);
|
||||||
|
_color set [3, 0.9]; // set alpha
|
||||||
|
// draw position, slightly above the prone unit
|
||||||
|
private _drawPos = (visiblePosition _unit) vectorAdd [0, 0, 0.5];
|
||||||
|
// draw icon
|
||||||
|
drawIcon3D [
|
||||||
|
"\A3\ui_f\data\map\markers\military\dot_CA.paa", // icon texture
|
||||||
|
_color, // color
|
||||||
|
_drawPos, // position AGL
|
||||||
|
1, // width
|
||||||
|
1, // height
|
||||||
|
0, // angle
|
||||||
|
"", // text
|
||||||
|
true // outline
|
||||||
|
// further params optional, omitted
|
||||||
|
];
|
||||||
|
} forEach GVAR(drawTargets);
|
||||||
|
}, 0, []] call CBA_fnc_addPerFrameHandler;
|
||||||
|
|
||||||
18
framework/triageIcons/functions/fn_addGetEntitiesPFH.sqf
Normal file
18
framework/triageIcons/functions/fn_addGetEntitiesPFH.sqf
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
// subroutine to gather nearest 50 units every 5 seconds and store in GVAR(drawTargets)
|
||||||
|
// cleanup
|
||||||
|
if (!isNil QGVAR(getEntitiesPFH)) then {
|
||||||
|
[GVAR(getEntitiesPFH)] call CBA_fnc_removePerFrameHandler;
|
||||||
|
};
|
||||||
|
// add pfh
|
||||||
|
GVAR(getEntitiesPFH) = [{
|
||||||
|
GVAR(drawTargets) = (
|
||||||
|
(allUnits + allDeadMen) select {
|
||||||
|
_x isKindOf "CAManBase" &&
|
||||||
|
player distance _x < 50 &&
|
||||||
|
!isNull _x &&
|
||||||
|
player isNotEqualTo _x
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}, 10] call CBA_fnc_addPerFrameHandler;
|
||||||
12
framework/triageIcons/functions/fn_initClient.sqf
Normal file
12
framework/triageIcons/functions/fn_initClient.sqf
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
// List of units to draw icons for
|
||||||
|
GVAR(drawTargets) = [];
|
||||||
|
|
||||||
|
[
|
||||||
|
LEVEL_DEBUG,
|
||||||
|
QUOTE(COMPONENT),
|
||||||
|
"postInit complete",
|
||||||
|
[]
|
||||||
|
] call EFUNC(common,log);
|
||||||
|
localNamespace setVariable [QGVAR(complete), true];
|
||||||
18
framework/triageIcons/functions/fn_updateColors.sqf
Normal file
18
framework/triageIcons/functions/fn_updateColors.sqf
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#include "..\script_component.hpp"
|
||||||
|
|
||||||
|
// ACE Triage colors, for consistency across UIs and functions
|
||||||
|
// GVAR(colors) = [
|
||||||
|
// (([QGVAR(setting_colorMinimal)] call CBA_settings_fnc_get) + 0.9), // TRIAGE_COLOR_MINIMAL
|
||||||
|
// (([QGVAR(setting_colorDelayed)] call CBA_settings_fnc_get) + 0.9), // TRIAGE_COLOR_DELAYED
|
||||||
|
// (([QGVAR(setting_colorImmediate)] call CBA_settings_fnc_get) + 0.9), // TRIAGE_COLOR_IMMEDIATE
|
||||||
|
// (([QGVAR(setting_colorDeceased)] call CBA_settings_fnc_get) + 0.9), // TRIAGE_COLOR_DECEASED
|
||||||
|
// (([QGVAR(setting_colorNone)] call CBA_settings_fnc_get) + 0) // TRIAGE_COLOR_NONE
|
||||||
|
// ];
|
||||||
|
|
||||||
|
GVAR(colors) = [
|
||||||
|
([QGVAR(setting_colorMinimal)] call CBA_settings_fnc_get), // TRIAGE_COLOR_MINIMAL
|
||||||
|
([QGVAR(setting_colorDelayed)] call CBA_settings_fnc_get), // TRIAGE_COLOR_DELAYED
|
||||||
|
([QGVAR(setting_colorImmediate)] call CBA_settings_fnc_get), // TRIAGE_COLOR_IMMEDIATE
|
||||||
|
([QGVAR(setting_colorDeceased)] call CBA_settings_fnc_get), // TRIAGE_COLOR_DECEASED
|
||||||
|
([QGVAR(setting_colorNone)] call CBA_settings_fnc_get) // TRIAGE_COLOR_NONE
|
||||||
|
];
|
||||||
3
framework/triageIcons/script_component.hpp
Normal file
3
framework/triageIcons/script_component.hpp
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#define COMPONENT triageIcons
|
||||||
|
#define COMPONENT_BEAUTIFIED Triage Icons
|
||||||
|
#include "../script_mod.hpp"
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user