diff --git a/addons/chemical/XEH_PREP.hpp b/addons/chemical/XEH_PREP.hpp index 0164e5547..4a41fa99e 100644 --- a/addons/chemical/XEH_PREP.hpp +++ b/addons/chemical/XEH_PREP.hpp @@ -7,7 +7,6 @@ PREP(canTakeOffGasMask); PREP(CASCreateGas); PREP(changeGasMaskFilter); PREP(checkGasMaskDur); -PREP(coughing); PREP(createSealAction); PREP(csGrenade); PREP(displayGasMaskDur); @@ -20,7 +19,6 @@ PREP(getList); PREP(giveUnitGasMask); PREP(gui_updateBodyImage); PREP(gui_updateInjuryListGeneral); -PREP(handleCSGas); PREP(handleFired); PREP(handleGasMaskDur); PREP(handleRespawn); diff --git a/addons/chemical/functions/fnc_coughing.sqf b/addons/chemical/functions/fnc_coughing.sqf deleted file mode 100644 index e44111a8c..000000000 --- a/addons/chemical/functions/fnc_coughing.sqf +++ /dev/null @@ -1,71 +0,0 @@ -#include "..\script_component.hpp" -/* - * Author: DiGii - * - * Arguments: - * 0: Unit - * - * Return Value: - * NONE - * - * Example: - * [player] call kat_chemical_fnc_coughing; - * - * Public: No -*/ -params ["_unit"]; - -//TO-DO IN FEEDBACK - -[ - { - params["_unit"]; - _unit getVariable [QGVAR(airPoisoning), false] - }, - { - params["_unit"]; - private _lastcought = CBA_missionTime; - [ - { - params ["_args", "_pfhID"]; - _args params ["_unit", "_lastcought"]; - if (_unit getVariable ["ACE_isUnconscious", false] || !(alive _unit) || !(_unit getVariable [QGVAR(airPoisoning), false])) exitWith { - [_pfhID] call CBA_fnc_removePerFrameHandler; - [_unit] call FUNC(coughing); - }; - private _nextcought = random [20,50,80]; - [ - { - params["_unit","_lastcought","_nextcought"]; - (CBA_missionTime - (_unit getVariable [QGVAR(lastCought), 0])) > _nextcought - }, - { - params["_unit"]; - if (_unit getVariable [QGVAR(airPoisoning),false]) then { - _unit say3D QGVAR(cough_1); - addCamShake [3, 4, 0]; - - _unit setVariable [QGVAR(lastCought), CBA_missionTime, true]; - - private _effect = ppEffectCreate ["ChromAberration",2005]; - KAT_PAIN_EFFECT = _effect; - _unit setVariable [QGVAR(painEffect), KAT_PAIN_EFFECT, true]; - KAT_PAIN_EFFECT ppEffectAdjust [0, 0, false]; - KAT_PAIN_EFFECT ppEffectCommit 0; - KAT_PAIN_EFFECT ppEffectEnable true; - private _intensity = linearConversion [0, 1, 0.5, 0, 0.06, true]; - private _initialAdjust = [_intensity, _intensity, true]; - private _delayedAdjust = [_intensity * 0.15, _intensity * 0.15, true]; - KAT_PAIN_EFFECT ppEffectAdjust _initialAdjust; - KAT_PAIN_EFFECT ppEffectCommit 0.3; - - [{ - params ["_adjust"]; - KAT_PAIN_EFFECT ppEffectAdjust _adjust; - KAT_PAIN_EFFECT ppEffectCommit 0.7; - }, [_delayedAdjust], 3] call CBA_fnc_waitAndExecute; - }; - }, - [_unit,_lastcought,_nextcought]] call CBA_fnc_waitUntilAndExecute; - }, 1, [_unit, _lastcought]] call CBA_fnc_addPerFrameHandler; - }, [_unit]] call CBA_fnc_waitUntilAndExecute; diff --git a/addons/chemical/functions/fnc_gasManagerPFH.sqf b/addons/chemical/functions/fnc_gasManagerPFH.sqf index 053ee57b2..6417aa7cd 100644 --- a/addons/chemical/functions/fnc_gasManagerPFH.sqf +++ b/addons/chemical/functions/fnc_gasManagerPFH.sqf @@ -47,9 +47,9 @@ [QGVAR(isInGasArea), [_x, _intensity], _x] call CBA_fnc_targetEvent; // Don't poison if already poisoned - if (_x getVariable [QGVAR(poisoned), false]) then { - continue; - }; + // if (_x getVariable [QGVAR(poisoned), false]) then { + // continue; + // }; [QGVAR(poison), [_x, _gasLevel], _x] call CBA_fnc_targetEvent; diff --git a/addons/chemical/functions/fnc_handleCSGas.sqf b/addons/chemical/functions/fnc_handleCSGas.sqf deleted file mode 100644 index bc08df968..000000000 --- a/addons/chemical/functions/fnc_handleCSGas.sqf +++ /dev/null @@ -1,66 +0,0 @@ -#include "..\script_component.hpp" -/* - * Author: DiGii - * - * Arguments: - * 0: Logic - * 1: Radius - * - * Return Value: - * NONE - * - * Example: - * [player, logic, 10] call kat_chemical_fnc_handleCSGas; - * - * Public: No -*/ -params ["_unit", "_logic", "_radius"]; - -// TO DO IN FEEDBACK - -[{ - params["_args","_handler"]; - _args params ["_unit"]; - - if (!isDamageAllowed _unit) exitWith { - [_unit] call FUNC(fullHealLocal); - }; - - if (_unit getVariable [QGVAR(enteredPoison), false]) then { - if (_unit getVariable [QACEGVAR(medical,pain), 0] < 0.25) then {_unit setVariable [QACEGVAR(medical,pain), 0.41]}; - if ((goggles _unit) in (missionNamespace getVariable [QGVAR(availGasmaskList), []])) then {_unit setVariable[QGVAR(enteredPoison), false, true]}; - _unit setVariable [QGVAR(CS), true, true]; - _unit say3D QGVAR(cough_1); - if (hasInterface) then { - private _rndBlur = selectRandom [5, 6, 7, 8]; - ppBlur ppEffectAdjust [_rndBlur]; - ppBlur ppEffectEnable true; - ppBlur ppEffectCommit 5; - }; - } else { - if (hasInterface) then { - ppBlur ppEffectAdjust [0]; - ppBlur ppEffectEnable true; - ppBlur ppEffectCommit 20; - }; - _unit setVariable [QGVAR(CS), false, true]; - [_handler] call CBA_fnc_removePerFrameHandler; - - }; -}, 5, [_unit]] call CBA_fnc_addPerFrameHandler; - -//Position Check -[{ - params ["_param","_handler"]; - _param params ["_logic", "_radius", "_unit"]; - - if (!isDamageAllowed _unit) exitWith { - [_unit] call FUNC(fullHealLocal); - }; - - private _position = _logic getVariable [QGVAR(gas_position), [0,0,0]]; - if ( _unit distance _position > _radius || !(_logic getVariable[QGVAR(gas_active),false]) || isNull _logic ) exitWith { - _unit setVariable [QGVAR(enteredPoison), false, true]; - [_handler] call CBA_fnc_removePerFrameHandler; - }; -}, 2, [_logic, _radius, _unit]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/chemical/functions/fnc_poison.sqf b/addons/chemical/functions/fnc_poison.sqf index 6c3ea2337..33d36f239 100644 --- a/addons/chemical/functions/fnc_poison.sqf +++ b/addons/chemical/functions/fnc_poison.sqf @@ -39,14 +39,10 @@ if ((goggles _unit in (missionNamespace getVariable [QGVAR(availGasmaskList), [] switch (_gasLevel) do { case 0: { - _unit setVariable [QGVAR(poisoned), true]; - [_unit, "CSGas", 300, 30, -10, 0, -10] call ACEFUNC(medical_status,addMedicationAdjustment); - [_unit, 0.5] call ACEFUNC(medical_status,adjustPainLevel); // Adjust pain based on severity + _unit setVariable [QGVAR(CSGas), true, true]; }; case 1: { - _unit setVariable [QGVAR(poisoned), true]; - [_unit, "ToxicGas", 300, 30, -10, 0, -10] call ACEFUNC(medical_status,addMedicationAdjustment); - [_unit, 1] call ACEFUNC(medical_status,adjustPainLevel); // Adjust pain based on severity + _unit setVariable [QGVAR(airPoisoning), true, true]; }; default {}; }; diff --git a/addons/feedback/XEH_PREP.hpp b/addons/feedback/XEH_PREP.hpp index 42df1399d..9af508f92 100644 --- a/addons/feedback/XEH_PREP.hpp +++ b/addons/feedback/XEH_PREP.hpp @@ -1,4 +1,6 @@ +PREP(effectCoughing); PREP(effectLowSpO2); PREP(effectOpioid); +PREP(effectTearHaze); PREP(handleEffects); -PREP(initEffects); \ No newline at end of file +PREP(initEffects); diff --git a/addons/feedback/functions/fnc_effectCoughing.sqf b/addons/feedback/functions/fnc_effectCoughing.sqf new file mode 100644 index 000000000..4f19a0f92 --- /dev/null +++ b/addons/feedback/functions/fnc_effectCoughing.sqf @@ -0,0 +1,46 @@ +#include "..\script_component.hpp" +/* + * Author: MiszczuZPolski & Digii + * Triggers the coughing effect. + * + * Arguments: + * 0: Enable + * 1: Intensity + * + * Return Value: + * None + * + * Example: + * [true, 0.5] call kat_feedback_fnc_effectCoughing; + * + * Public: No + */ + +params ["_enable", "_poisoned"]; +if (!_enable || !_poisoned) exitWith { + if (GVAR(airPoisoning) != -1) then { GVAR(airPoisoning) ppEffectEnable false; }; +}; +if (GVAR(airPoisoning) != -1) then { GVAR(airPoisoning) ppEffectEnable true; }; + +// Trigger effect every 2s +private _showNextTick = missionNamespace getVariable [QGVAR(showCoughNextTick), true]; +GVAR(showCoughNextTick) = !_showNextTick; +if (_showNextTick) exitWith {}; + +_unit say3D QEGVAR(chemical,cough_1); +addCamShake [3, 4, 0]; + +private _initialAdjust = []; +private _delayedAdjust = []; + +private _intensity = linearConversion [0, 1, 0.5, 0, 0.06, true]; +_initialAdjust = [_intensity, _intensity, true]; +_delayedAdjust = [_intensity * 0.15, _intensity * 0.15, true]; + +GVAR(airPoisoning) ppEffectAdjust _initialAdjust; +GVAR(airPoisoning) ppEffectCommit FX_COUGH_FADE_IN; +[{ + params ["_adjust"]; + GVAR(airPoisoning) ppEffectAdjust _adjust; + GVAR(airPoisoning) ppEffectCommit FX_COUGH_FADE_OUT; +}, [_delayedAdjust], 3] call CBA_fnc_waitAndExecute; diff --git a/addons/feedback/functions/fnc_effectTearHaze.sqf b/addons/feedback/functions/fnc_effectTearHaze.sqf new file mode 100644 index 000000000..cae15fa21 --- /dev/null +++ b/addons/feedback/functions/fnc_effectTearHaze.sqf @@ -0,0 +1,31 @@ +#include "..\script_component.hpp" +/* + * Author: MiszczuZPolski & Digii + * Triggers the coughing effect. + * + * Arguments: + * 0: Enable + * 1: Intensity + * + * Return Value: + * None + * + * Example: + * [true, 0.5] call kat_feedback_fnc_effectCoughing; + * + * Public: No + */ + +params ["_enable", "_tear"]; +if (!_enable || !_tear) exitWith { + if (GVAR(tearHaze) != -1) then { GVAR(tearHaze) ppEffectEnable false; }; +}; +if (GVAR(tearHaze) != -1) then { GVAR(tearHaze) ppEffectEnable true; }; + +GVAR(tearHaze) ppEffectAdjust [1.5,0.3,0.3,1.02,1.02,1.02,1.02,0.05,0.01,0.05,0.01,0.1,0.1,0.2,0.2]; +GVAR(tearHaze) ppEffectCommit 0; + +[{ + GVAR(tearHaze) ppEffectEnable false; + GVAR(tearHaze) ppEffectCommit 1; +}, [], 10] call CBA_fnc_waitAndExecute; diff --git a/addons/feedback/functions/fnc_handleEffects.sqf b/addons/feedback/functions/fnc_handleEffects.sqf index a178e9c77..21f9c5451 100644 --- a/addons/feedback/functions/fnc_handleEffects.sqf +++ b/addons/feedback/functions/fnc_handleEffects.sqf @@ -27,6 +27,8 @@ BEGIN_COUNTER(handleEffects); private _opioid = GET_PP(ACE_player); private _spO2 = GET_SPO2(ACE_player); private _unconscious = IS_UNCONSCIOUS(ACE_player); +private _poisoned = IS_POISONED(ACE_player); +private _tear = IN_TEARGAS(ACE_player); // - Visual effects ----------------------------------------------------------- @@ -37,5 +39,8 @@ private _unconscious = IS_UNCONSCIOUS(ACE_player); linearConversion [GVAR(effectLowSpO2), EGVAR(breathing,SpO2_dieValue), _spO2, 0, 1, true] ] call FUNC(effectLowSpO2); +[!_unconscious, _poisoned] call FUNC(effectCoughing); +[!_unconscious, _tear] call FUNC(effectTearHaze); + END_COUNTER(handleEffects); diff --git a/addons/feedback/functions/fnc_initEffects.sqf b/addons/feedback/functions/fnc_initEffects.sqf index ff0cbe28b..541753abc 100644 --- a/addons/feedback/functions/fnc_initEffects.sqf +++ b/addons/feedback/functions/fnc_initEffects.sqf @@ -42,6 +42,22 @@ GVAR(opioidEffect) = [ // - Low SpO2 ----------------------------------------------------------- GVAR(lowSpO2) = [ "ColorCorrections", - 21370, + 213702, [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]] ] call _fnc_createEffect; + +GVAR(airPoisoning) = [ + "ChromAberration", + 213703, + [0, 0, true] +] call _fnc_createEffect; + +GVAR(tearHaze) = [ + "WetDistortion", + 213704, + [1, + 1, 1, + 4.10, 3.70, 2.50, 1.85, + 0.0054, 0.0041, 0.0090, 0.0070, + 0.5, 0.3, 10.0, 6.0] +] call _fnc_createEffect; diff --git a/addons/feedback/script_component.hpp b/addons/feedback/script_component.hpp index 334ceebe7..900f27db0 100644 --- a/addons/feedback/script_component.hpp +++ b/addons/feedback/script_component.hpp @@ -3,7 +3,7 @@ #include "\x\kat\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL -// #define DISABLE_COMPILE_CACHE +#define DISABLE_COMPILE_CACHE // #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_FEEDBACK @@ -20,4 +20,7 @@ #define FX_OPIOD_FADE_OUT 0.7 #define FX_SPO2_FADE_IN 0.7 -#define FX_SPO2_FADE_OUT 1.6 \ No newline at end of file +#define FX_SPO2_FADE_OUT 1.6 + +#define FX_COUGH_FADE_IN 0.3 +#define FX_COUGH_FADE_OUT 0.7 diff --git a/addons/main/script_macros.hpp b/addons/main/script_macros.hpp index d18adf1f7..97d07d5c1 100644 --- a/addons/main/script_macros.hpp +++ b/addons/main/script_macros.hpp @@ -186,7 +186,7 @@ #undef GET_SM_STATE #define GET_SM_STATE(_unit) ([_unit, ACEGVAR(medical,STATE_MACHINE)] call CBA_statemachine_fnc_getCurrentState) -#undef GET_BLOOD_VOLUME +#undef GET_BLOOD_VOLUME #define GET_OPIOID_FACTOR(unit) (unit getVariable [QEGVAR(pharma,opioidFactor), 0]) #define GET_PAIN_PERCEIVED(unit) (0 max ((GET_PAIN(unit) - GET_PAIN_SUPPRESS(unit)) min 1)) @@ -340,3 +340,6 @@ //Feedback #define VAR_PP QEGVAR(feedback,ppEffect) #define GET_PP(unit) (unit getVariable [VAR_PP, 0]) + +#define IS_POISONED(unit) (unit getVariable [QEGVAR(chemical,airPoisoning), false]) +#define IN_TEARGAS(unit) (unit getVariable [QEGVAR(chemical,CSGas), false])