ready for dedi -- improvements to resupply, triageIcons too
This commit is contained in:
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
|
||||
];
|
||||
Reference in New Issue
Block a user