change root level folder name to framework, update resupply+vehicleflags
tested locally
This commit is contained in:
149
framework/CfgFunctions.hpp
Normal file
149
framework/CfgFunctions.hpp
Normal file
@@ -0,0 +1,149 @@
|
||||
class milsim
|
||||
{
|
||||
class settings
|
||||
{
|
||||
file = "framework\settings";
|
||||
class setDefaults { postInit = 1; };
|
||||
class addCBASettings { postInit = 1; };
|
||||
class addAARChatHandler { postInit = 1; };
|
||||
class addRespawnChatHandler { postInit = 1; };
|
||||
};
|
||||
|
||||
class init
|
||||
{
|
||||
file = "framework\init";
|
||||
class initServer { postInit = 1;}; //needs refactor
|
||||
class initPlayerLocal { postInit = 1;};
|
||||
};
|
||||
|
||||
class fbcb2 {
|
||||
file = "framework\fbcb2";
|
||||
class initFBCB2 { postInit = 1; };
|
||||
class processFBCB2RadioFrequencies {};
|
||||
class processFBCB2SmokeColors {};
|
||||
class processFBCB2Environment {};
|
||||
class hintFBCB2AssetStatus {};
|
||||
};
|
||||
class fbcb2_util {
|
||||
file = "framework\fbcb2\util";
|
||||
class createOrUpdateDiaryRecord {};
|
||||
};
|
||||
class fbcb2_radioFrequencies {
|
||||
file = "framework\fbcb2\radioFrequencies";
|
||||
class formatRadioElementForDiary {};
|
||||
class generateElementFrequencyRecordText {};
|
||||
};
|
||||
|
||||
class client {
|
||||
file = "framework\client";
|
||||
class addZenModules { postInit = 1; };
|
||||
class addDNI_PlayerFPS { postInit = 1; }; // needs refactor
|
||||
class bindEventHandlers { postInit = 1; };
|
||||
class bindVehicleActions { postInit = 1; };
|
||||
class addClientStatsPFH {};
|
||||
class addMedicalOverlayPFH { postInit = 1; };
|
||||
class calculateClientStats {};
|
||||
class bindEmptyGroupGarbageCleanup { postInit = 1; };
|
||||
};
|
||||
|
||||
class server {
|
||||
file = "framework\server";
|
||||
class addServerStatsPFH {};
|
||||
class calculateServerStats {};
|
||||
class logPlayerInventory {};
|
||||
};
|
||||
|
||||
class 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 milsim_util {
|
||||
class functions {
|
||||
file = "framework\util";
|
||||
class logMissionInfo { postInit = 1; };
|
||||
class addPlayerInfoToArray {};
|
||||
class log {};
|
||||
class padString {};
|
||||
class recurseSubclasses {};
|
||||
class getBattalionCfg {};
|
||||
class getNameOfBase {};
|
||||
class getNearestBase {};
|
||||
};
|
||||
};
|
||||
|
||||
class milsim_resupply {
|
||||
class functions {
|
||||
file = "framework\resupply\functions";
|
||||
class init {postInit=1;};
|
||||
class createBox {};
|
||||
class getSupplyCratesCfg {};
|
||||
class addArsenalObjectSpawnBoxActions {};
|
||||
class addCBASettings {postInit=1;};
|
||||
};
|
||||
};
|
||||
|
||||
class milsim_fbcb2_assets {
|
||||
class functions {
|
||||
file = "framework\fbcb2\assets";
|
||||
class updateAssetDiary {};
|
||||
class removeAssetDiaryRecords {};
|
||||
class getMagsForWeapon {};
|
||||
class getWeaponry {};
|
||||
class getInventory {};
|
||||
class getVehicleData {};
|
||||
};
|
||||
class assetsByBase {
|
||||
file = "framework\fbcb2\assets\byBase";
|
||||
class getAssetsByBase {};
|
||||
class getStartingAssetsByBase {};
|
||||
class updateAssetsByBase {};
|
||||
};
|
||||
class markers {
|
||||
file = "framework\fbcb2\assets\markers";
|
||||
class showMarkersOnMap {};
|
||||
class removeMarkersOnMap {};
|
||||
};
|
||||
};
|
||||
|
||||
class milsim_vehicleFlags {
|
||||
class functions {
|
||||
file = "framework\vehicleFlags\functions";
|
||||
class init {postInit=1;};
|
||||
class getActionsFlagCategories {};
|
||||
class getVehicleFlagsCfg {};
|
||||
class isClassExcluded {};
|
||||
};
|
||||
};
|
||||
|
||||
class milsim_reinsert {
|
||||
class server {
|
||||
file = "framework\reinsert\server";
|
||||
class initServer { postInit = 1; };
|
||||
class addToQueue {};
|
||||
class globalShowQueue {};
|
||||
class removeFromQueue {};
|
||||
class returnReinsertQueueNotification {};
|
||||
class validateQueue {};
|
||||
};
|
||||
class client {
|
||||
file = "framework\reinsert\client";
|
||||
class initClient { postInit = 1; };
|
||||
class addAceSelfActions {};
|
||||
class addCheckQueueSelfAction {};
|
||||
class requestShowQueue {};
|
||||
};
|
||||
};
|
||||
101
framework/ambience/fn_flakEH.sqf
Normal file
101
framework/ambience/fn_flakEH.sqf
Normal file
@@ -0,0 +1,101 @@
|
||||
params [
|
||||
["_event", [], []],
|
||||
["_maximumDistance", 2000, [0]],
|
||||
["_minimumAltitude", 0, [0]],
|
||||
["_primaryTurret", 0, [0]],
|
||||
["_fullAmmoCount", 2000, [0]],
|
||||
["_flakRoundsEvery", 2, [0]],
|
||||
["_speedDispersion", 20, [0]],
|
||||
["_distanceDispersion", 30, [0]]
|
||||
];
|
||||
|
||||
// diag_log "[MILSIM] (ambience) flakEH running";
|
||||
// diag_log text format["[MILSIM] (ambience) flakEH event: %1", _event];
|
||||
|
||||
_unit = _event select 0;
|
||||
// diag_log text format["[MILSIM] (ambience) flahEH vehicle: %1", _unit];
|
||||
|
||||
_projectile = _event select 6;
|
||||
// diag_log text format["[MILSIM] (ambience) flakEH projectile in flight: %1", _projectile];
|
||||
|
||||
deleteVehicle _projectile;
|
||||
// diag_log text "[MILSIM] (ambience) flakEH projectile deleted");
|
||||
|
||||
// diag_log text format["[MILSIM] (ambience) flakEH primary turret: %1", _unit weaponsTurret [0] select _primaryTurret];
|
||||
|
||||
_weapon = _unit weaponsTurret [0] select _primaryTurret;
|
||||
|
||||
_munitionConversionRate = _fullAmmoCount - _flakRoundsEvery;
|
||||
|
||||
// diag_log text format["[MILSIM] (ambience) flakEH munition count: %1", _unit ammo _weapon];
|
||||
// diag_log text format["[MILSIM] (ambience) flakEH munition replacement at: %1", _munitionConversionRate];
|
||||
|
||||
if (_unit ammo _weapon < _munitionConversionRate) then {
|
||||
_unit setAmmo [_weapon, _fullAmmoCount];
|
||||
// diag_log text format["[MILSIM] (ambience) flakEH replacing ammo count to: %1", _fullAmmoCount];
|
||||
|
||||
_targetPosition = [];
|
||||
|
||||
_target = 0;
|
||||
|
||||
if (isPlayer (assignedGunner _unit)) then {
|
||||
|
||||
_target = cursorTarget;
|
||||
|
||||
if (_unit distance _target < _maximumDistance) then {
|
||||
_targetPosition = getPos _target;
|
||||
};
|
||||
|
||||
} else {
|
||||
_possibleTargets = _unit nearTargets _maximumDistance;
|
||||
diag_log text format["ai has %1 possible targetting solutions", count _possibleTargets];
|
||||
|
||||
if ((count _possibleTargets) > 0) then {
|
||||
|
||||
_i = 0;
|
||||
_hold = 0;
|
||||
|
||||
{
|
||||
_i = _unit aimedAtTarget [_x select 4, _weapon];
|
||||
if (_i > _hold && (_x select 3) > 0) then {
|
||||
_target = _x select 4;
|
||||
diag_log text format["setting target to %1", _target];
|
||||
_targetPosition = _x select 0;
|
||||
_hold = _i;
|
||||
};
|
||||
} forEach _possibleTargets;
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
// diag_log text format["[MILSIM] (ambience) flakEH target coordinates: %1", _targetPosition];
|
||||
|
||||
if ((count _targetPosition) > 0) then {
|
||||
// diag_log text "[MILSIM] (ambience) flakEH calculating new projectile placement";
|
||||
|
||||
_targetX = _targetPosition select 0;
|
||||
_targetY = _targetPosition select 1;
|
||||
_targetZ = _targetPosition select 2;
|
||||
|
||||
// diag_log text format["[MILSIM] (ambience) flakEH checking target altitude: %1", _targetZ];
|
||||
|
||||
if (_targetZ > _minimumAltitude) then {
|
||||
// diag_log text "[MILSIM] (ambience) flakEH target is above minimum height, proceeding";
|
||||
|
||||
if !(lineIntersects [getPos _unit, _targetPosition, _unit, _target]) then {
|
||||
|
||||
// diag_log text "[MILSIM] (ambience) flakEH intersection calculated";
|
||||
|
||||
_flakDistance = ((speed _target * 0.8) * (_speedDispersion / 100)) + ((_unit distance _target) * (_distanceDispersion / 500));
|
||||
|
||||
_distanceX = ((random (_flakDistance * 2)) - _flakDistance) + _targetX;
|
||||
_distanceY = ((random (_flakDistance * 2)) - _flakDistance) + _targetY;
|
||||
_distanceZ = ((random (_flakDistance * 2)) - _flakDistance) + _targetZ;
|
||||
// diag_log text format["[MILSIM] (ambience) flakEH target is distance: %1 / distance2D %2 from me, creating munition distance %3, distance2D %4 from me", _unit distance _targetPosition, _unit distance2D _targetPosition, _unit distance [_distanceX, _distanceY, _distanceZ], _unit distance2D [_distanceX, _distanceY, _distanceZ]];
|
||||
_flak = createVehicle ["SmallSecondary", [_distanceX, _distanceY, _distanceZ], [], 0, "CAN_COLLIDE"];
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
81
framework/ambience/fn_flakInitVehicle.sqf
Normal file
81
framework/ambience/fn_flakInitVehicle.sqf
Normal file
@@ -0,0 +1,81 @@
|
||||
params [
|
||||
["_unit", objNull, [objNull]],
|
||||
["_maximumDistance", 2000, [0]],
|
||||
["_minimumAltitude", 0, [0]],
|
||||
["_flakRoundsEvery", 2, [0]],
|
||||
["_speedDispersion", 20, [0]],
|
||||
["_distanceDispersion", 30, [0]],
|
||||
["_removeMissiles", true, [true]]
|
||||
];
|
||||
|
||||
diag_log text "[MILSIM] (ambience) initializing flak v18";
|
||||
|
||||
_primaryTurret = objNull;
|
||||
|
||||
if (_removeMissiles) then {
|
||||
|
||||
diag_log text "[MILSIM] (ambience) removing missiles";
|
||||
|
||||
_magazines = magazinesAllTurrets _unit;
|
||||
|
||||
{
|
||||
_magazine = _x select 0;
|
||||
diag_log text format["[MILSIM] (ambience) checking: %1", _magazine];
|
||||
|
||||
_ammo = gettext( configfile >> "CfgMagazines" >> _magazine >> "ammo");
|
||||
diag_log text format["[MILSIM] (ambience) ammo: %1", _ammo];
|
||||
|
||||
_type = gettext(configFile >> "CfgAmmo" >> _ammo >> "simulation");
|
||||
diag_log text format["[MILSIM] (ambience) ammo type: %1", _type];
|
||||
|
||||
if (_type == "shotMissile") then {
|
||||
_unit removeMagazinesTurret [_magazine, [0]];
|
||||
diag_log text format["[MILSIM] (ambience) removing ammo: %1", _ammo];
|
||||
};
|
||||
|
||||
if ((_type == "shotBullet") && (_primaryTurret isEqualTo objNull)) then {
|
||||
_primaryTurret = _forEachIndex;
|
||||
diag_log text format["[MILSIM] (ambience) found primary turret: %1", _unit weaponsTurret [0] select _primaryTurret];
|
||||
};
|
||||
|
||||
} foreach _magazines;
|
||||
|
||||
};
|
||||
|
||||
_weapon = _unit weaponsTurret [0] select _primaryTurret;
|
||||
|
||||
_fullAmmoCount = _unit ammo _weapon;
|
||||
|
||||
|
||||
_unit setVariable["feh_maximumDistance", _maximumDistance];
|
||||
_unit setVariable["feh_minimumAltitude", _minimumAltitude];
|
||||
_unit setVariable["feh_primaryTurret", _primaryTurret];
|
||||
_unit setVariable["feh_fullAmmoCount", _fullAmmoCount];
|
||||
_unit setVariable["feh_flakRoundsEvery", _flakRoundsEvery];
|
||||
_unit setVariable["feh_speedDispersion", _speedDispersion];
|
||||
_unit setVariable["feh_distanceDispersion", _distanceDispersion];
|
||||
|
||||
diag_log text format [
|
||||
"[MILSIM] (ambience) {[_this, maximumDistance: %1, minimumAltitude: %2, primaryTurret: %3, fullAmmoCount: %4, flakRoundsEvery: %5, speedDispersion: %6, distanceDispersion: %7] call milsim_fnc_flakEH;}",
|
||||
_maximumDistance,
|
||||
_minimumAltitude,
|
||||
_primaryTurret,
|
||||
_fullAmmoCount,
|
||||
_flakRoundsEvery,
|
||||
_speedDispersion,
|
||||
_distanceDispersion
|
||||
];
|
||||
|
||||
|
||||
_unit addEventHandler ["Fired",
|
||||
format[
|
||||
"[_this, %1, %2, %3, %4, %5, %6, %7] call milsim_fnc_flakEH",
|
||||
_maximumDistance,
|
||||
_minimumAltitude,
|
||||
_primaryTurret,
|
||||
_fullAmmoCount,
|
||||
_flakRoundsEvery,
|
||||
_speedDispersion,
|
||||
_distanceDispersion
|
||||
]
|
||||
];
|
||||
18
framework/client/fn_addClientStatsPFH.sqf
Normal file
18
framework/client/fn_addClientStatsPFH.sqf
Normal file
@@ -0,0 +1,18 @@
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
diag_log text "[MILSIM] (client) initializing Stats PFH";
|
||||
|
||||
_cpsPFH = [
|
||||
{
|
||||
[] call milsim_fnc_calculateClientStats;
|
||||
},
|
||||
"milsim_client_cps_interval" call CBA_settings_fnc_get,
|
||||
[],
|
||||
{ diag_log text format ["[MILSIM] (client) PFH loaded with interval %1 seconds", "milsim_client_cps_interval" call CBA_settings_fnc_get ] },
|
||||
{ diag_log text format ["[MILSIM] (client) PFH unloaded"] },
|
||||
{ "milsim_client_cps_enable" call CBA_settings_fnc_get },
|
||||
{ false },
|
||||
[]
|
||||
] call CBA_fnc_createPerFrameHandlerObject;
|
||||
|
||||
player setVariable ["milsim_client_cps_handler", _cpsPFH];
|
||||
87
framework/client/fn_addDNI_PlayerFPS.sqf
Normal file
87
framework/client/fn_addDNI_PlayerFPS.sqf
Normal file
@@ -0,0 +1,87 @@
|
||||
if ( !hasInterface ) exitWith {};
|
||||
|
||||
diag_log text "[MILSIM] (DNI) writing variable loop";
|
||||
|
||||
[] spawn {
|
||||
while {true} do {
|
||||
player setVariable ["DNI_PlayerFPS", floor diag_fps, true];
|
||||
sleep 1
|
||||
};
|
||||
};
|
||||
|
||||
diag_log text "[MILSIM] (DNI) variable loop complete";
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
//Waits until curators are initalized in order to check//
|
||||
//if player is zeus to run the fps scripts //
|
||||
/////////////////////////////////////////////////////////
|
||||
diag_log text "[MILSIM] (DNI) waiting for curators";
|
||||
|
||||
waitUntil {
|
||||
private _hasCurators = (count allcurators) > 0;
|
||||
private _hasInitializedCurators = (count (call BIS_fnc_listCuratorPlayers)) > 0;
|
||||
private _curatorsInitialized = !_hasCurators || _hasInitializedCurators;
|
||||
((time > 2) || _curatorsInitialized)
|
||||
};
|
||||
|
||||
diag_log text "[MILSIM] (DNI) curator init complete";
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
//If player is a curator it will run the script and each/
|
||||
//player will have their FPS appear beneath them //
|
||||
/////////////////////////////////////////////////////////
|
||||
if (player in (call bis_fnc_listcuratorplayers)) then {
|
||||
|
||||
diag_log text "[MILSIM] (DNI) player is in curator list, adding Draw3D handler";
|
||||
|
||||
addMissionEventHandler ["Draw3D", {
|
||||
{
|
||||
_distance = position curatorCamera distance _x;
|
||||
//if zeus camera is farther than 1200 meters away from the targets the text will not display
|
||||
if (_distance < 1200) then {
|
||||
_playerFPS = _x getVariable ["DNI_PlayerFPS",50];
|
||||
//if the FPS is below 20 it turns red and becomes more visible for zeus to see so they are aware
|
||||
if (_playerFPS <20) then
|
||||
{
|
||||
drawIcon3D
|
||||
[
|
||||
"",//Path to image displayed near text
|
||||
[1,0,0,0.7],//color of the text using RGBA
|
||||
position _x,//position of the text _x referring to the player in 'allPlayers'
|
||||
1,//Width
|
||||
2,//height from position, below
|
||||
0,//angle
|
||||
format["%1 FPS: %2", name _x, str _playerFPS],//text to be displayed
|
||||
0,//shadow on text, 0=none,1=shadow,2=outline
|
||||
0.05,//text size
|
||||
"PuristaMedium",//text font
|
||||
"center"//align text left, right, or center
|
||||
];
|
||||
}
|
||||
//if the FPS is above 20 text is smaller and less visible as to not conern zeus as much
|
||||
else
|
||||
{
|
||||
drawIcon3D
|
||||
[
|
||||
"",//Path to image displayed near text
|
||||
[1,1,1,0.3],//color of the text using RGBA
|
||||
position _x,//position of the text _x referring to the player in 'allPlayers'
|
||||
1,//Width
|
||||
2,//height from position, below
|
||||
0,//angle
|
||||
format["%1 FPS: %2", name _x, str _playerFPS],//text to be displayed
|
||||
0,//shadow on text, 0=none,1=shadow,2=outline
|
||||
0.03,//text size
|
||||
"PuristaMedium",//text font
|
||||
"center"//align text left, right, or center
|
||||
];
|
||||
};
|
||||
};
|
||||
} forEach allPlayers;
|
||||
//Here is the array of units you wish to display the FPS text for, it can be
|
||||
//changed to be an array of specific units or players if you wish
|
||||
}];
|
||||
};
|
||||
/////////////////////////////////////////////////////////
|
||||
/////////////////////End FPS Script//////////////////////
|
||||
/////////////////////////////////////////////////////////
|
||||
99
framework/client/fn_addMedicalOverlayPFH.sqf
Normal file
99
framework/client/fn_addMedicalOverlayPFH.sqf
Normal file
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
// Force setting if CBA doesn't work?
|
||||
if (isNil "milsim_client_medState3D_enabled") then {
|
||||
milsim_client_medState3D_enabled = true;
|
||||
};
|
||||
if (isNil "milsim_client_medState3D_drawRange") then {
|
||||
milsim_client_medState3D_drawRange = 10;
|
||||
};
|
||||
|
||||
// List of units to draw icons for
|
||||
milsim_client_medState3D_drawTargets = [];
|
||||
|
||||
// ACE Triage colors, for consistency across UIs and functions
|
||||
// #define TRIAGE_COLOR_NONE 0.5, 0.5, 0.5, 0.1
|
||||
// #define TRIAGE_COLOR_MINIMAL 0, 0.5, 0, 0.9
|
||||
// #define TRIAGE_COLOR_DELAYED 1, 0.84, 0, 0.9
|
||||
// #define TRIAGE_COLOR_IMMEDIATE 1, 0, 0, 0.9
|
||||
// #define TRIAGE_COLOR_DECEASED 0, 0, 0, 0.9
|
||||
|
||||
// ACE Triage colors, for consistency across UIs and functions
|
||||
milsim_client_medState3D_colors = [
|
||||
[0, 0.5, 0, 0.9], // TRIAGE_COLOR_MINIMAL
|
||||
[1, 0.84, 0, 0.9], // TRIAGE_COLOR_DELAYED
|
||||
[1, 0, 0, 0.9], // TRIAGE_COLOR_IMMEDIATE
|
||||
[0.15, 0.15, 0.15, 0.9], // TRIAGE_COLOR_DECEASED
|
||||
[0.5, 0.5, 0.5, 0] // TRIAGE_COLOR_NONE
|
||||
];
|
||||
|
||||
// Per-frame handler to draw icons
|
||||
// cleanup
|
||||
if (!isNil "milsim_client_medState3D_pfh") then {
|
||||
[milsim_client_medState3D_pfh] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
// add pfh
|
||||
milsim_client_medState3D_pfh = [{
|
||||
// if disabled, skip processing
|
||||
if (!milsim_client_medState3D_enabled) exitWith {false};
|
||||
// if no targets, skip processing
|
||||
if (count milsim_client_medState3D_drawTargets == 0) exitWith {false};
|
||||
if !([player] call ace_medical_treatment_fnc_isMedic) exitWith {false};
|
||||
{
|
||||
// distance within 10 meters
|
||||
if (player distance _x > milsim_client_medState3D_drawRange) then {continue};
|
||||
// check unit not null, not conscious, and not in a vehicle
|
||||
if (
|
||||
!(_x getVariable ["ACE_isUnconscious", false]) ||
|
||||
!isNull (objectParent _x)
|
||||
) then {continue};
|
||||
|
||||
// color based on triage level
|
||||
private _triageLevel = _x getVariable ["ace_medical_triageLevel", -1];
|
||||
if (_triageLevel == -1) then {continue};
|
||||
private _color = milsim_client_medState3D_colors select (
|
||||
(_x getVariable ["ace_medical_triageLevel", -1]) -1
|
||||
);
|
||||
// draw position, slightly above the prone unit
|
||||
private _drawPos = (visiblePosition _x) 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
|
||||
// further params optional, omitted
|
||||
];
|
||||
} forEach milsim_client_medState3D_drawTargets;
|
||||
}, 0, []] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
// subroutine to gather nearest 50 units every 5 seconds and store in milsim_client_medState3D_drawTargets
|
||||
// cleanup
|
||||
if (!isNil "milsim_client_medState3D_drawTargetsPfh") then {
|
||||
[milsim_client_medState3D_drawTargetsPfh] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
// add pfh
|
||||
milsim_client_medState3D_drawTargetsPfh = [{
|
||||
milsim_client_medState3D_drawTargets = (
|
||||
(allUnits + allDeadMen) select {
|
||||
_x isKindOf "CAManBase" &&
|
||||
player distance _x < 50 &&
|
||||
!isNull _x &&
|
||||
player isNotEqualTo _x
|
||||
}
|
||||
);
|
||||
}, 5, false] call CBA_fnc_addPerFrameHandler;
|
||||
88
framework/client/fn_addZenModules.sqf
Normal file
88
framework/client/fn_addZenModules.sqf
Normal file
@@ -0,0 +1,88 @@
|
||||
if ( !hasInterface ) exitWith {};
|
||||
|
||||
[
|
||||
"17th Battalion",
|
||||
"Create Resupply Box",
|
||||
{
|
||||
params [["_pos", [0,0,0], [[]], 3], ["_target", objNull, [objNull]]];
|
||||
// get parent definition
|
||||
private _supplyCratesCfg = call milsim_resupply_fnc_getSupplyCratesCfg;
|
||||
// get the subclass names
|
||||
private _boxTypesAvailable = _supplyCratesCfg call BIS_fnc_getCfgSubClasses;
|
||||
|
||||
_boxTypesAvailable sort true;
|
||||
_comboOptions = _boxTypesAvailable apply {
|
||||
[
|
||||
// display name
|
||||
[_supplyCratesCfg >> _x >> "displayName", "STRING", "ERROR"] call CBA_fnc_getConfigEntry,
|
||||
// tooltip
|
||||
[_supplyCratesCfg >> _x >> "tooltip", "STRING", "ERROR"] call CBA_fnc_getConfigEntry,
|
||||
// icon
|
||||
[_supplyCratesCfg >> _x >> "icon", "STRING", "ERROR"] call CBA_fnc_getConfigEntry
|
||||
]
|
||||
};
|
||||
|
||||
[
|
||||
"Resupply Box Options",
|
||||
[
|
||||
// [ "COMBO", "Box Type", [[1,2,3], [["Ammo"],["Weapons"],["Medical"]],0] ]
|
||||
["COMBO", "Box Type", [_boxTypesAvailable, _comboOptions, 0]]
|
||||
],
|
||||
{
|
||||
|
||||
params ["_dialog", "_args"];
|
||||
|
||||
_dialog params ["_typeOptionSelected"];
|
||||
_args params ["_pos", "_target", "_keysSorted"];
|
||||
|
||||
|
||||
private _box = [_target, _typeOptionSelected, _pos] call milsim_resupply_fnc_createBox;
|
||||
if (isNull _box) exitWith {
|
||||
["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;
|
||||
},
|
||||
{},
|
||||
[_pos, _target]
|
||||
] call zen_dialog_fnc_create;
|
||||
}
|
||||
] call zen_custom_modules_fnc_register;
|
||||
|
||||
|
||||
[
|
||||
"17th Battalion",
|
||||
"Grounds Cleanup",
|
||||
{
|
||||
params [["_pos", [0,0,0], [[]], 3], ["_target", objNull, [objNull]]];
|
||||
|
||||
_pos = [_pos#0, _pos#1, 0];
|
||||
|
||||
[
|
||||
"Cleanup Area",
|
||||
[
|
||||
[ "SLIDER:RADIUS", "Radius (meters)", [50, 500, 100, 0, _pos, [0.8, 0.2, 0.2, 1.0]], true ]
|
||||
],
|
||||
{
|
||||
|
||||
params ["_dialog", "_args"];
|
||||
|
||||
_dialog params ["_radius"];
|
||||
_args params ["_pos", "_target"];
|
||||
|
||||
_objects = _pos nearObjects ["GroundWeaponHolder", _radius];
|
||||
{
|
||||
deleteVehicle _x;
|
||||
} forEach _objects
|
||||
|
||||
},
|
||||
{},
|
||||
[_pos, _target]
|
||||
] call zen_dialog_fnc_create;
|
||||
|
||||
}
|
||||
] call zen_custom_modules_fnc_register;
|
||||
|
||||
|
||||
diag_log text "[MILSIM] (client) zeus modules added";
|
||||
|
||||
nil;
|
||||
23
framework/client/fn_bindEmptyGroupGarbageCleanup.sqf
Normal file
23
framework/client/fn_bindEmptyGroupGarbageCleanup.sqf
Normal file
@@ -0,0 +1,23 @@
|
||||
diag_log text format ["[MILSIM] (client) initializing empty group deletion PFH"];
|
||||
|
||||
_emptyGroupPFH = [
|
||||
{
|
||||
{
|
||||
if (local _x) then {
|
||||
if ((count units _x) == 0) then {
|
||||
deleteGroup _x;
|
||||
};
|
||||
};
|
||||
} forEach allGroups;
|
||||
},
|
||||
300,
|
||||
[],
|
||||
{ diag_log text format ["[MILSIM] (client) Empty Group Deletion PFH loaded"] },
|
||||
{ diag_log text format ["[MILSIM] (client) Empty Group Deletion"] },
|
||||
{ true },
|
||||
{ false },
|
||||
[]
|
||||
] call CBA_fnc_createPerFrameHandlerObject;
|
||||
|
||||
|
||||
|
||||
55
framework/client/fn_bindEventHandlers.sqf
Normal file
55
framework/client/fn_bindEventHandlers.sqf
Normal file
@@ -0,0 +1,55 @@
|
||||
if ( !hasInterface ) exitWith {};
|
||||
|
||||
player addEventHandler["Respawn",
|
||||
{
|
||||
params ["_unit", "_corpse"];
|
||||
private _killer = _corpse getVariable ["ace_medical_causeOfDeath", "#scripted"];
|
||||
if (_killer == "respawn_button") then {
|
||||
[
|
||||
"client",
|
||||
"RESPAWNED WHILE UNCONSCIOUS",
|
||||
[_unit] call milsim_util_fnc_addPlayerInfoToArray
|
||||
] remoteExec ["milsim_util_fnc_log", 2];
|
||||
// format["%1 was unconscious then clicked the respawn button", name _unit] remoteExec["systemChat", 0];
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
[
|
||||
{
|
||||
params ["_unit", "_object", "_cost"];
|
||||
private _return = (count nearestObjects [_unit, ["B_APC_Tracked_01_CRV_F", "rhsusf_M1239_M2_Deploy_socom_d", "rhsusf_stryker_m1132_m2_wd", "rhsusf_m113_usarmy_supply", "rhsusf_M1078A1P2_B_WD_CP_fmtv_usarmy", "B_Slingload_01_Cargo_F"], 120]) > 0;
|
||||
_return
|
||||
}
|
||||
] call ace_fortify_fnc_addDeployHandler;
|
||||
|
||||
|
||||
addMissionEventHandler ["HandleChatMessage",
|
||||
{
|
||||
params ["_channel", "_owner", "_from", "_text", "_person", "_name", "_strID", "_forcedDisplay", "_isPlayerMessage", "_sentenceType", "_chatMessageType"];
|
||||
|
||||
if ( missionNamespace getVariable ["milsim_sideChat", false] ) exitWith{ false };
|
||||
|
||||
if (_channel != 1) exitWith { false };
|
||||
|
||||
if ( ( admin _owner ) != 0 ) exitWith { false };
|
||||
|
||||
if ( !isNull ( getAssignedCuratorLogic _person ) ) exitWith { false };
|
||||
|
||||
true;
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
["ace_arsenal_displayClosed", {
|
||||
[player] remoteExec ["milsim_util_fnc_logPlayerInventory", 2];
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
[missionNamespace, "arsenalClosed", {
|
||||
[player] remoteExec ["milsim_util_fnc_logPlayerInventory", 2];
|
||||
}] call BIS_fnc_addScriptedEventHandler;
|
||||
|
||||
diag_log text "[MILSIM] (client) event handlers bound";
|
||||
|
||||
nil;
|
||||
67
framework/client/fn_bindVehicleActions.sqf
Normal file
67
framework/client/fn_bindVehicleActions.sqf
Normal file
@@ -0,0 +1,67 @@
|
||||
if ( !hasInterface ) exitWith {};
|
||||
|
||||
_checkFuel =
|
||||
[
|
||||
"CheckFuel",
|
||||
"Check Fuel",
|
||||
"",
|
||||
{
|
||||
hint format ["Fuel: %1%2", floor (fuel _target *100), "%"];
|
||||
},
|
||||
{true}
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
|
||||
["LandVehicle", 0, ["ACE_MainActions"], _checkFuel, true] call ace_interact_menu_fnc_addActionToClass;
|
||||
|
||||
|
||||
_unflip =
|
||||
[
|
||||
"Unfuck",
|
||||
"Flip Vehicle",
|
||||
"",
|
||||
{
|
||||
_target setpos [(getpos _target) select 0,(getpos _target) select 1, 0.5];
|
||||
_target setVectorUp surfaceNormal position _target;
|
||||
},
|
||||
{true}
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
|
||||
["LandVehicle", 0, ["ACE_MainActions"], _unflip, true] call ace_interact_menu_fnc_addActionToClass;
|
||||
|
||||
|
||||
_patchTire =
|
||||
[
|
||||
"patchTire",
|
||||
"Patch Tire",
|
||||
"\a3\ui_f\data\IGUI\Cfg\Actions\repair_ca.paa",
|
||||
{
|
||||
[_player, "AinvPknlMstpSnonWnonDr_medic5", 0] call ace_common_fnc_doAnimation;
|
||||
|
||||
[
|
||||
30,
|
||||
[_player, _target],
|
||||
{
|
||||
params ["_args"];
|
||||
_args params ["_player", "_target"];
|
||||
hint "Tire Patched";
|
||||
_target setDamage 0.2;
|
||||
_target setVariable["milsim_ace_repair_wheel_canPatch", false];
|
||||
},
|
||||
{
|
||||
params ["_args"];
|
||||
_args params ["_player", "_target"];
|
||||
hint "Stopped repair";
|
||||
[_player, "", 0] call ace_common_fnc_doAnimation;
|
||||
},
|
||||
"Patching"
|
||||
] 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] ) }
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
|
||||
["ACE_Wheel", 0, ["ACE_MainActions"], _patchTire, true] call ace_interact_menu_fnc_addActionToClass;
|
||||
|
||||
|
||||
diag_log text "[MILSIM] (client) vehicle actions bound";
|
||||
|
||||
nil;
|
||||
29
framework/client/fn_calculateClientStats.sqf
Normal file
29
framework/client/fn_calculateClientStats.sqf
Normal file
@@ -0,0 +1,29 @@
|
||||
[] spawn {
|
||||
// warning: while loop without suspension executes multiple times per frame
|
||||
private _counter = 0;
|
||||
private _endTime = diag_tickTime + 5;
|
||||
private _frameNo = diag_frameNo;
|
||||
while { diag_tickTime < _endTime } do
|
||||
{
|
||||
_counter = _counter + 1;
|
||||
};
|
||||
// in an empty mission, the _counter may go well over 2000 times per frame!
|
||||
diag_log text format ["[MILSIM] (client) Average Execution: %1 times per frame", _counter / (diag_frameNo - _frameNo)];
|
||||
player setVariable ["milsim_player_raw_cps", _counter / (diag_frameNo - _frameNo), true];
|
||||
|
||||
// with suspension
|
||||
private _counter = 0;
|
||||
private _endTime = diag_tickTime + 5;
|
||||
private _frameNo = diag_frameNo;
|
||||
while { diag_tickTime < _endTime } do
|
||||
{
|
||||
_counter = _counter + 1;
|
||||
uiSleep 0.001; // waits at least 1 frame
|
||||
};
|
||||
// _counter says one per frame, as expected
|
||||
diag_log text format ["[MILSIM] (client) Average Execution: %1 times per frame", _counter / (diag_frameNo - _frameNo)];
|
||||
player setVariable ["milsim_player_cps", _counter / (diag_frameNo - _frameNo), true];
|
||||
|
||||
};
|
||||
|
||||
nil;
|
||||
4
framework/fbcb2/assets/byBase/fn_getAssetsByBase.sqf
Normal file
4
framework/fbcb2/assets/byBase/fn_getAssetsByBase.sqf
Normal file
@@ -0,0 +1,4 @@
|
||||
// return each base with its assets
|
||||
milsim_baseObjects apply {
|
||||
[_x, _x getVariable ["milsim_fbcb2_assets_assetsAtThisBase", []]]
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
// return each base with its assets
|
||||
milsim_baseObjects apply {
|
||||
[_x, _x getVariable ["milsim_fbcb2_assets_assetsStartedAtThisBase", []]]
|
||||
};
|
||||
179
framework/fbcb2/assets/byBase/fn_updateAssetsByBase.sqf
Normal file
179
framework/fbcb2/assets/byBase/fn_updateAssetsByBase.sqf
Normal file
@@ -0,0 +1,179 @@
|
||||
params [
|
||||
["_isInit", false, [false]],
|
||||
["_logCurrentAssets", false, [false]]
|
||||
];
|
||||
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
// 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 _assetsAtThisBaseVar = "milsim_fbcb2_assets_assetsAtThisBase";
|
||||
private _assetsStartedAtThisBaseVar = "milsim_fbcb2_assets_assetsStartedAtThisBase";
|
||||
|
||||
{
|
||||
private _className = configName _x;
|
||||
private _callsign = getText(_x >> "callsign");
|
||||
private _found = _allVehicles select { typeOf _x == _className };
|
||||
{
|
||||
private _asset = _x;
|
||||
// avoid duplicates
|
||||
if (_asset in _allSaved) then {continue};
|
||||
private _closestBase = [_asset] call milsim_util_fnc_getNearestBase;
|
||||
if (isNull _closestBase) then {
|
||||
// no base found
|
||||
continue;
|
||||
};
|
||||
if (
|
||||
_asset distance _closestBase >
|
||||
milsim_fbcb2_assets_setting_detectionRangeFromBase
|
||||
) then {
|
||||
// not within range
|
||||
continue;
|
||||
};
|
||||
|
||||
_asset setVariable ["milsim_fbcb2_assets_callsign", _callsign, true];
|
||||
|
||||
// add to base's assets list
|
||||
private _baseAssets = _closestBase getVariable [_assetsAtThisBaseVar, []];
|
||||
_baseAssets pushBackUnique _asset;
|
||||
// broadcast later so we're not spamming network
|
||||
_closestBase setVariable [
|
||||
_assetsAtThisBaseVar,
|
||||
_baseAssets
|
||||
];
|
||||
|
||||
// if this is the init, set the base's assets started at this base
|
||||
if (_isInit) then {
|
||||
// broadcast later so we're not spamming network
|
||||
_closestBase setVariable [
|
||||
_assetsStartedAtThisBaseVar,
|
||||
_baseAssets
|
||||
];
|
||||
};
|
||||
|
||||
_allSaved pushBack _asset;
|
||||
} forEach _found;
|
||||
} forEach ((missionConfigFile >> "ApprovedAssets") call BIS_fnc_returnChildren);
|
||||
|
||||
// Add all ground vehicles (LandVehicle)
|
||||
{
|
||||
private _asset = _x;
|
||||
// avoid duplicates
|
||||
if (_asset in _allSaved) then {continue};
|
||||
|
||||
private _closestBase = [_asset] call milsim_util_fnc_getNearestBase;
|
||||
if (isNull _closestBase) then {
|
||||
// no base found
|
||||
continue;
|
||||
};
|
||||
|
||||
if (
|
||||
_asset distance _closestBase >
|
||||
milsim_fbcb2_assets_setting_detectionRangeFromBase
|
||||
) then {
|
||||
// not within range
|
||||
continue;
|
||||
};
|
||||
|
||||
// add to base's assets list
|
||||
private _baseAssets = _closestBase getVariable [_assetsAtThisBaseVar, []];
|
||||
_baseAssets pushBackUnique _asset;
|
||||
// broadcast later so we're not spamming network
|
||||
_closestBase setVariable [
|
||||
_assetsAtThisBaseVar,
|
||||
_baseAssets
|
||||
];
|
||||
|
||||
// if this is the init, set the base's assets started at this base
|
||||
if (_isInit) then {
|
||||
// broadcast later so we're not spamming network
|
||||
_closestBase setVariable [
|
||||
_assetsStartedAtThisBaseVar,
|
||||
_baseAssets
|
||||
];
|
||||
};
|
||||
} forEach (_allVehicles select { _x isKindOf "LandVehicle" });
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// publish updated base variables
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
{
|
||||
private _base = _x;
|
||||
|
||||
// save current assets
|
||||
private _baseAssets = _base getVariable [_assetsAtThisBaseVar, []];
|
||||
_base setVariable [_assetsAtThisBaseVar, _baseAssets, true];
|
||||
|
||||
// if init, save starting assets
|
||||
if (_isInit) then {
|
||||
_base setVariable [_assetsStartedAtThisBaseVar, _baseAssets, true];
|
||||
};
|
||||
} forEach milsim_baseObjects;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// 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 = _base getVariable [_assetsAtThisBaseVar, []];
|
||||
|
||||
// prepare key value for logging
|
||||
private _baseAssetsHashesPrep = _baseAssets apply {
|
||||
private _asset = _x;
|
||||
[
|
||||
["callsign", _asset getVariable [
|
||||
"milsim_fbcb2_assets_callsign",
|
||||
"N/A"
|
||||
]],
|
||||
["className", typeOf _asset],
|
||||
["displayName", (configOf _asset) 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 {
|
||||
{
|
||||
[
|
||||
"fbcb2_assets",
|
||||
"CURRENT ASSETS",
|
||||
[
|
||||
["baseName", [[_base] call milsim_util_fnc_getNameOfBase]],
|
||||
["asset", _x]
|
||||
]
|
||||
] call milsim_util_fnc_log;
|
||||
} forEach _baseAssetsHashes;
|
||||
};
|
||||
|
||||
// if init, log starting assets
|
||||
if (_isInit) then {
|
||||
{
|
||||
[
|
||||
"fbcb2_assets",
|
||||
"STARTING ASSETS",
|
||||
[
|
||||
["baseName", [[_base] call milsim_util_fnc_getNameOfBase]],
|
||||
["asset", _x]
|
||||
]
|
||||
] call milsim_util_fnc_log;
|
||||
} forEach _baseAssetsHashes;
|
||||
};
|
||||
} forEach milsim_baseObjects;
|
||||
123
framework/fbcb2/assets/fn_getInventory.sqf
Normal file
123
framework/fbcb2/assets/fn_getInventory.sqf
Normal file
@@ -0,0 +1,123 @@
|
||||
params ["_vic"];
|
||||
|
||||
|
||||
_vicDispName = configOf _vic call BIS_fnc_displayName;
|
||||
private _thisArr = [];
|
||||
|
||||
// _thisArr pushBack getItemCargo _vic;
|
||||
// _thisArr pushBack getBackpackCargo _vic;
|
||||
// _thisArr pushBack getMagazineCargo _vic;
|
||||
// _thisArr pushBack getWeaponCargo _vic;
|
||||
|
||||
private _ItemCargo = [];
|
||||
private _MagazineCargo = [];
|
||||
private _WeaponCargo = [];
|
||||
private _BackpackCargo = [];
|
||||
|
||||
{
|
||||
private _config = _x call CBA_fnc_getItemConfig;
|
||||
_ItemCargo pushBack [
|
||||
getText (_config >> "displayName"),
|
||||
getText (_config >> "picture")
|
||||
];
|
||||
} forEach ItemCargo _vic;
|
||||
{
|
||||
private _config = _x call CBA_fnc_getItemConfig;
|
||||
_MagazineCargo pushBack [
|
||||
getText (_config >> "displayName"),
|
||||
getText (_config >> "picture")
|
||||
];
|
||||
} forEach MagazineCargo _vic;
|
||||
{
|
||||
// private _config = _x call CBA_fnc_getObjectConfig;
|
||||
_WeaponCargo pushBack [
|
||||
getText (configFile >> "CfgWeapons" >> _x >> "displayName"),
|
||||
getText (configFile >> "CfgWeapons" >> _x >> "picture")
|
||||
];
|
||||
} forEach WeaponCargo _vic;
|
||||
{
|
||||
private _config = _x call CBA_fnc_getObjectConfig;
|
||||
_BackpackCargo pushBack [
|
||||
getText (_config >> "displayName"),
|
||||
getText (_config >> "picture")
|
||||
];
|
||||
} forEach BackpackCargo _vic;
|
||||
|
||||
private _sortedItemCargo = ([_ItemCargo call BIS_fnc_consolidateArray, [], {_x # 0 # 0}] call BIS_fnc_sortBy) select {!(_x # 0 # 0 isEqualTo "")};
|
||||
private _sortedMagazineCargo = ([_MagazineCargo call BIS_fnc_consolidateArray, [], {_x # 0 # 0}] call BIS_fnc_sortBy) select {!(_x # 0 # 0 isEqualTo "")};
|
||||
private _sortedWeaponCargo = ([_WeaponCargo call BIS_fnc_consolidateArray, [], {_x # 0 # 0}] call BIS_fnc_sortBy) select {!(_x # 0 # 0 isEqualTo "")};
|
||||
private _sortedBackpackCargo = ([_BackpackCargo call BIS_fnc_consolidateArray, [], {_x # 0 # 0}] call BIS_fnc_sortBy) select {!(_x # 0 # 0 isEqualTo "")};
|
||||
|
||||
// "debug_console" callExtension(str _sortedItemCargo + "~0100");
|
||||
// "debug_console" callExtension(str _sortedMagazineCargo + "~0100");
|
||||
// "debug_console" callExtension(str _sortedWeaponCargo + "~0100");
|
||||
// "debug_console" callExtension(str _sortedBackpackCargo + "~0100");
|
||||
|
||||
if (count _sortedItemCargo > 0) then {
|
||||
_thisArr pushBack format["<font color='#ffffff' size='12' face='PuristaMedium'>Items:</font>"];
|
||||
private _itemCargoOut = [];
|
||||
{
|
||||
private _name = _x # 0 # 0;
|
||||
private _pic = _x # 0 # 1;
|
||||
private _count = _x # 1;
|
||||
if (_pic == "") then {
|
||||
_itemCargoOut pushBack format["<font color='#ffffff' size='12' face='EtelkaMonospacePro'><execute expression='systemChat ""%3"";'>%3 x%2</execute></font>", _pic, _count, _name];
|
||||
} else {
|
||||
_itemCargoOut pushBack format["<img height='30' image='%1'/><font color='#ffffff' size='10' face='EtelkaMonospacePro'><execute expression='systemChat ""%3"";'>x%2</execute></font>", _pic, _count, _name];
|
||||
};
|
||||
if ((_forEachIndex + 1) mod 6 == 0) then {_itemCargoOut pushBack "<br/>"};
|
||||
} forEach _sortedItemCargo;
|
||||
_thisArr pushBack (_itemCargoOut joinString "");
|
||||
};
|
||||
if (count _sortedMagazineCargo > 0) then {
|
||||
_thisArr pushBack format["<font color='#ffffff' size='12' face='PuristaMedium'>Magazines:</font>"];
|
||||
private _magCargoOut = [];
|
||||
{
|
||||
private _name = _x # 0 # 0;
|
||||
private _pic = _x # 0 # 1;
|
||||
private _count = _x # 1;
|
||||
if (_pic == "") then {
|
||||
_magCargoOut pushBack format["<font color='#ffffff' size='12' face='EtelkaMonospacePro'><execute expression='systemChat ""%3"";'>%3 x%2</execute></font>", _pic, _count, _name];
|
||||
} else {
|
||||
_magCargoOut pushBack format["<img height='30' image='%1'/><font color='#ffffff' size='10' face='EtelkaMonospacePro'><execute expression='systemChat ""%3"";'>x%2</execute></font>", _pic, _count, _name];
|
||||
};
|
||||
if ((_forEachIndex + 1) mod 6 == 0) then {_magCargoOut pushBack "<br/>"};
|
||||
} forEach _sortedMagazineCargo;
|
||||
_thisArr pushBack (_magCargoOut joinString "");
|
||||
};
|
||||
if (count _sortedWeaponCargo > 0) then {
|
||||
_thisArr pushBack format["<font color='#ffffff' size='12' face='PuristaMedium'>Weapons:</font>"];
|
||||
private _weaponCargoOut = [];
|
||||
{
|
||||
private _name = _x # 0 # 0;
|
||||
private _pic = _x # 0 # 1;
|
||||
private _count = _x # 1;
|
||||
if (_pic == "") then {
|
||||
_weaponCargoOut pushBack format["<font color='#ffffff' size='12' face='EtelkaMonospacePro'><execute expression='systemChat ""%3"";'>%3 x%2</execute></font>", _pic, _count, _name];
|
||||
} else {
|
||||
_weaponCargoOut pushBack format["<img height='50' image='%1'/><font color='#ffffff' size='10' face='EtelkaMonospacePro'><execute expression='systemChat ""%3"";'>x%2</execute></font>", _pic, _count, _name];
|
||||
};
|
||||
if ((_forEachIndex + 1) mod 3 == 0) then {_weaponCargoOut pushBack "<br/>"};
|
||||
} forEach _sortedWeaponCargo;
|
||||
_thisArr pushBack (_weaponCargoOut joinString "");
|
||||
};
|
||||
if (count _sortedBackpackCargo > 0) then {
|
||||
_thisArr pushBack format["<font color='#ffffff' size='12' face='PuristaMedium'>Backpacks:</font>"];
|
||||
private _backpackCargoOut = [];
|
||||
{
|
||||
private _name = _x # 0 # 0;
|
||||
private _pic = _x # 0 # 1;
|
||||
private _count = _x # 1;
|
||||
if (_pic == "") then {
|
||||
_backpackCargoOut pushBack format["<font color='#ffffff' size='12' face='EtelkaMonospacePro'><execute expression='systemChat ""%3"";'>%3 x%2</execute></font>", _pic, _count, _name];
|
||||
} else {
|
||||
_backpackCargoOut pushBack format["<img height='50' image='%1'/><font color='#ffffff' size='10' face='EtelkaMonospacePro'><execute expression='systemChat ""%3"";'>x%2</execute></font>", _pic, _count, _name];
|
||||
};
|
||||
if ((_forEachIndex + 1) mod 4 == 0) then {_backpackCargoOut pushBack "<br/>"};
|
||||
} forEach _sortedBackpackCargo;
|
||||
_thisArr pushBack (_backpackCargoOut joinString "");
|
||||
// "debug_console" callExtension(str _backpackCargoOut + "~0100");
|
||||
};
|
||||
|
||||
// "debug_console" callExtension(str _thisArr + "~1100");
|
||||
_thisArr;
|
||||
80
framework/fbcb2/assets/fn_getMagsForWeapon.sqf
Normal file
80
framework/fbcb2/assets/fn_getMagsForWeapon.sqf
Normal file
@@ -0,0 +1,80 @@
|
||||
params ["_vic", "_path", "_wep", "_magsHere", "_pylons"];
|
||||
|
||||
if (_path isEqualTo []) then {_path = [-1]};
|
||||
// "debug_console" callExtension (_wep + "#0100");
|
||||
if (_wep in [
|
||||
"rhs_weap_MASTERSAFE",
|
||||
"rhs_weap_fcs_ammo",
|
||||
"rhs_weap_laserDesignator_AI",
|
||||
"rhs_weap_fcs_ah64",
|
||||
"rhs_weap_DummyLauncher",
|
||||
"rhs_weap_fcs_nolrf_ammo",
|
||||
"rhsusf_weap_duke",
|
||||
"TruckHorn",
|
||||
"TruckHorn2",
|
||||
"TruckHorn3"
|
||||
]) exitWith {[[]]};
|
||||
|
||||
private _thisArr = [];
|
||||
_wepConfig = (configFile >> "CfgWeapons" >> _wep);
|
||||
_wepDisp = [(_wepConfig >> "displayName"), "STRING", "Weapon"] call CBA_fnc_getConfigEntry;
|
||||
if (_wep == "rhs_weap_smokegen") then {_wepDisp = "Smoke Generator"};
|
||||
if (_wepDisp isEqualTo "") exitWith {[[]]};
|
||||
|
||||
// "debug_console" callExtension (_wepDisp + "#0100");
|
||||
_magsToCheck = (_vic magazinesTurret _path);
|
||||
|
||||
|
||||
// See if the first default magazine in the config of this weapon is meant to be used on a pylon. If so, process differently
|
||||
// _mag1pylonWeapon = "";
|
||||
// _magsConfigArr = [(_wepConfig >> "magazines"), "ARRAY", []] call CBA_fnc_getConfigEntry;
|
||||
// if (_magsConfigArr isEqualTo []) then {
|
||||
// _mag1pylonWeapon = "";
|
||||
// } else {
|
||||
// _mag1Name = _magsConfigArr # 0;
|
||||
// _mag1pylonWeapon = [(configFile >> "CfgMagazines" >> _mag1Name >> "pylonWeapon"), "STRING", ""] call CBA_fnc_getConfigEntry;
|
||||
// };
|
||||
|
||||
_pylonMagNames = _pylons apply {_x # 3};
|
||||
|
||||
_compatMagsRef = [_wepConfig, true] call CBA_fnc_compatibleMagazines;
|
||||
_magsFound = _compatMagsRef select {_magsToCheck find _x != -1};
|
||||
|
||||
private _magsArr = [];
|
||||
|
||||
if (!((_magsFound # 0) in _pylonMagNames)) then {
|
||||
// Not a pylon weapon, so check mags in turret storage
|
||||
_thisArr pushBack format[" <font color='#87ffbb' face='PuristaSemiBold'>%1</font>", _wepDisp];
|
||||
{
|
||||
_thisMag = _x;
|
||||
_magAmmo = _vic magazineTurretAmmo [_x, _path];
|
||||
_magCount = (_magsHere select {_x # 0 == _thisMag} apply {_x # 1}) # 0;
|
||||
|
||||
private _magConfig = (configFile >> "CfgMagazines" >> _thisMag);
|
||||
private _magName = [(_magConfig >> "displayName"), "STRING", "Magazine"] call CBA_fnc_getConfigEntry;
|
||||
if (_magName isEqualTo "") then {_magName = "Magazine"};
|
||||
|
||||
|
||||
|
||||
_magsArr pushBack format[
|
||||
" + <font color='#4de4ff' size='12' face='PuristaMedium'><font color='#ffffff'>%1</font> <font color='#c2c2c2'>|</font> %2 <font color='#c2c2c2'>rounds</font> <font color='#c2c2c2'>|</font> %3 <font color='#c2c2c2'>mags</font></font>",
|
||||
_magName,
|
||||
_magAmmo,
|
||||
_magCount
|
||||
];
|
||||
} forEach _magsFound;
|
||||
} else {
|
||||
// This is a pylon weapon, so make a unique entry and directly check ammo on pylon
|
||||
_thisArr pushBack format[" <font color='#87ffbb' face='PuristaSemiBold'>%1</font> <font face='PuristaMedium'>[Pylon]</font>", _wepDisp];
|
||||
};
|
||||
|
||||
_thisArr pushBack _magsArr;
|
||||
// "debug_console" callExtension (str _magsArr + "#0100");
|
||||
_thisArr;
|
||||
// _thisArr;
|
||||
// "debug_console" callExtension (format[
|
||||
// " %1 | %2 rounds | %3 mags#0110",
|
||||
// getText(configFile >> "CfgMagazines" >> _thisMag >> "displayName"),
|
||||
// _magAmmo,
|
||||
// _magCount
|
||||
// ]);
|
||||
166
framework/fbcb2/assets/fn_getVehicleData.sqf
Normal file
166
framework/fbcb2/assets/fn_getVehicleData.sqf
Normal file
@@ -0,0 +1,166 @@
|
||||
params ["_vic"];
|
||||
|
||||
private _title = [];
|
||||
private _image = [];
|
||||
private _info = [];
|
||||
private _capacity = [];
|
||||
|
||||
// Excluded 2024-02-01
|
||||
// private _weapons = [];
|
||||
// private _pylonWeapons = [];
|
||||
// private _inventory = [];
|
||||
|
||||
|
||||
private _vicConfig = configOf _vic;
|
||||
private _class = configName _vicConfig;
|
||||
private _objType = (_vic call BIS_fnc_objectType) select 1;
|
||||
private _dispName = getText(_vicConfig >> 'displayName');
|
||||
|
||||
// "debug_console" callExtension (format["VehicleName = %1", _dispName] + "#0110");
|
||||
|
||||
private _cat = getText(_vicConfig >> 'category');
|
||||
private _fac = getText(_vicConfig >> 'faction');
|
||||
private _side = [getNumber(_vicConfig >> 'side')] call BIS_fnc_sideName;
|
||||
private _canFloat = (_vicConfig >> "canFloat") call BIS_fnc_getCfgDataBool;
|
||||
|
||||
private _totalSeats = [_class, true] call BIS_fnc_crewCount; // Number of total seats: crew + non-FFV cargo/passengers + FFV cargo/passengers
|
||||
private _crewSeats = [_class, false] call BIS_fnc_crewCount; // Number of crew seats only
|
||||
private _driverSeats = fullcrew [_vic, "driver", true];
|
||||
private _gunnerSeats = fullCrew [_vic, "gunner", true];
|
||||
private _commanderSeats = fullCrew [_vic, "commander", true];
|
||||
// _cargoSeats = fullCrew [_vic, "cargo", true];
|
||||
private _cargoSeats = _totalSeats - _crewSeats; // Number of total cargo/passenger seats: non-FFV + FFV
|
||||
private _turretSeatsRaw = fullCrew [_vic, "turret", true];
|
||||
private _turretSeats = _turretSeatsRaw select {(_x # 4) isEqualTo false};
|
||||
private _ffvSeats = _turretSeatsRaw select {(_x # 4) isEqualTo true};
|
||||
|
||||
private _pylons = getAllPylonsInfo _vic;
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// WRITE TITLE
|
||||
///////////////////////////////////////////////
|
||||
_title pushBack format["<font size='24' shadow='1' color='#e1701a' face='PuristaBold'>%1</font>", _dispName];
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// WRITE IMAGE
|
||||
///////////////////////////////////////////////
|
||||
// Editor preview image
|
||||
_image pushBack format["<img width='200' image='%1'/>", getText(_vicConfig >> 'editorPreview')];
|
||||
_image pushBack linebreak;
|
||||
// Thumbnail image
|
||||
// _image pushBack format["<img width='128' height='64' image='%1'/>", getText(_vicConfig >> 'picture')];
|
||||
// _image pushBack linebreak;
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// WRITE INFO
|
||||
///////////////////////////////////////////////
|
||||
_info pushBack format["<font size='14' color='#e1701a' face='PuristaBold'>INFO</font>"];
|
||||
_info pushBack format["<font face='PuristaMedium'> Classname: %1", _class];
|
||||
_info pushBack format[" Side: %1", _side];
|
||||
_info pushBack format[" Category: %1", _objType];
|
||||
_info pushBack format[" Faction: %1", _fac];
|
||||
_info pushBack format[" Can Float: %1", _canFloat];
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// WRITE CAPACITY
|
||||
///////////////////////////////////////////////
|
||||
_capacity pushBack format["<font size='14' color='#e1701a' face='PuristaBold'>CAPACITY: %1</font>", _totalSeats];
|
||||
_capacity pushBack format["<font face='PuristaMedium'> Driver Seats: %1", count _driverSeats];
|
||||
_capacity pushBack format[" Gunner Seats: %1", count _gunnerSeats];
|
||||
_capacity pushBack format[" Commander Seats: %1", count _commanderSeats];
|
||||
_capacity pushBack format[" Turret Seats: %1", count _turretSeats];
|
||||
_capacity pushBack format[" Cargo Seats: %1", _cargoSeats];
|
||||
_capacity pushBack format[" FFV Seats: %1</font>", count _ffvSeats];
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// GATHER WEAPONS AVAILABLE TO SEATS AND TURRETS
|
||||
// EXCLUDED 2024-02-01
|
||||
///////////////////////////////////////////////
|
||||
// _weapons pushBack format["<font size='14' color='#e1701a' face='PuristaBold'>WEAPONS</font>"];
|
||||
// // DRIVER
|
||||
// [_driverSeats apply {_x # 3}, "DRIVER/PILOT", _weapons] call milsim_fbcb2_assets_fnc_getWeaponry;
|
||||
|
||||
// //GUNNER
|
||||
// [_gunnerSeats apply {_x # 3}, "GUNNER/COPILOT", _weapons] call milsim_fbcb2_assets_fnc_getWeaponry;
|
||||
|
||||
// // COMMANDER
|
||||
// // "debug_console" callExtension ("COMMANDER" + "#1100");
|
||||
// [_commanderSeats apply {_x # 3}, "COMMANDER", _weapons] call milsim_fbcb2_assets_fnc_getWeaponry;
|
||||
|
||||
// // TURRETS
|
||||
// [_turretSeats apply {_x # 3}, "TURRET", _weapons] call milsim_fbcb2_assets_fnc_getWeaponry;
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// GATHER PYLON WEAPONS WITH AMMO
|
||||
// EXCLUDED 2024-02-01
|
||||
///////////////////////////////////////////////
|
||||
|
||||
// _pilotWeps = [];
|
||||
// _otherWeps = [];
|
||||
|
||||
// _parsePylonWeapons = {
|
||||
// params ["_input"];
|
||||
// _input params ["_index", "_name", "_turretPath", "_magazine","_ammoCount","_id"];
|
||||
// // "debug_console" callExtension (str _turretPath + "~0000");
|
||||
|
||||
// _magName = getText(configFile >> "CfgMagazines" >> _magazine >> "displayName");
|
||||
// if (_magName isEqualTo "") exitWith {};
|
||||
|
||||
// if (_turretPath isEqualTo [-1]) then {
|
||||
// _pilotWeps pushBack format[
|
||||
// " <font color='#87ffbb' face='PuristaSemiBold'>%1</font> <font face='PuristaMedium'><font color='#c2c2c2'>|</font> <font color='#4de4ff'>%2</font> <font color='#c2c2c2'>rounds</font></font>",
|
||||
// _magName,
|
||||
// _ammoCount
|
||||
// ];
|
||||
// } else {
|
||||
// _otherWeps pushBack format[
|
||||
// " <font color='#87ffbb' face='PuristaSemiBold'>%1</font> <font face='PuristaMedium'><font color='#c2c2c2'>|</font> <font color='#4de4ff'>%2</font> <font color='#c2c2c2'>rounds</font></font>",
|
||||
// _magName,
|
||||
// _ammoCount
|
||||
// ];
|
||||
// };
|
||||
// };
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// WRITE PYLON WEAPONS
|
||||
///////////////////////////////////////////////
|
||||
|
||||
// if (count _pylons > 0) then {
|
||||
// _pylonWeapons pushBack format["<font size='14' color='#e1701a' face='PuristaBold'>PYLON WEAPONS</font>"];
|
||||
// {
|
||||
// [_x] call _parsePylonWeapons;
|
||||
// } forEach _pylons;
|
||||
// _pylonWeapons pushBack format[" <font color='#f6dcbf' face='PuristaSemiBold'>PILOT</font>"];
|
||||
// {
|
||||
// _pylonWeapons pushBack _x;
|
||||
// } forEach _pilotWeps;
|
||||
// _pylonWeapons pushBack format[" <font color='#f6dcbf' face='PuristaSemiBold'>GUNNER</font>"];
|
||||
// {
|
||||
// _pylonWeapons pushBack _x;
|
||||
// } forEach _otherWeps;
|
||||
// };
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// GATHER INVENTORY
|
||||
// EXCLUDED 2024-02-01
|
||||
///////////////////////////////////////////////
|
||||
// _invLines = [_vic] call milsim_fbcb2_assets_fnc_getInventory;
|
||||
// if (count _invLines > 0) then {
|
||||
// _inventory pushBack format["<font size='14' color='#e1701a' face='PuristaBold'>INVENTORY</font>"];
|
||||
// _inventory append _invLines;
|
||||
// };
|
||||
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// CLOSE AND RETURN
|
||||
///////////////////////////////////////////////
|
||||
|
||||
[_vicConfig, _dispName, [
|
||||
_title joinString "<br/>",
|
||||
_image joinString "<br/>",
|
||||
_info joinString "<br/>",
|
||||
_capacity joinString "<br/>"
|
||||
// _weapons joinString "<br/>",
|
||||
// _pylonWeapons joinString "<br/>",
|
||||
// _inventory joinString "<br/>"
|
||||
]];
|
||||
55
framework/fbcb2/assets/fn_getWeaponry.sqf
Normal file
55
framework/fbcb2/assets/fn_getWeaponry.sqf
Normal file
@@ -0,0 +1,55 @@
|
||||
params ["_turretPaths", "_seatCategory", "_outArr"];
|
||||
{
|
||||
_path = _x;
|
||||
if (_path isEqualTo []) then {_path = [-1]};
|
||||
_weps = _vic weaponsTurret _path;
|
||||
private _thisArr = [];
|
||||
if (count _weps isNotEqualTo 0) then {
|
||||
_magsHere = _vic magazinesTurret _path call BIS_fnc_consolidateArray;
|
||||
|
||||
private _wepMags = [];
|
||||
{
|
||||
private _wepDet = [_vic, _path, _x, _magsHere, _pylons] call milsim_fbcb2_assets_fnc_getMagsForWeapon;
|
||||
if (!(_wepDet isEqualTo [[]])) then {
|
||||
_wepMags pushBack _wepDet;
|
||||
};
|
||||
} forEach _weps;
|
||||
|
||||
if (count _wepMags > 0) then {
|
||||
// "debug_console" callExtension (format["_wepMags Driver = %1", [_wepMags] call CBA_fnc_encodeJSON] + "#1100");
|
||||
{
|
||||
_thisArr pushBack _x # 0;
|
||||
if (count _x > 1) then {
|
||||
{
|
||||
_thisArr pushBack _x;
|
||||
} forEach (_x # 1);
|
||||
}
|
||||
} forEach _wepMags;
|
||||
};
|
||||
};// else {
|
||||
// "debug_console" callExtension (format["Running Mags Only."] + "#1100");
|
||||
// "debug_console" callExtension (format["Vic: %1",_vic] + "#1100");
|
||||
// "debug_console" callExtension (format["Path: %1", _path] + "#1100");
|
||||
// _mags = ([_vic, _path] call _getMags);
|
||||
|
||||
// if (count _mags > 0) then {
|
||||
// {
|
||||
// _thisArr pushBack _x;
|
||||
// } forEach _mags;
|
||||
// };
|
||||
// };
|
||||
|
||||
if (count _thisArr > 0) then {
|
||||
private _turretConfig = [_vic, _x] call BIS_fnc_turretConfig;
|
||||
private _turretDisplayName = [_turretConfig] call BIS_fnc_displayName;
|
||||
if (_turretDisplayName != "") then {
|
||||
_outArr pushBack format[" <font color='#f6dcbf' face='PuristaSemiBold'>%1 (""%2"")</font>", _seatCategory, _turretDisplayName];
|
||||
} else {
|
||||
_outArr pushBack format[" <font color='#f6dcbf' face='PuristaSemiBold'>%1</font>", _seatCategory];
|
||||
};
|
||||
|
||||
{
|
||||
_outArr pushBack _x;
|
||||
} forEach _thisArr;
|
||||
}
|
||||
} forEach _turretPaths;
|
||||
16
framework/fbcb2/assets/fn_removeAssetDiaryRecords.sqf
Normal file
16
framework/fbcb2/assets/fn_removeAssetDiaryRecords.sqf
Normal file
@@ -0,0 +1,16 @@
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
{
|
||||
private _diarySubject = _x;
|
||||
private _records = player allDiaryRecords _diarySubject;
|
||||
if (count _records isEqualTo 0) then {continue};
|
||||
|
||||
{
|
||||
private _diaryRecord = _x select -1;
|
||||
player removeDiaryRecord [_diarySubject, _diaryRecord];
|
||||
} forEach _records;
|
||||
} forEach [
|
||||
milsim_fbcb2_subjectAssetsFixedWingID,
|
||||
milsim_fbcb2_subjectAssetsRotaryID,
|
||||
milsim_fbcb2_subjectAssetsGroundID
|
||||
];
|
||||
185
framework/fbcb2/assets/fn_updateAssetDiary.sqf
Normal file
185
framework/fbcb2/assets/fn_updateAssetDiary.sqf
Normal file
@@ -0,0 +1,185 @@
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
// create diary records
|
||||
|
||||
|
||||
// remove any existing asset map markers
|
||||
call milsim_fbcb2_assets_fnc_removeMarkersOnMap;
|
||||
|
||||
// remove existing asset records
|
||||
call milsim_fbcb2_assets_fnc_removeAssetDiaryRecords;
|
||||
|
||||
// get all vehicles by base
|
||||
private _vehiclesByBase = call milsim_fbcb2_assets_fnc_getAssetsByBase;
|
||||
if (count _vehiclesByBase isEqualTo 0) exitWith {false};
|
||||
|
||||
// put vehicles from each base into a single array
|
||||
private _vehicles = [];
|
||||
{
|
||||
_vehicles append (_x#1);
|
||||
} forEach _vehiclesByBase;
|
||||
|
||||
if (count _vehicles isEqualTo 0) exitWith {false};
|
||||
private _distinctVehiclesClassNames = [];
|
||||
{
|
||||
_distinctVehiclesClassNames pushBackUnique (typeOf _x);
|
||||
} forEach _vehicles;
|
||||
|
||||
|
||||
// ForEach unique vehicle class name, we'll find the first and gather its info
|
||||
{
|
||||
private _className = _x;
|
||||
private _vehiclesOfThisKind = _vehicles select {typeOf _x isEqualTo _className};
|
||||
// This should never happen, but...
|
||||
if (count _vehiclesOfThisKind isEqualTo 0) then {continue};
|
||||
|
||||
// Take the first vehicle as a representative
|
||||
private _representativeVehicle = _vehiclesOfThisKind#0;
|
||||
private _vehicleCfg = configOf _representativeVehicle;
|
||||
private _vehicleCallsign = toUpper (
|
||||
_representativeVehicle getVariable [
|
||||
"milsim_fbcb2_assets_callsign",
|
||||
"NONE ASSIGNED"
|
||||
]
|
||||
);
|
||||
|
||||
// Process the vehicle for extended info
|
||||
// Exclusion list for display names
|
||||
if (
|
||||
((configOf _representativeVehicle) call BIS_fnc_displayName)
|
||||
in ["Helicopter"]
|
||||
) then {continue};
|
||||
|
||||
// Get the vehicle data
|
||||
private _processed = [_representativeVehicle] call milsim_fbcb2_assets_fnc_getVehicleData;
|
||||
|
||||
if (isNil "_processed") then {continue};
|
||||
_processed params ["_vehicleCfg", "_displayName", "_diaryTextSections"];
|
||||
_diaryTextSections params [
|
||||
"_title",
|
||||
"_image",
|
||||
"_info",
|
||||
"_capacity"
|
||||
// "_weapons",
|
||||
// "_pylonWeapons",
|
||||
// "_inventory"
|
||||
];
|
||||
|
||||
// Create the diary record
|
||||
private _recordText = [];
|
||||
// Add the title and image
|
||||
_recordText pushBack _title;
|
||||
_recordText pushBack _image;
|
||||
_recordText pushBack "<br/>";
|
||||
_recordText pushBack format[
|
||||
"CALLSIGN: %1",
|
||||
_vehicleCallsign
|
||||
];
|
||||
_recordText pushBack format[
|
||||
"COUNT ACTIVE: %1",
|
||||
count _vehiclesOfThisKind
|
||||
];
|
||||
|
||||
// Here, we'll create a link to show markers on the map for all vehicles of this kind
|
||||
private _randomColor = selectRandom [
|
||||
["ColorRed", "#FF0000", "Red"],
|
||||
["ColorGreen", "#00FF00", "Green"],
|
||||
["ColorBlue", "#0000FF", "Blue"],
|
||||
["ColorYellow", "#FFFF00", "Yellow"],
|
||||
["ColorWhite", "#FFFFFF", "White"]
|
||||
];
|
||||
private _vehicleCfg = configFile >> "CfgVehicles" >> _className;
|
||||
// get 'picture' for record
|
||||
private _icon = getText(_vehicleCfg >> "picture");
|
||||
// determine marker type
|
||||
private _markerType = "mil_dot";
|
||||
switch (true) do {
|
||||
case (_representativeVehicle isKindOf "Helicopter"): {
|
||||
_markerType = "loc_heli";
|
||||
};
|
||||
case (_representativeVehicle isKindOf "Air"): {
|
||||
_markerType = "loc_plane";
|
||||
};
|
||||
case (_representativeVehicle isKindOf "Ship"): {
|
||||
_markerType = "loc_boat";
|
||||
};
|
||||
case (_representativeVehicle isKindOf "Car"): {
|
||||
_markerType = "loc_car";
|
||||
};
|
||||
default {
|
||||
_markerType = "loc_truck";
|
||||
};
|
||||
};
|
||||
|
||||
// Link to show markers
|
||||
private _showMarkersText = format[
|
||||
"<execute expression='[""%1"",""%2"",""%3"",%4] call milsim_fbcb2_assets_fnc_showMarkersOnMap'>SHOW MARKERS at vehicle positions</execute> (in %5)",
|
||||
_className,
|
||||
_markerType,
|
||||
_randomColor#0,
|
||||
(_vehiclesOfThisKind apply {
|
||||
format["%1", _x call BIS_fnc_netId]
|
||||
}),
|
||||
format["<font color='%1'>%2</font>", _randomColor#1, _randomColor#2]
|
||||
];
|
||||
_recordText pushBack _showMarkersText;
|
||||
|
||||
// Link to hide markers
|
||||
_recordText pushBack "<execute expression=""call milsim_fbcb2_assets_fnc_removeMarkersOnMap"">REMOVE ALL MARKERS showing asset positions</execute>";
|
||||
|
||||
// Link to update asset diary entries
|
||||
_recordText pushBack "<execute expression=""call milsim_fbcb2_assets_fnc_updateAssetDiary"">UPDATE ENTRIES for all assets</execute>";
|
||||
|
||||
_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 (~5 minutes at most)."
|
||||
];
|
||||
|
||||
|
||||
|
||||
// Add info and capacity sections
|
||||
_recordText pushBack _info;
|
||||
_recordText pushBack _capacity;
|
||||
|
||||
|
||||
private _subjectID = "";
|
||||
switch (true) do {
|
||||
case (_representativeVehicle isKindOf "Helicopter"): {
|
||||
_subjectID = milsim_fbcb2_subjectAssetsRotaryID;
|
||||
};
|
||||
case (_representativeVehicle isKindOf "Air"): {
|
||||
_subjectID = milsim_fbcb2_subjectAssetsFixedWingID;
|
||||
};
|
||||
default {
|
||||
_subjectID = milsim_fbcb2_subjectAssetsGroundID;
|
||||
};
|
||||
};
|
||||
|
||||
[
|
||||
_subjectID,
|
||||
format[
|
||||
"%1x %2",
|
||||
count _vehiclesOfThisKind,
|
||||
(configOf _representativeVehicle) call BIS_fnc_displayName
|
||||
],
|
||||
_recordText joinString "<br/>",
|
||||
_icon
|
||||
] call milsim_fnc_createOrUpdateDiaryRecord;
|
||||
|
||||
// "\A3\ui_f\data\igui\cfg\simpleTasks\types\car_ca.paa"
|
||||
} forEach _distinctVehiclesClassNames;
|
||||
|
||||
// log to RPT
|
||||
[
|
||||
"fbcb2_assets",
|
||||
"UPDATED ASSET DIARY",
|
||||
[
|
||||
["assetCount", count _vehicles],
|
||||
["distinctAssetCount", count _distinctVehiclesClassNames]
|
||||
]
|
||||
] call milsim_util_fnc_log;
|
||||
|
||||
true;
|
||||
25
framework/fbcb2/assets/markers/fn_removeMarkersOnMap.sqf
Normal file
25
framework/fbcb2/assets/markers/fn_removeMarkersOnMap.sqf
Normal file
@@ -0,0 +1,25 @@
|
||||
private _baseMarkerStoreVar = "milsim_fbcb2_assets_baseMarkerStore";
|
||||
private _assetMarkerStoreVar = "milsim_fbcb2_assets_assetMarkerStore";
|
||||
|
||||
private _baseMarkerStore = localNamespace getVariable [
|
||||
_baseMarkerStoreVar,
|
||||
[]
|
||||
];
|
||||
private _assetMarkerStore = localNamespace getVariable [
|
||||
_assetMarkerStoreVar,
|
||||
[]
|
||||
];
|
||||
|
||||
// delete markers
|
||||
{
|
||||
deleteMarkerLocal (_x#1);
|
||||
} forEach (_baseMarkerStore + _assetMarkerStore);
|
||||
|
||||
localNamespace setVariable [
|
||||
_baseMarkerStoreVar,
|
||||
[]
|
||||
];
|
||||
localNamespace setVariable [
|
||||
_assetMarkerStoreVar,
|
||||
[]
|
||||
];
|
||||
106
framework/fbcb2/assets/markers/fn_showMarkersOnMap.sqf
Normal file
106
framework/fbcb2/assets/markers/fn_showMarkersOnMap.sqf
Normal file
@@ -0,0 +1,106 @@
|
||||
params [
|
||||
["_className", "", [""]],
|
||||
["_markerType", "hd_dot", [""]],
|
||||
["_markerColor", "", [""]],
|
||||
["_assetObjects", [], []]
|
||||
];
|
||||
|
||||
if (count _className isEqualTo 0) exitWith {
|
||||
["No class name provided!"] call BIS_fnc_error;
|
||||
};
|
||||
if (count _markerColor isEqualTo 0) exitWith {
|
||||
["No marker color provided!"] call BIS_fnc_error;
|
||||
};
|
||||
if (count _assetObjects isEqualTo 0) exitWith {
|
||||
["No vehicles provided!"] call BIS_fnc_error;
|
||||
};
|
||||
|
||||
private _baseMarkerStoreVar = "milsim_fbcb2_assets_baseMarkerStore";
|
||||
private _assetMarkerStoreVar = "milsim_fbcb2_assets_assetMarkerStore";
|
||||
|
||||
private _baseMarkerStore = localNamespace getVariable [
|
||||
_baseMarkerStoreVar,
|
||||
[]
|
||||
];
|
||||
private _assetMarkerStore = localNamespace getVariable [
|
||||
_assetMarkerStoreVar,
|
||||
[]
|
||||
];
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Create base markers if not already present
|
||||
if (not (count _baseMarkerStore > 0)) then {
|
||||
{ // milsim_baseObjects is accessed directly, so are valid objects
|
||||
private _base = _x;
|
||||
|
||||
// create a circle marker with range as the detection range of assets
|
||||
_newMarker = createMarkerLocal [
|
||||
format["milsim_fbcb2_assets_base_marker_%1", _forEachIndex + 1],
|
||||
getPosASL _base
|
||||
];
|
||||
_newMarker setMarkerTypeLocal "mil_dot";
|
||||
_newMarker setMarkerColorLocal "ColorGreen";
|
||||
_newMarker setMarkerShapeLocal "ELLIPSE";
|
||||
_newMarker setMarkerSizeLocal [
|
||||
milsim_fbcb2_assets_setting_detectionRangeFromBase,
|
||||
milsim_fbcb2_assets_setting_detectionRangeFromBase
|
||||
];
|
||||
_newMarker setMarkerAlphaLocal 0.5;
|
||||
_newMarker setMarkerTextLocal str(_forEachIndex + 1);
|
||||
|
||||
_baseMarkerStore pushBack [
|
||||
_base,
|
||||
_newMarker
|
||||
];
|
||||
|
||||
// create a flag marker at base position
|
||||
_newMarker = createMarkerLocal [
|
||||
format["milsim_fbcb2_assets_base_flag_marker_%1", _forEachIndex + 1],
|
||||
getPosASL _base
|
||||
];
|
||||
_newMarker setMarkerTypeLocal "mil_flag";
|
||||
_newMarker setMarkerColorLocal "ColorGreen";
|
||||
_newMarker setMarkerSizeLocal [0.7, 0.7];
|
||||
_newMarker setMarkerTextLocal ([_base] call milsim_util_fnc_getNameOfBase);
|
||||
|
||||
_baseMarkerStore pushBack [
|
||||
_base,
|
||||
_newMarker
|
||||
];
|
||||
} forEach milsim_baseObjects;
|
||||
|
||||
localNamespace setVariable [_baseMarkerStoreVar, _baseMarkerStore];
|
||||
};
|
||||
|
||||
|
||||
private _start = (count _assetMarkerStore) + 1;
|
||||
{ // _assetObjects is a serialized parameter, so we pass the netIds (strings)
|
||||
private _assetNetIdStr = _x;
|
||||
private _asset = _assetNetIdStr call BIS_fnc_objectFromNetId;
|
||||
// if asset was removed since last update
|
||||
if (isNull _asset) then {continue};
|
||||
// check if a marker is already placed for this asset
|
||||
if (
|
||||
(_assetMarkerStore findIf { _x select 0 isEqualTo _asset })
|
||||
> -1
|
||||
) then {continue};
|
||||
|
||||
// create a marker for the asset
|
||||
private _newMarker = createMarkerLocal [
|
||||
format["milsim_fbcb2_assets_marker_%1", _start],
|
||||
getPosASL _asset
|
||||
];
|
||||
_newMarker setMarkerAlphaLocal 1;
|
||||
_newMarker setMarkerTypeLocal _markerType;
|
||||
_newMarker setMarkerColorLocal _markerColor;
|
||||
// _newMarker setMarkerTextLocal ([configOf _asset] call BIS_fnc_displayName);
|
||||
|
||||
_assetMarkerStore pushBack [
|
||||
_asset,
|
||||
_newMarker
|
||||
];
|
||||
_start = _start + 1;
|
||||
} forEach _assetObjects;
|
||||
|
||||
// update store var
|
||||
localNamespace setVariable [_assetMarkerStoreVar, _assetMarkerStore];
|
||||
31
framework/fbcb2/fn_hintFBCB2AssetStatus.sqf
Normal file
31
framework/fbcb2/fn_hintFBCB2AssetStatus.sqf
Normal file
@@ -0,0 +1,31 @@
|
||||
_assetList = param [0, [objNull], [[objNull]]];
|
||||
|
||||
_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 ];
|
||||
|
||||
{
|
||||
_callSign = _x select 0;
|
||||
_asset = _x select 1;
|
||||
_assigned = _x select 2;
|
||||
_available = 0; //count (getMarkerPos "respawn_west" nearEntities [ _asset, 2000] );
|
||||
|
||||
_homes = allMissionObjects "ModuleRespawnPosition_F";
|
||||
|
||||
{
|
||||
_home = _x;
|
||||
_available = _available + count( _home nearEntities [ _asset, 750] );
|
||||
} forEach _homes;
|
||||
|
||||
|
||||
_image = getText(configFile >> "CfgVehicles" >> _asset >> "picture");
|
||||
|
||||
_name = getText(configFile >> "CfgVehicles" >> _asset >> "displayName") select [0, 24];
|
||||
_data = "<img size='1' align='left' image='" + _image + "'/><t size='1' align='left'> " + _name + "</t><t size='1' align='right'>" + str _available + " [ " + str _assigned +" ]</t>";
|
||||
_text = composeText[ _text, parseText _data, lineBreak ];
|
||||
|
||||
|
||||
} foreach _assetList;
|
||||
|
||||
hint _text;
|
||||
39
framework/fbcb2/fn_initFBCB2.sqf
Normal file
39
framework/fbcb2/fn_initFBCB2.sqf
Normal file
@@ -0,0 +1,39 @@
|
||||
|
||||
if ( !hasInterface ) exitWith {};
|
||||
|
||||
waitUntil { !isNil "milsim_complete" };
|
||||
|
||||
milsim_fbcb2_recordTitleColor = "#ff6666";
|
||||
milsim_fbcb2_recordTitleFont = "PuristaMedium";
|
||||
milsim_fbcb2_recordTitleSize = 20;
|
||||
|
||||
milsim_fbcb2_recordTextHeaderSize = 16;
|
||||
milsim_fbcb2_recordTextBodySize = 14;
|
||||
|
||||
milsim_fbcb2_subjectStatusID = "FBCB2_Status";
|
||||
milsim_fbcb2_subjectIntelID = "FBCB2_Intel";
|
||||
milsim_fbcb2_subjectMessagesID = "FBCB2_Messages";
|
||||
milsim_fbcb2_subjectFrequenciesID = "FBCB2_Frequencies";
|
||||
milsim_fbcb2_subjectAssetsFixedWingID = "FBCB2_Assets_FixedWing";
|
||||
milsim_fbcb2_subjectAssetsRotaryID = "FBCB2_Assets_Rotary";
|
||||
milsim_fbcb2_subjectAssetsGroundID = "FBCB2_Assets_Ground";
|
||||
|
||||
player createDiarySubject[milsim_fbcb2_subjectStatusID, "FBCB2 - Status"];
|
||||
player createDiarySubject[milsim_fbcb2_subjectMessagesID, "FBCB2 - Messages"];
|
||||
player createDiarySubject[milsim_fbcb2_subjectIntelID, "FBCB2 - Intel"];
|
||||
player createDiarySubject[milsim_fbcb2_subjectFrequenciesID, "FBCB2 - Frequencies"];
|
||||
player createDiarySubject[milsim_fbcb2_subjectAssetsFixedWingID, "FBCB2 - Assets Plane"];
|
||||
player createDiarySubject[milsim_fbcb2_subjectAssetsRotaryID, "FBCB2 - Assets Rotary"];
|
||||
player createDiarySubject[milsim_fbcb2_subjectAssetsGroundID, "FBCB2 - Assets Ground"];
|
||||
|
||||
// store records in format:
|
||||
// [subject, [
|
||||
// [title, diaryRecord]
|
||||
// ]]
|
||||
milsim_fbcb2_diaryRecords = createHashMap;
|
||||
|
||||
// populate diary
|
||||
[] call milsim_fnc_processFBCB2RadioFrequencies;
|
||||
[] call milsim_fnc_processFBCB2SmokeColors;
|
||||
[] call milsim_fnc_processFBCB2Environment;
|
||||
[] call milsim_fbcb2_assets_fnc_updateAssetDiary;
|
||||
45
framework/fbcb2/fn_processFBCB2Environment.sqf
Normal file
45
framework/fbcb2/fn_processFBCB2Environment.sqf
Normal file
@@ -0,0 +1,45 @@
|
||||
private _recordTitle = "MDS - INTEL - ENVIRONMENT";
|
||||
|
||||
private _text = [
|
||||
format[
|
||||
"<font size='%1' color='%2' face='%3'>%4</font><br/><br/>",
|
||||
milsim_fbcb2_recordTitleSize,
|
||||
milsim_fbcb2_recordTitleColor,
|
||||
milsim_fbcb2_recordTitleFont,
|
||||
_recordTitle
|
||||
]
|
||||
];
|
||||
|
||||
private _sunriseColor = "#4A86E8";
|
||||
private _sunsetColor = "#6AA84F";
|
||||
private _whiteColor = "#FFFFFF";
|
||||
|
||||
private _sunTimes = date call BIS_fnc_sunriseSunsetTime;
|
||||
|
||||
_text pushBack format[
|
||||
"<font size='%1' color='%2'>Local Sunrise</font><br/>
|
||||
<font size='%3' color='%4'>%5</font><br/><br/>",
|
||||
milsim_fbcb2_recordTextHeaderSize,
|
||||
_sunriseColor,
|
||||
milsim_fbcb2_recordTextBodySize,
|
||||
_whiteColor,
|
||||
([_sunTimes select 0, "HH:MM"] call BIS_fnc_timeToString)
|
||||
];
|
||||
|
||||
_text pushBack format[
|
||||
"<font size='%1' color='%2'>Local Sunset</font><br/>
|
||||
<font size='%3' color='%4'>%5</font><br/><br/>",
|
||||
milsim_fbcb2_recordTextHeaderSize,
|
||||
_sunsetColor,
|
||||
milsim_fbcb2_recordTextBodySize,
|
||||
_whiteColor,
|
||||
([_sunTimes select 1, "HH:MM"] call BIS_fnc_timeToString)
|
||||
];
|
||||
|
||||
_text = _text joinString "";
|
||||
|
||||
[
|
||||
milsim_fbcb2_subjectIntelID,
|
||||
_recordTitle,
|
||||
_text
|
||||
] call milsim_fnc_createOrUpdateDiaryRecord;
|
||||
50
framework/fbcb2/fn_processFBCB2RadioFrequencies.sqf
Normal file
50
framework/fbcb2/fn_processFBCB2RadioFrequencies.sqf
Normal file
@@ -0,0 +1,50 @@
|
||||
// updated 2024-02-01 by IndigoFox
|
||||
// now reads from the battalion config structure to generate the diary entries
|
||||
|
||||
////////////////////////////////////////
|
||||
// Get info from missionConfigFile
|
||||
////////////////////////////////////////
|
||||
private _battalionInfoCfg = call milsim_util_fnc_getBattalionCfg;
|
||||
private _battalionElementCfgs = [_battalionInfoCfg >> "Command"] call BIS_fnc_returnChildren;
|
||||
|
||||
////////////////////////////////////////
|
||||
// Define formatting constants
|
||||
////////////////////////////////////////
|
||||
private _ELEMENT_NAME_SIZE = 10;
|
||||
private _ELEMENT_NAME_FONT = "EtelkaMonospaceProBold";
|
||||
private _ELEMENT_FREQ_SIZE = 9;
|
||||
private _ELEMENT_FREQ_FONT = "EtelkaMonospacePro";
|
||||
private _FREQ_INDENT_CONSTANT = 6;
|
||||
private _FREQ_PAD_LENGTH = 17;
|
||||
private _FREQ_TEXT_COLOR = "#CCCCCC";
|
||||
// Note: Element colors are defined in the battalion config
|
||||
|
||||
////////////////////////////////////////
|
||||
// ADD DIARY ENTRIES
|
||||
////////////////////////////////////////
|
||||
|
||||
// First is all the battalion-level elements beneath command
|
||||
// To have the records listed in the order they appear in the battalion config, we need to reverse the array
|
||||
// Since each entry is added to the top of the list, this will result in the entries being added in the correct order
|
||||
reverse _battalionElementCfgs;
|
||||
|
||||
{
|
||||
// recursively generate diary text for all child elements of battalion-level elements
|
||||
private _diaryTitleText = [_x, true] call milsim_fnc_generateElementFrequencyRecordText;
|
||||
[
|
||||
milsim_fbcb2_subjectFrequenciesID,
|
||||
_diaryTitleText#0,
|
||||
_diaryTitleText#1
|
||||
] call milsim_fnc_createOrUpdateDiaryRecord;
|
||||
} forEach _battalionElementCfgs;
|
||||
|
||||
// add the battalion command to the top of the list
|
||||
// don't process child elements
|
||||
private _diaryTitleText = [_battalionInfoCfg >> "Command", false] call milsim_fnc_generateElementFrequencyRecordText;
|
||||
[
|
||||
milsim_fbcb2_subjectFrequenciesID,
|
||||
_diaryTitleText#0,
|
||||
_diaryTitleText#1
|
||||
] call milsim_fnc_createOrUpdateDiaryRecord;
|
||||
|
||||
true;
|
||||
41
framework/fbcb2/fn_processFBCB2SmokeColors.sqf
Normal file
41
framework/fbcb2/fn_processFBCB2SmokeColors.sqf
Normal file
@@ -0,0 +1,41 @@
|
||||
private _recordTitle = "MDS - INTEL - SMOKES";
|
||||
|
||||
private _text = [
|
||||
// Title
|
||||
format[
|
||||
"<font size='%1' color='%2' face='%3'>%4</font>",
|
||||
milsim_fbcb2_recordTitleSize,
|
||||
milsim_fbcb2_recordTitleColor,
|
||||
milsim_fbcb2_recordTitleFont,
|
||||
_recordTitle
|
||||
]
|
||||
];
|
||||
|
||||
private _smokeColors = [
|
||||
["#FFFFFF", "WHITE", "Concealment"],
|
||||
["#008800", "GREEN", "Friendly Forces"],
|
||||
["#0000FF", "BLUE", "LZ Markers"],
|
||||
["#FF0000", "RED", "Enemy Location"],
|
||||
["#FFA500", "ORANGE", "Resupply Marker"],
|
||||
["#FFFF00", "YELLOW", "Medical Emergency"],
|
||||
["#800080", "PURPLE", "Broken Arrow - 100m radius"]
|
||||
];
|
||||
|
||||
{
|
||||
_x params ["_color", "_name", "_description"];
|
||||
_text pushBack format[
|
||||
"<font size='%1'><font color='%2'>%3</font> - %4</font>",
|
||||
milsim_fbcb2_recordTextHeaderSize,
|
||||
_color,
|
||||
_name,
|
||||
_description
|
||||
];
|
||||
} forEach _smokeColors;
|
||||
|
||||
_text = _text joinString "<br/><br/>";
|
||||
|
||||
[
|
||||
milsim_fbcb2_subjectIntelID,
|
||||
_recordTitle,
|
||||
_text
|
||||
] call milsim_fnc_createOrUpdateDiaryRecord;
|
||||
@@ -0,0 +1,73 @@
|
||||
// called from milsim_fnc_processFBCB2RadioFrequencies
|
||||
params ["_cfg", ["_indentCount", 1, [5]]];
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Define leading space/hyphenation for element name
|
||||
//////////////////////////////////////////////////////
|
||||
private _leadingSpace = [
|
||||
format["<font size='%1' face='%2'>| ", _ELEMENT_NAME_SIZE, _ELEMENT_NAME_FONT]
|
||||
];
|
||||
for "_i" from 1 to _indentCount do {
|
||||
_leadingSpace pushBack "-";
|
||||
};
|
||||
_leadingSpace pushBack " | </font>";
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// Create the header line for the provided config entry
|
||||
/////////////////////////////////////////////////////////
|
||||
private _lines = [
|
||||
format[
|
||||
"<font color='%1'>%2%3</font>",
|
||||
getText(_cfg >> "textColor"),
|
||||
_leadingSpace joinString "",
|
||||
getText (_cfg >> "callsign")
|
||||
]
|
||||
];
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Create the frequency lines for the provided config entry
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
// Generate leading space
|
||||
private _freqLeadingSpace = [
|
||||
format["<font size='%1' face='%2'>| ", _ELEMENT_NAME_SIZE, _ELEMENT_NAME_FONT]
|
||||
];
|
||||
for "_i" from 1 to _FREQ_INDENT_CONSTANT do {
|
||||
_freqLeadingSpace pushBack " ";
|
||||
};
|
||||
_freqLeadingSpace pushBack "</font>";
|
||||
_freqLeadingSpace = _freqLeadingSpace joinString "";
|
||||
|
||||
// Process config values for frequencies
|
||||
{
|
||||
_x params ["_role", "_sr", "_lr"];
|
||||
|
||||
|
||||
private ["_srStr", "_lrStr"];
|
||||
if (count _sr > 0) then {
|
||||
_srStr = format["%1", _sr joinString " / "];
|
||||
} else {
|
||||
_srStr = "----";
|
||||
};
|
||||
if (count _lr > 0) then {
|
||||
_lrStr = format["%1", _lr joinString " / "];
|
||||
} else {
|
||||
_lrStr = "----";
|
||||
};
|
||||
|
||||
// Add formatted line to the array
|
||||
_lines pushBack format[
|
||||
"%1<font size='%2' face='%3' color='%4'>- %5%6%7</font>",
|
||||
_freqLeadingSpace,
|
||||
_ELEMENT_FREQ_SIZE,
|
||||
_ELEMENT_FREQ_FONT,
|
||||
_FREQ_TEXT_COLOR,
|
||||
[_role, "right", " ", _FREQ_PAD_LENGTH] call milsim_util_fnc_padString,
|
||||
[_srStr, "right", " ", _FREQ_PAD_LENGTH] call milsim_util_fnc_padString,
|
||||
_lrStr
|
||||
];
|
||||
} forEach (getArray (_cfg >> "frequencies"));
|
||||
// diag_log text (_lines joinString endl);
|
||||
|
||||
// Return the formatted lines in ARRAY format
|
||||
_lines;
|
||||
@@ -0,0 +1,87 @@
|
||||
// called from milsim_fnc_processFBCB2RadioFrequencies ONLY
|
||||
// this function is called recursively to process all child elements of a battalion element in missionConfigFile
|
||||
params [
|
||||
["_elementCfg", configNull, [configNull]],
|
||||
["_shouldProcessChildCfgs", true]
|
||||
];
|
||||
|
||||
if (isNull _elementCfg) exitWith {
|
||||
["_elementCfg parameter is NULL"] call BIS_fnc_error;
|
||||
};
|
||||
|
||||
// change reference variable for clarity
|
||||
private _battalionElement = _elementCfg;
|
||||
|
||||
// Generate title from callsign and shortDescription
|
||||
private _recordTitle = format[
|
||||
"%1 (%2)",
|
||||
getText(_battalionElement >> "callsign"),
|
||||
getText(_battalionElement >> "shortDescription")
|
||||
];
|
||||
// systemChat _recordTitle;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
// Generate frequency table header line's leading space
|
||||
//////////////////////////////////////////////////////////
|
||||
private _freqLeadingSpace = [
|
||||
format["<font size='%1' face='%2'>| ", _ELEMENT_NAME_SIZE, _ELEMENT_NAME_FONT]
|
||||
];
|
||||
for "_i" from 1 to _FREQ_INDENT_CONSTANT do {
|
||||
_freqLeadingSpace pushBack " ";
|
||||
};
|
||||
_freqLeadingSpace pushBack "</font>";
|
||||
_freqLeadingSpace = _freqLeadingSpace joinString "";
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
// Generate header line and frequency table header line
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
private _headers = [
|
||||
format[
|
||||
"<font size='%1' color='%2' face='%3'>%4</font>",
|
||||
milsim_fbcb2_recordTitleSize,
|
||||
milsim_fbcb2_recordTitleColor,
|
||||
milsim_fbcb2_recordTitleFont,
|
||||
_recordTitle
|
||||
],
|
||||
format[
|
||||
"%1<font size='%2' face='%3' color='%4'>- %5%6%7</font>",
|
||||
_freqLeadingSpace,
|
||||
_ELEMENT_FREQ_SIZE,
|
||||
_ELEMENT_FREQ_FONT,
|
||||
_FREQ_TEXT_COLOR,
|
||||
["ROLE", "right", " ", _FREQ_PAD_LENGTH] call milsim_util_fnc_padString,
|
||||
["SR", "right", " ", _FREQ_PAD_LENGTH] call milsim_util_fnc_padString,
|
||||
"LR"
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
// Generate the list of element headers and frequencies
|
||||
//////////////////////////////////////////////////////////
|
||||
private _allText = [];
|
||||
|
||||
// get all child elements recursively and format them
|
||||
if (_shouldProcessChildCfgs) then {
|
||||
[_battalionElement, {
|
||||
params ["_cfg", "_recurseCounter"];
|
||||
// add config
|
||||
private _lines = [_cfg, _recurseCounter+1] call milsim_fnc_formatRadioElementForDiary;
|
||||
// private _lines = [_cfg, _indentCount] call t;
|
||||
_allText pushBack (_lines joinString "<br/>");
|
||||
}] call milsim_util_fnc_recurseSubclasses;
|
||||
} else {
|
||||
// or if the param was false, just add the battalion element
|
||||
private _lines = [_battalionElement, 1] call milsim_fnc_formatRadioElementForDiary;
|
||||
// private _lines = [_cfg, _indentCount] call t;
|
||||
_allText pushBack (_lines joinString "<br/>");
|
||||
};
|
||||
|
||||
// add headers, add all other lines and format them as monospace
|
||||
_allText = format[
|
||||
"%1<br/><br/><font face='EtelkaMonospaceProBold'>%2</font>", _headers joinString "<br/>", _allText joinString "<br/><br/>"];
|
||||
|
||||
// return the title and all text
|
||||
[_recordTitle, _allText];
|
||||
28
framework/fbcb2/util/fn_createOrUpdateDiaryRecord.sqf
Normal file
28
framework/fbcb2/util/fn_createOrUpdateDiaryRecord.sqf
Normal file
@@ -0,0 +1,28 @@
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
params [
|
||||
["_subjectID", milsim_fbcb2_subjectStatusID, [""]],
|
||||
["_recordTitle", "", [""]],
|
||||
["_recordText", "", [""]],
|
||||
["_recordIcon", "", [""]]
|
||||
];
|
||||
|
||||
// Check if already created
|
||||
private _subjectRecords = milsim_fbcb2_diaryRecords getOrDefault [_subjectID, createHashMap, true];
|
||||
private _existingRecord = _subjectRecords getOrDefault [_recordTitle, diaryRecordNull, true];
|
||||
|
||||
if (!isNull _existingRecord) then {
|
||||
player setDiaryRecordText [[_subjectID, _existingRecord], [_recordTitle, _recordText, _recordIcon]];
|
||||
systemChat format ["Updated diary record: %1", _recordTitle];
|
||||
} else {
|
||||
private _new = player createDiaryRecord [
|
||||
_subjectID,
|
||||
[
|
||||
_recordTitle,
|
||||
_recordText,
|
||||
_recordIcon
|
||||
]
|
||||
];
|
||||
_subjectRecords set [_recordTitle, _new];
|
||||
milsim_fbcb2_diaryRecords set [_subjectID, _subjectRecords];
|
||||
};
|
||||
0
framework/fbcb2/util/fn_removeDiaryRecord.sqf
Normal file
0
framework/fbcb2/util/fn_removeDiaryRecord.sqf
Normal file
14
framework/init/fn_initPlayerLocal.sqf
Normal file
14
framework/init/fn_initPlayerLocal.sqf
Normal file
@@ -0,0 +1,14 @@
|
||||
if ( !hasInterface ) exitWith {};
|
||||
|
||||
if (!isServer) then {
|
||||
["milsim_logText", {
|
||||
params [["_strArray", [""], [[]]]];
|
||||
{
|
||||
diag_log text _x;
|
||||
} forEach _strArray;
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
};
|
||||
|
||||
["InitializePlayer", [player, true]] call BIS_fnc_dynamicGroups;
|
||||
|
||||
nil;
|
||||
35
framework/init/fn_initServer.sqf
Normal file
35
framework/init/fn_initServer.sqf
Normal file
@@ -0,0 +1,35 @@
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
milsim_baseObjects = allMissionObjects "ModuleRespawnPosition_F";
|
||||
publicVariable "milsim_baseObjects";
|
||||
|
||||
// init asset stores at bases
|
||||
[true] call milsim_fbcb2_assets_fnc_updateAssetsByBase;
|
||||
// starting 5 minutes after postInit, update asset stores every 5 minutes
|
||||
[{
|
||||
[
|
||||
{[false] call milsim_fbcb2_assets_fnc_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 milsim_fbcb2_assets_fnc_updateAssetsByBase;
|
||||
}];
|
||||
|
||||
// Initializes the Dynamic Groups framework and groups
|
||||
["Initialize", [true]] call BIS_fnc_dynamicGroups;
|
||||
|
||||
["milsim_logText", {
|
||||
params [["_strArray", [""], [[]]]];
|
||||
{
|
||||
diag_log text _x;
|
||||
} forEach _strArray;
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
missionNamespace setVariable ["milsim_complete", true];
|
||||
diag_log text "[MILSIM] (initServer) milsim_complete: version 2.3";
|
||||
|
||||
publicVariable "milsim_complete";
|
||||
5
framework/map/fn_copyMapFromPlayer.sqf
Normal file
5
framework/map/fn_copyMapFromPlayer.sqf
Normal file
@@ -0,0 +1,5 @@
|
||||
params ["_sourcePlayer","_destinationPlayer"];
|
||||
|
||||
hint format["Copying map markers from %1", name _sourcePlayer];
|
||||
|
||||
[_destinationPlayer] remoteExecCall ["milsim_fnc_getPlayerMapMarkers",_sourcePlayer];
|
||||
16
framework/map/fn_getPlayerMapMarkers.sqf
Normal file
16
framework/map/fn_getPlayerMapMarkers.sqf
Normal file
@@ -0,0 +1,16 @@
|
||||
params ["_destinationPlayer"];
|
||||
|
||||
_markerData = [];
|
||||
|
||||
hint format["Your map is being copied by %1", name _destinationPlayer];
|
||||
|
||||
{
|
||||
_marker = toArray _x;
|
||||
_marker resize 15;
|
||||
if ( toString _marker == "_USER_DEFINED #" ) then {
|
||||
_marker = _x call milsim_fnc_mapMarkerToString;
|
||||
_markerData pushBack _marker;
|
||||
};
|
||||
} forEach allMapMarkers;
|
||||
|
||||
[_markerData] remoteExecCall ["milsim_fnc_loadMapMarkers",_destinationPlayer];
|
||||
17
framework/map/fn_initMapCopy.sqf
Normal file
17
framework/map/fn_initMapCopy.sqf
Normal file
@@ -0,0 +1,17 @@
|
||||
_map_copy_condition =
|
||||
{
|
||||
('ItemMap' in (assignedItems _player)) && ('ItemMap' in (assignedItems _target)) && ([_player, _target, []] call ace_common_fnc_canInteractWith)
|
||||
};
|
||||
|
||||
_map_copy_action =
|
||||
[
|
||||
"MilSimCopyMap",
|
||||
"Copy Map",
|
||||
"\a3\ui_f\data\igui\cfg\actions\talk_ca.paa",
|
||||
{
|
||||
[_target,_player] call milsim_fnc_copyMapFromPlayer
|
||||
},
|
||||
_map_copy_condition
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
|
||||
["Man", 0, ["ACE_MainActions"], _map_copy_action, true] call ace_interact_menu_fnc_addActionToClass;
|
||||
10
framework/map/fn_loadMapMarkers.sqf
Normal file
10
framework/map/fn_loadMapMarkers.sqf
Normal file
@@ -0,0 +1,10 @@
|
||||
params ["_markerList"];
|
||||
|
||||
if ('ItemMap' in (assignedItems player)) then {
|
||||
{
|
||||
_x call milsim_fnc_stringToMapMarker;
|
||||
} foreach _markerList;
|
||||
hint format["Map copied!"];
|
||||
} else {
|
||||
hint format["You need a map to copy onto!"];
|
||||
};
|
||||
52
framework/map/fn_mapMarkerToString.sqf
Normal file
52
framework/map/fn_mapMarkerToString.sqf
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
Author:
|
||||
Killzone_Kid, modified by LAxemann
|
||||
|
||||
Description:
|
||||
Serializes marker to string for storage
|
||||
|
||||
Parameter(s):
|
||||
0: STRING - existing marker name
|
||||
1: STRING (Optional) - a single data delimiter character. Default "|"
|
||||
|
||||
Returns:
|
||||
STRING - serialized marker to be used with BIS_fnc_stringToMarker or BIS_fnc_stringToMarkerLocal
|
||||
or
|
||||
"" on error
|
||||
|
||||
Example:
|
||||
["marker_0"] call RR_mapStuff_fnc_markerToString;
|
||||
["marker_1", ":"] call RR_mapStuff_fnc_markerToString;
|
||||
*/
|
||||
|
||||
params [["_markerName", "", [""]], ["_delimiter", "|", [""]]];
|
||||
|
||||
private _markerShape = markerShape _markerName;
|
||||
private _polyLineArray = [];
|
||||
private _markerType = "none";
|
||||
if (_markerShape isEqualTo "POLYLINE") then {
|
||||
_polyLineArray = markerPolyline _markerName;
|
||||
} else {
|
||||
_markerType = markerType _markerName;
|
||||
};
|
||||
|
||||
|
||||
|
||||
toFixed 4;
|
||||
private _markerPosition = str markerPos [_markerName, true];
|
||||
toFixed -1;
|
||||
|
||||
[
|
||||
"",
|
||||
_markerName,
|
||||
_markerPosition,
|
||||
_markerType,
|
||||
_markerShape,
|
||||
markerSize _markerName,
|
||||
markerDir _markerName,
|
||||
markerBrush _markerName,
|
||||
markerColor _markerName,
|
||||
markerAlpha _markerName,
|
||||
str _polyLineArray,
|
||||
markerText _markerName
|
||||
] joinString _delimiter;
|
||||
70
framework/map/fn_stringToMapMarker.sqf
Normal file
70
framework/map/fn_stringToMapMarker.sqf
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
Author:
|
||||
Killzone_Kid, modified by LAxemann
|
||||
|
||||
Description:
|
||||
Creates marker from serialized data
|
||||
|
||||
Parameter(s):
|
||||
0: STRING - marker data from BIS_fnc_markerToString
|
||||
|
||||
Returns:
|
||||
STRING - created marker
|
||||
or
|
||||
"" on error or if marker exists
|
||||
|
||||
Example:
|
||||
["|marker_0|[4359.1,4093.51,0]|mil_objective|ICON|[1,1]|0|Solid|Default|1|An objective"] call RR_mapStuff_fnc_stringToMarker;
|
||||
*/
|
||||
|
||||
params [["_markerData","",[""]]];
|
||||
|
||||
if (_markerData isEqualTo "") exitWith
|
||||
{
|
||||
["Marker data is empty"] call BIS_fnc_error;
|
||||
""
|
||||
};
|
||||
|
||||
_markerData splitString (_markerData select [0,1]) params
|
||||
[
|
||||
"_markerName",
|
||||
"_markerPos",
|
||||
"_markerType",
|
||||
"_markerShape",
|
||||
"_markerSize",
|
||||
"_markerDir",
|
||||
"_markerBrush",
|
||||
"_markerColor",
|
||||
"_markerAlpha",
|
||||
"_polyLineArray",
|
||||
["_markerText",""]
|
||||
];
|
||||
|
||||
if ((count _polyLineArray) > 0) then {
|
||||
_polyLineArray = parseSimpleArray _polyLineArray;
|
||||
};
|
||||
|
||||
_markerNameData = _markerName splitString "#" select 1;
|
||||
_markerNameData splitString "/" params ["_markerCreator", "_markerID", "_markerChannel"];
|
||||
|
||||
_markerName = "_USER_DEFINED #" + _markerCreator + "/" + _markerCreator + _markerID + "/" + _markerChannel;
|
||||
|
||||
|
||||
private _marker = createMarkerLocal [_markerName, parseSimpleArray _markerPos];
|
||||
|
||||
_marker setMarkerColorLocal _markerColor;
|
||||
_marker setMarkerShapeLocal _markerShape;
|
||||
_marker setMarkerAlphaLocal parseNumber _markerAlpha;
|
||||
|
||||
|
||||
if ((count _polyLineArray) > 0) then {
|
||||
_marker setMarkerPolylineLocal _polyLineArray;
|
||||
} else {
|
||||
_marker setMarkerTypeLocal _markerType;
|
||||
_marker setMarkerSizeLocal parseSimpleArray _markerSize;
|
||||
_marker setMarkerBrushLocal _markerBrush;
|
||||
_marker setMarkerTextLocal _markerText;
|
||||
_marker setMarkerDirLocal parseNumber _markerDir;
|
||||
};
|
||||
|
||||
_marker
|
||||
67
framework/reinsert/client/fn_addAceSelfActions.sqf
Normal file
67
framework/reinsert/client/fn_addAceSelfActions.sqf
Normal file
@@ -0,0 +1,67 @@
|
||||
params ["_type"]; // string of the object's classname
|
||||
if (!(_type isKindOf "CAManBase")) exitWith {};
|
||||
|
||||
if (
|
||||
(localNamespace getVariable ["milsim_reinsert_fileForReinsertClassesAdded", []])
|
||||
find _type != -1
|
||||
) exitWith {};
|
||||
|
||||
private _fileForReinsertAction = [
|
||||
"milsim_reinsert_fileReinsertRequest",
|
||||
"File Re-insert Request",
|
||||
"\A3\ui_f\data\igui\cfg\simpleTasks\types\takeoff_ca.paa",
|
||||
{ // statement
|
||||
params ["_target", "_player", "_params"];
|
||||
// find nearest base or location
|
||||
private _base = [_player] call milsim_util_fnc_getNearestBase;
|
||||
private _baseName = [_base] call milsim_util_fnc_getNameOfBase;
|
||||
// send event to server
|
||||
["milsim_reinsert_fileReinsertRequest", [_player, _base]] call CBA_fnc_serverEvent;
|
||||
// notify player their request was filed
|
||||
[["Re-insert Request Filed"], [format["Location: %1", _baseName]]] call CBA_fnc_notify;
|
||||
},
|
||||
{ // condition
|
||||
params ["_target", "_player", "_params"];
|
||||
// find nearest base or location
|
||||
private _base = [_player] call milsim_util_fnc_getNearestBase;
|
||||
private _baseDistance = _player distance _base;
|
||||
|
||||
private _maxRangeToReady = missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_maxRangeToReady", 400];
|
||||
private _existingQueue = missionNamespace getVariable ["milsim_reinsert_reinsertionQueue", []];
|
||||
|
||||
// check if module is enabled, player is near a base, and player is not already in the queue
|
||||
// (serverTime - milsim_reinsert_missionStartServerTime) > 60*5 && // only allow after 15 minutes
|
||||
missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_enabled", true] &&
|
||||
(_baseDistance < _maxRangeToReady) &&
|
||||
not (_player in (_existingQueue apply {_x#0}))
|
||||
}
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
[_type, 1, ["ACE_SelfActions"], _fileForReinsertAction, true] call ace_interact_menu_fnc_addActionToClass;
|
||||
|
||||
private _removeFileForReinsertAction = [
|
||||
"milsim_reinsert_removeReinsertRequest",
|
||||
"Remove Re-insert Request",
|
||||
"\A3\ui_f\data\igui\cfg\simpleTasks\types\land_ca.paa",
|
||||
{ // statement
|
||||
params ["_target", "_player", "_params"];
|
||||
// send event to server
|
||||
["milsim_reinsert_removeReinsertRequest", [_player]] call CBA_fnc_serverEvent;
|
||||
// notify player their request was rescinded
|
||||
"Re-insert Request Rescinded" call CBA_fnc_notify;
|
||||
},
|
||||
{ // condition
|
||||
params ["_target", "_player", "_params"];
|
||||
private _existingQueue = missionNamespace getVariable ["milsim_reinsert_reinsertionQueue", []];
|
||||
|
||||
// check if module is enabled, player is in the queue
|
||||
// (serverTime - milsim_reinsert_missionStartServerTime) > 60*5 && // only allow after 15 minutes
|
||||
missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_enabled", true] &&
|
||||
(_player in (_existingQueue apply {_x#0}))
|
||||
}
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
[_type, 1, ["ACE_SelfActions"], _removeFileForReinsertAction, true] call ace_interact_menu_fnc_addActionToClass;
|
||||
|
||||
private _classesActionsAddedTo = (localNamespace getVariable ["milsim_reinsert_fileForReinsertClassesAdded", []]);
|
||||
_classesActionsAddedTo pushBackUnique _type;
|
||||
localNamespace setVariable ["milsim_reinsert_fileForReinsertClassesAdded", _classesActionsAddedTo];
|
||||
|
||||
28
framework/reinsert/client/fn_addCheckQueueSelfAction.sqf
Normal file
28
framework/reinsert/client/fn_addCheckQueueSelfAction.sqf
Normal file
@@ -0,0 +1,28 @@
|
||||
params ["_type"]; // string of the object's classname
|
||||
if (!(_type isKindOf "CAManBase")) exitWith {};
|
||||
|
||||
if (
|
||||
(localNamespace getVariable ["milsim_reinsert_checkReinsertQueueClassesAdded", []])
|
||||
find _type != -1
|
||||
) exitWith {};
|
||||
|
||||
private _checkReinsertQueueAction = [
|
||||
"milsim_reinsert_checkReinsertQueue",
|
||||
"[PILOT] Check Re-insert Queue",
|
||||
"\A3\ui_f\data\igui\cfg\simpleTasks\types\land_ca.paa",
|
||||
{
|
||||
params ["_target", "_player", "_params"];
|
||||
// request notification from the server
|
||||
call milsim_reinsert_fnc_requestShowQueue;
|
||||
// reset last check time
|
||||
localNamespace setVariable ["milsim_reinsert_lastReinsertQueueCheck", diag_tickTime];
|
||||
},
|
||||
{
|
||||
missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_enabled", true]
|
||||
} // always allow
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
[_type, 1, ["ACE_SelfActions"], _checkReinsertQueueAction, true] call ace_interact_menu_fnc_addActionToClass;
|
||||
|
||||
private _classesActionsAddedTo = (localNamespace getVariable ["milsim_reinsert_checkReinsertQueueClassesAdded", []]);
|
||||
_classesActionsAddedTo pushBackUnique _type;
|
||||
localNamespace setVariable ["milsim_reinsert_checkReinsertQueueClassesAdded", _classesActionsAddedTo];
|
||||
53
framework/reinsert/client/fn_initClient.sqf
Normal file
53
framework/reinsert/client/fn_initClient.sqf
Normal file
@@ -0,0 +1,53 @@
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
// ACE SELF-INTERACTIONS FOR FILING AND RESCINDING REINSERT REQUESTS NEAR BASE - ALL PLAYERS
|
||||
localNamespace setVariable ["milsim_reinsert_fileForReinsertClassesAdded", []];
|
||||
// add actions to current class
|
||||
[typeOf player] call milsim_reinsert_fnc_addAceSelfActions;
|
||||
// add actions to future classes
|
||||
["ace_interact_menu_newControllableObject", {
|
||||
_this call milsim_reinsert_fnc_addAceSelfActions;
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
// PILOTS ONLY
|
||||
// ACE SELF-INTERACTIONS FOR CHECKING REINSERT QUEUE - ONLY FOR PILOTS
|
||||
if ((typeOf player) in ["B_Helipilot_F", "B_helicrew_F"]) then {
|
||||
localNamespace setVariable ["milsim_reinsert_checkReinsertQueueClassesAdded", []];
|
||||
localNamespace setVariable ["milsim_reinsert_lastReinsertQueueCheck", diag_tickTime];
|
||||
|
||||
// add actions to current class
|
||||
[typeOf player] call milsim_reinsert_fnc_addCheckQueueSelfAction;
|
||||
// add actions to future classes
|
||||
["ace_interact_menu_newControllableObject", {
|
||||
_this call milsim_reinsert_fnc_addCheckQueueSelfAction;
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
};
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// ADD TIMER FOR PILOTS - IF REINSERT LIST NOT CHECKED FOR 20 MINUTES, SHOW NOTIFICATION AUTOMATICALLY
|
||||
if ((typeOf player) in ["B_Helipilot_F", "B_helicrew_F"]) then {
|
||||
[{
|
||||
// if module not enabled and pilot forced check not enabled, exit
|
||||
if (not (
|
||||
missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_enabled", true] &&
|
||||
missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_pilotForcedCheckEnabled", true]
|
||||
)) exitWith {};
|
||||
|
||||
// if last check was less than X minutes ago, skip
|
||||
private _lastCheck = localNamespace getVariable ["milsim_reinsert_lastReinsertQueueCheck", diag_tickTime];
|
||||
private _requiredCheckInterval = missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_pilotForcedCheckInterval", 60*20];
|
||||
if (
|
||||
diag_tickTime - _lastCheck <
|
||||
_requiredCheckInterval
|
||||
) exitWith {}; // if last check was less than X minutes ago, skip
|
||||
|
||||
// last check was greater than X minutes ago
|
||||
// reset last check time
|
||||
localNamespace setVariable ["milsim_reinsert_lastReinsertQueueCheck", diag_tickTime];
|
||||
// request notification from the server
|
||||
call milsim_reinsert_fnc_requestShowQueue;
|
||||
}, 30] call CBA_fnc_addPerFrameHandler;
|
||||
};
|
||||
/////////////////////////////////////////////////////
|
||||
3
framework/reinsert/client/fn_requestShowQueue.sqf
Normal file
3
framework/reinsert/client/fn_requestShowQueue.sqf
Normal file
@@ -0,0 +1,3 @@
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
[] remoteExec ["milsim_reinsert_fnc_returnReinsertQueueNotification", 2];
|
||||
56
framework/reinsert/server/fn_addToQueue.sqf
Normal file
56
framework/reinsert/server/fn_addToQueue.sqf
Normal file
@@ -0,0 +1,56 @@
|
||||
params [
|
||||
["_player", objNull, [objNull]],
|
||||
["_base", objNull, [objNull]],
|
||||
["_timeFiled", diag_tickTime, [25]]
|
||||
];
|
||||
|
||||
if (!isServer) exitWith {
|
||||
[
|
||||
"respawn_reinsertion",
|
||||
"ATTEMPTED RUN ON CLIENT",
|
||||
[
|
||||
["player", _player],
|
||||
["base", _base]
|
||||
]
|
||||
] call milsim_util_fnc_log;
|
||||
};
|
||||
if (
|
||||
isNull _player ||
|
||||
isNull _base
|
||||
) exitWith {
|
||||
[
|
||||
"respawn_reinsertion",
|
||||
"NULL PARAMETERS",
|
||||
[
|
||||
["player", _player],
|
||||
["base", _base]
|
||||
]
|
||||
] call milsim_util_fnc_log;
|
||||
};
|
||||
|
||||
|
||||
private _maxRangeToReady = missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_maxRangeToReady", 400];
|
||||
// nearest base here is the same as the base sent
|
||||
private _nearestBase = _base;
|
||||
|
||||
milsim_reinsert_reinsertionQueue pushBackUnique [
|
||||
_player, _base, _timeFiled
|
||||
];
|
||||
// broadcast new list to all machines
|
||||
publicVariable "milsim_reinsert_reinsertionQueue";
|
||||
|
||||
// log to rpt
|
||||
private _logParams = [
|
||||
["filedAtBase", [_base] call milsim_util_fnc_getNameOfBase],
|
||||
["filedAtBaseDistance", _player distance _base],
|
||||
["closestBase", [_nearestBase] call milsim_util_fnc_getNameOfBase],
|
||||
["closestBaseDistance", _player distance _nearestBase],
|
||||
["maxDistanceSetting", _maxRangeToReady],
|
||||
["inQueueDuration", diag_tickTime - _timeFiled]
|
||||
];
|
||||
_logParams = [_player, _logParams] call milsim_util_fnc_addPlayerInfoToArray;
|
||||
[
|
||||
"respawn_reinsertion",
|
||||
"PLAYER FILED REQUEST",
|
||||
_logParams
|
||||
] call milsim_util_fnc_log;
|
||||
70
framework/reinsert/server/fn_globalShowQueue.sqf
Normal file
70
framework/reinsert/server/fn_globalShowQueue.sqf
Normal file
@@ -0,0 +1,70 @@
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
// if at least 1 player in the queue has been waiting longer than the configured timeout, notify all players
|
||||
private _timeout = missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_max_wait", 60*20]; // default 20 minutes
|
||||
private _timeoutPlayers = milsim_reinsert_reinsertionQueue select {
|
||||
_x params ["_player", "_base", "_timeFiled"];
|
||||
alive (_player) &&
|
||||
(diag_tickTime - (_timeFiled)) > _timeout
|
||||
};
|
||||
if (count _timeoutPlayers > 0) then {
|
||||
// GLOBAL CBA NOTIFY
|
||||
private _playerLines = [["Players are still waiting for Re-insert!", 1.2, [1, 0.64, 0, 1]]];
|
||||
private _maxRangeToReady = missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_maxRangeToReady", 400];
|
||||
|
||||
// get base objects from queue
|
||||
private _basesWithPeople = (missionNamespace getVariable ["milsim_reinsert_reinsertionQueue", []]) apply {_x#1};
|
||||
// get unique base objects
|
||||
private _basesWithPeople = _basesWithPeople arrayIntersect _basesWithPeople;
|
||||
|
||||
{
|
||||
private _thisBase = _x;
|
||||
|
||||
// Add line for base name
|
||||
_playerLines pushBack ([[_thisBase] call milsim_util_fnc_getNameOfBase, 1, [0,1,0,1]]);
|
||||
|
||||
// Get players under this base
|
||||
private _thisBasePlayers = _timeoutPlayers select {_x#1 isEqualTo _thisBase};
|
||||
// sort _timeoutPlayers by time in queue, descending
|
||||
_thisBasePlayers = [_thisBasePlayers, [], {
|
||||
_x params ["_player", "_base", "_timeFiled"];
|
||||
_timeFiled;
|
||||
}, "DESCEND"] call BIS_fnc_sortBy;
|
||||
|
||||
|
||||
{ // for each player under this base, add a line
|
||||
_x params ["_player", "_base", "_timeFiled"];
|
||||
// get the closest base to the player
|
||||
private _nearestBase = [_player] call milsim_util_fnc_getNearestBase;
|
||||
|
||||
// add player to array of players under bases
|
||||
_playerLines pushBack ([format [
|
||||
"%1: %2 [%3]",
|
||||
groupID (group (_player)),
|
||||
name (_player),
|
||||
[diag_tickTime - (_timeFiled), "MM:SS"] call BIS_fnc_secondsToString
|
||||
], 0.8, [0.8, 0.8, 0.8, 1]]);
|
||||
|
||||
// log to rpt
|
||||
private _logParams = [
|
||||
["filedAtBase", [_base] call milsim_util_fnc_getNameOfBase],
|
||||
["filedAtBaseDistance", _player distance _base],
|
||||
["closestBase", [_nearestBase] call milsim_util_fnc_getNameOfBase],
|
||||
["closestBaseDistance", _player distance _nearestBase],
|
||||
["maxDistanceSetting", _maxRangeToReady],
|
||||
["inQueueDuration", diag_tickTime - _timeFiled]
|
||||
];
|
||||
_logParams = [_player, _logParams] call milsim_util_fnc_addPlayerInfoToArray;
|
||||
[
|
||||
"respawn_reinsertion",
|
||||
"PLAYER WAITING OVER TIMEOUT",
|
||||
_logParams
|
||||
] call milsim_util_fnc_log;
|
||||
} forEach _thisBasePlayers;
|
||||
} forEach _basesWithPeople;
|
||||
|
||||
// SEND NOTIFY
|
||||
_playerLines remoteExec ["CBA_fnc_notify", [0, -2] select isDedicated];
|
||||
// RESET NOTIFICATION TIMER
|
||||
milsim_reinsert_reinsertionOverTimeoutLastNotificationTime = diag_tickTime;
|
||||
};
|
||||
50
framework/reinsert/server/fn_initServer.sqf
Normal file
50
framework/reinsert/server/fn_initServer.sqf
Normal file
@@ -0,0 +1,50 @@
|
||||
// if a player files for reinsert using self-interaction
|
||||
// they're added to the queue along with their nearest base location and the time they filed
|
||||
// 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
|
||||
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
// array of all respawn modules in the mission, used as 'base' locations for reinsertion
|
||||
milsim_baseObjects = allMissionObjects "ModuleRespawnPosition_F";
|
||||
publicVariable "milsim_baseObjects";
|
||||
|
||||
// register queue
|
||||
milsim_reinsert_reinsertionQueue = [];
|
||||
publicVariable "milsim_reinsert_reinsertionQueue";
|
||||
|
||||
|
||||
// server mission start time
|
||||
milsim_reinsert_missionStartServerTime = serverTime;
|
||||
|
||||
// FILE REQUEST CBA HANDLER
|
||||
["milsim_reinsert_fileReinsertRequest", {
|
||||
params ["_player", "_base"];
|
||||
[_player, _base] call milsim_reinsert_fnc_addToQueue;
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
// REMOVE REQUEST CBA HANDLER
|
||||
["milsim_reinsert_removeReinsertRequest", {
|
||||
params ["_player"];
|
||||
[_player] call milsim_reinsert_fnc_removeFromQueue;
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
|
||||
// automated wait threshold timer
|
||||
milsim_reinsert_reinsertionOverTimeoutLastNotificationTime = 0;
|
||||
|
||||
[{ // every 60 seconds
|
||||
|
||||
// validate queue
|
||||
call milsim_reinsert_fnc_validateQueue;
|
||||
|
||||
// check if last overTimeout notification was sent more than X minutes ago
|
||||
if (
|
||||
diag_tickTime - milsim_reinsert_reinsertionOverTimeoutLastNotificationTime > 60*5
|
||||
) then {
|
||||
// show global queue notification with any players that are over timeout
|
||||
call milsim_reinsert_fnc_globalShowQueue;
|
||||
};
|
||||
|
||||
}, 60] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
57
framework/reinsert/server/fn_removeFromQueue.sqf
Normal file
57
framework/reinsert/server/fn_removeFromQueue.sqf
Normal file
@@ -0,0 +1,57 @@
|
||||
params [["_player", objNull, [objNull]]];
|
||||
|
||||
if (!isServer) exitWith {
|
||||
[
|
||||
"respawn_reinsertion",
|
||||
"ATTEMPTED RUN ON CLIENT",
|
||||
[
|
||||
["player", _player]
|
||||
]
|
||||
] call milsim_util_fnc_log;
|
||||
};
|
||||
if (isNull _player) exitWith {
|
||||
[
|
||||
"respawn_reinsertion",
|
||||
"NULL PARAMETERS",
|
||||
[
|
||||
["player", _player]
|
||||
]
|
||||
] call milsim_util_fnc_log;
|
||||
};
|
||||
|
||||
// get entries for this player from queue
|
||||
private _unitArrs = milsim_reinsert_reinsertionQueue select {_x#0 isEqualTo _player};
|
||||
// if player not in queue, skip
|
||||
if (count _unitArrs isEqualTo 0) exitWith {};
|
||||
|
||||
private _maxRangeToReady = missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_maxRangeToReady", 400];
|
||||
|
||||
// remove player from queue
|
||||
milsim_reinsert_reinsertionQueue = milsim_reinsert_reinsertionQueue - _unitArrs;
|
||||
// broadcast new list to all machines
|
||||
publicVariable "milsim_reinsert_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 milsim_util_fnc_getNearestBase;
|
||||
// log to rpt
|
||||
private _logParams = [
|
||||
["filedAtBase", [_base] call milsim_util_fnc_getNameOfBase],
|
||||
["filedAtBaseDistance", _player distance _base],
|
||||
["closestBase", [_nearestBase] call milsim_util_fnc_getNameOfBase],
|
||||
["closestBaseDistance", _player distance _nearestBase],
|
||||
["maxDistanceSetting", _maxRangeToReady],
|
||||
["inQueueDuration", diag_tickTime - _timeFiled]
|
||||
];
|
||||
_logParams = [_player, _logParams] call milsim_util_fnc_addPlayerInfoToArray;
|
||||
[
|
||||
"respawn_reinsertion",
|
||||
"PLAYER RESCINDED REQUEST",
|
||||
_logParams
|
||||
] call milsim_util_fnc_log;
|
||||
109
framework/reinsert/server/fn_returnReinsertQueueNotification.sqf
Normal file
109
framework/reinsert/server/fn_returnReinsertQueueNotification.sqf
Normal file
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
Function: milsim_reinsert_fnc_showReinsertQueueNotification
|
||||
|
||||
Description:
|
||||
Designed to be remoteExecuted on the server. Will show a CBA notification on the remoteExecutedOwner's screen with the current reinsertion queue and log this occurrence in the server RPT.
|
||||
|
||||
Author: IndigoFox
|
||||
*/
|
||||
|
||||
if (not isRemoteExecuted) exitWith {
|
||||
diag_log text format ["[milsim] (respawn_reinsertion) SHOW QUEUE NOT REMOTE EXECUTED"];
|
||||
};
|
||||
if (not isServer) exitWith {
|
||||
diag_log text format ["[milsim] (respawn_reinsertion) SHOW QUEUE NOT RUN ON SERVER"];
|
||||
};
|
||||
|
||||
private _users = allUsers apply {getUserInfo _x} select {count _x > 0};
|
||||
private _userIndex = _users findIf {_x#1 isEqualTo remoteExecutedOwner};
|
||||
if (_userIndex isEqualTo -1) exitWith {
|
||||
diag_log text format ["[milsim] (respawn_reinsertion) SHOW QUEUE USER NOT FOUND"];
|
||||
};
|
||||
private _userObject = _users select _userIndex select 10;
|
||||
if (isNull _userObject) exitWith {
|
||||
diag_log text format ["[milsim] (respawn_reinsertion) SHOW QUEUE USER OBJECT NOT FOUND"];
|
||||
};
|
||||
|
||||
// log to rpt
|
||||
private _logParams = [_userObject, []] call milsim_util_fnc_addPlayerInfoToArray;
|
||||
[
|
||||
"respawn_reinsertion",
|
||||
"SHOW QUEUE REQUESTED",
|
||||
_logParams
|
||||
] call milsim_util_fnc_log;
|
||||
|
||||
private _queue = missionNamespace getVariable ["milsim_reinsert_reinsertionQueue", []];
|
||||
// get base objects from queue
|
||||
private _basesWithPeople = (missionNamespace getVariable ["milsim_reinsert_reinsertionQueue", []]) apply {_x#1};
|
||||
// get unique base objects
|
||||
private _basesWithPeople = _basesWithPeople arrayIntersect _basesWithPeople;
|
||||
|
||||
// text array to use in notification
|
||||
private _par = [["Players Awaiting Reinsert", 1.2, [1,0.64,0,1]]];
|
||||
|
||||
if (count _basesWithPeople isEqualTo 0) then {
|
||||
_par pushBack ["[QUEUE EMPTY]", 1, [1,1,1,1]];
|
||||
};
|
||||
|
||||
// forEach _basesWithPeople
|
||||
{
|
||||
private _thisBase = _x;
|
||||
private _baseName = [_thisBase] call milsim_util_fnc_getNameOfBase;
|
||||
|
||||
// generate player lines for this base
|
||||
private _playerLines = _queue select {
|
||||
_x#1 isEqualTo _thisBase
|
||||
} apply {
|
||||
_x params ["_player", "_base", "_timeFiled"];
|
||||
[
|
||||
format [
|
||||
"%1: %2 [%3]",
|
||||
groupId (group _player),
|
||||
name _player,
|
||||
[diag_tickTime - _timeFiled, "MM:SS"] call BIS_fnc_secondsToString
|
||||
],
|
||||
0.8,
|
||||
[1,1,1,1]
|
||||
];
|
||||
};
|
||||
|
||||
// determine suffix for player count based on count
|
||||
private _playerCountText = "";
|
||||
switch (count _playerLines) do {
|
||||
case 0: {
|
||||
_playerCountText = "No players";
|
||||
};
|
||||
case 1: {
|
||||
_playerCountText = "1 player";
|
||||
};
|
||||
default {
|
||||
_playerCountText = format ["%1 players", count _playerLines];
|
||||
};
|
||||
};
|
||||
|
||||
// add base name and player count to notification lines
|
||||
_par pushBack [
|
||||
format ["Location: %1 (%2)",
|
||||
_baseName,
|
||||
_playerCountText
|
||||
],
|
||||
1,
|
||||
[0,1,0,1]
|
||||
];
|
||||
|
||||
// sort by text (first piece of text is group name)
|
||||
_playerLines = [
|
||||
_playerLines,
|
||||
[],
|
||||
{_x#0}
|
||||
] call BIS_fnc_sortBy;
|
||||
|
||||
// add to notification lines
|
||||
{
|
||||
_par pushBack _x;
|
||||
} forEach _playerLines;
|
||||
} forEach _basesWithPeople;
|
||||
|
||||
_par remoteExec ["CBA_fnc_notify", remoteExecutedOwner];
|
||||
|
||||
true;
|
||||
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)
|
||||
private _stillValid = [];
|
||||
private _maxRangeToReady = missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_maxRangeToReady", 400];
|
||||
{
|
||||
_x params ["_player", "_base", "_timeFiled"]; // _unitArr = [unit, baseName, timeInQueue]
|
||||
|
||||
private _distanceToOriginalBase = _player distance _base;
|
||||
// get the closest base to the player
|
||||
private _nearestBase = [_player] call milsim_util_fnc_getNearestBase;
|
||||
private _isCloseEnoughToAnyBase = (_player distance _nearestBase) < _maxRangeToReady;
|
||||
|
||||
if (not _isCloseEnoughToAnyBase || not (alive _player)) then {
|
||||
// don't include player in updated queue
|
||||
// log to rpt
|
||||
private _logParams = [
|
||||
["filedAtBase", [_base] call milsim_util_fnc_getNameOfBase],
|
||||
["filedAtBaseDistance", _player distance _base],
|
||||
["closestBase", [_nearestBase] call milsim_util_fnc_getNameOfBase],
|
||||
["closestBaseDistance", _player distance _nearestBase],
|
||||
["maxDistanceSetting", _maxRangeToReady],
|
||||
["inQueueDuration", diag_tickTime - _timeFiled]
|
||||
];
|
||||
_logParams = [_player, _logParams] call milsim_util_fnc_addPlayerInfoToArray;
|
||||
[
|
||||
"respawn_reinsertion",
|
||||
"PLAYER DEQUEUED AUTOMATICALLY",
|
||||
_logParams
|
||||
] call milsim_util_fnc_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 {
|
||||
private _logParams = [
|
||||
["filedAtBase", [_base] call milsim_util_fnc_getNameOfBase],
|
||||
["filedAtBaseDistance", _player distance _base],
|
||||
["closestBase", [_nearestBase] call milsim_util_fnc_getNameOfBase],
|
||||
["closestBaseDistance", _player distance _nearestBase],
|
||||
["maxDistanceSetting", _maxRangeToReady],
|
||||
["inQueueDuration", diag_tickTime - _timeFiled]
|
||||
];
|
||||
_logParams = [_player, _logParams] call milsim_util_fnc_addPlayerInfoToArray;
|
||||
[
|
||||
"respawn_reinsertion",
|
||||
"PLAYER BASE WAS UPDATED",
|
||||
_logParams
|
||||
] call milsim_util_fnc_log;
|
||||
};
|
||||
} forEach milsim_reinsert_reinsertionQueue;
|
||||
|
||||
// broadcast new list to all machines
|
||||
milsim_reinsert_reinsertionQueue = _stillValid;
|
||||
publicVariable "milsim_reinsert_reinsertionQueue";
|
||||
@@ -0,0 +1,33 @@
|
||||
#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;
|
||||
{
|
||||
private _cfg = _x;
|
||||
private _supplyCrateDisplayName = (_cfg >> "displayName") call BIS_fnc_getCfgData;
|
||||
|
||||
_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);
|
||||
}, [_cfg], 0, false, true, "", ""];
|
||||
} forEach _supplyCrateTypesCfgs;
|
||||
} forEach _arsenalBoxes;
|
||||
25
framework/resupply/functions/fn_addCBASettings.sqf
Normal file
25
framework/resupply/functions/fn_addCBASettings.sqf
Normal file
@@ -0,0 +1,25 @@
|
||||
#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"];
|
||||
[
|
||||
QUOTE(COMPONENT),
|
||||
"SETTING CHANGED",
|
||||
[
|
||||
[
|
||||
"setting",
|
||||
QGVAR(setting_allowSupplyBoxScrollWheelSpawning)
|
||||
],
|
||||
["newValue", _value]
|
||||
]
|
||||
] call EFUNC(util,log);
|
||||
},
|
||||
true // requires mission restart
|
||||
] call CBA_fnc_addSetting;
|
||||
168
framework/resupply/functions/fn_createBox.sqf
Normal file
168
framework/resupply/functions/fn_createBox.sqf
Normal file
@@ -0,0 +1,168 @@
|
||||
/*
|
||||
* Author: Hizumi & IndigoFox
|
||||
*
|
||||
* Create Mortar resupply box for the 17th Battalion. Primarily called from milsim_fnc_addZenModules
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Vehicle - <OBJECT>
|
||||
* 1: Type - <STRING>
|
||||
* 2: Position - <ARRAY>
|
||||
*
|
||||
* Return Value:
|
||||
* Function executed <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [box, "AmmoSquad"] call milsim_fnc_createBox; // create mortar ammo box via init line of editor object
|
||||
* [objNull, "AmmoHeavy", pos] call milsim_fnc_createBox; // create mortar ammo box via zeus module
|
||||
*
|
||||
* Public: Yes
|
||||
*
|
||||
* Note: For gathering:
|
||||
formatText ["%1", [
|
||||
["containerClassname", typeOf cursorObject],
|
||||
["backpack", (backpackCargo cursorObject) call BIS_fnc_consolidateArray],
|
||||
["item", (itemCargo cursorObject) call BIS_fnc_consolidateArray],
|
||||
["magazine", (magazineCargo cursorObject) call BIS_fnc_consolidateArray],
|
||||
["magazineAmmo", magazinesAmmoCargo cursorObject],
|
||||
["weapon", (weaponCargo cursorObject) call BIS_fnc_consolidateArray]
|
||||
]];
|
||||
*/
|
||||
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
params [
|
||||
["_box", objNull, [objNull]],
|
||||
["_type", "", [""]],
|
||||
["_pos", [0,0,0], [[]], 3]
|
||||
];
|
||||
|
||||
// get defs class
|
||||
private _supplyCratesCfg = call FUNC(getSupplyCratesCfg);
|
||||
if (!isClass _supplyCratesCfg) exitWith {
|
||||
["Resupply Boxes: Failed to load crate definitions, possibly a bad edit?"] call BIS_fnc_error;
|
||||
objNull;
|
||||
};
|
||||
|
||||
// get the subclass names
|
||||
private _boxTypesAvailable = _supplyCratesCfg call BIS_fnc_getCfgSubClasses;
|
||||
|
||||
// if no type is provided, show the available types
|
||||
if (_type isEqualTo "") exitWith {
|
||||
[
|
||||
"%1 | %2 %3",
|
||||
"Resupply Boxes: [_boxObject, _type, _pos] call milsim_fnc_createBox",
|
||||
"No type provided. Please use one of the following types for _type:",
|
||||
_boxTypesAvailable joinString ", "
|
||||
] call BIS_fnc_error;
|
||||
objNull;
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// get the box definition class
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
private _boxDef = (_supplyCratesCfg >> _type);
|
||||
// validate it exists
|
||||
if (!isClass _boxDef) exitWith {
|
||||
[
|
||||
"%1 | %2 %3",
|
||||
"Resupply Boxes: [_boxObject, _type, _pos] call milsim_fnc_createBox",
|
||||
"Invalid type provided. Please use one of the following types for _type:",
|
||||
_boxTypesAvailable joinString ", "
|
||||
] call BIS_fnc_error;
|
||||
objNull;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Create box if one wasn't provided in parameters
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
if (isNull _box) then {
|
||||
private _neededBoxType = getText(_boxDef >> "boxClass");
|
||||
if (_neededBoxType isEqualTo "") exitWith {
|
||||
[
|
||||
"Resupply Boxes: Failed to create box. No boxClass defined in the box definition."
|
||||
] call BIS_fnc_error;
|
||||
objNull;
|
||||
};
|
||||
_box = _neededBoxType createVehicle _pos;
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Clear box
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
clearBackpackCargoGlobal _box;
|
||||
clearItemCargoGlobal _box;
|
||||
clearMagazineCargoGlobal _box;
|
||||
clearWeaponCargoGlobal _box;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Get [item, quantity] arrays from definition
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
private _backpacks = ([_boxDef >> "backpacks"] call BIS_fnc_getCfgDataArray);
|
||||
if (isNil "_backpacks") exitWith {
|
||||
[
|
||||
"Resupply Boxes: Failed to create box. No backpacks defined in the box definition."
|
||||
] call BIS_fnc_error;
|
||||
objNull;
|
||||
};
|
||||
|
||||
private _weapons = ([_boxDef >> "weapons"] call BIS_fnc_getCfgDataArray);
|
||||
if (isNil "_weapons") exitWith {
|
||||
[
|
||||
"Resupply Boxes: Failed to create box. No weapons defined in the box definition."
|
||||
] call BIS_fnc_error;
|
||||
objNull;
|
||||
};
|
||||
|
||||
private _magazines = ([_boxDef >> "magazines"] call BIS_fnc_getCfgDataArray);
|
||||
if (isNil "_magazines") exitWith {
|
||||
[
|
||||
"Resupply Boxes: Failed to create box. No magazines defined in the box definition."
|
||||
] call BIS_fnc_error;
|
||||
objNull;
|
||||
};
|
||||
|
||||
private _items = ([_boxDef >> "items"] call BIS_fnc_getCfgDataArray);
|
||||
if (isNil "_items") exitWith {
|
||||
[
|
||||
"Resupply Boxes: Failed to create box. No items defined in the box definition."
|
||||
] call BIS_fnc_error;
|
||||
objNull;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Add stuff to box
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
{
|
||||
_x params ["_class", "_qty"];
|
||||
_box addBackpackCargoGlobal [_class, _qty]
|
||||
} foreach _backpacks;
|
||||
|
||||
{
|
||||
_x params ["_class", "_qty"];
|
||||
_box addItemCargoGlobal [_class, _qty]
|
||||
} foreach _items;
|
||||
|
||||
{
|
||||
_x params ["_class", "_qty"];
|
||||
_box addMagazineCargoGlobal [_class, _qty]
|
||||
} foreach _magazines;
|
||||
|
||||
{
|
||||
_x params ["_class", "_qty"];
|
||||
_box addWeaponCargoGlobal [_class, _qty]
|
||||
} foreach _weapons;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Adjust ACE settings
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// set box size
|
||||
[_box,1] call ace_cargo_fnc_setSize;
|
||||
|
||||
// ignore weight restrictions for carry/drag
|
||||
_box setVariable ["ace_ignoreWeightCarry", true, true];
|
||||
|
||||
// Return the box
|
||||
_box;
|
||||
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");
|
||||
12
framework/resupply/functions/fn_init.sqf
Normal file
12
framework/resupply/functions/fn_init.sqf
Normal file
@@ -0,0 +1,12 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
// 5 seconds after the client is loaded, add the resupply action to all arsenal boxes
|
||||
[
|
||||
{time > 5},
|
||||
{
|
||||
if (missionNamespace getVariable [
|
||||
QGVAR(setting_allowSupplyBoxScrollWheelSpawning),
|
||||
false
|
||||
]) then {call FUNC(addSpawnBoxActions)}
|
||||
}
|
||||
] call CBA_fnc_waitUntilAndExecute;
|
||||
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"
|
||||
5
framework/script_macros.hpp
Normal file
5
framework/script_macros.hpp
Normal file
@@ -0,0 +1,5 @@
|
||||
// all text before cba include
|
||||
#define SETTINGS_GROUP_NAME 17th Battalion
|
||||
|
||||
|
||||
#include "\x\cba\addons\main\script_macros_mission.hpp"
|
||||
10
framework/script_mod.hpp
Normal file
10
framework/script_mod.hpp
Normal file
@@ -0,0 +1,10 @@
|
||||
#define PREFIX milsim
|
||||
|
||||
#include "script_version.hpp"
|
||||
|
||||
#define VERSION MAJOR.MINOR.PATCHLVL
|
||||
#define VERSION_STR MAJOR.MINOR.PATCHLVL
|
||||
#define VERSION_AR MAJOR,MINOR,PATCHLVL
|
||||
|
||||
// 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
|
||||
50
framework/server/fn_addServerStatsPFH.sqf
Normal file
50
framework/server/fn_addServerStatsPFH.sqf
Normal file
@@ -0,0 +1,50 @@
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
missionNamespace setVariable["milsim_raw_cps", 0];
|
||||
missionNamespace setVariable["milsim_cps", 0];
|
||||
|
||||
publicVariable "milsim_raw_cps";
|
||||
publicVariable "milsim_cps";
|
||||
|
||||
diag_log text format ["[MILSIM] (server) initializing Server Stats PFH"];
|
||||
|
||||
_serverCpsPFH = [
|
||||
{
|
||||
[] call milsim_fnc_calculateServerStats;
|
||||
},
|
||||
"milsim_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 },
|
||||
{ false },
|
||||
[]
|
||||
] call CBA_fnc_createPerFrameHandlerObject;
|
||||
|
||||
|
||||
missionNamespace setVariable ["milsim_server_cps_handler", _serverCpsPFH];
|
||||
|
||||
_playerCpsPFH = [
|
||||
{
|
||||
|
||||
diag_log text "[MILSIM] (server) ** Player Executions **";
|
||||
|
||||
{
|
||||
diag_log ( format ["%1: ( %2, %3 )", name _x, _x getVariable ["milsim_player_raw_cps",-1], _x getVariable ["milsim_player_cps",-1] ] )
|
||||
} forEach allPlayers;
|
||||
|
||||
diag_log text "[MILSIM] (server) ***********************";
|
||||
|
||||
},
|
||||
"milsim_server_cps_interval" call CBA_settings_fnc_get,
|
||||
[],
|
||||
{ diag_log text format ["[MILSIM] (server) Player PFH loaded"] },
|
||||
{ diag_log text format ["[MILSIM] (server) Player PFH unloaded"] },
|
||||
{ "milsim_server_cps_enable" call CBA_settings_fnc_get },
|
||||
{ false },
|
||||
[]
|
||||
] call CBA_fnc_createPerFrameHandlerObject;
|
||||
|
||||
missionNamespace setVariable ["milsim_player_cps_handler", _playerCpsPFH];
|
||||
|
||||
nil;
|
||||
34
framework/server/fn_calculateServerStats.sqf
Normal file
34
framework/server/fn_calculateServerStats.sqf
Normal file
@@ -0,0 +1,34 @@
|
||||
[] 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;
|
||||
};
|
||||
|
||||
diag_log text format ["[MILSIM] (server) Average Server Execution: %1 times per frame", _counter / (diag_frameNo - _frameNo)];
|
||||
|
||||
missionNamespace setVariable ["milsim_raw_cps", _counter / (diag_frameNo - _frameNo)];
|
||||
publicVariable "milsim_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
|
||||
};
|
||||
|
||||
diag_log text format ["[MILSIM] (server) Average Server Execution: %1 times per frame", _counter / (diag_frameNo - _frameNo)];
|
||||
|
||||
missionNamespace setVariable ["milsim_cps", _counter / (diag_frameNo - _frameNo)];
|
||||
publicVariable "milsim_cps";
|
||||
|
||||
["milsim_serverEfficiency", [ [ ["float", "milsim_raw_cps", missionNamespace getVariable ["milsim_raw_cps", -1]], ["float", "milsim_cps", missionNamespace getVariable ["milsim_cps", -1]] ] ] ] call CBA_fnc_localEvent;
|
||||
};
|
||||
|
||||
nil;
|
||||
144
framework/server/fn_logPlayerInventory.sqf
Normal file
144
framework/server/fn_logPlayerInventory.sqf
Normal file
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
Function: milsim_util_fnc_logPlayerInventory
|
||||
|
||||
Description:
|
||||
Checks a player's inventory for non-compliant items and logs results to all machines.
|
||||
|
||||
Author: Hizumi, EagleTrooper, IndigoFox
|
||||
|
||||
Parameters:
|
||||
0: _player - <OBJECT> - Player to check inventory of.
|
||||
|
||||
Returns:
|
||||
<ARRAY> - Array of strings to be logged.
|
||||
|
||||
*/
|
||||
params [
|
||||
["_player", objNull, [objNull]]
|
||||
];
|
||||
|
||||
if (!isPlayer _player) exitWith {
|
||||
[
|
||||
"logPlayerInventory",
|
||||
"PARAM PLAYER IS NOT A PLAYER",
|
||||
[["player", _player]]
|
||||
] call milsim_util_fnc_log;
|
||||
};
|
||||
|
||||
// testing
|
||||
// test_old = compile preprocessFileLineNumbers "testold.sqf";
|
||||
// test_new = compile preprocessFileLineNumbers "testnew.sqf";
|
||||
// player addItem "A3_GPNVG18_BLK_TI";
|
||||
// player addWeapon "SMA_HK417_16in";
|
||||
// player addItem "ej_VPS15";
|
||||
// player addItem "ACE_Banana";
|
||||
|
||||
// INSTANTIATE VARS
|
||||
private _foundItemsKeyValue = [];
|
||||
private _allFoundItemsSoFar = [];
|
||||
|
||||
// GET PLAYER ITEMS
|
||||
private _playerItems = [
|
||||
_player, // Unit
|
||||
true, // Include weapons, attachments, loaded magazines
|
||||
true, // Include items in backpack
|
||||
true, // Include items in vest
|
||||
true, // Include items in uniform
|
||||
true, // Include assigned items
|
||||
true // Include not loaded magazines
|
||||
] call CBA_fnc_uniqueUnitItems;
|
||||
|
||||
_playerItems pushBack (headgear _player);
|
||||
_playerItems pushBack (uniform _player);
|
||||
|
||||
|
||||
[
|
||||
"logPlayerInventory",
|
||||
"CHECKING PLAYER INVENTORY",
|
||||
[_player] call milsim_util_fnc_addPlayerInfoToArray
|
||||
] call milsim_util_fnc_log;
|
||||
|
||||
////////////////////////////////////////
|
||||
// HARDCODED DISALLOWED ITEMS - see functions/definitions/DisallowedEquipment.hpp
|
||||
|
||||
// Get parent class
|
||||
private _disallowedEquipmentCfg = (missionConfigFile >> "DisallowedEquipment");
|
||||
|
||||
// Get all subclasses
|
||||
private _definitionCfgs = (_disallowedEquipmentCfg call BIS_fnc_getCfgSubClasses) apply {
|
||||
(_disallowedEquipmentCfg >> _x)
|
||||
};
|
||||
|
||||
// diag_log text format["DEFINITION CFGS: %1", _definitionCfgs];
|
||||
// Check all items
|
||||
{ // forEach _subclassesCfgs
|
||||
private _definitionCfg = _x;
|
||||
private _definitionLabel = (_definitionCfg >> "label") call BIS_fnc_getCfgData;
|
||||
private _definitionItems = (_definitionCfg >> "items") call BIS_fnc_getCfgDataArray;
|
||||
// diag_log text format["DEF ITEMS: %1", _definitionItems];
|
||||
{ // forEach _playerItems
|
||||
private _playerItem = _x;
|
||||
// diag_log text format["PLAYER ITEM: %1", _playerItem];
|
||||
if (_playerItem in _definitionItems && not (_playerItem in _allFoundItemsSoFar)) then {
|
||||
// add under def label
|
||||
[_foundItemsKeyValue, _definitionLabel, _playerItem] call BIS_fnc_addToPairs;
|
||||
// add to all found items
|
||||
_allFoundItemsSoFar pushBackUnique _playerItem;
|
||||
};
|
||||
} forEach _playerItems;
|
||||
} forEach _definitionCfgs;
|
||||
|
||||
////////////////////////////////////////
|
||||
// UNLISTED THERMAL - Any item with thermal capabilities that is not already in the list
|
||||
|
||||
// Identify thermal items in the player list
|
||||
private _thermalItems = _playerItems select {
|
||||
private _playerItem = _x;
|
||||
private _modes = getArray(configfile >> "CfgWeapons" >> _playerItem >> "visionMode");
|
||||
private _subModes = [configfile >> "CfgWeapons" >> _playerItem >> "ItemInfo" >> "OpticsModes", 1] call BIS_fnc_returnChildren;
|
||||
{
|
||||
_modes append getArray( _x >> "visionMode" );
|
||||
} forEach _subModes;
|
||||
if ((count _modes) isNotEqualTo 0) then {
|
||||
// if the item has thermal capabilities and is not in the list anywhere else, include it
|
||||
"ti" in (_modes apply { toLower _x }) && not (_playerItem in _allFoundItemsSoFar);
|
||||
} else {
|
||||
false;
|
||||
};
|
||||
};
|
||||
|
||||
{
|
||||
[_foundItemsKeyValue, "UNLISTED THERMAL", _x] call BIS_fnc_addToPairs;
|
||||
} forEach _thermalItems;
|
||||
|
||||
|
||||
// Only log compliance message if no non-compliant items were found
|
||||
if (count _allFoundItemsSoFar isEqualTo 0) exitWith {
|
||||
[
|
||||
"logPlayerInventory",
|
||||
"PLAYER INVENTORY IS COMPLIANT",
|
||||
[_player] call milsim_util_fnc_addPlayerInfoToArray
|
||||
] call milsim_util_fnc_log;
|
||||
};
|
||||
|
||||
// Log all non-compliant items
|
||||
{
|
||||
_x params ["_categoryLabel", "_items"];
|
||||
if (typeName _items isEqualTo "STRING") then {
|
||||
_items = [_items];
|
||||
};
|
||||
{
|
||||
private _itemClassName = _x;
|
||||
private _itemConfig = _itemClassName call CBA_fnc_getItemConfig;
|
||||
// Log to RPT
|
||||
[
|
||||
"logPlayerInventory",
|
||||
"NON-COMPLIANT ITEM",
|
||||
[_player, [
|
||||
["category", _categoryLabel],
|
||||
["className", _itemClassName],
|
||||
["displayName", [_itemConfig] call BIS_fnc_displayName]
|
||||
]] call milsim_util_fnc_addPlayerInfoToArray
|
||||
] call milsim_util_fnc_log;
|
||||
} forEach _items;
|
||||
} forEach _foundItemsKeyValue;
|
||||
11
framework/settings/fn_addAARChatHandler.sqf
Normal file
11
framework/settings/fn_addAARChatHandler.sqf
Normal file
@@ -0,0 +1,11 @@
|
||||
[
|
||||
"saveaar",
|
||||
{
|
||||
[] remoteExec["ocap_fnc_exportData", 2];
|
||||
},
|
||||
"admin"
|
||||
] call CBA_fnc_registerChatCommand;
|
||||
|
||||
diag_log text "[MILSIM] (settings) OCAP chat handler registered";
|
||||
|
||||
nil;
|
||||
273
framework/settings/fn_addCBASettings.sqf
Normal file
273
framework/settings/fn_addCBASettings.sqf
Normal file
@@ -0,0 +1,273 @@
|
||||
//---------------------
|
||||
// Side Chat
|
||||
//---------------------
|
||||
|
||||
[
|
||||
"milsim_sideChat",
|
||||
"CHECKBOX",
|
||||
"Side Chat Text Enabled",
|
||||
["17th Battalion", "Side Chat"],
|
||||
false,
|
||||
true,
|
||||
{
|
||||
params ["_value"];
|
||||
diag_log format["side chat activation set to %1", _value];
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
["milsim_sideChat", false] call CBA_settings_fnc_set;
|
||||
|
||||
//---------------------
|
||||
// Server CPS
|
||||
//---------------------
|
||||
|
||||
[
|
||||
"milsim_server_cps_enable",
|
||||
"CHECKBOX",
|
||||
"CPS Metrics Enabled",
|
||||
["17th Battalion", "Server Metrics"],
|
||||
true,
|
||||
true,
|
||||
{
|
||||
params ["_value"];
|
||||
diag_log format["server cps activation set to %1", _value];
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
["milsim_server_cps_enable", true] call CBA_settings_fnc_set;
|
||||
|
||||
[
|
||||
"milsim_server_cps_interval",
|
||||
"TIME",
|
||||
"Metrics Interval",
|
||||
["17th Battalion", "Server Metrics"],
|
||||
[60,300,120],
|
||||
true,
|
||||
{
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
params ["_value"];
|
||||
diag_log format["server cps interval set to %1", _value];
|
||||
_cpsPFH = missionNamespace getVariable ["milsim_server_cps_handler", ObjNull];
|
||||
if (!isNull _cpsPFH) then {
|
||||
_cpsPFH call CBA_fnc_deletePerFrameHandlerObject;
|
||||
};
|
||||
|
||||
_playerCpsPFH = missionNamespace getVariable ["milsim_player_cps_handler", ObjNull];
|
||||
if (!isNull _playerCpsPFH) then {
|
||||
_playerCpsPFH call CBA_fnc_deletePerFrameHandlerObject;
|
||||
};
|
||||
|
||||
[] call milsim_fnc_addServerStatsPFH;
|
||||
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
//---------------------
|
||||
// Client CPS
|
||||
//---------------------
|
||||
|
||||
[
|
||||
"milsim_client_cps_enable",
|
||||
"CHECKBOX",
|
||||
"CPS Metrics Enabled",
|
||||
["17th Battalion", "Client Metrics"],
|
||||
true,
|
||||
true,
|
||||
{
|
||||
params ["_value"];
|
||||
diag_log format["client cps activation set to %1", _value];
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
["milsim_client_cps_enable", true] call CBA_settings_fnc_set;
|
||||
|
||||
[
|
||||
"milsim_client_cps_interval",
|
||||
"TIME",
|
||||
"CPS Metrics Interval",
|
||||
["17th Battalion", "Client Metrics"],
|
||||
[60,300,120],
|
||||
true,
|
||||
{
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
params ["_value"];
|
||||
diag_log format["client cps interval set to %1", _value];
|
||||
_cpsPFH = player getVariable ["milsim_client_cps_handler", ObjNull];
|
||||
if (!isNull _cpsPFH) then {
|
||||
_cpsPFH call CBA_fnc_deletePerFrameHandlerObject;
|
||||
};
|
||||
|
||||
[] call milsim_fnc_addClientStatsPFH;
|
||||
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
//---------------------
|
||||
// Medical Overlay
|
||||
//---------------------
|
||||
|
||||
[
|
||||
"milsim_client_medState3D_enabled", // variable
|
||||
"CHECKBOX", // type
|
||||
["Enable 3D Triage Card State", "Draws a colored dot over units within 10m indicating current ACE Triage State"], // title
|
||||
["17th Battalion", "Medical"], // category
|
||||
true // default value
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
"milsim_client_medState3D_drawRange", // variable
|
||||
"LIST", // type
|
||||
["Range To Draw Icons", "Determines range at which dots are visible"], // title
|
||||
["17th Battalion", "Medical"], // category
|
||||
[[2, 4, 6, 8, 10], ["2", "4", "6", "8", "10"], 4] // option values, option labels, default index
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
|
||||
//---------------------
|
||||
// Respawn Settings
|
||||
[
|
||||
"milsim_reinsert_setting_reinsertion_enabled", // variable
|
||||
"CHECKBOX", // type
|
||||
["Enabled", "Whether or not players can file for reinsert and pilots can check the reinsert queue"], // title
|
||||
["17th Battalion", "Re-insert Queue"], // category
|
||||
true, // default value
|
||||
true, // global setting
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
"respawn_reinsertion",
|
||||
"SETTING CHANGED",
|
||||
[
|
||||
[
|
||||
"setting",
|
||||
"milsim_reinsert_setting_reinsertion_enabled"
|
||||
],
|
||||
["newValue", _value]
|
||||
]
|
||||
] call milsim_util_fnc_log;
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
"milsim_reinsert_setting_reinsertion_maxRangeToReady", // variable
|
||||
"SLIDER", // type
|
||||
["Max Request Filing Range", "Maximum distance from a respawn point a player can be to ready up"], // title
|
||||
["17th Battalion", "Re-insert Queue"], // category
|
||||
[0, 1000, 400, 0, false], // [_min, _max, _default, _trailingDecimals, _isPercentage]
|
||||
true, // global setting
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
"respawn_reinsertion",
|
||||
"SETTING CHANGED",
|
||||
[
|
||||
[
|
||||
"setting",
|
||||
"milsim_reinsert_setting_reinsertion_maxRangeToReady"
|
||||
],
|
||||
["newValue", _value]
|
||||
]
|
||||
] call milsim_util_fnc_log;
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
"milsim_reinsert_setting_reinsertion_pilotForcedCheckEnabled", // variable
|
||||
"CHECKBOX", // type
|
||||
["Enabled", "Whether or not pilots are forced to view the contents of the reinsertion queue per interval"], // title
|
||||
["17th Battalion", "Re-insert Queue"], // category
|
||||
true, // default value
|
||||
true, // global setting
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
"respawn_reinsertion",
|
||||
"SETTING CHANGED",
|
||||
[
|
||||
[
|
||||
"setting",
|
||||
"milsim_reinsert_setting_reinsertion_pilotForcedCheckEnabled"
|
||||
],
|
||||
["newValue", _value]
|
||||
]
|
||||
] call milsim_util_fnc_log;
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
"milsim_reinsert_setting_reinsertion_pilotForcedCheckInterval", // variable
|
||||
"TIME", // type
|
||||
["Pilot Forced Check Interval", "Pilots will be force shown the queue if they haven't checked it in X seconds"], // title
|
||||
["17th Battalion", "Re-insert Queue"], // category
|
||||
[60*5, 60*30, 60*10], // [_min, _max, _default]
|
||||
true,
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
"respawn_reinsertion",
|
||||
"SETTING CHANGED",
|
||||
[
|
||||
[
|
||||
"setting",
|
||||
"milsim_reinsert_setting_reinsertion_pilotForcedCheckInterval"
|
||||
],
|
||||
["newValue", _value]
|
||||
]
|
||||
] call milsim_util_fnc_log;
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
"milsim_reinsert_setting_reinsertion_max_wait", // variable
|
||||
"TIME", // type
|
||||
["Max Wait Threshold", "How long should at least one person be waiting before prompting a global notification."], // title
|
||||
["17th Battalion", "Re-insert Queue"], // category
|
||||
[60*5, 60*30, 60*20], // [_min, _max, _default]
|
||||
true,
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
"respawn_reinsertion",
|
||||
"SETTING CHANGED",
|
||||
[
|
||||
[
|
||||
"setting",
|
||||
"milsim_reinsert_setting_reinsertion_max_wait"
|
||||
],
|
||||
["newValue", _value]
|
||||
]
|
||||
] call milsim_util_fnc_log;
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
//---------------------
|
||||
// Asset Diary and Markers Settings
|
||||
|
||||
[
|
||||
"milsim_fbcb2_assets_setting_detectionRangeFromBase", // variable
|
||||
"SLIDER", // type
|
||||
["Detection Range From Base", "The range from a base that assets will be detected"], // title
|
||||
["17th Battalion", "Asset Diary and Markers"], // category
|
||||
[0, 1000, 750, 0, false], // [_min, _max, _default, _trailingDecimals, _isPercentage]
|
||||
true, // global setting
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
"fbcb2_assets",
|
||||
"SETTING CHANGED",
|
||||
[
|
||||
[
|
||||
"setting",
|
||||
"milsim_fbcb2_assets_setting_detectionRangeFromBase"
|
||||
],
|
||||
["newValue", _value]
|
||||
]
|
||||
] call milsim_util_fnc_log;
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
diag_log text "[MILSIM] (settings) Custom CBA settings initialized";
|
||||
|
||||
nil;
|
||||
23
framework/settings/fn_addRespawnChatHandler.sqf
Normal file
23
framework/settings/fn_addRespawnChatHandler.sqf
Normal file
@@ -0,0 +1,23 @@
|
||||
[
|
||||
"respawn",
|
||||
{
|
||||
_clientID = _thisArgs select 0;
|
||||
player setDamage 1;
|
||||
|
||||
// log to server RPT
|
||||
[
|
||||
"init",
|
||||
"CHAT COMMAND RESPAWN",
|
||||
[player] call milsim_util_fnc_addPlayerInfoToArray
|
||||
] remoteExec ["milsim_util_fnc_log", 2];
|
||||
|
||||
// systemChat to all remote machines
|
||||
format["%1 claims they were glitched and respawned (%2)", name player, netID player] remoteExec["systemChat", -_clientID];
|
||||
},
|
||||
"all",
|
||||
[clientOwner]
|
||||
] call CBA_fnc_registerChatCommand;
|
||||
|
||||
diag_log text "[MILSIM] (settings) respawn chat handler registered";
|
||||
|
||||
nil;
|
||||
19
framework/settings/fn_setDefaults.sqf
Normal file
19
framework/settings/fn_setDefaults.sqf
Normal file
@@ -0,0 +1,19 @@
|
||||
enableSaving[false, false];
|
||||
|
||||
enableRadio false;
|
||||
enableSentences false;
|
||||
|
||||
missionNamespace setVariable ["ACE_maxWeightDrag", 2400];
|
||||
missionNamespace setVariable ["ACE_maxWeightCarry", 1800];
|
||||
|
||||
if(isClass(configfile >> "CfgPatches" >> "rhs_main")) then {
|
||||
rhs_vehicleRadioChatter = 0;
|
||||
};
|
||||
|
||||
waitUntil {time > 0};
|
||||
|
||||
enableEnvironment[false, true];
|
||||
|
||||
diag_log text "[MILSIM] (settings) defaults set";
|
||||
|
||||
nil;
|
||||
14
framework/util/fn_addPlayerInfoToArray.sqf
Normal file
14
framework/util/fn_addPlayerInfoToArray.sqf
Normal file
@@ -0,0 +1,14 @@
|
||||
params [["_playerObj", objNull], ["_arrayToModify", [], [[]]]];
|
||||
|
||||
if (isNull _playerObj) exitWith {_arrayToModify};
|
||||
|
||||
{
|
||||
_arrayToModify = [_arrayToModify, _x#0, _x#1] call BIS_fnc_setToPairs;
|
||||
} forEach [
|
||||
["playerName", name _playerObj],
|
||||
["playerUID", getPlayerUID _playerObj],
|
||||
["playerGroup", groupId (group _playerObj)],
|
||||
["playerNetID", [_playerObj] call BIS_fnc_netId]
|
||||
];
|
||||
|
||||
_arrayToModify;
|
||||
1
framework/util/fn_getBattalionCfg.sqf
Normal file
1
framework/util/fn_getBattalionCfg.sqf
Normal file
@@ -0,0 +1 @@
|
||||
(missionConfigFile >> "BattalionInfo")
|
||||
17
framework/util/fn_getNameOfBase.sqf
Normal file
17
framework/util/fn_getNameOfBase.sqf
Normal file
@@ -0,0 +1,17 @@
|
||||
params [["_base", objNull, [objNull]]];
|
||||
if (_base == objNull) exitWith {""};
|
||||
|
||||
// get base name
|
||||
private _baseName = _base getVariable ["name", ""];
|
||||
// if (_baseName == "") then {
|
||||
// _baseName = format[
|
||||
// "near %1",
|
||||
// text (nearestLocation [_base, ["NameCity", "NameLocal"]])
|
||||
// ]
|
||||
// };
|
||||
|
||||
if (_baseName == "") then {
|
||||
_baseName = _base call BIS_fnc_locationDescription;
|
||||
};
|
||||
|
||||
_baseName;
|
||||
10
framework/util/fn_getNearestBase.sqf
Normal file
10
framework/util/fn_getNearestBase.sqf
Normal file
@@ -0,0 +1,10 @@
|
||||
params [["_object", objNull, [objNull]]];
|
||||
if (isNull _object) exitWith {objNull};
|
||||
|
||||
private _bases = missionNamespace getVariable ["milsim_baseObjects", []];
|
||||
if (count _bases == 0) exitWith {objNull};
|
||||
|
||||
// get nearest base (Module_Respawn_F)
|
||||
private _closestBase = [_bases, _object] call BIS_fnc_nearestPosition;
|
||||
if (isNull _closestBase) exitWith {objNull};
|
||||
_closestBase;
|
||||
28
framework/util/fn_log.sqf
Normal file
28
framework/util/fn_log.sqf
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
Function: milsim_util_fnc_log
|
||||
|
||||
Description:
|
||||
Used to log messages to the server RPT file.
|
||||
|
||||
Parameters:
|
||||
0: STRING - component name.
|
||||
1: STRING - message to log.
|
||||
2: ARRAY - Key value pairs of data to log.
|
||||
*/
|
||||
|
||||
params [
|
||||
["_component", "", [""]],
|
||||
["_message", "", [""]],
|
||||
["_data", [], [[]]]
|
||||
];
|
||||
|
||||
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 ["[milsim] [%1] [%2] [%3] :: %4", _component, _fnc_scriptNameParent, _message, _json];
|
||||
|
||||
diag_log text _log;
|
||||
23
framework/util/fn_logMissionInfo.sqf
Normal file
23
framework/util/fn_logMissionInfo.sqf
Normal file
@@ -0,0 +1,23 @@
|
||||
[
|
||||
"init",
|
||||
"MISSION INFO",
|
||||
[
|
||||
["serverName", serverName],
|
||||
["worldName", worldName],
|
||||
["missionSeries", getMissionConfigValue ["missionSeries", ""]],
|
||||
["missionName", missionName],
|
||||
["briefingName", briefingName],
|
||||
["overviewText", getMissionConfigValue ["overviewText", ""]],
|
||||
["onLoadName", getMissionConfigValue ["onLoadName", ""]],
|
||||
["onLoadMission", getMissionConfigValue ["onLoadMission", ""]],
|
||||
["missionAuthor", getMissionConfigValue ["author", ""]],
|
||||
["unitSlots", createHashMapFromArray [
|
||||
["EAST", playableSlotsNumber EAST], // 0 is EAST side
|
||||
["WEST", playableSlotsNumber WEST], // 1 is WEST side
|
||||
["RESISTANCE", playableSlotsNumber RESISTANCE], // 2 is RESISTANCE side
|
||||
["CIVILIAN", playableSlotsNumber CIVILIAN], // 3 is CIVILIAN side
|
||||
["SIDEUNKNOWN", 0], // 4 is SIDEUNKNOWN side
|
||||
["LOGIC", playableSlotsNumber sideLogic] // 5 is LOGIC side
|
||||
]]
|
||||
]
|
||||
] call milsim_util_fnc_log;
|
||||
20
framework/util/fn_padString.sqf
Normal file
20
framework/util/fn_padString.sqf
Normal file
@@ -0,0 +1,20 @@
|
||||
params [
|
||||
["_text", "", [""]],
|
||||
["_padSide", "left", ["left", "right"]],
|
||||
["_padChar", " ", [" "]],
|
||||
["_padLength", 4, [4]]
|
||||
];
|
||||
|
||||
// pad a string with a character to a certain length
|
||||
if (_padSide == "left") then {
|
||||
for "_i" from 1 to _padLength - count _text do {
|
||||
_text = _padChar + _text;
|
||||
};
|
||||
};
|
||||
if (_padSide == "right") then {
|
||||
for "_i" from 1 to _padLength - count _text do {
|
||||
_text = _text + _padChar;
|
||||
};
|
||||
};
|
||||
|
||||
_text
|
||||
25
framework/util/fn_recurseSubclasses.sqf
Normal file
25
framework/util/fn_recurseSubclasses.sqf
Normal file
@@ -0,0 +1,25 @@
|
||||
params [
|
||||
["_cfg", configNull, [configNull]],
|
||||
["_code", {}, [{}]]
|
||||
];
|
||||
|
||||
if (isNull _cfg) exitWith {["Provided config is null!"] call BIS_fnc_error};
|
||||
|
||||
|
||||
private _recurseFnc = {
|
||||
params ["_cfg", "_code", ["_recurseCounter", 0]];
|
||||
[_cfg, _recurseCounter] call _code;
|
||||
// get children and recurse
|
||||
private _childCfgs = _cfg call BIS_fnc_returnChildren;
|
||||
if (count _childCfgs isEqualTo 0) exitWith {false};
|
||||
|
||||
{
|
||||
[_x, _code, _recurseCounter + 1] call _recurseFnc;
|
||||
} forEach _childCfgs;
|
||||
false;
|
||||
};
|
||||
|
||||
private _continue = true;
|
||||
while {_continue} do {
|
||||
_continue = [_cfg, _code] call _recurseFnc;
|
||||
};
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
Used to generate flag category and nested flag child options for the ACE3 interaction menu.
|
||||
|
||||
Parameters:
|
||||
0: STRING - Parent action ID
|
||||
1: ARRAY - Flag category configs
|
||||
*/
|
||||
|
||||
params ["_rootActionID", "_flagCategoryCfgs"];
|
||||
|
||||
private _allCategoryActions = [];
|
||||
|
||||
{
|
||||
// diag_log format ["NewFlagCategory: %1 %2", _flagCategory, _flagOptions];
|
||||
|
||||
private _flagCategoryCfg = _x;
|
||||
private _flagCategoryActionID = getText(_flagCategoryCfg >> "actionID");
|
||||
private _flagCategoryTitle = getText(_flagCategoryCfg >> "actionTitle");
|
||||
|
||||
private _flagSubclassesCfgs = _flagCategoryCfg call BIS_fnc_returnChildren;
|
||||
|
||||
private _flagCategoryAction = [
|
||||
_rootActionID + "_" + _flagCategoryActionID, // id
|
||||
_flagCategoryTitle, // displayed title
|
||||
getText((_flagSubclassesCfgs#0) >> "texture"), // flag icon for category - use first flag option
|
||||
{true}, // statement
|
||||
{
|
||||
params ["_target", "_player", "_params"];
|
||||
alive _target;
|
||||
// true;
|
||||
}, // condition
|
||||
{
|
||||
// generate child code under category
|
||||
// this is the level where actual flag options will be displayed
|
||||
params ["_target", "_player", "_params"];
|
||||
_params params ["_rootActionID", "_flagCategoryActionID", "_flagSubclassesCfgs"];
|
||||
|
||||
private _individualFlagActions = [];
|
||||
{ // forEach _flagSubclassesCfgs;
|
||||
private _flagOptionCfg = _x;
|
||||
private _flagOptionID = getText(_flagOptionCfg >> "actionID");
|
||||
private _flagOptionTitle = getText(_flagOptionCfg >> "actionTitle");
|
||||
private _flagOptionTexture = getText(_flagOptionCfg >> "texture");
|
||||
|
||||
// if the texture doesn't exist at the config path, skip this flag option
|
||||
if (not (fileExists _flagOptionTexture)) then {continue};
|
||||
|
||||
// diag_log format ["NewFlagOption: %1 %2", _flagOptionID, _flagOptionData];
|
||||
|
||||
private _newFlagOption = [
|
||||
|
||||
_rootActionID + "_" + _flagCategoryActionID + "_" + _flagOptionID, // id
|
||||
_flagOptionTitle, // displayed title
|
||||
_flagOptionTexture, // flag icon
|
||||
{
|
||||
params ["_target", "_player", "_params"];
|
||||
_params params ["_flagOptionTexture"];
|
||||
_target forceFlagTexture _flagOptionTexture;
|
||||
}, // statement
|
||||
{
|
||||
params ["_target", "_player", "_params"];
|
||||
alive _target;
|
||||
// true;
|
||||
}, // condition
|
||||
nil, // child code
|
||||
[_flagOptionTexture], // params
|
||||
nil, // position
|
||||
4, // distance
|
||||
[false, false, false, false, false] // other params
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
|
||||
// add flag option to category subactions
|
||||
_individualFlagActions pushBack [_newFlagOption, [], _target];
|
||||
} forEach _flagSubclassesCfgs;
|
||||
|
||||
// return the generated flag options to the category as child actions
|
||||
_individualFlagActions;
|
||||
}, // child code
|
||||
[_rootActionID, _flagCategoryActionID, _flagSubclassesCfgs], // params
|
||||
nil, // position
|
||||
4, // distance
|
||||
[false, false, false, false, false], // other params
|
||||
nil // modifier function code
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
|
||||
// add category to all category actions array
|
||||
_allCategoryActions pushBack [_flagCategoryAction, [], _target];
|
||||
} forEach _flagCategoryCfgs;
|
||||
|
||||
_allCategoryActions;
|
||||
@@ -0,0 +1 @@
|
||||
(missionConfigFile >> "VehicleFlags");
|
||||
103
framework/vehicleFlags/functions/fn_init.sqf
Normal file
103
framework/vehicleFlags/functions/fn_init.sqf
Normal file
@@ -0,0 +1,103 @@
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
private _vehicleFlagsCfg = call FUNC(getVehicleFlagsCfg);
|
||||
|
||||
if (!isClass _vehicleFlagsCfg) exitWith {
|
||||
["WARNING: Vehicle Flags: Vehicle Flags config not found. Vehicle Flags will not be available."] call BIS_fnc_error;
|
||||
};
|
||||
|
||||
private _baseClassesToApplyActionsFor =
|
||||
(_vehicleFlagsCfg >> "baseClassesToApplyActionsFor") call BIS_fnc_getCfgDataArray;
|
||||
private _flagCategoryCfgs = (_vehicleFlagsCfg >> "FlagCategories") call BIS_fnc_returnChildren;
|
||||
|
||||
{ // forEach _baseClassesToApplyActionsFor
|
||||
private _parentClass = _x;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// add CBA class event handler to add actions to vehicles after they are initialized
|
||||
// all classes that inherit from the base classes will also have this applied
|
||||
// an exclusion function is present for manually excluding specific classes
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
[_parentClass, "InitPost", {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// create the root action
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
private _rootActionID = "SetVehicleFlag";
|
||||
private _flagRootAction = [
|
||||
_rootActionID, // id
|
||||
"Set Vehicle Flag", // displayed title
|
||||
"\A3\ui_f\data\map\markers\flags\nato_ca.paa", // flag icon
|
||||
{true}, // statement
|
||||
{
|
||||
params ["_target", "_player", "_params"];
|
||||
// _params params ["_parentActionID", "_flagCategories"];
|
||||
|
||||
// check if vehicle is excluded
|
||||
private _excluded = [typeOf _target] call FUNC(isClassExcluded);
|
||||
if (_excluded || !alive _target) exitWith {false};
|
||||
|
||||
true;
|
||||
}, // condition
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// create the flag category actions (with nested flag actions)
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
params ["_target", "_player", "_params"];
|
||||
_params params ["_rootActionID", "_flagCategoryCfgs"];
|
||||
|
||||
// return category child actions with individual flag actions nested as children
|
||||
[_rootActionID, _flagCategoryCfgs] call FUNC(getActionsFlagCategories);
|
||||
|
||||
}, // child code
|
||||
[_rootActionID, _flagCategoryCfgs], // params
|
||||
nil, // position
|
||||
4, // distance
|
||||
[false, false, false, false, false], // other params
|
||||
nil // modifier function code
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// add root action to add flags
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
[
|
||||
(_this select 0), // object
|
||||
0, // action 0 or self-action 1
|
||||
["ACE_MainActions"], // parent
|
||||
_flagRootAction // action
|
||||
] call ace_interact_menu_fnc_addActionToObject;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// add action to remove flag under the root action
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// create action
|
||||
private _removeFlagAction = [
|
||||
_rootActionID + "_removeflag", // id
|
||||
"Remove Flag", // displayed title
|
||||
"\A3\ui_f\data\map\markers\flags\nato_ca.paa", // flag icon
|
||||
{
|
||||
params ["_target", "_player", "_params"];
|
||||
_target forceFlagTexture "";
|
||||
}, // statement
|
||||
{
|
||||
params ["_target", "_player", "_params"];
|
||||
alive _target && getForcedFlagTexture _target != "";
|
||||
}, // condition
|
||||
nil // child code
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
|
||||
// add the action to the vehicle
|
||||
// in this class event handler, this#0 will be the vehicle
|
||||
[
|
||||
(_this select 0), // object
|
||||
0, // action 0 or self-action 1
|
||||
["ACE_MainActions", _rootActionID], // parent
|
||||
_removeFlagAction // action
|
||||
] call ace_interact_menu_fnc_addActionToObject;
|
||||
|
||||
}, true, [], true] call CBA_fnc_addClassEventHandler;
|
||||
} forEach _baseClassesToApplyActionsFor;
|
||||
|
||||
nil;
|
||||
26
framework/vehicleFlags/functions/fn_isClassExcluded.sqf
Normal file
26
framework/vehicleFlags/functions/fn_isClassExcluded.sqf
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
Used to read vehicle flags config and check provided classname against all present exclusion groups.
|
||||
|
||||
Author: IndigoFox
|
||||
|
||||
Parameter(s):
|
||||
0: STRING - Classname of the vehicle to check
|
||||
*/
|
||||
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
params [["_className", "", [""]]];
|
||||
if (_className == "") exitWith {false};
|
||||
|
||||
private _vehicleFlagsCfg = call milsim_vehicleFlags_fnc_getVehicleFlagsCfg;
|
||||
private _excludedVehiclesClass = (_vehicleFlagsCfg >> "ExcludedVehicles");
|
||||
private _exclusionGroups = configProperties [_vehicleFlagsCfg >> "ExcludedVehicles"];
|
||||
|
||||
{
|
||||
// Check if the class doesn't have a flag proxy
|
||||
private _excludedClasses = _x call BIS_fnc_getCfgDataArray;
|
||||
if (_className in _excludedClasses) exitWith {true};
|
||||
} forEach _exclusionGroups;
|
||||
|
||||
false;
|
||||
3
framework/vehicleFlags/script_component.hpp
Normal file
3
framework/vehicleFlags/script_component.hpp
Normal file
@@ -0,0 +1,3 @@
|
||||
#define COMPONENT vehicleFlags
|
||||
#define COMPONENT_BEAUTIFIED Vehicle Flags
|
||||
#include "../script_mod.hpp"
|
||||
Reference in New Issue
Block a user