From 86a58887038097da6775d85130cf3398ee6bb4a1 Mon Sep 17 00:00:00 2001 From: MiszczuZPolski <71414303+MiszczuZPolski@users.noreply.github.com> Date: Thu, 12 Dec 2024 18:35:57 +0100 Subject: [PATCH] update logic --- addons/chemical/functions/fnc_poison.sqf | 24 ++++++++----------- .../vitals/functions/fnc_handlePoisoning.sqf | 2 +- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/addons/chemical/functions/fnc_poison.sqf b/addons/chemical/functions/fnc_poison.sqf index 2c6c61003..0c8d549d9 100644 --- a/addons/chemical/functions/fnc_poison.sqf +++ b/addons/chemical/functions/fnc_poison.sqf @@ -37,6 +37,13 @@ if ((goggles _unit in (missionNamespace getVariable [QGVAR(availGasmaskList), [] [QGVAR(handleGasMaskDur), _unit, _unit] call CBA_fnc_targetEvent; }; +if (_gasLevel == 0) exitWith { + _unit setVariable [QGVAR(CSGas), 30, true]; + if (random 1 <= GVAR(tearGasDropChance)) then { + [QACEGVAR(hitreactions,dropWeapon), _unit, _unit] call CBA_fnc_targetEvent; + }; +}; + //Get max infection time private _infectionTime = missionNamespace getVariable [QGVAR(infectionTime), 60]; @@ -52,18 +59,7 @@ if (_currentInfection != _newTime) then { _unit setVariable [QGVAR(infectionTime), _newTime, true]; }; -// Exit if infection reaches 0 or the unit is dead +// Exit if infection reaches 0 if (_newTime <= 0) then { - switch (_gasLevel) do { - case 0: { - _unit setVariable [QGVAR(CSGas), 30, true]; - if (random 1 <= GVAR(tearGasDropChance)) then { - [QACEGVAR(hitreactions,dropWeapon), _unit, _unit] call CBA_fnc_targetEvent; - }; - }; - case 1: { - _unit setVariable [QGVAR(airPoisoning), true, true]; - }; - default {}; - }; -}; \ No newline at end of file + _unit setVariable [QGVAR(airPoisoning), true, true]; +}; diff --git a/addons/vitals/functions/fnc_handlePoisoning.sqf b/addons/vitals/functions/fnc_handlePoisoning.sqf index f1a5561b0..b8f9e75b8 100644 --- a/addons/vitals/functions/fnc_handlePoisoning.sqf +++ b/addons/vitals/functions/fnc_handlePoisoning.sqf @@ -32,4 +32,4 @@ if !(_unit getVariable [QEGVAR(chemical,airPoisoning), false]) then { _unit setVariable [QEGVAR(chemical,infectionTime), _updateTime, true]; } else { _unit setVariable [QEGVAR(chemical,infectionTime), 0, true]; -}; \ No newline at end of file +};