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 - Combine advancedBandages and woundReopening settings #7392

Merged
merged 5 commits into from
Feb 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
59 changes: 24 additions & 35 deletions addons/medical_gui/functions/fnc_updateInjuryList.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -104,45 +104,34 @@ if (_totalIvVolume >= 1) then {
// Add entries for open, bandaged, and stitched wounds
private _woundEntries = [];

private _fnc_getWoundDescription = {
private _classIndex = _woundClassID / 10;
private _category = _woundClassID % 10;
private _className = EGVAR(medical_damage,woundsData) select _classIndex 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 [localize LSTRING(PartialX), _woundName];
};
};
private _fnc_processWounds = {
params ["_wounds", "_format", "_color"];

{
_x params ["_woundClassID", "_bodyPartN", "_amountOf"];
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]];
{
_x params ["_woundClassID", "_bodyPartN", "_amountOf"];

if (_selectionN == _bodyPartN && {_amountOf > 0}) then {
private _classIndex = _woundClassID / 10;
private _category = _woundClassID % 10;

private _className = EGVAR(medical_damage,woundsData) select _classIndex select 6;
private _suffix = ["Minor", "Medium", "Large"] select _category;
private _woundName = localize format [ELSTRING(medical_damage,%1_%2), _className, _suffix];

private _woundDescription = if (_amountOf >= 1) then {
format ["%1x %2", ceil _amountOf, _woundName]
} else {
format [localize LSTRING(PartialX), _woundName]
};
};
};
} forEach GET_OPEN_WOUNDS(_target);

{
_x params ["_woundClassID", "_bodyPartN", "_amountOf"];
if (_selectionN == _bodyPartN && {_amountOf > 0}) then {
_woundEntries pushBack [format ["[B] %1", call _fnc_getWoundDescription], [0.88, 0.7, 0.65, 1]];
};
} forEach GET_BANDAGED_WOUNDS(_target);
_woundEntries pushBack [format [_format, _woundDescription], _color];
};
} forEach _wounds;
};

{
_x params ["_woundClassID", "_bodyPartN", "_amountOf"];
if (_selectionN == _bodyPartN && {_amountOf > 0}) then {
_woundEntries pushBack [format ["[S] %1", call _fnc_getWoundDescription], [0.7, 0.7, 0.7, 1]];
};
} forEach GET_STITCHED_WOUNDS(_target);
[GET_OPEN_WOUNDS(_target), "%1", [1, 1, 1, 1]] call _fnc_processWounds;
[GET_BANDAGED_WOUNDS(_target), "[B] %1", [0.88, 0.7, 0.65, 1]] call _fnc_processWounds;
Copy link
Contributor

@PabstMirror PabstMirror Jan 9, 2020

Choose a reason for hiding this comment

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

`if ((missionNamespace getVariable [QEGVAR(medical_treatment,advancedBandages), 1]) == 2) then {`
    [GET_BANDAGED_WOUNDS(_target), "[B] %1", [0.88, 0.7, 0.65, 1]] call _fnc_processWounds;

might save a little time as you can only get bandaged/stitched in mode2

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we'd still want to show any bandaged wounds in case the setting was changed mid-mission because those would still be able to be stitched.

Copy link
Member

Choose a reason for hiding this comment

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

I'd be for only listing them when reopening is active. Wouldn't they then appear when the UI is recreated if the setting is changed mid-mission?

Copy link
Member Author

Choose a reason for hiding this comment

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

The injuries list is constantly refreshed. The concern is that if a unit originally has a bandaged wound that could reopen or be stitched (advancedBandaged == 2), changing the setting would cause the originally bandaged wound to not be shown but it can still reopen and be stitched.

Bandaging open wounds after changing the setting would not produce any new bandaged wounds - not able to reopen or be stitched.

Copy link
Member

Choose a reason for hiding this comment

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

Ah I see the distinction here now between "bandaged wounds" the array and "bandaged wounds" when re-opening isn't enabled. Missed that before.

Wonder if we could handle that setting changing better 🤔 Probably beyond the scope of this PR though.

[GET_STITCHED_WOUNDS(_target), "[S] %1", [0.7, 0.7, 0.7, 1]] call _fnc_processWounds;

// Handle no wound entries
if (_woundEntries isEqualTo []) then {
Expand Down
4 changes: 2 additions & 2 deletions addons/medical_treatment/functions/fnc_bandageLocal.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ _patient setVariable [VAR_OPEN_WOUNDS, _openWounds, true];
[_patient] call EFUNC(medical_status,updateWoundBloodLoss);

// Handle the reopening of bandaged wounds
if (_impact > 0 && {GVAR(advancedBandages) && {GVAR(woundReopening)}}) then {
if (_impact > 0 && {GVAR(advancedBandages) == 2}) then {
[_patient, _impact, _partIndex, _woundIndex, _wound, _bandage] call FUNC(handleBandageOpening);
};

// Check if we fixed limping from this treatment
if ((EGVAR(medical,limping) == 1) && {_partIndex > 3} && {_amountOf <= 0} && {_patient getVariable [QEGVAR(medical,isLimping), false]}) then {
if (EGVAR(medical,limping) == 1 && {_partIndex > 3} && {_amountOf <= 0} && {_patient getVariable [QEGVAR(medical,isLimping), false]}) then {
[_patient] call EFUNC(medical_engine,updateDamageEffects);
};

Expand Down
2 changes: 1 addition & 1 deletion addons/medical_treatment/functions/fnc_canBandage.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
params ["_medic", "_patient", "_bodyPart", "_bandage"];

// Bandage type and bandage setting XNOR to show only active actions
if ((_bandage == "BasicBandage") isEqualTo GVAR(advancedBandages)) exitWith {false};
if ((_bandage == "BasicBandage") isEqualTo (GVAR(advancedBandages) != 0)) exitWith {false};

private _index = ALL_BODY_PARTS find toLower _bodyPart;
private _canBandage = false;
Expand Down
7 changes: 4 additions & 3 deletions addons/medical_treatment/functions/fnc_getBandageTime.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ _targetWound params ["_wound", "_woundIndex", "_effectiveness"];
TRACE_3("findMostEffectiveWound",_wound,_woundIndex,_effectiveness);

// Everything is patched up on this body part already
if (_wound isEqualTo EMPTY_WOUND) exitWith { 0 };
if (_wound isEqualTo EMPTY_WOUND) exitWith {0};

_wound params ["_classID", "", "_amountOf", "_bloodloss", "_damage"];
private _category = (_classID % 10);
Expand All @@ -37,8 +37,9 @@ private _category = (_classID % 10);
private _bandageTime = [BANDAGE_TIME_S, BANDAGE_TIME_M, BANDAGE_TIME_L] select _category;

// Scale bandage time based on amount left and effectiveness (less time if only a little wound left)
if (GVAR(advancedBandages)) then { // basicBandage will have a very high effectiveness and can be ignored
_bandageTime = _bandageTime * (linearConversion [0, _effectiveness, _amountOf, 0.666, 1, true]);
// Basic bandage treatment will have a very high effectiveness and can be ignored
if (GVAR(advancedBandages) != 0) then {
_bandageTime = _bandageTime * linearConversion [0, _effectiveness, _amountOf, 0.666, 1, true];
};

// Medics are more practised at applying bandages
Expand Down
19 changes: 4 additions & 15 deletions addons/medical_treatment/initSettings.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@
true
] call CBA_settings_fnc_init;

[
QGVAR(advancedBandages),
"CHECKBOX",
[LSTRING(AdvancedBandages_DisplayName), LSTRING(AdvancedBandages_Description)],
[ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)],
true,
true
] call CBA_settings_fnc_init;

[
QGVAR(advancedMedication),
"CHECKBOX",
Expand All @@ -25,14 +16,12 @@
true
] call CBA_settings_fnc_init;

// todo: verify that this setting does not require a restart
// todo: this setting requires advanced bandages to be enabled, they should be independent
[
QGVAR(woundReopening),
"CHECKBOX",
[LSTRING(WoundReopening_DisplayName), LSTRING(WoundReopening_Description)],
QGVAR(advancedBandages),
"LIST",
[LSTRING(AdvancedBandages_DisplayName), LSTRING(AdvancedBandages_Description)],
[ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)],
false,
[[0, 1, 2], [ELSTRING(common,Disabled), ELSTRING(common,Enabled), LSTRING(AdvancedBandages_EnabledCanReopen)], 1],
true
] call CBA_settings_fnc_init;

Expand Down
75 changes: 27 additions & 48 deletions addons/medical_treatment/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,30 @@
<Polish>Włącza opcje sprawdzania Pulsu, Ciśnienia Tętniczego Krwi i Reakcje Na Ból, zamiast bardziej ogólnej akcji Diagnozuj.\n Po wyłączeniu tej opcji akcja RKO będzie wyświetlana tylko wtedy, gdy jej wykonanie będzie odpowiednie.\n Opcja, która włącza to ustawienie jest potrzebna do ustalenia, czy osoba jest nieprzytomna lub ma zatrzymanie krążenia.</Polish>
<German>Ermöglicht die 'Überprüfe Puls', 'Überprüfe Blutdruck' und 'Überprüfe Reaktionen' Behandlungsaktionen anstatt der einfachen 'Diagnose' Behandlungsaktion.\nWenn diese Einstellung nicht aktiviert ist, wird die "HLW"-Aktion nur angezeigt, wenn die Anwendung von HLW angemessen ist.\nDie Aktionen, die das Aktivieren dieser Einstellung ermöglicht, werden benötigt um zu bestimmen, ob eine Person bewusstlos ist oder einen Herzstillstand erleidet.</German>
</Key>
<Key ID="STR_ACE_Medical_Treatment_AdvancedMedication_DisplayName">
<English>Advanced Medication</English>
<German>Erweiterte Medikation</German>
<Japanese>アドバンスド医薬品</Japanese>
<Russian>Расширенные Лекарства</Russian>
<French>Médication avancée</French>
<Portuguese>Medicação Avançada</Portuguese>
<Chinese>進階醫療用品</Chinese>
<Czech>Pokročilé léky</Czech>
<Italian>Medicazione avanzata</Italian>
<Polish>Zaawansowane leki</Polish>
</Key>
<Key ID="STR_ACE_Medical_Treatment_AdvancedMedication_Description">
<English>Enables extended, more in-depth medication handling. Also, enables the use of Adenosine.</English>
<Russian>Устанавливает расширенное использование лекарств</Russian>
<Japanese>有効化するともっと多くの多様な機能を持つ医薬品を使えます。また、アデノシンとアトロピンが利用可能になります。</Japanese>
<French>Permet une manipulation étendue et plus approfondie des médicaments.\nEn outre, permet l'utilisation d'adénosine.</French>
<Portuguese>Ativa a manipulação avançada de medicações. Também permite o uso de Adenosina e Atropina.</Portuguese>
<Chinese>是否擴展藥物管控使其更深度化。並且,啟用腺苷以及阿托品的使用次數</Chinese>
<Czech>Povoluje hlubší a rozšířené zacházení s léčivy. Také aktivuje Adenosin a Atropin.</Czech>
<Italian>Abilita una gestione della medicazione più estesa e approfondita. Permette inoltre l'utilizzo dell'Adenosina.</Italian>
<German>Ermöglicht erweiterte, mehr tiefgründigere Anwendung von Medikationen. Ebenso ermöglicht es die Benutzung von Adenosin.</German>
<Polish>Pozwala na zaawansowane uzycie leków. Pozwala na używanie Adenozyny.</Polish>
</Key>
<Key ID="STR_ACE_Medical_Treatment_AdvancedBandages_DisplayName">
<English>Advanced Bandages</English>
<German>Erweiterte Bandagen</German>
Expand All @@ -62,7 +86,7 @@
<Polish>Zaawansowane Bandaże</Polish>
</Key>
<Key ID="STR_ACE_Medical_Treatment_AdvancedBandages_Description">
<English>Enables treatment actions for different bandage types instead of the generic Bandage action.</English>
<English>Enables treatment actions for different bandage types instead of the generic Bandage action.\nAdditionally, the reopening of bandaged wounds can also be enabled.</English>
<German>Ermöglicht Behandlungsaktionen für verschiedene Bandagentypen anstelle der gewöhnlichen Bandageaktionen.</German>
<Japanese>有効化すると通常の包帯動作に代わり、様々な種類がある包帯で治療ができます。</Japanese>
<French>Active différents types de bandages, à choisir judicieusement en fonction des plaies.</French>
Expand All @@ -73,53 +97,8 @@
<Czech>Povoluje specifické obvazy s různými vlastnostmi namísto jednoho univerzálního obvazu.</Czech>
<Polish>Umożliwia wybranie konkretnego rodzaju bandaża zamiast ogólnej akcji bandażowania.</Polish>
</Key>
<Key ID="STR_ACE_Medical_Treatment_AdvancedMedication_DisplayName">
<English>Advanced Medication</English>
<German>Erweiterte Medikamente</German>
<Japanese>アドバンスド医薬品</Japanese>
<Russian>Расширенные Лекарства</Russian>
<French>Médication avancée</French>
<Portuguese>Medicação Avançada</Portuguese>
<Chinese>進階醫療用品</Chinese>
<Czech>Pokročilé léky</Czech>
<Polish>Zaawansowane leki</Polish>
<Italian>Medicazione avanzata</Italian>
</Key>
<Key ID="STR_ACE_Medical_Treatment_AdvancedMedication_Description">
<English>Enables extended, more in-depth medication handling. Also, enables the use of Adenosine.</English>
<Russian>Устанавливает расширенное использование лекарств</Russian>
<Japanese>有効化するともっと多くの多様な機能を持つ医薬品を使えます。また、アデノシンとアトロピンが利用可能になります。</Japanese>
<French>Permet une manipulation étendue et plus approfondie des médicaments.\nEn outre, permet l'utilisation d'adénosine.</French>
<Portuguese>Ativa a manipulação avançada de medicações. Também permite o uso de Adenosina e Atropina.</Portuguese>
<Chinese>是否擴展藥物管控使其更深度化。並且,啟用腺苷以及阿托品的使用次數</Chinese>
<Czech>Povoluje hlubší a rozšířené zacházení s léčivy. Také aktivuje Adenosin a Atropin.</Czech>
<Italian>Abilita una gestione della medicazione più estesa e approfondita. Permette inoltre l'utilizzo dell'Adenosina.</Italian>
<German>Ermöglicht erweiterte, mehr tiefgründigere Anwendung von Medikationen. Ebenso ermöglicht es die Benutzung von Adenosin.</German>
<Polish>Pozwala na zaawansowane uzycie leków. Pozwala na używanie Adenozyny.</Polish>
</Key>
<Key ID="STR_ACE_Medical_Treatment_WoundReopening_DisplayName">
<English>Wound Reopening</English>
<Japanese>創傷再開放</Japanese>
<French>Réouverture des plaies</French>
<Russian>Повторное открытие ран</Russian>
<Portuguese>Reabrir Feridas</Portuguese>
<Chinese>傷口再度裂開</Chinese>
<Italian>Riapertura delle ferite</Italian>
<Czech>Znovuotevření ran</Czech>
<Polish>Ponowne Otwarcie Ran</Polish>
<German>Wunden Wiederöffnung</German>
</Key>
<Key ID="STR_ACE_Medical_Treatment_WoundReopening_Description">
<English>Enables the reopening of bandaged wounds. Requires Advanced Bandages to be enabled.</English>
<Japanese>有効化すると治療をした創傷を再開放します。アドバンスド包帯を有効化している必要があります。</Japanese>
<French>Permet la réouverture des plaies pansées.\nNécessite que l'option "pansements avancés" soit activée.</French>
<Russian>Разрешает повторное открытие перевязанных ран. Требуются опция «Расширенная Перевязка».</Russian>
<Portuguese>Permite que ferimentos atados possam reabrir. Requer Ataduras Avançadas para funcionar.</Portuguese>
<Chinese>啟用包紮過的傷口是否會再度裂開。需要啟用「進階包紮」之功能。</Chinese>
<Czech>Povoluje znovuotevírání obvázaných zranění. Vyžaduje zapnuté Pokročilé obvazy.</Czech>
<Polish>Umożliwia ponowne otwarcie się zabandażowanych ran. Wymaga włączenia opcji Zaawansowane Bandaże.</Polish>
<Italian>Permette la riapertura delle ferite fasciate. Richiede l'abilitazione di Bende Avanzate.</Italian>
<German>Ermöglicht das Wiederöffnen von bandagierten Wunden. Benötigt, dass 'Erweiterte Bandagen' aktiviert ist.</German>
<Key ID="STR_ACE_Medical_Treatment_AdvancedBandages_EnabledCanReopen">
<English>Enabled &amp; Can Reopen</English>
</Key>
<Key ID="STR_ACE_Medical_Treatment_ClearTraumaAfterBandage_DisplayName">
<English>Clear Trauma After Bandage</English>
Expand Down