Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Medical GUI - Show warning if tourniquet will interfere with medical menu action #9475

Merged
merged 6 commits into from
Oct 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion addons/medical_gui/functions/fnc_collectActions.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ GVAR(actions) = [];
private _category = getText (_x >> "category");
private _condition = compile format [QUOTE([ARR_4(ACE_player, GVAR(target), %1 select GVAR(selectedBodyPart), '%2')] call DEFUNC(medical_treatment,canTreatCached)), ALL_BODY_PARTS, _configName];
private _statement = compile format [QUOTE([ARR_4(ACE_player, GVAR(target), %1 select GVAR(selectedBodyPart), '%2')] call DEFUNC(medical_treatment,treatment)), ALL_BODY_PARTS, _configName];
private _items = getArray (_x >> "items");

GVAR(actions) pushBack [_displayName, _category, _condition, _statement];
GVAR(actions) pushBack [_displayName, _category, _condition, _statement, _items];
} forEach configProperties [configFile >> QEGVAR(medical_treatment,actions), "isClass _x"];


Expand Down
12 changes: 11 additions & 1 deletion addons/medical_gui/functions/fnc_updateActions.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ if (_showTriage) exitWith {
// Show treatment options on action buttons
private _shownIndex = 0;
{
_x params ["_displayName", "_category", "_condition", "_statement"];
_x params ["_displayName", "_category", "_condition", "_statement", "_items"];

// Check action category and condition
if (_category == _selectedCategory && {call _condition}) then {
Expand All @@ -50,6 +50,16 @@ private _shownIndex = 0;
_ctrl ctrlSetPositionY POS_H(1.1 * _shownIndex);
_ctrl ctrlCommit 0;

// Show warning if tourniquet will interfere with action
if (((_category in ["examine", "medication"]) || (_items findIf {"IV" in _x}) > -1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't there an IV category? The _items findIf {"IV" in _x}) > -1 check is too specific imo.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IVs are in the advanced category, shared with things like stitching and CPR. Checking the item name was the most succinct way I could figure out without having to pass extra information about the actions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Item config properties can be checked instead to determine if it's an IV, but oof...

I don't like the idea of relying on classnames.

&& HAS_TOURNIQUET_APPLIED_ON(GVAR(target),GVAR(selectedBodyPart))) then {
_ctrl ctrlSetTooltipColorText [1, 1, 0, 1];
_ctrl ctrlSetTooltip localize LSTRING(TourniquetWarning);
amsteadrayle marked this conversation as resolved.
Show resolved Hide resolved
} else {
_ctrl ctrlSetTooltipColorText [1, 1, 1, 1];
_ctrl ctrlSetTooltip "";
};

_ctrl ctrlSetText _displayName;
_ctrl ctrlShow true;

Expand Down
3 changes: 3 additions & 0 deletions addons/medical_gui/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1304,5 +1304,8 @@
<German>Chronisches Trauma</German>
<Korean>심각한 외상</Korean>
</Key>
<Key ID="STR_ACE_Medical_GUI_TourniquetWarning">
<English>No effect while tourniqeted</English>
amsteadrayle marked this conversation as resolved.
Show resolved Hide resolved
</Key>
</Package>
</Project>