ready for dedi -- improvements to resupply, triageIcons too
This commit is contained in:
@@ -1,6 +1,19 @@
|
||||
#include "script_mod.hpp"
|
||||
|
||||
class CfgFunctions {
|
||||
|
||||
class DOUBLES(PREFIX,init) {
|
||||
class functions {
|
||||
file = "framework\init\functions";
|
||||
class initServer { postInit = 1;};
|
||||
class initClient { postInit = 1;};
|
||||
class setDefaults { postInit = 1; };
|
||||
class addAARChatHandler { postInit = 1; };
|
||||
class addRespawnChatHandler { postInit = 1; };
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
class PREFIX {
|
||||
class ambience {
|
||||
file = "framework\ambience";
|
||||
@@ -22,7 +35,6 @@ class CfgFunctions {
|
||||
class DOUBLES(PREFIX,client) {
|
||||
class functions {
|
||||
file = "framework\client\functions";
|
||||
class addMedicalOverlayPFH { postInit = 1; };
|
||||
class addZenModules { postInit = 1; };
|
||||
class bindEmptyGroupGarbageCleanup { postInit = 1; };
|
||||
class bindEventHandlers { postInit = 1; };
|
||||
@@ -35,14 +47,14 @@ class CfgFunctions {
|
||||
class functions {
|
||||
file = "framework\common\functions";
|
||||
class addCBASettings { preInit = 1; };
|
||||
class logMissionInfo { postInit = 1; };
|
||||
class logMissionInfo {};
|
||||
class addPlayerInfoToArray {};
|
||||
class getApprovedAssetsCfg {};
|
||||
class getBattalionCfg {};
|
||||
class getNameOfBase {};
|
||||
class getNearestBase {};
|
||||
class log {};
|
||||
class logPlayerInventory {};
|
||||
class checkPlayerInventory {};
|
||||
class logSettingChanged {};
|
||||
class padString {};
|
||||
class recurseSubclasses {};
|
||||
@@ -53,30 +65,30 @@ class CfgFunctions {
|
||||
class functions {
|
||||
file = "framework\fbcb2_assets\functions";
|
||||
class addCBASettings {preInit=1;};
|
||||
class initClient {postInit=1;};
|
||||
class initServer {postInit=1;};
|
||||
class getAssetsByBase {};
|
||||
class initServer {};
|
||||
class initClient {};
|
||||
class getCallsignFromClassname {};
|
||||
class getCurrentAssetsByBase {};
|
||||
class getInventory {};
|
||||
class getMagsForWeapon {};
|
||||
class getStartingAndCurrentAssets {};
|
||||
class getStartingAssetsByBase {};
|
||||
class getVehicleData {};
|
||||
class getWeaponry {};
|
||||
class hintAllApprovedAssets {};
|
||||
class isAssetInRangeOfBase {};
|
||||
class removeAssetDiaryRecords {};
|
||||
class removeMarkersOnMap {};
|
||||
class showMarkersOnMap {};
|
||||
class updateAssetDiary {};
|
||||
class updateAssetsByBase {};
|
||||
class getCallsignFromClassname {};
|
||||
class getStartingAndCurrentAssets {};
|
||||
class isAssetInRangeOfBase {};
|
||||
};
|
||||
};
|
||||
|
||||
class DOUBLES(PREFIX,fbcb2_main) {
|
||||
class functions {
|
||||
file = "framework\fbcb2_main\functions";
|
||||
class init { postInit = 1; };
|
||||
class initClient {};
|
||||
class addEnvironmentRecord {};
|
||||
class addFrequenciesRecord {};
|
||||
class addSignalColorsRecord {};
|
||||
@@ -89,21 +101,13 @@ class CfgFunctions {
|
||||
};
|
||||
};
|
||||
|
||||
class DOUBLES(PREFIX,init) {
|
||||
file = "framework\init\functions";
|
||||
class addAARChatHandler { postInit = 1; };
|
||||
class addRespawnChatHandler { postInit = 1; };
|
||||
class initServer { postInit = 1;};
|
||||
class initPlayerLocal { postInit = 1;};
|
||||
class setDefaults { postInit = 1; };
|
||||
};
|
||||
|
||||
class DOUBLES(PREFIX,performance) {
|
||||
class functions {
|
||||
file = "framework\performance\functions";
|
||||
class addCBASettings {preInit=1;};
|
||||
class init {postInit=1;};
|
||||
class addDNI_PlayerFPS { postInit = 1; };
|
||||
|
||||
// PFHs managed in addCBASettings onChange code
|
||||
class addClientStatsPFH {};
|
||||
class calculateClientStats {};
|
||||
class addServerStatsPFH {};
|
||||
@@ -118,7 +122,7 @@ class CfgFunctions {
|
||||
};
|
||||
class server {
|
||||
file = "framework\reinsert\server";
|
||||
class initServer { postInit = 1; };
|
||||
class initServer {};
|
||||
class addToQueue {};
|
||||
class globalShowQueue {};
|
||||
class removeFromQueue {};
|
||||
@@ -127,7 +131,7 @@ class CfgFunctions {
|
||||
};
|
||||
class client {
|
||||
file = "framework\reinsert\client";
|
||||
class initClient { postInit = 1; };
|
||||
class initClient {};
|
||||
class addAceSelfActions {};
|
||||
class addCheckQueueSelfAction {};
|
||||
class requestShowQueue {};
|
||||
@@ -138,17 +142,28 @@ class CfgFunctions {
|
||||
class functions {
|
||||
file = "framework\resupply\functions";
|
||||
class addCBASettings {preInit=1;};
|
||||
class init {postInit=1;};
|
||||
class initClient {};
|
||||
class createBox {};
|
||||
class getSupplyCratesCfg {};
|
||||
class addArsenalObjectSpawnBoxActions {};
|
||||
};
|
||||
};
|
||||
|
||||
class DOUBLES(PREFIX,triageIcons) {
|
||||
class functions {
|
||||
file = "framework\triageIcons\functions";
|
||||
class addCBASettings {preInit=1;};
|
||||
class initClient {};
|
||||
class addDrawIconsPFH {};
|
||||
class addGetEntitiesPFH {};
|
||||
class updateColors {};
|
||||
};
|
||||
};
|
||||
|
||||
class DOUBLES(PREFIX,vehicleFlags) {
|
||||
class functions {
|
||||
file = "framework\vehicleFlags\functions";
|
||||
class init {postInit=1;};
|
||||
class initClient {};
|
||||
class getActionsFlagCategories {};
|
||||
class getVehicleFlagsCfg {};
|
||||
class isClassExcluded {};
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
/*
|
||||
|
||||
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;
|
||||
@@ -1,4 +1,11 @@
|
||||
diag_log text format ["[MILSIM] (client) initializing empty group deletion PFH"];
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"Initializing empty group deletion PFH",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
|
||||
_emptyGroupPFH = [
|
||||
{
|
||||
@@ -12,8 +19,21 @@ _emptyGroupPFH = [
|
||||
},
|
||||
300,
|
||||
[],
|
||||
{ diag_log text format ["[MILSIM] (client) Empty Group Deletion PFH loaded"] },
|
||||
{ diag_log text format ["[MILSIM] (client) Empty Group Deletion"] },
|
||||
{
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"Empty group deletion PFH loaded",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
},
|
||||
{ [
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"Empty group deletion PFH unloaded",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
},
|
||||
{ true },
|
||||
{ false },
|
||||
[]
|
||||
|
||||
@@ -8,7 +8,7 @@ player addEventHandler["Respawn",
|
||||
private _killer = _corpse getVariable ["ace_medical_causeOfDeath", "#scripted"];
|
||||
if (_killer == "respawn_button") then {
|
||||
[
|
||||
LEVEL_INFO
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"RESPAWNED WHILE UNCONSCIOUS",
|
||||
[_unit] call EFUNC(common,addPlayerInfoToArray)
|
||||
@@ -46,11 +46,11 @@ addMissionEventHandler ["HandleChatMessage",
|
||||
|
||||
|
||||
["ace_arsenal_displayClosed", {
|
||||
[player] remoteExec [QEFUNC(common,logPlayerInventory), 2];
|
||||
[player] remoteExec [QEFUNC(common,checkPlayerInventory), 2];
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
[missionNamespace, "arsenalClosed", {
|
||||
[player] remoteExec [QEFUNC(common,logPlayerInventory), 2];
|
||||
[player] remoteExec [QEFUNC(common,checkPlayerInventory), 2];
|
||||
}] call BIS_fnc_addScriptedEventHandler;
|
||||
|
||||
diag_log text "[MILSIM] (client) event handlers bound";
|
||||
|
||||
@@ -56,7 +56,7 @@ _patchTire =
|
||||
"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] ) }
|
||||
{ ( alive _target ) && ( [_player, "ToolKit"] call ace_common_fnc_hasItem ) && ( damage _target > 0.2 ) && ( _target getVariable["milsim_ace_repair_wheel_canPatch", true] ) }
|
||||
] call ace_interact_menu_fnc_createAction;
|
||||
|
||||
["ACE_Wheel", 0, ["ACE_MainActions"], _patchTire, true] call ace_interact_menu_fnc_addActionToClass;
|
||||
|
||||
@@ -22,29 +22,6 @@
|
||||
|
||||
[QGVARMAIN(sideChat), false] call CBA_settings_fnc_set;
|
||||
|
||||
|
||||
//---------------------
|
||||
// Medical Overlay
|
||||
//---------------------
|
||||
|
||||
[
|
||||
"milsim_client_medState3D_enabled", // variable
|
||||
"CHECKBOX", // type
|
||||
["Enable 3D Triage Card State", "Draws a colored dot over units within 10m indicating current ACE Triage State"], // title
|
||||
["17th Battalion", "Medical"], // category
|
||||
true // default value
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
"milsim_client_medState3D_drawRange", // variable
|
||||
"LIST", // type
|
||||
["Range To Draw Icons", "Determines range at which dots are visible"], // title
|
||||
["17th Battalion", "Medical"], // category
|
||||
[[2, 4, 6, 8, 10], ["2", "4", "6", "8", "10"], 4] // option values, option labels, default index
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
|
||||
|
||||
diag_log text "[MILSIM] (settings) Custom CBA settings initialized";
|
||||
|
||||
nil;
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
params [["_playerObj", objNull], ["_arrayToModify", [], [[]]]];
|
||||
params [["_playerObj", objNull, [nil, objNull]], ["_arrayToModify", [], [[]]]];
|
||||
|
||||
if (isNull _playerObj) exitWith {_arrayToModify};
|
||||
|
||||
@@ -10,7 +10,7 @@ if (isNull _playerObj) exitWith {_arrayToModify};
|
||||
["playerName", name _playerObj],
|
||||
["playerUID", getPlayerUID _playerObj],
|
||||
["playerGroup", groupId (group _playerObj)],
|
||||
["playerNetID", [_playerObj] call BIS_fnc_netId]
|
||||
["playerNetID", _playerObj call BIS_fnc_netId]
|
||||
];
|
||||
|
||||
_arrayToModify;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Function: milsim_util_fnc_logPlayerInventory
|
||||
Function: milsim_common_fnc_checkPlayerInventory
|
||||
|
||||
Description:
|
||||
Checks a player's inventory for non-compliant items and logs results to all machines.
|
||||
@@ -21,7 +21,7 @@ params [
|
||||
|
||||
if (!isPlayer _player) exitWith {
|
||||
[
|
||||
LEVEL_ERROR
|
||||
LEVEL_ERROR,
|
||||
QUOTE(COMPONENT),
|
||||
"PARAM PLAYER IS NOT A PLAYER",
|
||||
[["player", _player]]
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Function: milsim_util_fnc_log
|
||||
Function: milsim_common_fnc_log
|
||||
|
||||
Description:
|
||||
Used to log messages to the server RPT file.
|
||||
@@ -19,13 +19,13 @@ params [
|
||||
["_data", [], [[]]]
|
||||
];
|
||||
|
||||
if (_logLevel < LOG_LEVEL) exitWith {};
|
||||
if (_logLevel < DEBUG_MODE) exitWith {};
|
||||
|
||||
private _hash = createHashMapFromArray _data;
|
||||
|
||||
// Replace square brackets with round brackets to avoid parsing issues.
|
||||
_message regexReplace ["\[", "("];
|
||||
_message regexReplace ["\]", ")"];
|
||||
_message regexReplace ['(\[)', "("];
|
||||
_message regexReplace ['(\])', ")"];
|
||||
|
||||
private _json = [_hash] call CBA_fnc_encodeJSON;
|
||||
_log = format ["[%1] [%2] [%3] [%4] :: %5", QUOTE(PREFIX), _component, _fnc_scriptNameParent, _message, _json];
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"MISSION INFO",
|
||||
[
|
||||
|
||||
@@ -8,7 +8,7 @@ private _startingAssets = [];
|
||||
} forEach _startingAssetsByBase;
|
||||
|
||||
// get all current assets at each base and combine to array
|
||||
private _assetsByBase = call FUNC(getAssetsByBase);
|
||||
private _assetsByBase = call FUNC(getCurrentAssetsByBase);
|
||||
private _assets = [];
|
||||
{
|
||||
_assets append (_x#1);
|
||||
|
||||
@@ -2,11 +2,21 @@
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
call FUNC(updateAssetDiary);
|
||||
|
||||
// once the server has published that assets have been gathered and distributed to bases (respawn modules),
|
||||
// we can update the asset diary on our end using that data
|
||||
[{missionNamespace getVariable [QGVAR(serverAssetsReady), false]}, {
|
||||
call FUNC(updateAssetDiary);
|
||||
}] call CBA_fnc_waitUntilAndExecute;
|
||||
[QGVAR(assetsGathered), {
|
||||
[
|
||||
LEVEL_DEBUG,
|
||||
QUOTE(COMPONENT),
|
||||
"Received gathered base asset data from server",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
|
||||
// update the asset diary with the data we've received
|
||||
FUNC(updateAssetDiary);
|
||||
}] call CBA_fnc_addEventHandlerArgs;
|
||||
|
||||
[
|
||||
LEVEL_DEBUG,
|
||||
@@ -14,3 +24,5 @@ if (!hasInterface) exitWith {};
|
||||
"postInit complete",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
|
||||
localNamespace setVariable [QGVAR(complete), true];
|
||||
@@ -5,8 +5,6 @@ if (!isServer) exitWith {};
|
||||
// init asset stores at bases
|
||||
[true] call FUNC(updateAssetsByBase);
|
||||
|
||||
missionNamespace setVariable [QGVAR(serverAssetsReady), true, true];
|
||||
|
||||
// starting 5 minutes after postInit, update asset stores every 5 minutes
|
||||
[{
|
||||
[
|
||||
|
||||
@@ -7,6 +7,8 @@ params [
|
||||
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
GVARMAIN(baseObjects) = allMissionObjects "ModuleRespawnPosition_F";
|
||||
|
||||
// Get all approved assets on map, find the closest base
|
||||
// Then determine if it's within range
|
||||
// If it is, add it to the base's assets list
|
||||
@@ -14,12 +16,14 @@ if (!isServer) exitWith {};
|
||||
private _allVehicles = vehicles;
|
||||
private _allSaved = [];
|
||||
|
||||
private _assetsAtThisBaseVar = QGVAR(assetsAtThisBase);
|
||||
private _assetsStartedAtThisBaseVar = QGVAR(assetsStartedAtThisBase);
|
||||
private _assetsAtThisBaseVar = QGVAR(assetsAtThisBase);
|
||||
|
||||
private _approvedAssetsCfg = call EFUNC(common,getApprovedAssetsCfg);
|
||||
if (isNull _approvedAssetsCfg) exitWith {};
|
||||
|
||||
private _currentBaseAssetsGathered = GVARMAIN(baseObjects) apply {[_x, []]};;
|
||||
|
||||
{
|
||||
private _className = configName _x;
|
||||
private _callsign = getText(_x >> "callsign");
|
||||
@@ -27,68 +31,34 @@ if (isNull _approvedAssetsCfg) exitWith {};
|
||||
{
|
||||
private _asset = _x;
|
||||
|
||||
// avoid duplicates
|
||||
if (_asset in _allSaved) then {continue};
|
||||
|
||||
// ignore assets beyond the range of bases
|
||||
if (not ([_asset] call FUNC(isAssetInRangeOfBase))) then {continue};
|
||||
|
||||
|
||||
// add to base's assets list
|
||||
private _closestBase = [_asset] call EFUNC(common,getNearestBase);
|
||||
private _baseAssets = _closestBase getVariable [_assetsAtThisBaseVar, []];
|
||||
_baseAssets pushBackUnique [
|
||||
private _closestBaseCurrentAssets = (_currentBaseAssetsGathered select { _x select 0 isEqualTo _closestBase })#0#1;
|
||||
_closestBaseCurrentAssets pushBackUnique [
|
||||
_asset call BIS_fnc_netId,
|
||||
configOf _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 (_approvedAssetsCfg call BIS_fnc_returnChildren);
|
||||
|
||||
// Add all ground vehicles (LandVehicle)
|
||||
{
|
||||
private _asset = _x;
|
||||
// avoid duplicates
|
||||
if (_asset in _allSaved) then {continue};
|
||||
|
||||
// ignore assets beyond the range of bases
|
||||
if (not ([_asset] call FUNC(isAssetInRangeOfBase))) then {continue};
|
||||
|
||||
|
||||
// add to base's assets list
|
||||
private _closestBase = [_asset] call EFUNC(common,getNearestBase);
|
||||
private _baseAssets = _closestBase getVariable [_assetsAtThisBaseVar, []];
|
||||
_baseAssets pushBackUnique [
|
||||
private _closestBaseCurrentAssets = (_currentBaseAssetsGathered select { _x select 0 isEqualTo _closestBase })#0#1;
|
||||
_closestBaseCurrentAssets pushBackUnique [
|
||||
_asset call BIS_fnc_netId,
|
||||
configOf _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" });
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
@@ -97,16 +67,17 @@ if (isNull _approvedAssetsCfg) exitWith {};
|
||||
{
|
||||
private _base = _x;
|
||||
|
||||
// save current assets
|
||||
private _baseAssets = _base getVariable [_assetsAtThisBaseVar, []];
|
||||
_base setVariable [_assetsAtThisBaseVar, _baseAssets, true];
|
||||
private _thisBaseCurrentAssets = (_currentBaseAssetsGathered select { _x select 0 isEqualTo _base })#0#1;
|
||||
_base setVariable [_assetsAtThisBaseVar, _thisBaseCurrentAssets, true];
|
||||
|
||||
// if init, save starting assets
|
||||
if (_isInit) then {
|
||||
_base setVariable [_assetsStartedAtThisBaseVar, _baseAssets, true];
|
||||
_base setVariable [_assetsStartedAtThisBaseVar, _thisBaseCurrentAssets, true];
|
||||
};
|
||||
} forEach GVARMAIN(baseObjects);
|
||||
|
||||
// send a CBA event to let other scripts know that assets have been gathered
|
||||
[{[QGVAR(assetsGathered)] call CBA_fnc_globalEvent;}, 2] call CBA_fnc_waitAndExecute;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// log starting assets if init
|
||||
// log current assets if requested (for end of mission counts)
|
||||
@@ -117,7 +88,7 @@ if !(_isInit || _logCurrentAssets) exitWith {};
|
||||
private _base = _x;
|
||||
|
||||
// get current assets
|
||||
private _baseAssets = _base getVariable [_assetsAtThisBaseVar, []];
|
||||
private _baseAssets = (_currentBaseAssetsGathered select { _x select 0 isEqualTo _base })#0#1;
|
||||
|
||||
// prepare key value for logging
|
||||
private _baseAssetsHashesPrep = _baseAssets apply {
|
||||
|
||||
@@ -14,6 +14,7 @@ if (isNull _battalionInfoCfg) exitWith {
|
||||
"Null Battalion Config",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
["Null Battalion Config"] call BIS_fnc_error;
|
||||
};
|
||||
|
||||
private _battalionElementCfgs = [_battalionInfoCfg >> "Command"] call BIS_fnc_returnChildren;
|
||||
@@ -24,6 +25,7 @@ if (count _battalionElementCfgs == 0) exitWith {
|
||||
"ERROR: No battalion elements found. Check that the battalion config is correctly structured. See defines/BattalionInfo.hpp and framework/util/functions/getBattalionCfg.sqf.",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
["ERROR: No battalion elements found. Check that the battalion config is correctly structured. See defines/BattalionInfo.hpp and framework/util/functions/getBattalionCfg.sqf."] call BIS_fnc_error;
|
||||
};
|
||||
|
||||
////////////////////////////////////////
|
||||
@@ -48,12 +50,12 @@ private _FREQ_TEXT_COLOR = "#CCCCCC";
|
||||
reverse _battalionElementCfgs;
|
||||
|
||||
{
|
||||
diag_log text format[
|
||||
"[%1] <%2> Processing battalion element %3",
|
||||
QUOTE(PREFIX),
|
||||
_fnc_scriptName,
|
||||
configName _x
|
||||
];
|
||||
[
|
||||
LEVEL_TRACE,
|
||||
QUOTE(COMPONENT),
|
||||
format["Processing battalion element %1", configName _x],
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
// recursively generate diary text for all child elements of battalion-level elements
|
||||
private _diaryTitleText = [_x, true] call FUNC(generateElementFrequencyRecordText);
|
||||
[
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
if ( !hasInterface ) exitWith {};
|
||||
|
||||
waitUntil { !isNil QGVARMAIN(complete) };
|
||||
|
||||
GVAR(recordTitleColor) = "#ff6666";
|
||||
GVAR(recordTitleFont) = "PuristaMedium";
|
||||
GVAR(recordTitleSize) = 20;
|
||||
@@ -33,7 +31,7 @@ player createDiarySubject[GVAR(subjectAssetsGroundID), "FBCB2 Ground"];
|
||||
// ]]
|
||||
GVAR(diaryRecords) = createHashMap;
|
||||
|
||||
// run main inits - assets handled in that component
|
||||
// run main inits
|
||||
[] call FUNC(addFrequenciesRecord);
|
||||
[] call FUNC(addSignalColorsRecord);
|
||||
[] call FUNC(addEnvironmentRecord);
|
||||
@@ -52,3 +50,5 @@ GVAR(diaryRecords) = createHashMap;
|
||||
"postInit complete",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
|
||||
localNamespace setVariable [QGVAR(complete), true];
|
||||
@@ -15,9 +15,16 @@ private _existingRecord = _subjectRecords getOrDefault [_recordTitle, diaryRecor
|
||||
|
||||
if (!isNull _existingRecord) then {
|
||||
player setDiaryRecordText [[_subjectID, _existingRecord], [_recordTitle, _recordText, _recordIcon]];
|
||||
if (DEBUG_ENABLED) then {
|
||||
systemChat format ["Updated diary record: %1", _recordTitle];
|
||||
};
|
||||
|
||||
[
|
||||
LEVEL_DEBUG,
|
||||
QUOTE(COMPONENT),
|
||||
format ["Updated diary record: %1", _recordTitle],
|
||||
[
|
||||
["subjectID", _subjectID],
|
||||
["recordTitle", _recordTitle]
|
||||
]
|
||||
] call EFUNC(common,log);
|
||||
} else {
|
||||
private _new = player createDiaryRecord [
|
||||
_subjectID,
|
||||
@@ -29,4 +36,14 @@ if (!isNull _existingRecord) then {
|
||||
];
|
||||
_subjectRecords set [_recordTitle, _new];
|
||||
GVAR(diaryRecords) set [_subjectID, _subjectRecords];
|
||||
|
||||
[
|
||||
LEVEL_DEBUG,
|
||||
QUOTE(COMPONENT),
|
||||
format ["Created diary record: %1", _recordTitle],
|
||||
[
|
||||
["subjectID", _subjectID],
|
||||
["recordTitle", _recordTitle]
|
||||
]
|
||||
] call EFUNC(common,log);
|
||||
};
|
||||
@@ -71,7 +71,8 @@ if (_shouldProcessChildCfgs) then {
|
||||
[
|
||||
LEVEL_TRACE,
|
||||
QUOTE(COMPONENT),
|
||||
"Processing child elements for battalion element %1"
|
||||
"Processing child elements for battalion element %1",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
|
||||
[_battalionElement, {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
[
|
||||
"saveaar",
|
||||
{
|
||||
|
||||
34
framework/init/functions/fn_initClient.sqf
Normal file
34
framework/init/functions/fn_initClient.sqf
Normal file
@@ -0,0 +1,34 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
if ( !hasInterface ) exitWith {};
|
||||
|
||||
["milsim_logText", {
|
||||
params [["_strArray", [""], [[]]]];
|
||||
{
|
||||
diag_log text _x;
|
||||
} forEach _strArray;
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
// make sure the server has finished init
|
||||
waitUntil {!isNil QGVARMAIN(complete)};
|
||||
|
||||
["InitializePlayer", [player, true]] call BIS_fnc_dynamicGroups;
|
||||
|
||||
|
||||
// initialize other modules
|
||||
call EFUNC(reinsert,initClient);
|
||||
call EFUNC(resupply,initClient);
|
||||
call EFUNC(triageIcons,initClient);
|
||||
call EFUNC(vehicleFlags,initClient);
|
||||
call EFUNC(fbcb2_main,initClient);
|
||||
call EFUNC(fbcb2_assets,initClient);
|
||||
|
||||
|
||||
[
|
||||
LEVEL_DEBUG,
|
||||
QUOTE(COMPONENT),
|
||||
"postInit complete",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
|
||||
nil;
|
||||
@@ -1,23 +0,0 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
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;
|
||||
|
||||
[
|
||||
LEVEL_DEBUG,
|
||||
QUOTE(COMPONENT),
|
||||
"postInit complete",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
|
||||
nil;
|
||||
@@ -2,23 +2,30 @@
|
||||
|
||||
if (!isServer) exitWith {};
|
||||
|
||||
|
||||
// array of all respawn modules in the mission representing "bases"
|
||||
GVARMAIN(baseObjects) = allMissionObjects "ModuleRespawnPosition_F";
|
||||
publicVariable "milsim_baseObjects";
|
||||
publicVariable QGVARMAIN(baseObjects);
|
||||
|
||||
// Initializes the Dynamic Groups framework and groups
|
||||
["Initialize", [true]] call BIS_fnc_dynamicGroups;
|
||||
|
||||
["milsim_logText", {
|
||||
if (isDedicated) then {
|
||||
["milsim_logText", {
|
||||
params [["_strArray", [""], [[]]]];
|
||||
{
|
||||
diag_log text _x;
|
||||
} forEach _strArray;
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
};
|
||||
|
||||
missionNamespace setVariable [QGVARMAIN(complete), true];
|
||||
publicVariable QGVARMAIN(complete);
|
||||
|
||||
// initialize other modules
|
||||
call EFUNC(common,logMissionInfo);
|
||||
call EFUNC(fbcb2_assets,initServer);
|
||||
call EFUNC(reinsert,initServer);
|
||||
|
||||
// declare init complete to other modules
|
||||
missionNamespace setVariable [QGVARMAIN(complete), true, true];
|
||||
|
||||
[
|
||||
LEVEL_INFO,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
QGVAR(server_cps_enable),
|
||||
"CHECKBOX",
|
||||
"Server CPS Metrics Enabled",
|
||||
["17th Battalion", "Server Metrics"],
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)],
|
||||
true,
|
||||
true,
|
||||
{
|
||||
|
||||
@@ -10,13 +10,8 @@
|
||||
_counter = _counter + 1;
|
||||
};
|
||||
// in an empty mission, the _counter may go well over 2000 times per frame!
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
format ["Average Execution: %1 times per frame", _counter / (diag_frameNo - _frameNo)],
|
||||
[["playerRawCPS", _counter / (diag_frameNo - _frameNo)]]
|
||||
] call EFUNC(common,log);
|
||||
player setVariable [QGVAR(player_raw_cps), _counter / (diag_frameNo - _frameNo), true];
|
||||
private _rawCPS = _counter / (diag_frameNo - _frameNo);
|
||||
player setVariable [QGVAR(player_raw_cps), _rawCPS, true];
|
||||
|
||||
// with suspension
|
||||
private _counter = 0;
|
||||
@@ -28,13 +23,23 @@
|
||||
uiSleep 0.001; // waits at least 1 frame
|
||||
};
|
||||
// _counter says one per frame, as expected
|
||||
private _playerCPS = _counter / (diag_frameNo - _frameNo);
|
||||
player setVariable [QGVAR(player_cps), _playerCPS, true];
|
||||
|
||||
// log to RPT
|
||||
[
|
||||
|
||||
{_this call EFUNC(common,log);},
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
format ["Average Execution: %1 times per frame", _counter / (diag_frameNo - _frameNo)],
|
||||
[["playerCPS", _counter / (diag_frameNo - _frameNo)]]
|
||||
] call EFUNC(common,log);
|
||||
player setVariable [QGVAR(player_cps), _counter / (diag_frameNo - _frameNo), true];
|
||||
format ["Average Execution: %1 times per frame", _playerCPS],
|
||||
[
|
||||
["playerRawCPS", _rawCPS],
|
||||
["playerCPS", _playerCPS]
|
||||
]
|
||||
]
|
||||
] call CBA_fnc_directCall;
|
||||
};
|
||||
|
||||
nil;
|
||||
@@ -1,3 +1,5 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
[] spawn {
|
||||
// warning: while loop without suspension executes multiple times per frame
|
||||
private _counter = 0;
|
||||
@@ -8,10 +10,9 @@
|
||||
_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";
|
||||
private _rawCPS = _counter / (diag_frameNo - _frameNo);
|
||||
missionNamespace setVariable [QGVAR(server_raw_cps), _rawCPS];
|
||||
publicVariable QGVAR(server_raw_cps);
|
||||
|
||||
// with suspension
|
||||
private _counter = 0;
|
||||
@@ -23,12 +24,31 @@
|
||||
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)];
|
||||
private _serverCPS = _counter / (diag_frameNo - _frameNo);
|
||||
missionNamespace setVariable [QGVAR(server_cps), _counter / (diag_frameNo - _frameNo)];
|
||||
publicVariable QGVAR(server_cps);
|
||||
|
||||
missionNamespace setVariable ["milsim_cps", _counter / (diag_frameNo - _frameNo)];
|
||||
publicVariable "milsim_cps";
|
||||
// log to RPT
|
||||
[
|
||||
|
||||
["milsim_serverEfficiency", [ [ ["float", "milsim_raw_cps", missionNamespace getVariable ["milsim_raw_cps", -1]], ["float", "milsim_cps", missionNamespace getVariable ["milsim_cps", -1]] ] ] ] call CBA_fnc_localEvent;
|
||||
{_this call EFUNC(common,log);},
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
format ["Average Server Execution: %1 times per frame", _serverCPS],
|
||||
[
|
||||
["serverRawCPS", _rawCPS],
|
||||
["serverCPS", _serverCPS]
|
||||
]
|
||||
]
|
||||
] call CBA_fnc_directCall;
|
||||
|
||||
[QGVARMAIN(serverEfficiency), [
|
||||
[
|
||||
["float", QGVAR(server_raw_cps), missionNamespace getVariable [QGVAR(server_raw_cps), -1]],
|
||||
["float", QGVAR(server_cps), missionNamespace getVariable [QGVAR(server_cps), -1]]
|
||||
]
|
||||
]] call CBA_fnc_localEvent;
|
||||
};
|
||||
|
||||
nil;
|
||||
@@ -34,10 +34,26 @@
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
QGVAR(setting_maxWait), // variable
|
||||
"TIME", // type
|
||||
["Max Wait Before Global Notify", "How long should at least one person be waiting before prompting a global notification."], // title
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||
[60*5, 60*30, 60*20], // [_min, _max, _default]
|
||||
true,
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
QGVAR(setting_maxWait),
|
||||
_value
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
QGVAR(setting_pilotForcedCheckEnabled), // variable
|
||||
"CHECKBOX", // type
|
||||
["Enabled", "Whether or not pilots are forced to view the contents of the reinsertion queue per interval"], // title
|
||||
["Force Queue Checks for Pilots", "Whether or not pilots are forced to view the contents of the reinsertion queue per interval"], // title
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||
false, // default value
|
||||
true, // global setting
|
||||
@@ -65,19 +81,3 @@
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
QGVAR(setting_maxWait), // variable
|
||||
"TIME", // type
|
||||
["Max Wait Threshold", "How long should at least one person be waiting before prompting a global notification."], // title
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||
[60*5, 60*30, 60*20], // [_min, _max, _default]
|
||||
true,
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
QGVAR(setting_maxWait),
|
||||
_value
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
@@ -43,7 +43,7 @@ if (count _timeoutPlayers > 0) then {
|
||||
_playerLines pushBack ([format [
|
||||
"%1: %2 [%3]",
|
||||
groupID (group (_player)),
|
||||
name (_player),
|
||||
name _player,
|
||||
[diag_tickTime - (_timeFiled), "MM:SS"] call BIS_fnc_secondsToString
|
||||
], 0.8, [0.8, 0.8, 0.8, 1]]);
|
||||
|
||||
|
||||
@@ -4,21 +4,23 @@ params [["_player", objNull, [objNull]]];
|
||||
|
||||
if (!isServer) exitWith {
|
||||
[
|
||||
"respawn_reinsertion",
|
||||
LEVEL_ERROR,
|
||||
QUOTE(COMPONENT),
|
||||
"ATTEMPTED RUN ON CLIENT",
|
||||
[
|
||||
["player", _player]
|
||||
]
|
||||
] call milsim_util_fnc_log;
|
||||
] call EFUNC(common,log);
|
||||
};
|
||||
if (isNull _player) exitWith {
|
||||
[
|
||||
"respawn_reinsertion",
|
||||
LEVEL_ERROR,
|
||||
QUOTE(COMPONENT),
|
||||
"NULL PARAMETERS",
|
||||
[
|
||||
["player", _player]
|
||||
]
|
||||
] call milsim_util_fnc_log;
|
||||
] call EFUNC(common,log);
|
||||
};
|
||||
|
||||
// get entries for this player from queue
|
||||
@@ -43,17 +45,16 @@ publicVariable QGVAR(reinsertionQueue);
|
||||
// get the closest base to the player
|
||||
private _nearestBase = [_player] call EFUNC(common,getNearestBase);
|
||||
// log to rpt
|
||||
private _logParams = [
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"PLAYER RESCINDED REQUEST",
|
||||
[_player, [
|
||||
["filedAtBase", [_base] call EFUNC(common,getNameOfBase)],
|
||||
["filedAtBaseDistance", _player distance _base],
|
||||
["closestBase", [_nearestBase] call EFUNC(common,getNameOfBase)],
|
||||
["closestBaseDistance", _player distance _nearestBase],
|
||||
["maxDistanceSetting", _maxRangeToReady],
|
||||
["inQueueDuration", diag_tickTime - _timeFiled]
|
||||
];
|
||||
_logParams = [_player, _logParams] call EFUNC(common,addPlayerInfoToArray);
|
||||
[
|
||||
"respawn_reinsertion",
|
||||
"PLAYER RESCINDED REQUEST",
|
||||
_logParams
|
||||
] call milsim_util_fnc_log;
|
||||
]] call EFUNC(common,addPlayerInfoToArray)
|
||||
] call EFUNC(common,log);
|
||||
@@ -7,6 +7,8 @@
|
||||
Author: IndigoFox
|
||||
*/
|
||||
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
if (not isRemoteExecuted) exitWith {
|
||||
diag_log text format ["[milsim] (respawn_reinsertion) SHOW QUEUE NOT REMOTE EXECUTED"];
|
||||
};
|
||||
@@ -25,12 +27,12 @@ if (isNull _userObject) exitWith {
|
||||
};
|
||||
|
||||
// log to rpt
|
||||
private _logParams = [_userObject, []] call EFUNC(common,addPlayerInfoToArray);
|
||||
[
|
||||
"respawn_reinsertion",
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"SHOW QUEUE REQUESTED",
|
||||
_logParams
|
||||
] call milsim_util_fnc_log;
|
||||
[_userObject] call EFUNC(common,addPlayerInfoToArray)
|
||||
] call EFUNC(common,log);
|
||||
|
||||
private _queue = missionNamespace getVariable [QGVAR(reinsertionQueue), []];
|
||||
// get base objects from queue
|
||||
|
||||
@@ -15,8 +15,6 @@ private _maxRangeToReady = missionNamespace getVariable [QGVAR(setting_maxRangeT
|
||||
if (not _isCloseEnoughToAnyBase || not (alive _player)) then {
|
||||
// don't include player in updated queue
|
||||
// log to rpt
|
||||
private _logParams = ;
|
||||
_logParams = ;
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
@@ -38,20 +36,19 @@ private _maxRangeToReady = missionNamespace getVariable [QGVAR(setting_maxRangeT
|
||||
_stillValid pushBackUnique [_player, _nearestBase, _timeFiled];
|
||||
// if player's base has changed, log to rpt
|
||||
if (_base != _nearestBase) then {
|
||||
private _logParams = [
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"PLAYER BASE WAS UPDATED",
|
||||
[_player, [
|
||||
["filedAtBase", [_base] call EFUNC(common,getNameOfBase)],
|
||||
["filedAtBaseDistance", _player distance _base],
|
||||
["closestBase", [_nearestBase] call EFUNC(common,getNameOfBase)],
|
||||
["closestBaseDistance", _player distance _nearestBase],
|
||||
["maxDistanceSetting", _maxRangeToReady],
|
||||
["inQueueDuration", diag_tickTime - _timeFiled]
|
||||
];
|
||||
_logParams = [_player, _logParams] call EFUNC(common,addPlayerInfoToArray);
|
||||
[
|
||||
"respawn_reinsertion",
|
||||
"PLAYER BASE WAS UPDATED",
|
||||
_logParams
|
||||
] call milsim_util_fnc_log;
|
||||
]] call EFUNC(common,addPlayerInfoToArray)
|
||||
] call EFUNC(common,log);
|
||||
};
|
||||
} forEach GVAR(reinsertionQueue);
|
||||
|
||||
|
||||
@@ -16,11 +16,29 @@ private _supplyCrateTypesCfgs = _supplyCratesCfg call BIS_fnc_returnChildren;
|
||||
{
|
||||
// add scroll wheel action to spawn different supply box types
|
||||
private _arsenalBox = _x;
|
||||
|
||||
// always remove old actions if they exist
|
||||
private _actionIDs = _arsenalBox getVariable [QGVAR(supplyCrateActionIDs), []];
|
||||
{
|
||||
_arsenalBox removeAction _x;
|
||||
} forEach _actionIDs;
|
||||
_arsenalBox setVariable [QGVAR(supplyCrateActionIDs), []];
|
||||
|
||||
|
||||
// if setting disabled, skip adding actions
|
||||
if (not (
|
||||
[QGVAR(setting_allowSupplyBoxScrollWheelSpawning)] call CBA_settings_fnc_get
|
||||
)) then {continue};
|
||||
|
||||
|
||||
{ // add an action for each supply crate type
|
||||
private _cfg = _x;
|
||||
private _supplyCrateDisplayName = (_cfg >> "displayName") call BIS_fnc_getCfgData;
|
||||
|
||||
_arsenalBox addAction [format ["<t color='#ffffff'>Spawn %1</t>", _supplyCrateDisplayName], {
|
||||
|
||||
|
||||
|
||||
private _actionID = _arsenalBox addAction [format ["<t color='#ffffff'>Spawn %1</t>", _supplyCrateDisplayName], {
|
||||
params ["_target", "_caller", "_actionId", "_arguments"];
|
||||
_arguments params ["_supplyCrateCfg"];
|
||||
[
|
||||
@@ -29,5 +47,6 @@ private _supplyCrateTypesCfgs = _supplyCratesCfg call BIS_fnc_returnChildren;
|
||||
getPos _target
|
||||
] call FUNC(createBox);
|
||||
}, [_cfg], 0, false, true, "", ""];
|
||||
(_arsenalBox getVariable [QGVAR(supplyCrateActionIDs), []]) pushBack _actionID;
|
||||
} forEach _supplyCrateTypesCfgs;
|
||||
} forEach _arsenalBoxes;
|
||||
@@ -13,6 +13,10 @@
|
||||
QGVAR(setting_allowSupplyBoxScrollWheelSpawning),
|
||||
_value
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
|
||||
if (_value && hasInterface && time > 0) then {
|
||||
[] call FUNC(addArsenalObjectSpawnBoxActions);
|
||||
};
|
||||
},
|
||||
true // requires mission restart
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
#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;
|
||||
13
framework/resupply/functions/fn_initClient.sqf
Normal file
13
framework/resupply/functions/fn_initClient.sqf
Normal file
@@ -0,0 +1,13 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
call FUNC(addArsenalObjectSpawnBoxActions);
|
||||
|
||||
[
|
||||
LEVEL_DEBUG,
|
||||
QUOTE(COMPONENT),
|
||||
"postInit complete",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
localNamespace setVariable [QGVAR(complete), true];
|
||||
@@ -7,8 +7,8 @@
|
||||
#define VERSION_AR MAJOR,MINOR,PATCHLVL
|
||||
|
||||
// #define DEBUG_MODE -1 // TRACE
|
||||
#define DEBUG_MODE 0 // DEBUG
|
||||
// #define DEBUG_MODE 1 // INFO
|
||||
// #define DEBUG_MODE 0 // DEBUG
|
||||
#define DEBUG_MODE 1 // INFO
|
||||
// #define DEBUG_MODE 2 // WARNING
|
||||
// #define DEBUG_MODE 3 // ERROR
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
#define COMPONENT server
|
||||
#define COMPONENT_BEAUTIFIED Server
|
||||
#include "../script_mod.hpp"
|
||||
138
framework/triageIcons/functions/fn_addCBASettings.sqf
Normal file
138
framework/triageIcons/functions/fn_addCBASettings.sqf
Normal file
@@ -0,0 +1,138 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
//---------------------
|
||||
// Medical Overlay
|
||||
//---------------------
|
||||
|
||||
[
|
||||
QGVAR(setting_enabled), // variable
|
||||
"CHECKBOX", // type
|
||||
["Enable 3D Triage Card State", "Draws a colored dot over units within Xm indicating current ACE Triage State"], // title
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||
true, // default value
|
||||
false, // isGlobal
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
QGVAR(setting_enabled),
|
||||
_value
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
|
||||
call FUNC(addGetEntitiesPFH);
|
||||
call FUNC(addDrawIconsPFH);
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
QGVAR(setting_drawRange), // variable
|
||||
"LIST", // type
|
||||
["Range To Draw Icons", "Determines range at which dots are visible"], // title
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||
[[2, 4, 6, 8, 10], ["2", "4", "6", "8", "10"], 4], // option values, option labels, default index
|
||||
false, // isGlobal
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
QGVAR(setting_drawRange),
|
||||
_value
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
QGVAR(setting_colorMinimal), // variable
|
||||
"COLOR", // type
|
||||
["Minimal State Color", "Color of the dot for MINIMAL state"], // title
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||
[0, 0.5, 0], // default value
|
||||
false, // isGlobal
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
QGVAR(setting_colorMinimal),
|
||||
str _value
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
|
||||
call FUNC(updateColors);
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
QGVAR(setting_colorDelayed), // variable
|
||||
"COLOR", // type
|
||||
["Delayed State Color", "Color of the dot for DELAYED state"], // title
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||
[1, 0.84, 0], // default value
|
||||
false, // isGlobal
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
QGVAR(setting_colorDelayed),
|
||||
str _value
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
|
||||
call FUNC(updateColors);
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
QGVAR(setting_colorImmediate), // variable
|
||||
"COLOR", // type
|
||||
["Immediate State Color", "Color of the dot for IMMEDIATE state"], // title
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||
[1, 0, 0], // default value
|
||||
false, // isGlobal
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
QGVAR(setting_colorImmediate),
|
||||
str _value
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
|
||||
call FUNC(updateColors);
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
QGVAR(setting_colorDeceased), // variable
|
||||
"COLOR", // type
|
||||
["Deceased State Color", "Color of the dot for DECEASED state"], // title
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||
[0.15, 0.15, 0.15], // default value
|
||||
false, // isGlobal
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
QGVAR(setting_colorDeceased),
|
||||
str _value
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
|
||||
call FUNC(updateColors);
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
QGVAR(setting_colorNone), // variable
|
||||
"COLOR", // type
|
||||
["None State Color", "Color of the dot for NONE state, when a card is not set"], // title
|
||||
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
|
||||
[0.5, 0.5, 0.5], // default value
|
||||
false, // isGlobal
|
||||
{
|
||||
params ["_value"];
|
||||
[
|
||||
QGVAR(setting_colorNone),
|
||||
str _value
|
||||
] call EFUNC(common,logSettingChanged);
|
||||
|
||||
call FUNC(updateColors);
|
||||
}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
|
||||
[
|
||||
LEVEL_INFO,
|
||||
QUOTE(COMPONENT),
|
||||
"CREATED SETTINGS",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
62
framework/triageIcons/functions/fn_addDrawIconsPFH.sqf
Normal file
62
framework/triageIcons/functions/fn_addDrawIconsPFH.sqf
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
|
||||
milsim_fnc_addMedicalOverlayPFH
|
||||
|
||||
Author: IndigoFox
|
||||
|
||||
Description:
|
||||
Affects players with medical permissions. Will see a 3D colored dot over nearby (5-10m)
|
||||
unconscious players who are not in a vehicle
|
||||
which indicates their current ACE Triage Card status.
|
||||
Designed to increase efficiency of CCPs.
|
||||
|
||||
*/
|
||||
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
|
||||
// Per-frame handler to draw icons
|
||||
// cleanup
|
||||
if (!isNil QGVAR(drawIconsPfh)) then {
|
||||
[GVAR(drawIconsPfh)] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
// add pfh
|
||||
GVAR(drawIconsPfh) = [{
|
||||
// if disabled, skip processing
|
||||
if (!GVAR(setting_enabled)) exitWith {false};
|
||||
// if no targets, skip processing
|
||||
if (count GVAR(drawTargets) == 0) exitWith {false};
|
||||
// if the player doesn't have medical perms, skip processing
|
||||
if !([player] call ace_medical_treatment_fnc_isMedic) exitWith {false};
|
||||
{
|
||||
private _unit = _x;
|
||||
// distance within X meters
|
||||
if (player distance _unit > GVAR(setting_drawRange)) then {continue};
|
||||
// check unit not null, not conscious, and not in a vehicle
|
||||
if (
|
||||
!(_unit getVariable ["ACE_isUnconscious", false]) ||
|
||||
!isNull (objectParent _unit)
|
||||
) then {continue};
|
||||
|
||||
// color based on triage level
|
||||
private _triageLevel = _unit getVariable ["ace_medical_triageLevel", 4];
|
||||
if (_triageLevel == -1) then {continue};
|
||||
private _color = GVAR(colors) select (_triageLevel - 1);
|
||||
_color set [3, 0.9]; // set alpha
|
||||
// draw position, slightly above the prone unit
|
||||
private _drawPos = (visiblePosition _unit) vectorAdd [0, 0, 0.5];
|
||||
// draw icon
|
||||
drawIcon3D [
|
||||
"\A3\ui_f\data\map\markers\military\dot_CA.paa", // icon texture
|
||||
_color, // color
|
||||
_drawPos, // position AGL
|
||||
1, // width
|
||||
1, // height
|
||||
0, // angle
|
||||
"", // text
|
||||
true // outline
|
||||
// further params optional, omitted
|
||||
];
|
||||
} forEach GVAR(drawTargets);
|
||||
}, 0, []] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
18
framework/triageIcons/functions/fn_addGetEntitiesPFH.sqf
Normal file
18
framework/triageIcons/functions/fn_addGetEntitiesPFH.sqf
Normal file
@@ -0,0 +1,18 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
// subroutine to gather nearest 50 units every 5 seconds and store in GVAR(drawTargets)
|
||||
// cleanup
|
||||
if (!isNil QGVAR(getEntitiesPFH)) then {
|
||||
[GVAR(getEntitiesPFH)] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
// add pfh
|
||||
GVAR(getEntitiesPFH) = [{
|
||||
GVAR(drawTargets) = (
|
||||
(allUnits + allDeadMen) select {
|
||||
_x isKindOf "CAManBase" &&
|
||||
player distance _x < 50 &&
|
||||
!isNull _x &&
|
||||
player isNotEqualTo _x
|
||||
}
|
||||
);
|
||||
}, 10] call CBA_fnc_addPerFrameHandler;
|
||||
12
framework/triageIcons/functions/fn_initClient.sqf
Normal file
12
framework/triageIcons/functions/fn_initClient.sqf
Normal file
@@ -0,0 +1,12 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
// List of units to draw icons for
|
||||
GVAR(drawTargets) = [];
|
||||
|
||||
[
|
||||
LEVEL_DEBUG,
|
||||
QUOTE(COMPONENT),
|
||||
"postInit complete",
|
||||
[]
|
||||
] call EFUNC(common,log);
|
||||
localNamespace setVariable [QGVAR(complete), true];
|
||||
18
framework/triageIcons/functions/fn_updateColors.sqf
Normal file
18
framework/triageIcons/functions/fn_updateColors.sqf
Normal file
@@ -0,0 +1,18 @@
|
||||
#include "..\script_component.hpp"
|
||||
|
||||
// ACE Triage colors, for consistency across UIs and functions
|
||||
// GVAR(colors) = [
|
||||
// (([QGVAR(setting_colorMinimal)] call CBA_settings_fnc_get) + 0.9), // TRIAGE_COLOR_MINIMAL
|
||||
// (([QGVAR(setting_colorDelayed)] call CBA_settings_fnc_get) + 0.9), // TRIAGE_COLOR_DELAYED
|
||||
// (([QGVAR(setting_colorImmediate)] call CBA_settings_fnc_get) + 0.9), // TRIAGE_COLOR_IMMEDIATE
|
||||
// (([QGVAR(setting_colorDeceased)] call CBA_settings_fnc_get) + 0.9), // TRIAGE_COLOR_DECEASED
|
||||
// (([QGVAR(setting_colorNone)] call CBA_settings_fnc_get) + 0) // TRIAGE_COLOR_NONE
|
||||
// ];
|
||||
|
||||
GVAR(colors) = [
|
||||
([QGVAR(setting_colorMinimal)] call CBA_settings_fnc_get), // TRIAGE_COLOR_MINIMAL
|
||||
([QGVAR(setting_colorDelayed)] call CBA_settings_fnc_get), // TRIAGE_COLOR_DELAYED
|
||||
([QGVAR(setting_colorImmediate)] call CBA_settings_fnc_get), // TRIAGE_COLOR_IMMEDIATE
|
||||
([QGVAR(setting_colorDeceased)] call CBA_settings_fnc_get), // TRIAGE_COLOR_DECEASED
|
||||
([QGVAR(setting_colorNone)] call CBA_settings_fnc_get) // TRIAGE_COLOR_NONE
|
||||
];
|
||||
3
framework/triageIcons/script_component.hpp
Normal file
3
framework/triageIcons/script_component.hpp
Normal file
@@ -0,0 +1,3 @@
|
||||
#define COMPONENT triageIcons
|
||||
#define COMPONENT_BEAUTIFIED Triage Icons
|
||||
#include "../script_mod.hpp"
|
||||
Reference in New Issue
Block a user