mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
8d2bba4b35
* Add a macro for the bloodloss scaling factor * Adjust bloodloss threshold for red icon * Remove bloodloss color scaling factor The issue is actually the other way round, the factor of 20 would instantly make bodyparts red on taking a wound. * Implemet 10 color steps provided by ShackTac This replaces the old method of colouring the interaction menu icons and body image selections with a new method that has 10 distinct color steps (matching across the icons and the body image). * Use macros for constants * Implement blue damage colouring This re-adds visualisation for colouring based on damage. The case where a limb has a tourniquet will hopefully be handled by an overlayed icon. * Tidy up file structure * Move patient information display to medical_ui * Make common colour conversion code into functions * Add tourniquet icon overlay to body image * Fix mispelling I forgot to commit * Update icon paths to new white cross icon * Clean mess after rebase * Add new medical menu gui * Add updating injury list and body image * Add updating treatment category buttons * Update onMenuClose function * Delete unused functions * Add action buttons and triage card to menu * Move medical menu PFH to separate function * Move setTriageStatus to treatment * Add triage select dropdown * Add toggle button action * Fix mouse moving randomly when opening * Add logs list update and remove unused functions * Hide tourniquet icons by default * Remove CfgInGameUI (already in feedback) * Update patient info display * Update triage card display * Add settings to control interact menu actions * Cleanup files/paths * Move triage status update to common function * Add icons for interact menu actions * Modify icon color for interact menu actions * Update canOpenMenu for new setting * Hide pain information for unconscious * Stringtable cleanup * Use switch for pain text * Change minor triage status to minimal * Fix injury list to use new stringtable entry names * Fix medical actions check when disabled * Skip distance check in same vehicle * More cleanup * Fix CI error * Requested changes * Fix INJURIES string * Fix include after comment block * Fix missing ; Co-Authored-By: mharis001 <34453221+mharis001@users.noreply.github.com>
149 lines
4.6 KiB
Plaintext
149 lines
4.6 KiB
Plaintext
#include "script_component.hpp"
|
|
/*
|
|
* Author: mharis001
|
|
* Updates injury list for given body part for the target.
|
|
*
|
|
* Arguments:
|
|
* 0: Injury list <CONTROL>
|
|
* 1: Target <OBJECT>
|
|
* 2: Body part <NUMBER>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [_ctrlInjuries, _target, 0] call ace_medical_gui_fnc_updateInjuryList
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
params ["_ctrl", "_target", "_selectionN"];
|
|
|
|
private _entries = [];
|
|
|
|
// Add selected body part name
|
|
private _bodyPartName = [
|
|
LSTRING(Head),
|
|
LSTRING(Torso),
|
|
LSTRING(LeftArm),
|
|
LSTRING(RightArm),
|
|
LSTRING(LeftLeg),
|
|
LSTRING(RightLeg)
|
|
] select _selectionN;
|
|
|
|
_entries pushBack [localize _bodyPartName, [1, 1, 1, 1]];
|
|
|
|
// Indicate if unit is bleeding at all
|
|
if (IS_BLEEDING(_target)) then {
|
|
_entries pushBack [localize LSTRING(Status_Bleeding), [1, 0, 0, 1]];
|
|
};
|
|
|
|
// Give a qualitative description of the blood volume lost
|
|
switch (GET_HEMORRHAGE(_target)) do {
|
|
case 1: {
|
|
_entries pushBack [localize LSTRING(Lost_Blood1), [1, 0, 0, 1]];
|
|
};
|
|
case 2: {
|
|
_entries pushBack [localize LSTRING(Lost_Blood2), [1, 0, 0, 1]];
|
|
};
|
|
case 3: {
|
|
_entries pushBack [localize LSTRING(Lost_Blood3), [1, 0, 0, 1]];
|
|
};
|
|
case 4: {
|
|
_entries pushBack [localize LSTRING(Lost_Blood4), [1, 0, 0, 1]];
|
|
};
|
|
};
|
|
|
|
// Indicate if a tourniquet is applied
|
|
if (HAS_TOURNIQUET_APPLIED_ON(_target,_selectionN)) then {
|
|
_entries pushBack [localize LSTRING(Status_Tourniquet_Applied), [0.77, 0.51, 0.08, 1]];
|
|
};
|
|
|
|
// Indicate the amount of pain the unit is in
|
|
if ([_target] call EFUNC(common,isAwake)) then {
|
|
private _pain = GET_PAIN_PERCEIVED(_target);
|
|
if (_pain > 0) then {
|
|
private _painText = switch (true) do {
|
|
case (_pain > 0.5): {
|
|
ELSTRING(medical_treatment,Status_SeverePain);
|
|
};
|
|
case (_pain > 0.1): {
|
|
ELSTRING(medical_treatment,Status_Pain);
|
|
};
|
|
default {
|
|
ELSTRING(medical_treatment,Status_MildPain);
|
|
};
|
|
};
|
|
_entries pushBack [localize _painText, [1, 1, 1, 1]];
|
|
};
|
|
};
|
|
|
|
// Show receiving IV volume remaining
|
|
private _totalIvVolume = 0;
|
|
{
|
|
_x params ["_volumeRemaining"];
|
|
_totalIvVolume = _totalIvVolume + _volumeRemaining;
|
|
} forEach (_target getVariable [QEGVAR(medical,ivBags), []]);
|
|
|
|
if (_totalIvVolume >= 1) then {
|
|
_entries pushBack [format [localize ELSTRING(medical_treatment,receivingIvVolume), floor _totalIvVolume], [1, 1, 1, 1]];
|
|
};
|
|
|
|
// Add entries for open, bandaged, and stitched wounds
|
|
private _woundEntries = [];
|
|
|
|
private _fnc_getWoundDescription = {
|
|
private _className = EGVAR(medical_damage,woundsData) select _woundClassID select 6;
|
|
private _suffix = ["Minor", "Medium", "Large"] select _category;
|
|
private _woundName = localize format [ELSTRING(medical_damage,%1_%2), _className, _suffix];
|
|
if (_amountOf >= 1) then {
|
|
format ["%1x %2", ceil _amountOf, _woundName];
|
|
} else {
|
|
format ["Partial %1", _woundName];
|
|
};
|
|
};
|
|
|
|
{
|
|
_x params ["", "_woundClassID", "_bodyPartN", "_amountOf", "", "", "_category"];
|
|
if (_selectionN == _bodyPartN) then {
|
|
if (_amountOf > 0) then {
|
|
_woundEntries pushBack [call _fnc_getWoundDescription, [1, 1, 1, 1]];
|
|
} else {
|
|
if !(EGVAR(medical_treatment,advancedBandages) && {EGVAR(medical_treatment,woundReopening)}) then {
|
|
_woundEntries pushBack [format ["[B] %1", call _fnc_getWoundDescription], [0.7, 0.7, 0.7, 1]];
|
|
};
|
|
};
|
|
};
|
|
} forEach (_target getVariable [QEGVAR(medical,openWounds), []]);
|
|
|
|
{
|
|
_x params ["", "_woundClassID", "_bodyPartN", "_amountOf", "", "", "_category"];
|
|
if (_selectionN == _bodyPartN && {_amountOf > 0}) then {
|
|
_woundEntries pushBack [format ["[B] %1", call _fnc_getWoundDescription], [0.88, 0.7, 0.65, 1]];
|
|
};
|
|
} forEach (_target getVariable [QEGVAR(medical,bandagedWounds), []]);
|
|
|
|
{
|
|
_x params ["", "_woundClassID", "_bodyPartN", "_amountOf", "", "", "_category"];
|
|
if (_selectionN == _bodyPartN && {_amountOf > 0}) then {
|
|
_woundEntries pushBack [format ["[S] %1", call _fnc_getWoundDescription], [0.7, 0.7, 0.7, 1]];
|
|
};
|
|
} forEach (_target getVariable [QEGVAR(medical,stitchedWounds), []]);
|
|
|
|
// Handle no wound entries
|
|
if (_woundEntries isEqualTo []) then {
|
|
_entries pushBack [localize ELSTRING(medical_treatment,NoInjuriesBodypart), [1, 1, 1, 1]];
|
|
} else {
|
|
_entries append _woundEntries;
|
|
};
|
|
|
|
// Add all entries to injury list
|
|
lbClear _ctrl;
|
|
|
|
{
|
|
_x params ["_text", "_color"];
|
|
private _index = _ctrl lbAdd _text;
|
|
_ctrl lbSetColor [_index, _color];
|
|
_ctrl lbSetSelectColor [_index, _color];
|
|
} forEach _entries;
|