From 7a39f4f251f01ec49d5d3d74ac7761c88b4df0e7 Mon Sep 17 00:00:00 2001 From: Mia <95135995+MissHeda@users.noreply.github.com> Date: Mon, 16 Jan 2023 10:53:59 +0100 Subject: [PATCH 1/2] Low SpO2, stamina lose change Changed the low SpO2 stamina lose from staidly removing stamina bits to making you drain more stamina on actions. --- addons/breathing/functions/fnc_handleBreathing.sqf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/breathing/functions/fnc_handleBreathing.sqf b/addons/breathing/functions/fnc_handleBreathing.sqf index 84f53e5ed..e82b2ae6e 100644 --- a/addons/breathing/functions/fnc_handleBreathing.sqf +++ b/addons/breathing/functions/fnc_handleBreathing.sqf @@ -194,10 +194,12 @@ if (!local _unit) then { if(GVAR(staminaLossAtLowSPO2)) then { if (!(_unit getVariable ["ACE_isUnconscious",false]) && {_finalOutput <= GVAR(lowSPO2Level)}) then { if (ACEGVAR(advanced_fatigue,enabled)) then { - ACEGVAR(advanced_fatigue,anReserve) = ACEGVAR(advanced_fatigue,anReserve) - 30; + ["LSDF", 1.5] call ACEFUNC(advanced_fatigue,addDutyFactor); } else { _unit setStamina(getStamina _unit - 3); }; + } else { + ["LSDF"] call ACEFUNC(advanced_fatigue,removeDutyFactor); }; }; From 4fe820060ea0364db39302f759f4d664ed51cf7a Mon Sep 17 00:00:00 2001 From: Mia <95135995+MissHeda@users.noreply.github.com> Date: Thu, 19 Jan 2023 18:53:42 +0100 Subject: [PATCH 2/2] Visual SpO2 fix --- addons/breathing/XEH_PREP.hpp | 3 +- addons/breathing/XEH_postInit.sqf | 1 + .../functions/fnc_handleBreathing.sqf | 50 ++----------- addons/breathing/functions/fnc_lowSpO2pp.sqf | 73 +++++++++++++++++++ 4 files changed, 81 insertions(+), 46 deletions(-) create mode 100644 addons/breathing/functions/fnc_lowSpO2pp.sqf diff --git a/addons/breathing/XEH_PREP.hpp b/addons/breathing/XEH_PREP.hpp index b0014659c..48ed560ce 100644 --- a/addons/breathing/XEH_PREP.hpp +++ b/addons/breathing/XEH_PREP.hpp @@ -13,4 +13,5 @@ PREP(treatmentAdvanced_pulseoximeterLocal); PREP(treatmentAdvanced_removePulseoximeter); PREP(treatmentAdvanced_tensionpneumothorax); PREP(treatmentAdvanced_tensionpneumothoraxLocal); -PREP(listenLungs); \ No newline at end of file +PREP(listenLungs); +PREP(lowSpO2pp); \ No newline at end of file diff --git a/addons/breathing/XEH_postInit.sqf b/addons/breathing/XEH_postInit.sqf index bcd39a5ec..684078e35 100644 --- a/addons/breathing/XEH_postInit.sqf +++ b/addons/breathing/XEH_postInit.sqf @@ -6,5 +6,6 @@ [QGVAR(hemopneumothoraxLocal), LINKFUNC(treatmentAdvanced_hemopneumothoraxLocal)] call CBA_fnc_addEventHandler; [QGVAR(tensionpneumothoraxLocal), LINKFUNC(treatmentAdvanced_tensionpneumothoraxLocal)] call CBA_fnc_addEventHandler; [QGVAR(cyanosisLocal), LINKFUNC(treatmentAdvanced_CyanosisLocal)] call CBA_fnc_addEventHandler; +[QGVAR(lowSpO2pp), LINKFUNC(lowSpO2pp)] call CBA_fnc_addEventHandler; [QACEGVAR(medical,woundReceived),LINKFUNC(handlePulmoHit)] call CBA_fnc_addEventHandler; diff --git a/addons/breathing/functions/fnc_handleBreathing.sqf b/addons/breathing/functions/fnc_handleBreathing.sqf index e82b2ae6e..793169f98 100644 --- a/addons/breathing/functions/fnc_handleBreathing.sqf +++ b/addons/breathing/functions/fnc_handleBreathing.sqf @@ -25,6 +25,10 @@ if (!local _unit) then { [QGVAR(handleBreathing), [_unit], _unit] call CBA_fnc_targetEvent; }; +if (!(_unit getVariable [QGVAR(lowSpO2ppActive), false]) && hasInterface && ACE_Player == _unit) then { + [QGVAR(lowSpO2pp), [_unit], _unit] call CBA_fnc_targetEvent; +}; + [{ params ["_args", "_idPFH"]; _args params ["_unit"]; @@ -146,51 +150,7 @@ if (!local _unit) then { if (!(_unit getVariable ["ACE_isUnconscious",false]) && {_finalOutput <= GVAR(SpO2_unconscious)}) then { [QACEGVAR(medical,CriticalVitals), _unit] call CBA_fnc_localEvent; }; - - if (GVAR(enableSPO2Flashing)) then { - if (!(_unit getVariable ["ACE_isUnconscious",false]) && {_finalOutput <= GVAR(lowSPO2Level)}) then { - ["ColorCorrections", 1500, [1, 1, 0, [0, 0, 0, 0], [0, 0, 0, 1], [0.33, 0.33, 0.33, 0], [0.55, 0.5, 0, 0, 0, 0, 4]]] spawn - { - params ["_name", "_priority", "_effect", "_handle"]; - while { - _handle = ppEffectCreate [_name, _priority]; - _handle < 0 - } do { - _priority = _priority + 1; - }; - _handle ppEffectEnable true; - _handle ppEffectAdjust _effect; - _handle ppEffectCommit 0.7; - - [{ params["_handle"]; - ppEffectCommitted _handle - }, - { params["_handle"]; - _handle ppEffectAdjust [1, 1, 0, [0, 0, 0, 0.9], [0, 0, 0, 1], [0.33, 0.33, 0.33, 0], [0.55, 0.5, 0, 0, 0, 0, 4]]; - _handle ppEffectCommit 0.7; - - [{ params["_handle"]; - ppEffectCommitted _handle - }, - { params["_handle"]; - _handle ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [0, 0, 0, 1], [0.33, 0.33, 0.33, 0], [0.55, 0.5, 0, 0, 0, 0, 4]]; - _handle ppEffectCommit 1.6; - - [{ params["_handle"]; - ppEffectCommitted _handle - }, - { params["_handle"]; - _handle ppEffectEnable false; - ppEffectDestroy _handle; - }, [_handle]] call CBA_fnc_waitUntilAndExecute; - - }, [_handle]] call CBA_fnc_waitUntilAndExecute; - - }, [_handle]] call CBA_fnc_waitUntilAndExecute; - }; - }; - }; - + if(GVAR(staminaLossAtLowSPO2)) then { if (!(_unit getVariable ["ACE_isUnconscious",false]) && {_finalOutput <= GVAR(lowSPO2Level)}) then { if (ACEGVAR(advanced_fatigue,enabled)) then { diff --git a/addons/breathing/functions/fnc_lowSpO2pp.sqf b/addons/breathing/functions/fnc_lowSpO2pp.sqf new file mode 100644 index 000000000..b31a9e104 --- /dev/null +++ b/addons/breathing/functions/fnc_lowSpO2pp.sqf @@ -0,0 +1,73 @@ +#include "script_component.hpp" +/* + * Author: Miss Heda, Digii + * Triggers the low SPO2 visual effect. + * + * Arguments: + * 0: Target + * + * + * Return Value: + * None + * + * Example: + * [player] call kat_breathing_fnc_lowSpO2pp + * + * Public: No + */ + +params ["_target"]; + +_target setVariable [QGVAR(lowSpO2ppActive), true, true]; + +[{ + + params ["_args", "_idPFH"]; + _args params ["_target"]; + + _currentSpO2 = _target getVariable [QGVAR(airwayStatus), 100]; + if (!(alive _target) || !([_target] call ACEFUNC(common,isAwake)) || _currentSpO2 > GVAR(lowSPO2Level)) exitWith { + _target setVariable [QGVAR(lowSpO2ppActive), false, true]; + [_idPFH] call CBA_fnc_removePerFrameHandler; + }; + + ["ColorCorrections", 1500, [1, 1, 0, [0, 0, 0, 0], [0, 0, 0, 1], [0.33, 0.33, 0.33, 0], [0.55, 0.5, 0, 0, 0, 0, 4]]] spawn + { + params ["_name", "_priority", "_effect", "_handle"]; + while { + _handle = ppEffectCreate [_name, _priority]; + _handle < 0 + } do { + _priority = _priority + 1; + }; + _handle ppEffectEnable true; + _handle ppEffectAdjust _effect; + _handle ppEffectCommit 0.7; + + [{ params["_handle"]; + ppEffectCommitted _handle + }, + { params["_handle"]; + _handle ppEffectAdjust [1, 1, 0, [0, 0, 0, 0.9], [0, 0, 0, 1], [0.33, 0.33, 0.33, 0], [0.55, 0.5, 0, 0, 0, 0, 4]]; + _handle ppEffectCommit 0.7; + + [{ params["_handle"]; + ppEffectCommitted _handle + }, + { params["_handle"]; + _handle ppEffectAdjust [1, 1, 0, [0, 0, 0, 0.1], [0, 0, 0, 1], [0.33, 0.33, 0.33, 0], [0.55, 0.5, 0, 0, 0, 0, 4]]; + _handle ppEffectCommit 1.6; + + [{ params["_handle"]; + ppEffectCommitted _handle + }, + { params["_handle"]; + _handle ppEffectEnable false; + ppEffectDestroy _handle; + }, [_handle]] call CBA_fnc_waitUntilAndExecute; + + }, [_handle]] call CBA_fnc_waitUntilAndExecute; + + }, [_handle]] call CBA_fnc_waitUntilAndExecute; + }; +}, 3, [_target]] call CBA_fnc_addPerFrameHandler; \ No newline at end of file