87 lines
2.8 KiB
Plaintext
87 lines
2.8 KiB
Plaintext
/*
|
|
|
|
milsim_fnc_medicalTriageState3D
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
// Add setting
|
|
[
|
|
"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 Batallion", // category
|
|
true // default value
|
|
] call CBA_fnc_addSetting;
|
|
|
|
|
|
// Force setting if CBA doesn't work?
|
|
if (isNil "milsim_client_medState3D_enabled") then {
|
|
milsim_client_medState3D_enabled = true;
|
|
};
|
|
|
|
// List of units to draw icons for
|
|
milsim_client_medState3D_drawTargets = [];
|
|
// Range to draw icons for
|
|
milsim_client_medState3D_drawRange = 10;
|
|
|
|
// 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, 0, 0, 0.9], // TRIAGE_COLOR_DECEASED
|
|
[0.5, 0.5, 0.5, 0] // TRIAGE_COLOR_NONE
|
|
];
|
|
|
|
// Per-frame handler to draw icons
|
|
milsim_client_medState3D_pfh = [{
|
|
// if disabled, skip processing
|
|
if (!milsim_client_medState3D_enabled) exitWith {};
|
|
// if no targets, skip processing
|
|
if (count milsim_client_medState3D_drawTargets == 0) exitWith {};
|
|
if !([player] call ace_medical_treatment_fnc_isMedic) exitWith {};
|
|
{
|
|
// 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 _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;
|
|
|
|
["Man", "InitPost", {
|
|
params ["_unit"];
|
|
milsim_client_medState3D_drawTargets pushBack _unit;
|
|
}, true, [], true] call CBA_fnc_addClassEventHandler; |