ready for dedi -- improvements to resupply, triageIcons too

This commit is contained in:
2024-02-06 17:36:01 -08:00
parent 0a64d9e170
commit 91b982e06e
44 changed files with 586 additions and 354 deletions

View File

@@ -1,6 +1,19 @@
#include "script_mod.hpp" #include "script_mod.hpp"
class CfgFunctions { 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 PREFIX {
class ambience { class ambience {
file = "framework\ambience"; file = "framework\ambience";
@@ -22,7 +35,6 @@ class CfgFunctions {
class DOUBLES(PREFIX,client) { class DOUBLES(PREFIX,client) {
class functions { class functions {
file = "framework\client\functions"; file = "framework\client\functions";
class addMedicalOverlayPFH { postInit = 1; };
class addZenModules { postInit = 1; }; class addZenModules { postInit = 1; };
class bindEmptyGroupGarbageCleanup { postInit = 1; }; class bindEmptyGroupGarbageCleanup { postInit = 1; };
class bindEventHandlers { postInit = 1; }; class bindEventHandlers { postInit = 1; };
@@ -35,14 +47,14 @@ class CfgFunctions {
class functions { class functions {
file = "framework\common\functions"; file = "framework\common\functions";
class addCBASettings { preInit = 1; }; class addCBASettings { preInit = 1; };
class logMissionInfo { postInit = 1; }; class logMissionInfo {};
class addPlayerInfoToArray {}; class addPlayerInfoToArray {};
class getApprovedAssetsCfg {}; class getApprovedAssetsCfg {};
class getBattalionCfg {}; class getBattalionCfg {};
class getNameOfBase {}; class getNameOfBase {};
class getNearestBase {}; class getNearestBase {};
class log {}; class log {};
class logPlayerInventory {}; class checkPlayerInventory {};
class logSettingChanged {}; class logSettingChanged {};
class padString {}; class padString {};
class recurseSubclasses {}; class recurseSubclasses {};
@@ -53,30 +65,30 @@ class CfgFunctions {
class functions { class functions {
file = "framework\fbcb2_assets\functions"; file = "framework\fbcb2_assets\functions";
class addCBASettings {preInit=1;}; class addCBASettings {preInit=1;};
class initClient {postInit=1;}; class initServer {};
class initServer {postInit=1;}; class initClient {};
class getAssetsByBase {}; class getCallsignFromClassname {};
class getCurrentAssetsByBase {};
class getInventory {}; class getInventory {};
class getMagsForWeapon {}; class getMagsForWeapon {};
class getStartingAndCurrentAssets {};
class getStartingAssetsByBase {}; class getStartingAssetsByBase {};
class getVehicleData {}; class getVehicleData {};
class getWeaponry {}; class getWeaponry {};
class hintAllApprovedAssets {}; class hintAllApprovedAssets {};
class isAssetInRangeOfBase {};
class removeAssetDiaryRecords {}; class removeAssetDiaryRecords {};
class removeMarkersOnMap {}; class removeMarkersOnMap {};
class showMarkersOnMap {}; class showMarkersOnMap {};
class updateAssetDiary {}; class updateAssetDiary {};
class updateAssetsByBase {}; class updateAssetsByBase {};
class getCallsignFromClassname {};
class getStartingAndCurrentAssets {};
class isAssetInRangeOfBase {};
}; };
}; };
class DOUBLES(PREFIX,fbcb2_main) { class DOUBLES(PREFIX,fbcb2_main) {
class functions { class functions {
file = "framework\fbcb2_main\functions"; file = "framework\fbcb2_main\functions";
class init { postInit = 1; }; class initClient {};
class addEnvironmentRecord {}; class addEnvironmentRecord {};
class addFrequenciesRecord {}; class addFrequenciesRecord {};
class addSignalColorsRecord {}; 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 DOUBLES(PREFIX,performance) {
class functions { class functions {
file = "framework\performance\functions"; file = "framework\performance\functions";
class addCBASettings {preInit=1;}; class addCBASettings {preInit=1;};
class init {postInit=1;};
class addDNI_PlayerFPS { postInit = 1; }; class addDNI_PlayerFPS { postInit = 1; };
// PFHs managed in addCBASettings onChange code
class addClientStatsPFH {}; class addClientStatsPFH {};
class calculateClientStats {}; class calculateClientStats {};
class addServerStatsPFH {}; class addServerStatsPFH {};
@@ -118,7 +122,7 @@ class CfgFunctions {
}; };
class server { class server {
file = "framework\reinsert\server"; file = "framework\reinsert\server";
class initServer { postInit = 1; }; class initServer {};
class addToQueue {}; class addToQueue {};
class globalShowQueue {}; class globalShowQueue {};
class removeFromQueue {}; class removeFromQueue {};
@@ -127,7 +131,7 @@ class CfgFunctions {
}; };
class client { class client {
file = "framework\reinsert\client"; file = "framework\reinsert\client";
class initClient { postInit = 1; }; class initClient {};
class addAceSelfActions {}; class addAceSelfActions {};
class addCheckQueueSelfAction {}; class addCheckQueueSelfAction {};
class requestShowQueue {}; class requestShowQueue {};
@@ -138,17 +142,28 @@ class CfgFunctions {
class functions { class functions {
file = "framework\resupply\functions"; file = "framework\resupply\functions";
class addCBASettings {preInit=1;}; class addCBASettings {preInit=1;};
class init {postInit=1;}; class initClient {};
class createBox {}; class createBox {};
class getSupplyCratesCfg {}; class getSupplyCratesCfg {};
class addArsenalObjectSpawnBoxActions {}; 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 DOUBLES(PREFIX,vehicleFlags) {
class functions { class functions {
file = "framework\vehicleFlags\functions"; file = "framework\vehicleFlags\functions";
class init {postInit=1;}; class initClient {};
class getActionsFlagCategories {}; class getActionsFlagCategories {};
class getVehicleFlagsCfg {}; class getVehicleFlagsCfg {};
class isClassExcluded {}; class isClassExcluded {};

View File

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

View File

@@ -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 = [ _emptyGroupPFH = [
{ {
@@ -12,8 +19,21 @@ _emptyGroupPFH = [
}, },
300, 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 }, { true },
{ false }, { false },
[] []

View File

@@ -8,7 +8,7 @@ player addEventHandler["Respawn",
private _killer = _corpse getVariable ["ace_medical_causeOfDeath", "#scripted"]; private _killer = _corpse getVariable ["ace_medical_causeOfDeath", "#scripted"];
if (_killer == "respawn_button") then { if (_killer == "respawn_button") then {
[ [
LEVEL_INFO LEVEL_INFO,
QUOTE(COMPONENT), QUOTE(COMPONENT),
"RESPAWNED WHILE UNCONSCIOUS", "RESPAWNED WHILE UNCONSCIOUS",
[_unit] call EFUNC(common,addPlayerInfoToArray) [_unit] call EFUNC(common,addPlayerInfoToArray)
@@ -46,11 +46,11 @@ addMissionEventHandler ["HandleChatMessage",
["ace_arsenal_displayClosed", { ["ace_arsenal_displayClosed", {
[player] remoteExec [QEFUNC(common,logPlayerInventory), 2]; [player] remoteExec [QEFUNC(common,checkPlayerInventory), 2];
}] call CBA_fnc_addEventHandler; }] call CBA_fnc_addEventHandler;
[missionNamespace, "arsenalClosed", { [missionNamespace, "arsenalClosed", {
[player] remoteExec [QEFUNC(common,logPlayerInventory), 2]; [player] remoteExec [QEFUNC(common,checkPlayerInventory), 2];
}] call BIS_fnc_addScriptedEventHandler; }] call BIS_fnc_addScriptedEventHandler;
diag_log text "[MILSIM] (client) event handlers bound"; diag_log text "[MILSIM] (client) event handlers bound";

View File

@@ -56,7 +56,7 @@ _patchTire =
"Patching" "Patching"
] call ace_common_fnc_progressBar ] call ace_common_fnc_progressBar
}, },
{ ( alive _target ) && ( [_player, "ToolKit"] call ace_common_fnc_hasItem ) && ( getDammage _target > 0.2 ) && ( _target getVariable["milsim_ace_repair_wheel_canPatch", true] ) } { ( alive _target ) && ( [_player, "ToolKit"] call ace_common_fnc_hasItem ) && ( damage _target > 0.2 ) && ( _target getVariable["milsim_ace_repair_wheel_canPatch", true] ) }
] call ace_interact_menu_fnc_createAction; ] call ace_interact_menu_fnc_createAction;
["ACE_Wheel", 0, ["ACE_MainActions"], _patchTire, true] call ace_interact_menu_fnc_addActionToClass; ["ACE_Wheel", 0, ["ACE_MainActions"], _patchTire, true] call ace_interact_menu_fnc_addActionToClass;

View File

@@ -22,29 +22,6 @@
[QGVARMAIN(sideChat), false] call CBA_settings_fnc_set; [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"; diag_log text "[MILSIM] (settings) Custom CBA settings initialized";
nil; nil;

View File

@@ -1,6 +1,6 @@
#include "..\script_component.hpp" #include "..\script_component.hpp"
params [["_playerObj", objNull], ["_arrayToModify", [], [[]]]]; params [["_playerObj", objNull, [nil, objNull]], ["_arrayToModify", [], [[]]]];
if (isNull _playerObj) exitWith {_arrayToModify}; if (isNull _playerObj) exitWith {_arrayToModify};
@@ -10,7 +10,7 @@ if (isNull _playerObj) exitWith {_arrayToModify};
["playerName", name _playerObj], ["playerName", name _playerObj],
["playerUID", getPlayerUID _playerObj], ["playerUID", getPlayerUID _playerObj],
["playerGroup", groupId (group _playerObj)], ["playerGroup", groupId (group _playerObj)],
["playerNetID", [_playerObj] call BIS_fnc_netId] ["playerNetID", _playerObj call BIS_fnc_netId]
]; ];
_arrayToModify; _arrayToModify;

View File

@@ -1,5 +1,5 @@
/* /*
Function: milsim_util_fnc_logPlayerInventory Function: milsim_common_fnc_checkPlayerInventory
Description: Description:
Checks a player's inventory for non-compliant items and logs results to all machines. Checks a player's inventory for non-compliant items and logs results to all machines.
@@ -21,7 +21,7 @@ params [
if (!isPlayer _player) exitWith { if (!isPlayer _player) exitWith {
[ [
LEVEL_ERROR LEVEL_ERROR,
QUOTE(COMPONENT), QUOTE(COMPONENT),
"PARAM PLAYER IS NOT A PLAYER", "PARAM PLAYER IS NOT A PLAYER",
[["player", _player]] [["player", _player]]

View File

@@ -1,5 +1,5 @@
/* /*
Function: milsim_util_fnc_log Function: milsim_common_fnc_log
Description: Description:
Used to log messages to the server RPT file. Used to log messages to the server RPT file.
@@ -19,13 +19,13 @@ params [
["_data", [], [[]]] ["_data", [], [[]]]
]; ];
if (_logLevel < LOG_LEVEL) exitWith {}; if (_logLevel < DEBUG_MODE) exitWith {};
private _hash = createHashMapFromArray _data; private _hash = createHashMapFromArray _data;
// Replace square brackets with round brackets to avoid parsing issues. // 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; private _json = [_hash] call CBA_fnc_encodeJSON;
_log = format ["[%1] [%2] [%3] [%4] :: %5", QUOTE(PREFIX), _component, _fnc_scriptNameParent, _message, _json]; _log = format ["[%1] [%2] [%3] [%4] :: %5", QUOTE(PREFIX), _component, _fnc_scriptNameParent, _message, _json];

View File

@@ -1,6 +1,7 @@
#include "..\script_component.hpp" #include "..\script_component.hpp"
[ [
LEVEL_INFO,
QUOTE(COMPONENT), QUOTE(COMPONENT),
"MISSION INFO", "MISSION INFO",
[ [

View File

@@ -8,7 +8,7 @@ private _startingAssets = [];
} forEach _startingAssetsByBase; } forEach _startingAssetsByBase;
// get all current assets at each base and combine to array // get all current assets at each base and combine to array
private _assetsByBase = call FUNC(getAssetsByBase); private _assetsByBase = call FUNC(getCurrentAssetsByBase);
private _assets = []; private _assets = [];
{ {
_assets append (_x#1); _assets append (_x#1);

View File

@@ -2,15 +2,27 @@
if (!hasInterface) exitWith {}; if (!hasInterface) exitWith {};
call FUNC(updateAssetDiary);
// once the server has published that assets have been gathered and distributed to bases (respawn modules), // 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 // we can update the asset diary on our end using that data
[{missionNamespace getVariable [QGVAR(serverAssetsReady), false]}, { [QGVAR(assetsGathered), {
call FUNC(updateAssetDiary); [
}] call CBA_fnc_waitUntilAndExecute; 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, LEVEL_DEBUG,
QUOTE(COMPONENT), QUOTE(COMPONENT),
"postInit complete", "postInit complete",
[] []
] call EFUNC(common,log); ] call EFUNC(common,log);
localNamespace setVariable [QGVAR(complete), true];

View File

@@ -5,8 +5,6 @@ if (!isServer) exitWith {};
// init asset stores at bases // init asset stores at bases
[true] call FUNC(updateAssetsByBase); [true] call FUNC(updateAssetsByBase);
missionNamespace setVariable [QGVAR(serverAssetsReady), true, true];
// starting 5 minutes after postInit, update asset stores every 5 minutes // starting 5 minutes after postInit, update asset stores every 5 minutes
[{ [{
[ [

View File

@@ -7,6 +7,8 @@ params [
if (!isServer) exitWith {}; if (!isServer) exitWith {};
GVARMAIN(baseObjects) = allMissionObjects "ModuleRespawnPosition_F";
// Get all approved assets on map, find the closest base // Get all approved assets on map, find the closest base
// Then determine if it's within range // Then determine if it's within range
// If it is, add it to the base's assets list // If it is, add it to the base's assets list
@@ -14,12 +16,14 @@ if (!isServer) exitWith {};
private _allVehicles = vehicles; private _allVehicles = vehicles;
private _allSaved = []; private _allSaved = [];
private _assetsAtThisBaseVar = QGVAR(assetsAtThisBase);
private _assetsStartedAtThisBaseVar = QGVAR(assetsStartedAtThisBase); private _assetsStartedAtThisBaseVar = QGVAR(assetsStartedAtThisBase);
private _assetsAtThisBaseVar = QGVAR(assetsAtThisBase);
private _approvedAssetsCfg = call EFUNC(common,getApprovedAssetsCfg); private _approvedAssetsCfg = call EFUNC(common,getApprovedAssetsCfg);
if (isNull _approvedAssetsCfg) exitWith {}; if (isNull _approvedAssetsCfg) exitWith {};
private _currentBaseAssetsGathered = GVARMAIN(baseObjects) apply {[_x, []]};;
{ {
private _className = configName _x; private _className = configName _x;
private _callsign = getText(_x >> "callsign"); private _callsign = getText(_x >> "callsign");
@@ -27,68 +31,34 @@ if (isNull _approvedAssetsCfg) exitWith {};
{ {
private _asset = _x; private _asset = _x;
// avoid duplicates // ignore assets beyond the range of bases
if (_asset in _allSaved) then {continue};
if (not ([_asset] call FUNC(isAssetInRangeOfBase))) then {continue}; if (not ([_asset] call FUNC(isAssetInRangeOfBase))) then {continue};
// add to base's assets list // add to base's assets list
private _closestBase = [_asset] call EFUNC(common,getNearestBase); private _closestBase = [_asset] call EFUNC(common,getNearestBase);
private _baseAssets = _closestBase getVariable [_assetsAtThisBaseVar, []]; private _closestBaseCurrentAssets = (_currentBaseAssetsGathered select { _x select 0 isEqualTo _closestBase })#0#1;
_baseAssets pushBackUnique [ _closestBaseCurrentAssets pushBackUnique [
_asset call BIS_fnc_netId, _asset call BIS_fnc_netId,
configOf _asset 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 _found;
} forEach (_approvedAssetsCfg call BIS_fnc_returnChildren); } forEach (_approvedAssetsCfg call BIS_fnc_returnChildren);
// Add all ground vehicles (LandVehicle) // Add all ground vehicles (LandVehicle)
{ {
private _asset = _x; 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}; if (not ([_asset] call FUNC(isAssetInRangeOfBase))) then {continue};
// add to base's assets list // add to base's assets list
private _closestBase = [_asset] call EFUNC(common,getNearestBase); private _closestBase = [_asset] call EFUNC(common,getNearestBase);
private _baseAssets = _closestBase getVariable [_assetsAtThisBaseVar, []]; private _closestBaseCurrentAssets = (_currentBaseAssetsGathered select { _x select 0 isEqualTo _closestBase })#0#1;
_baseAssets pushBackUnique [ _closestBaseCurrentAssets pushBackUnique [
_asset call BIS_fnc_netId, _asset call BIS_fnc_netId,
configOf _asset 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" }); } forEach (_allVehicles select { _x isKindOf "LandVehicle" });
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
@@ -97,16 +67,17 @@ if (isNull _approvedAssetsCfg) exitWith {};
{ {
private _base = _x; private _base = _x;
// save current assets private _thisBaseCurrentAssets = (_currentBaseAssetsGathered select { _x select 0 isEqualTo _base })#0#1;
private _baseAssets = _base getVariable [_assetsAtThisBaseVar, []]; _base setVariable [_assetsAtThisBaseVar, _thisBaseCurrentAssets, true];
_base setVariable [_assetsAtThisBaseVar, _baseAssets, true];
// if init, save starting assets
if (_isInit) then { if (_isInit) then {
_base setVariable [_assetsStartedAtThisBaseVar, _baseAssets, true]; _base setVariable [_assetsStartedAtThisBaseVar, _thisBaseCurrentAssets, true];
}; };
} forEach GVARMAIN(baseObjects); } 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 starting assets if init
// log current assets if requested (for end of mission counts) // log current assets if requested (for end of mission counts)
@@ -117,7 +88,7 @@ if !(_isInit || _logCurrentAssets) exitWith {};
private _base = _x; private _base = _x;
// get current assets // get current assets
private _baseAssets = _base getVariable [_assetsAtThisBaseVar, []]; private _baseAssets = (_currentBaseAssetsGathered select { _x select 0 isEqualTo _base })#0#1;
// prepare key value for logging // prepare key value for logging
private _baseAssetsHashesPrep = _baseAssets apply { private _baseAssetsHashesPrep = _baseAssets apply {

View File

@@ -14,6 +14,7 @@ if (isNull _battalionInfoCfg) exitWith {
"Null Battalion Config", "Null Battalion Config",
[] []
] call EFUNC(common,log); ] call EFUNC(common,log);
["Null Battalion Config"] call BIS_fnc_error;
}; };
private _battalionElementCfgs = [_battalionInfoCfg >> "Command"] call BIS_fnc_returnChildren; private _battalionElementCfgs = [_battalionInfoCfg >> "Command"] call BIS_fnc_returnChildren;
@@ -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.", "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); ] 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; reverse _battalionElementCfgs;
{ {
diag_log text format[ [
"[%1] <%2> Processing battalion element %3", LEVEL_TRACE,
QUOTE(PREFIX), QUOTE(COMPONENT),
_fnc_scriptName, format["Processing battalion element %1", configName _x],
configName _x []
]; ] call EFUNC(common,log);
// recursively generate diary text for all child elements of battalion-level elements // recursively generate diary text for all child elements of battalion-level elements
private _diaryTitleText = [_x, true] call FUNC(generateElementFrequencyRecordText); private _diaryTitleText = [_x, true] call FUNC(generateElementFrequencyRecordText);
[ [

View File

@@ -2,8 +2,6 @@
if ( !hasInterface ) exitWith {}; if ( !hasInterface ) exitWith {};
waitUntil { !isNil QGVARMAIN(complete) };
GVAR(recordTitleColor) = "#ff6666"; GVAR(recordTitleColor) = "#ff6666";
GVAR(recordTitleFont) = "PuristaMedium"; GVAR(recordTitleFont) = "PuristaMedium";
GVAR(recordTitleSize) = 20; GVAR(recordTitleSize) = 20;
@@ -33,7 +31,7 @@ player createDiarySubject[GVAR(subjectAssetsGroundID), "FBCB2 Ground"];
// ]] // ]]
GVAR(diaryRecords) = createHashMap; GVAR(diaryRecords) = createHashMap;
// run main inits - assets handled in that component // run main inits
[] call FUNC(addFrequenciesRecord); [] call FUNC(addFrequenciesRecord);
[] call FUNC(addSignalColorsRecord); [] call FUNC(addSignalColorsRecord);
[] call FUNC(addEnvironmentRecord); [] call FUNC(addEnvironmentRecord);
@@ -51,4 +49,6 @@ GVAR(diaryRecords) = createHashMap;
QUOTE(COMPONENT), QUOTE(COMPONENT),
"postInit complete", "postInit complete",
[] []
] call EFUNC(common,log); ] call EFUNC(common,log);
localNamespace setVariable [QGVAR(complete), true];

View File

@@ -15,9 +15,16 @@ private _existingRecord = _subjectRecords getOrDefault [_recordTitle, diaryRecor
if (!isNull _existingRecord) then { if (!isNull _existingRecord) then {
player setDiaryRecordText [[_subjectID, _existingRecord], [_recordTitle, _recordText, _recordIcon]]; 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 { } else {
private _new = player createDiaryRecord [ private _new = player createDiaryRecord [
_subjectID, _subjectID,
@@ -29,4 +36,14 @@ if (!isNull _existingRecord) then {
]; ];
_subjectRecords set [_recordTitle, _new]; _subjectRecords set [_recordTitle, _new];
GVAR(diaryRecords) set [_subjectID, _subjectRecords]; GVAR(diaryRecords) set [_subjectID, _subjectRecords];
[
LEVEL_DEBUG,
QUOTE(COMPONENT),
format ["Created diary record: %1", _recordTitle],
[
["subjectID", _subjectID],
["recordTitle", _recordTitle]
]
] call EFUNC(common,log);
}; };

View File

@@ -71,7 +71,8 @@ if (_shouldProcessChildCfgs) then {
[ [
LEVEL_TRACE, LEVEL_TRACE,
QUOTE(COMPONENT), QUOTE(COMPONENT),
"Processing child elements for battalion element %1" "Processing child elements for battalion element %1",
[]
] call EFUNC(common,log); ] call EFUNC(common,log);
[_battalionElement, { [_battalionElement, {

View File

@@ -1,3 +1,5 @@
#include "..\script_component.hpp"
[ [
"saveaar", "saveaar",
{ {

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

View File

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

View File

@@ -2,23 +2,30 @@
if (!isServer) exitWith {}; if (!isServer) exitWith {};
// array of all respawn modules in the mission representing "bases" // array of all respawn modules in the mission representing "bases"
GVARMAIN(baseObjects) = allMissionObjects "ModuleRespawnPosition_F"; GVARMAIN(baseObjects) = allMissionObjects "ModuleRespawnPosition_F";
publicVariable "milsim_baseObjects"; publicVariable QGVARMAIN(baseObjects);
// Initializes the Dynamic Groups framework and groups // Initializes the Dynamic Groups framework and groups
["Initialize", [true]] call BIS_fnc_dynamicGroups; ["Initialize", [true]] call BIS_fnc_dynamicGroups;
["milsim_logText", { if (isDedicated) then {
params [["_strArray", [""], [[]]]]; ["milsim_logText", {
{ params [["_strArray", [""], [[]]]];
diag_log text _x; {
} forEach _strArray; diag_log text _x;
}] call CBA_fnc_addEventHandler; } forEach _strArray;
}] 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, LEVEL_INFO,

View File

@@ -8,7 +8,7 @@
QGVAR(server_cps_enable), QGVAR(server_cps_enable),
"CHECKBOX", "CHECKBOX",
"Server CPS Metrics Enabled", "Server CPS Metrics Enabled",
["17th Battalion", "Server Metrics"], [QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)],
true, true,
true, true,
{ {

View File

@@ -10,13 +10,8 @@
_counter = _counter + 1; _counter = _counter + 1;
}; };
// in an empty mission, the _counter may go well over 2000 times per frame! // in an empty mission, the _counter may go well over 2000 times per frame!
[ private _rawCPS = _counter / (diag_frameNo - _frameNo);
LEVEL_INFO, player setVariable [QGVAR(player_raw_cps), _rawCPS, true];
QUOTE(COMPONENT),
format ["Average Execution: %1 times per frame", _counter / (diag_frameNo - _frameNo)],
[["playerRawCPS", _counter / (diag_frameNo - _frameNo)]]
] call EFUNC(common,log);
player setVariable [QGVAR(player_raw_cps), _counter / (diag_frameNo - _frameNo), true];
// with suspension // with suspension
private _counter = 0; private _counter = 0;
@@ -28,13 +23,23 @@
uiSleep 0.001; // waits at least 1 frame uiSleep 0.001; // waits at least 1 frame
}; };
// _counter says one per frame, as expected // _counter says one per frame, as expected
private _playerCPS = _counter / (diag_frameNo - _frameNo);
player setVariable [QGVAR(player_cps), _playerCPS, true];
// log to RPT
[ [
LEVEL_INFO,
QUOTE(COMPONENT), {_this call EFUNC(common,log);},
format ["Average Execution: %1 times per frame", _counter / (diag_frameNo - _frameNo)], [
[["playerCPS", _counter / (diag_frameNo - _frameNo)]] LEVEL_INFO,
] call EFUNC(common,log); QUOTE(COMPONENT),
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; nil;

View File

@@ -1,3 +1,5 @@
#include "..\script_component.hpp"
[] spawn { [] spawn {
// warning: while loop without suspension executes multiple times per frame // warning: while loop without suspension executes multiple times per frame
private _counter = 0; private _counter = 0;
@@ -8,10 +10,9 @@
_counter = _counter + 1; _counter = _counter + 1;
}; };
diag_log text format ["[MILSIM] (server) Average Server Execution: %1 times per frame", _counter / (diag_frameNo - _frameNo)]; private _rawCPS = _counter / (diag_frameNo - _frameNo);
missionNamespace setVariable [QGVAR(server_raw_cps), _rawCPS];
missionNamespace setVariable ["milsim_raw_cps", _counter / (diag_frameNo - _frameNo)]; publicVariable QGVAR(server_raw_cps);
publicVariable "milsim_raw_cps";
// with suspension // with suspension
private _counter = 0; private _counter = 0;
@@ -23,12 +24,31 @@
uiSleep 0.001; // waits at least 1 frame 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)]; // log to RPT
publicVariable "milsim_cps"; [
{_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;
["milsim_serverEfficiency", [ [ ["float", "milsim_raw_cps", missionNamespace getVariable ["milsim_raw_cps", -1]], ["float", "milsim_cps", missionNamespace getVariable ["milsim_cps", -1]] ] ] ] call CBA_fnc_localEvent; [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; nil;

View File

@@ -34,10 +34,26 @@
} }
] call CBA_fnc_addSetting; ] 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 QGVAR(setting_pilotForcedCheckEnabled), // variable
"CHECKBOX", // type "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 [QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
false, // default value false, // default value
true, // global setting true, // global setting
@@ -65,19 +81,3 @@
] call EFUNC(common,logSettingChanged); ] call EFUNC(common,logSettingChanged);
} }
] call CBA_fnc_addSetting; ] call CBA_fnc_addSetting;
[
QGVAR(setting_maxWait), // variable
"TIME", // type
["Max Wait Threshold", "How long should at least one person be waiting before prompting a global notification."], // title
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
[60*5, 60*30, 60*20], // [_min, _max, _default]
true,
{
params ["_value"];
[
QGVAR(setting_maxWait),
_value
] call EFUNC(common,logSettingChanged);
}
] call CBA_fnc_addSetting;

View File

@@ -43,7 +43,7 @@ if (count _timeoutPlayers > 0) then {
_playerLines pushBack ([format [ _playerLines pushBack ([format [
"%1: %2 [%3]", "%1: %2 [%3]",
groupID (group (_player)), groupID (group (_player)),
name (_player), name _player,
[diag_tickTime - (_timeFiled), "MM:SS"] call BIS_fnc_secondsToString [diag_tickTime - (_timeFiled), "MM:SS"] call BIS_fnc_secondsToString
], 0.8, [0.8, 0.8, 0.8, 1]]); ], 0.8, [0.8, 0.8, 0.8, 1]]);

View File

@@ -4,21 +4,23 @@ params [["_player", objNull, [objNull]]];
if (!isServer) exitWith { if (!isServer) exitWith {
[ [
"respawn_reinsertion", LEVEL_ERROR,
QUOTE(COMPONENT),
"ATTEMPTED RUN ON CLIENT", "ATTEMPTED RUN ON CLIENT",
[ [
["player", _player] ["player", _player]
] ]
] call milsim_util_fnc_log; ] call EFUNC(common,log);
}; };
if (isNull _player) exitWith { if (isNull _player) exitWith {
[ [
"respawn_reinsertion", LEVEL_ERROR,
QUOTE(COMPONENT),
"NULL PARAMETERS", "NULL PARAMETERS",
[ [
["player", _player] ["player", _player]
] ]
] call milsim_util_fnc_log; ] call EFUNC(common,log);
}; };
// get entries for this player from queue // get entries for this player from queue
@@ -43,17 +45,16 @@ publicVariable QGVAR(reinsertionQueue);
// get the closest base to the player // get the closest base to the player
private _nearestBase = [_player] call EFUNC(common,getNearestBase); private _nearestBase = [_player] call EFUNC(common,getNearestBase);
// log to rpt // log to rpt
private _logParams = [
["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", LEVEL_INFO,
QUOTE(COMPONENT),
"PLAYER RESCINDED REQUEST", "PLAYER RESCINDED REQUEST",
_logParams [_player, [
] call milsim_util_fnc_log; ["filedAtBase", [_base] call EFUNC(common,getNameOfBase)],
["filedAtBaseDistance", _player distance _base],
["closestBase", [_nearestBase] call EFUNC(common,getNameOfBase)],
["closestBaseDistance", _player distance _nearestBase],
["maxDistanceSetting", _maxRangeToReady],
["inQueueDuration", diag_tickTime - _timeFiled]
]] call EFUNC(common,addPlayerInfoToArray)
] call EFUNC(common,log);

View File

@@ -7,6 +7,8 @@
Author: IndigoFox Author: IndigoFox
*/ */
#include "..\script_component.hpp"
if (not isRemoteExecuted) exitWith { if (not isRemoteExecuted) exitWith {
diag_log text format ["[milsim] (respawn_reinsertion) SHOW QUEUE NOT REMOTE EXECUTED"]; diag_log text format ["[milsim] (respawn_reinsertion) SHOW QUEUE NOT REMOTE EXECUTED"];
}; };
@@ -25,12 +27,12 @@ if (isNull _userObject) exitWith {
}; };
// log to rpt // log to rpt
private _logParams = [_userObject, []] call EFUNC(common,addPlayerInfoToArray);
[ [
"respawn_reinsertion", LEVEL_INFO,
QUOTE(COMPONENT),
"SHOW QUEUE REQUESTED", "SHOW QUEUE REQUESTED",
_logParams [_userObject] call EFUNC(common,addPlayerInfoToArray)
] call milsim_util_fnc_log; ] call EFUNC(common,log);
private _queue = missionNamespace getVariable [QGVAR(reinsertionQueue), []]; private _queue = missionNamespace getVariable [QGVAR(reinsertionQueue), []];
// get base objects from queue // get base objects from queue

View File

@@ -15,8 +15,6 @@ private _maxRangeToReady = missionNamespace getVariable [QGVAR(setting_maxRangeT
if (not _isCloseEnoughToAnyBase || not (alive _player)) then { if (not _isCloseEnoughToAnyBase || not (alive _player)) then {
// don't include player in updated queue // don't include player in updated queue
// log to rpt // log to rpt
private _logParams = ;
_logParams = ;
[ [
LEVEL_INFO, LEVEL_INFO,
QUOTE(COMPONENT), QUOTE(COMPONENT),
@@ -38,20 +36,19 @@ private _maxRangeToReady = missionNamespace getVariable [QGVAR(setting_maxRangeT
_stillValid pushBackUnique [_player, _nearestBase, _timeFiled]; _stillValid pushBackUnique [_player, _nearestBase, _timeFiled];
// if player's base has changed, log to rpt // if player's base has changed, log to rpt
if (_base != _nearestBase) then { if (_base != _nearestBase) then {
private _logParams = [
["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", LEVEL_INFO,
QUOTE(COMPONENT),
"PLAYER BASE WAS UPDATED", "PLAYER BASE WAS UPDATED",
_logParams [_player, [
] call milsim_util_fnc_log; ["filedAtBase", [_base] call EFUNC(common,getNameOfBase)],
["filedAtBaseDistance", _player distance _base],
["closestBase", [_nearestBase] call EFUNC(common,getNameOfBase)],
["closestBaseDistance", _player distance _nearestBase],
["maxDistanceSetting", _maxRangeToReady],
["inQueueDuration", diag_tickTime - _timeFiled]
]] call EFUNC(common,addPlayerInfoToArray)
] call EFUNC(common,log);
}; };
} forEach GVAR(reinsertionQueue); } forEach GVAR(reinsertionQueue);

View File

@@ -16,11 +16,29 @@ private _supplyCrateTypesCfgs = _supplyCratesCfg call BIS_fnc_returnChildren;
{ {
// add scroll wheel action to spawn different supply box types // add scroll wheel action to spawn different supply box types
private _arsenalBox = _x; 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 _cfg = _x;
private _supplyCrateDisplayName = (_cfg >> "displayName") call BIS_fnc_getCfgData; 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"]; params ["_target", "_caller", "_actionId", "_arguments"];
_arguments params ["_supplyCrateCfg"]; _arguments params ["_supplyCrateCfg"];
[ [
@@ -29,5 +47,6 @@ private _supplyCrateTypesCfgs = _supplyCratesCfg call BIS_fnc_returnChildren;
getPos _target getPos _target
] call FUNC(createBox); ] call FUNC(createBox);
}, [_cfg], 0, false, true, "", ""]; }, [_cfg], 0, false, true, "", ""];
(_arsenalBox getVariable [QGVAR(supplyCrateActionIDs), []]) pushBack _actionID;
} forEach _supplyCrateTypesCfgs; } forEach _supplyCrateTypesCfgs;
} forEach _arsenalBoxes; } forEach _arsenalBoxes;

View File

@@ -13,6 +13,10 @@
QGVAR(setting_allowSupplyBoxScrollWheelSpawning), QGVAR(setting_allowSupplyBoxScrollWheelSpawning),
_value _value
] call EFUNC(common,logSettingChanged); ] call EFUNC(common,logSettingChanged);
if (_value && hasInterface && time > 0) then {
[] call FUNC(addArsenalObjectSpawnBoxActions);
};
}, },
true // requires mission restart true // requires mission restart
] call CBA_fnc_addSetting; ] call CBA_fnc_addSetting;

View File

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

View 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];

View File

@@ -7,8 +7,8 @@
#define VERSION_AR MAJOR,MINOR,PATCHLVL #define VERSION_AR MAJOR,MINOR,PATCHLVL
// #define DEBUG_MODE -1 // TRACE // #define DEBUG_MODE -1 // TRACE
#define DEBUG_MODE 0 // DEBUG // #define DEBUG_MODE 0 // DEBUG
// #define DEBUG_MODE 1 // INFO #define DEBUG_MODE 1 // INFO
// #define DEBUG_MODE 2 // WARNING // #define DEBUG_MODE 2 // WARNING
// #define DEBUG_MODE 3 // ERROR // #define DEBUG_MODE 3 // ERROR

View File

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

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

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

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

View 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];

View 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
];

View File

@@ -0,0 +1,3 @@
#define COMPONENT triageIcons
#define COMPONENT_BEAUTIFIED Triage Icons
#include "../script_mod.hpp"