From f344093b79bb23dfc31373b8cb85e9254755f398 Mon Sep 17 00:00:00 2001 From: mharis001 Date: Tue, 11 Aug 2020 05:21:49 -0400 Subject: [PATCH 1/3] Medical - Add force walk option to fracture setting --- addons/medical/dev/watchVariable.sqf | 3 ++- addons/medical/initSettings.sqf | 2 +- addons/medical/stringtable.xml | 5 ++++- .../functions/fnc_updateDamageEffects.sqf | 15 +++++++-------- .../medical_gui/functions/fnc_updateBodyImage.sqf | 2 +- .../functions/fnc_updateInjuryList.sqf | 4 ++-- 6 files changed, 17 insertions(+), 14 deletions(-) diff --git a/addons/medical/dev/watchVariable.sqf b/addons/medical/dev/watchVariable.sqf index 0d02a74e193..94ff6b4c29a 100644 --- a/addons/medical/dev/watchVariable.sqf +++ b/addons/medical/dev/watchVariable.sqf @@ -69,7 +69,8 @@ GVAR(dev_watchVariableRunning) = true; private _fractures = GET_FRACTURES(_unit); private _canSprint = if (isSprintAllowed _unit) then {""} else {"[Sprint Blocked]"}; - _return pushBack format ["Fractures: %1 %2", _fractures, _canSprint]; + private _forceWalk = if (isForcedWalk _unit) then {"[Forced Walking]"} else {""}; + _return pushBack format ["Fractures: %1 %2%3", _fractures, _canSprint, _forceWalk]; // Tourniquets: diff --git a/addons/medical/initSettings.sqf b/addons/medical/initSettings.sqf index 367b4f56ba2..065314fcf97 100644 --- a/addons/medical/initSettings.sqf +++ b/addons/medical/initSettings.sqf @@ -14,7 +14,7 @@ "LIST", [LSTRING(Fractures_DisplayName), LSTRING(Fractures_Description)], LSTRING(Category), - [[0, 1, 2], [ELSTRING(common,Disabled), LSTRING(Fractures_SplintHealsFully), LSTRING(Fractures_SplintHasEffects)], 1], + [[0, 1, 2, 3], [ELSTRING(common,Disabled), LSTRING(Fractures_SplintHealsFully), LSTRING(Fractures_SplintHealsNoSprint), LSTRING(Fractures_SplintHealsNoJog)], 1], true, {}, true diff --git a/addons/medical/stringtable.xml b/addons/medical/stringtable.xml index ebb9f92622a..9ba9f0088f3 100644 --- a/addons/medical/stringtable.xml +++ b/addons/medical/stringtable.xml @@ -169,7 +169,7 @@ Férulas sanan completamente las fracturas Schienen heilen Knochenbrüche vollständig - + Splints Heal, but Cannot Sprint Шины вылечивают, но не дают бегать 添え木で治癒可能、走れないように @@ -183,6 +183,9 @@ Las férulas sanan, pero no pueden correr Schienen heilen, aber ermöglichen kein Sprinten + + Splints Heal, but Cannot Jog + Fracture Chance Chance de fracture diff --git a/addons/medical_engine/functions/fnc_updateDamageEffects.sqf b/addons/medical_engine/functions/fnc_updateDamageEffects.sqf index b58faf4057c..4a0c6cd1016 100644 --- a/addons/medical_engine/functions/fnc_updateDamageEffects.sqf +++ b/addons/medical_engine/functions/fnc_updateDamageEffects.sqf @@ -1,11 +1,10 @@ #include "script_component.hpp" /* * Author: commy2, PabstMirror - * Updates damage effects for limping and fractures + * Updates damage effects for limping and fractures. * * Arguments: * 0: Unit - * 1: Limping (optional, default: true) * * Return Value: * None @@ -33,12 +32,12 @@ if (EGVAR(medical,fractures) > 0) then { if ((_fractures select 2) == 1) then { _aimFracture = _aimFracture + 4; }; if ((_fractures select 3) == 1) then { _aimFracture = _aimFracture + 4; }; - if (EGVAR(medical,fractures) == 2) then { // the limp with a splint will still cause effects - private _isSprintBlocked = ((_fractures select 4) == -1) || {(_fractures select 5) == -1}; // block sprinting if we have a leg splint on - if (_isSprintBlocked || {!isSprintAllowed _unit}) then { // only update status effect if we need to - TRACE_1("updating status effect",_isSprintBlocked); - [_unit, "blockSprint", QEGVAR(medical,fracture), _isSprintBlocked] call EFUNC(common,statusEffect_set); - }; + // Block sprint / force walking based on fracture setting and leg splint status + private _hasLegSplint = (_fractures select 4) == -1 || {(_fractures select 5) == -1}; + [_unit, "blockSprint", QEGVAR(medical,fracture), _hasLegSplint && {EGVAR(medical,fractures) == 2}] call EFUNC(common,statusEffect_set); + [_unit, "forceWalk", QEGVAR(medical,fracture), _hasLegSplint && {EGVAR(medical,fractures) == 3}] call EFUNC(common,statusEffect_set); + + if (EGVAR(medical,fractures) in [2, 3]) then { // the limp with a splint will still cause effects if ((_fractures select 2) == -1) then { _aimFracture = _aimFracture + 2; }; if ((_fractures select 3) == -1) then { _aimFracture = _aimFracture + 2; }; }; diff --git a/addons/medical_gui/functions/fnc_updateBodyImage.sqf b/addons/medical_gui/functions/fnc_updateBodyImage.sqf index c522f95a637..3a1f756f798 100644 --- a/addons/medical_gui/functions/fnc_updateBodyImage.sqf +++ b/addons/medical_gui/functions/fnc_updateBodyImage.sqf @@ -51,7 +51,7 @@ private _bodyPartBloodLoss = [0, 0, 0, 0, 0, 0]; _ctrlBone ctrlSetTextColor [1, 0, 0, 1]; }; case -1: { - if (EGVAR(medical,fractures) == 2) then { + if (EGVAR(medical,fractures) in [2, 3]) then { _ctrlBone ctrlShow true; _ctrlBone ctrlSetTextColor [0, 0, 1, 1]; } else { diff --git a/addons/medical_gui/functions/fnc_updateInjuryList.sqf b/addons/medical_gui/functions/fnc_updateInjuryList.sqf index ef186242544..66d78c253ea 100644 --- a/addons/medical_gui/functions/fnc_updateInjuryList.sqf +++ b/addons/medical_gui/functions/fnc_updateInjuryList.sqf @@ -65,8 +65,8 @@ switch (GET_FRACTURES(_target) select _selectionN) do { _entries pushBack [localize LSTRING(Status_Fractured), [1, 0, 0, 1]]; }; case -1: { - if (EGVAR(medical,fractures) == 2) then { // Ignore if the splint has no effect - _entries pushBack [localize LSTRING(Status_SplintApplied), [1, 1, 1, 1]]; + if (EGVAR(medical,fractures) in [2, 3]) then { // Ignore if the splint has no effect + _entries pushBack [localize LSTRING(Status_SplintApplied), [0.2, 0.2, 1, 1]]; }; }; }; From d2074086e9371a18ffecb8ea51e1a4fe70a8a4a9 Mon Sep 17 00:00:00 2001 From: mharis001 <34453221+mharis001@users.noreply.github.com> Date: Tue, 11 Aug 2020 13:29:03 -0400 Subject: [PATCH 2/3] Add French translation Co-authored-by: Elgin675 --- addons/medical/stringtable.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/medical/stringtable.xml b/addons/medical/stringtable.xml index 9ba9f0088f3..e0c072903c4 100644 --- a/addons/medical/stringtable.xml +++ b/addons/medical/stringtable.xml @@ -185,6 +185,7 @@ Splints Heal, but Cannot Jog + Les attelles guérissent les fractures, mais empêchent de courir Fracture Chance From ac03dc2cd383afc2340bb3e079e25a7480eb870f Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sat, 22 Aug 2020 12:44:04 -0500 Subject: [PATCH 3/3] Reduce calls to statusEffect_set (#7865) * Reduce calls to statusEffect_set * statusEffect_addType fracture to forcewalk --- addons/common/XEH_postInit.sqf | 2 +- .../functions/fnc_updateDamageEffects.sqf | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 974e8b8c415..181b7099c62 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -19,7 +19,7 @@ //Status Effect EHs: [QGVAR(setStatusEffect), {_this call FUNC(statusEffect_set)}] call CBA_fnc_addEventHandler; -["forceWalk", false, ["ace_advanced_fatigue", "ACE_SwitchUnits", "ACE_Attach", "ACE_dragging", "ACE_Explosives", "ACE_Ladder", "ACE_Sandbag", "ACE_refuel", "ACE_rearm", "ACE_Trenches"]] call FUNC(statusEffect_addType); +["forceWalk", false, ["ace_advanced_fatigue", "ACE_SwitchUnits", "ACE_Attach", "ACE_dragging", "ACE_Explosives", "ACE_Ladder", "ACE_Sandbag", "ACE_refuel", "ACE_rearm", "ACE_Trenches", "ace_medical_fracture"]] call FUNC(statusEffect_addType); ["blockSprint", false, ["ace_advanced_fatigue", "ace_medical_fracture"]] call FUNC(statusEffect_addType); ["setCaptive", true, [QEGVAR(captives,Handcuffed), QEGVAR(captives,Surrendered)]] call FUNC(statusEffect_addType); ["blockDamage", false, ["fixCollision", "ACE_cargo"]] call FUNC(statusEffect_addType); diff --git a/addons/medical_engine/functions/fnc_updateDamageEffects.sqf b/addons/medical_engine/functions/fnc_updateDamageEffects.sqf index 4a0c6cd1016..107a1945c66 100644 --- a/addons/medical_engine/functions/fnc_updateDamageEffects.sqf +++ b/addons/medical_engine/functions/fnc_updateDamageEffects.sqf @@ -32,12 +32,15 @@ if (EGVAR(medical,fractures) > 0) then { if ((_fractures select 2) == 1) then { _aimFracture = _aimFracture + 4; }; if ((_fractures select 3) == 1) then { _aimFracture = _aimFracture + 4; }; - // Block sprint / force walking based on fracture setting and leg splint status - private _hasLegSplint = (_fractures select 4) == -1 || {(_fractures select 5) == -1}; - [_unit, "blockSprint", QEGVAR(medical,fracture), _hasLegSplint && {EGVAR(medical,fractures) == 2}] call EFUNC(common,statusEffect_set); - [_unit, "forceWalk", QEGVAR(medical,fracture), _hasLegSplint && {EGVAR(medical,fractures) == 3}] call EFUNC(common,statusEffect_set); - if (EGVAR(medical,fractures) in [2, 3]) then { // the limp with a splint will still cause effects + // Block sprint / force walking based on fracture setting and leg splint status + private _hasLegSplint = (_fractures select 4) == -1 || {(_fractures select 5) == -1}; + if (EGVAR(medical,fractures) == 2) then { + [_unit, "blockSprint", QEGVAR(medical,fracture), _hasLegSplint] call EFUNC(common,statusEffect_set); + } else { + [_unit, "forceWalk", QEGVAR(medical,fracture), _hasLegSplint] call EFUNC(common,statusEffect_set); + }; + if ((_fractures select 2) == -1) then { _aimFracture = _aimFracture + 2; }; if ((_fractures select 3) == -1) then { _aimFracture = _aimFracture + 2; }; };