Medical Feedback - Add indication of Fractures and applied CATs/Splints (#8321)

Co-authored-by: mharis001 <34453221+mharis001@users.noreply.github.com>
Co-authored-by: jonpas <jonpas33@gmail.com>
This commit is contained in:
10Dozen 2021-10-12 15:16:30 +03:00 committed by GitHub
parent 341f4c3aef
commit 3d9315529d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 119 additions and 1 deletions

View File

@ -1,7 +1,12 @@
class RscPictureKeepAspect;
class RscInGameUI {
class RscStanceInfo {
controls[] += {QGVAR(bloodVolumeIndicator)};
controls[] += {
QGVAR(bloodVolumeIndicator),
QGVAR(stateIndicator1),
QGVAR(stateIndicator2),
QGVAR(stateIndicator3)
};
class GVAR(bloodVolumeIndicator): RscPictureKeepAspect {
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QQGVAR(bloodVolumeIndicator),_this select 0)]);
x = IGUI_GRID_STANCE_X;
@ -9,5 +14,21 @@ class RscInGameUI {
w = IGUI_GRID_STANCE_WAbs / 4;
h = IGUI_GRID_STANCE_HAbs / 4;
};
class GVAR(stateIndicator1): RscPictureKeepAspect {
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QQGVAR(stateIndicator1), _this select 0)]);
x = IGUI_GRID_STANCE_X + IGUI_GRID_STANCE_WAbs * 3 / 4;
y = IGUI_GRID_STANCE_Y;
w = IGUI_GRID_STANCE_WAbs / 4;
h = IGUI_GRID_STANCE_HAbs / 4;
};
class GVAR(stateIndicator2): GVAR(stateIndicator1) {
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QQGVAR(stateIndicator2), _this select 0)]);
y = IGUI_GRID_STANCE_Y + IGUI_GRID_STANCE_HAbs / 4;
};
class GVAR(stateIndicator3): GVAR(stateIndicator1) {
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QQGVAR(stateIndicator3), _this select 0)]);
y = IGUI_GRID_STANCE_Y + IGUI_GRID_STANCE_HAbs * 2 / 4;
};
};
};

View File

@ -5,6 +5,7 @@ PREP(effectHeartBeat);
PREP(effectIncapacitated);
PREP(effectPain);
PREP(effectUnconscious);
PREP(handleHUDIndicators);
PREP(handleEffects);
PREP(initEffects);
PREP(playInjuredSound);

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -58,4 +58,9 @@ if ((!GVAR(heartBeatEffectRunning)) && {_heartRate != 0} && {(_heartRate > 160)
[!_unconscious, _pain] call FUNC(effectPain);
[!_unconscious, _bleedingStrength, _manualUpdate] call FUNC(effectBleeding);
// - Tourniquets, fractures and splints indication ---------------------------------------
if (GVAR(enableHUDIndicators)) then {
[] call FUNC(handleHUDIndicators);
};
END_COUNTER(handleEffects);

View File

@ -0,0 +1,64 @@
#include "script_component.hpp"
/*
* Author: 10Dozen
* Handles indication of the fractures, applied tourniquets and splints over Stance indicator.
* Draws an icon if there is at least 1 fracture/splint/tourniquet applied.
*
* Arguments:
* 0: Flag to drop all indicators (optional) <BOOL>
*
* Return Value:
* None
*
* Example:
* [false] call ace_medical_feedback_fnc_handleHUDIndicators
*
* Public: No
*/
params [["_dropAllIndicators", false]];
private _indicatorSlots = [
uiNamespace getVariable [QGVAR(stateIndicator1), controlNull],
uiNamespace getVariable [QGVAR(stateIndicator2), controlNull],
uiNamespace getVariable [QGVAR(stateIndicator3), controlNull]
];
// --- Removes any indication and exit
if (_dropAllIndicators) exitWith {
{
_x ctrlSetText "";
} forEach _indicatorSlots;
};
// --- Tourniquets
private _hasTourniquets = GET_TOURNIQUETS(ACE_player) findIf {_x > 0} > -1;
private _tourniquetIcon = ["", ICON_TOURNIQUET_PATH] select _hasTourniquets;
// --- Fractures and Splints
private _fractureSettings = EGVAR(medical,fractures);
private _fractureIcon = "";
private _splintIcon = "";
if (_fractureSettings > 0) then {
// --- Fractures enabled: check for fracture indication
private _hasFractures = GET_FRACTURES(ACE_player) findIf {_x > 0} > -1;
_fractureIcon = ["", ICON_FRACTURE_PATH] select _hasFractures;
if (_fractureSettings > 1) then {
// --- Fractures can not be fully healed: check for splint indication
private _hasSplints = GET_FRACTURES(ACE_player) findIf {_x == -1} > -1;
_splintIcon = ["", ICON_SPLINT_PATH] select _hasSplints;
};
};
// --- Get prioritized list of icons to apply
private _icons = [
_fractureIcon,
_tourniquetIcon,
_splintIcon
] select {_x isNotEqualTo ""};
// --- Apply icons to indicator slots, if no icon for slot - remove slot's text
{
_x ctrlSetText (_icons param [_forEachIndex, ""]);
} forEach _indicatorSlots;

View File

@ -39,3 +39,18 @@
[true] call FUNC(initEffects);
}
] call CBA_fnc_addSetting;
[
QGVAR(enableHUDIndicators),
"CHECKBOX",
[LSTRING(EnableHUDIndicators_DisplayName), LSTRING(EnableHUDIndicators_Description)],
[ELSTRING(medical,Category), LSTRING(SubCategory)],
true,
false,
{
// --- Drop indication on disabling
if (!_this) exitWith {
[true] call FUNC(handleHUDIndicators);
};
}
] call CBA_fnc_addSetting;

View File

@ -55,3 +55,7 @@
#define ICON_BLOODVOLUME_COLOR_WHITE [1, 1, 1, 1]
#define ICON_BLOODVOLUME_COLOR_ORANGE [1, 0.6, 0, 1]
#define ICON_BLOODVOLUME_COLOR_RED [0.8, 0.2, 0, 1]
#define ICON_TOURNIQUET_PATH QPATHTOF(data\tourniquet.paa)
#define ICON_SPLINT_PATH QPATHTOF(data\splint.paa)
#define ICON_FRACTURE_PATH QPATHTOF(data\fracture.paa)

View File

@ -189,6 +189,14 @@
<Chinese>啟用傷者的尖叫聲</Chinese>
<Turkish>Yaralı birimler tarafından çığlık atmayı etkinleştir</Turkish>
</Key>
<Key ID="STR_ACE_Medical_Feedback_EnableHUDIndicators_DisplayName">
<English>Enable Fracture/Tourniquet/Splint Indicators</English>
<Russian>Включить индикаторы переломов/жгутов/шин</Russian>
</Key>
<Key ID="STR_ACE_Medical_Feedback_EnableHUDIndicators_Description">
<English>Enables indicators for fractures and applied tourniquets and splints over the Stance Indicator.</English>
<Russian>Включает индикацию переломов, наложенных шин и жгутов поверх индикатора положения тела.</Russian>
</Key>
</Container>
</Package>
</Project>