Medical - Show triage level in interaction (#7940)

* medical: show triage in interaction

* rename

* clean up comments

* Update addons/medical_gui/functions/fnc_modifyActionTriageLevel.sqf

Co-authored-by: jonpas <jonpas33@gmail.com>

* Update addons/medical_gui/functions/fnc_modifyActionTriageLevel.sqf

Co-authored-by: jonpas <jonpas33@gmail.com>

* Add setting (disabled, enabled, medicsOnly)

* Apply suggestions from code review

Co-authored-by: mharis001 <34453221+mharis001@users.noreply.github.com>

Co-authored-by: jonpas <jonpas33@gmail.com>
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
Co-authored-by: mharis001 <34453221+mharis001@users.noreply.github.com>
This commit is contained in:
Brett 2020-10-28 18:08:00 -06:00 committed by GitHub
parent a67d6eecb0
commit 78c307196d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 65 additions and 0 deletions

View File

@ -19,6 +19,7 @@ class CfgVehicles {
exceptions[] = {"isNotInside", "isNotSwimming"};
statement = QUOTE(_target call FUNC(openMenu));
icon = QPATHTOF(ui\cross.paa);
modifierFunction = QUOTE(call FUNC(modifyActionTriageLevel));
};
};
class ACE_Actions {
@ -26,12 +27,14 @@ class CfgVehicles {
#include "InteractionBodyParts.hpp"
#undef ACTION_CONDITION
class ACE_MainActions {
modifierFunction = QUOTE(call FUNC(modifyActionTriageLevel));
class ACE_Medical_Menu {
displayName = CSTRING(MedicalMenu);
condition = QUOTE([ARR_2(ACE_player,_target)] call FUNC(canOpenMenu));
exceptions[] = {"isNotInside", "isNotSwimming"};
statement = QUOTE(_target call FUNC(openMenu));
icon = QPATHTOF(ui\cross.paa);
modifierFunction = QUOTE(call FUNC(modifyActionTriageLevel));
};
class ACE_Medical_Radial {
displayName = CSTRING(Medical);

View File

@ -9,6 +9,7 @@ PREP(handleToggle);
PREP(handleTriageSelect);
PREP(menuPFH);
PREP(modifyAction);
PREP(modifyActionTriageLevel);
PREP(onMenuClose);
PREP(onMenuOpen);
PREP(openMenu);

View File

@ -0,0 +1,46 @@
#include "script_component.hpp"
/*
* Author: SynixeBrett
* Modifies the action color to match the triage level.
*
* Arguments:
* 0: Target <OBJECT>
* 1: Player <OBJECT>
* 2: Args <ANY>
* 3: Action Data <ARRAY>
*
* Return Value:
* None
*
* Example:
* [cursorObject, player, [], []] call ace_interaction_fnc_modifyActionTriageLevel
*
* Public: No
*/
params ["_target", "_player", "", "_actionData"];
if (
GVAR(interactionMenuShowTriage) == 1 // Anyone
|| {GVAR(interactionMenuShowTriage) == 2 && {[_player] call EFUNC(medical_treatment,isMedic)}} // Medics & Doctors
) then {
private _colorHex = switch (_target getVariable [QEGVAR(medical,triageLevel), 0]) do {
case 1: {
[TRIAGE_COLOR_MINIMAL] call BIS_fnc_colorRGBtoHTML
};
case 2: {
[TRIAGE_COLOR_DELAYED] call BIS_fnc_colorRGBtoHTML
};
case 3: {
[TRIAGE_COLOR_IMMEDIATE] call BIS_fnc_colorRGBtoHTML
};
case 4: {
[TRIAGE_COLOR_DECEASED] call BIS_fnc_colorRGBtoHTML
};
default {
"#FFFFFF"
};
};
_actionData params ["", "", "_icon"];
_icon set [1, _colorHex];
};

View File

@ -42,3 +42,12 @@
[0, 10, 3, 1],
true
] call CBA_settings_fnc_init;
[
QGVAR(interactionMenuShowTriage),
"LIST",
[LSTRING(InteractionMenuShowTriage_DisplayName), LSTRING(InteractionMenuShowTriage_Description)],
[ELSTRING(medical,Category), LSTRING(SubCategory)],
[[0, 1, 2], [ELSTRING(common,Disabled), ELSTRING(Medical_Treatment,Anyone), ELSTRING(Medical_Treatment,Medics)], 1],
false
] call CBA_settings_fnc_init;

View File

@ -189,6 +189,12 @@
<Spanish>Distancia máxima desde el paciente para que el menú pueda ser abierto</Spanish>
<Turkish>Tıbbi Menünün açılabileceği maksimum mesafe.</Turkish>
</Key>
<Key ID="STR_ACE_Medical_GUI_InteractionMenuShowTriage_DisplayName">
<English>Show Triage Level in Interaction Menu</English>
</Key>
<Key ID="STR_ACE_Medical_GUI_InteractionMenuShowTriage_Description">
<English>Shows the patient's triage level by changing the color of the main and medical menu actions.</English>
</Key>
<Key ID="STR_ACE_Medical_GUI_Medical">
<English>Medical</English>
<Czech>Lékařské</Czech>