From 0df8e463c209c832025c4c3576e8f9c2ab34b37b Mon Sep 17 00:00:00 2001 From: MiszczuZPolski <71414303+MiszczuZPolski@users.noreply.github.com> Date: Sat, 7 Dec 2024 22:51:40 +0100 Subject: [PATCH 01/12] add missing entries --- addons/chemical/XEH_preInit.sqf | 2 +- addons/chemical/stringtable.xml | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/addons/chemical/XEH_preInit.sqf b/addons/chemical/XEH_preInit.sqf index c786cc786..17dd4c740 100644 --- a/addons/chemical/XEH_preInit.sqf +++ b/addons/chemical/XEH_preInit.sqf @@ -35,7 +35,7 @@ PREP_RECOMPILE_END; [ QGVAR(gasMaskSoundVolume), "SLIDER", - [LLSTRING(SETTING_stethoscopeSoundVolume), LLSTRING(SETTING_stethoscopeSoundVolume_DESC)], + [LLSTRING(SETTING_gasMaskSoundVolume), LLSTRING(SETTING_gasMaskSoundVolume_DESC)], CBA_SETTINGS_CHEM, [0, 2, 1, 1], 2, diff --git a/addons/chemical/stringtable.xml b/addons/chemical/stringtable.xml index 9b7cf8e93..d93bc1e5f 100644 --- a/addons/chemical/stringtable.xml +++ b/addons/chemical/stringtable.xml @@ -795,5 +795,17 @@ Take off gas mask ガスマスクを外す + + Gas Mask Sound Volume + + + Determines how loud the breathing sounds are when using the stethoscope + + + Drop Weapon Chance + + + Determines chance for dropping weapon while in tear gas + From 04af51709e09c4e9d4a2511b7a1593edcc90b3d9 Mon Sep 17 00:00:00 2001 From: MiszczuZPolski <71414303+MiszczuZPolski@users.noreply.github.com> Date: Sat, 7 Dec 2024 23:10:34 +0100 Subject: [PATCH 02/12] module now support zones without object --- addons/chemical/functions/fnc_gasmodule.sqf | 2 ++ addons/chemical/functions/fnc_ui_gasModule.sqf | 12 ++++++++---- addons/chemical/stringtable.xml | 4 ---- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/addons/chemical/functions/fnc_gasmodule.sqf b/addons/chemical/functions/fnc_gasmodule.sqf index f80c2fe21..15a57154f 100644 --- a/addons/chemical/functions/fnc_gasmodule.sqf +++ b/addons/chemical/functions/fnc_gasmodule.sqf @@ -22,6 +22,8 @@ private _radius = _logic getVariable ["Radius", 20]; private _gasLevel = _logic getVariable ["GAS_type", 0]; private _isSealable = _logic getVariable ["IsSealable", false]; +if (count _units == 0) then {_units pushBack _logic;}; + if (!_activated) exitWith {}; if (isServer) then { diff --git a/addons/chemical/functions/fnc_ui_gasModule.sqf b/addons/chemical/functions/fnc_ui_gasModule.sqf index c359f333a..7a229d7ce 100644 --- a/addons/chemical/functions/fnc_ui_gasModule.sqf +++ b/addons/chemical/functions/fnc_ui_gasModule.sqf @@ -47,9 +47,6 @@ if !(isNull attachedTo _logic) then { }; default {}; }; - -} else { - [LLSTRING(OnlyObject)] call _fnc_errorAndClose; }; private _fnc_onUnload = { @@ -78,8 +75,15 @@ private _fnc_onConfirm = { private _gasLevel = _display getVariable [QGVAR(ui_gastype), 0]; private _radius = _display getVariable [QGVAR(ui_radius), 20]; private _isSealable = _display getVariable [QGVAR(ui_sealable), false]; + private _center = objNull; + + if (isNull attachedTo _logic) then { + _center = _logic; + } else { + _center = attachedTo _logic; + }; - [QGVAR(addGasSource), [attachedTo _logic, _radius, _gasLevel, _logic, { + [QGVAR(addGasSource), [_center, _radius, _gasLevel, _logic, { params ["_endTime", "_logic"]; // If logic no longer exists, exit diff --git a/addons/chemical/stringtable.xml b/addons/chemical/stringtable.xml index d93bc1e5f..b82cc628b 100644 --- a/addons/chemical/stringtable.xml +++ b/addons/chemical/stringtable.xml @@ -783,10 +783,6 @@ Determines how loud the breathing sounds are when using the gas mask ガスマスク使用時の呼吸音の大きさを設定します - - Must be placed on object - オブジェクトに配置する必要があります - Put on gas mask ガスマスクを装着 From b5d45c8ce39f2b4cbf6c560f62d3b7f82ae4ae3a Mon Sep 17 00:00:00 2001 From: MiszczuZPolski <71414303+MiszczuZPolski@users.noreply.github.com> Date: Sun, 8 Dec 2024 00:28:25 +0100 Subject: [PATCH 03/12] infectionTime --- addons/chemical/XEH_preInit.sqf | 12 +++++- .../chemical/functions/fnc_fullHealLocal.sqf | 1 + .../functions/fnc_handleGasMaskDur.sqf | 4 +- addons/chemical/functions/fnc_poison.sqf | 38 ++++++++++++++----- addons/chemical/stringtable.xml | 4 +- .../vitals/functions/fnc_handlePoisoning.sqf | 8 ++++ 6 files changed, 52 insertions(+), 15 deletions(-) diff --git a/addons/chemical/XEH_preInit.sqf b/addons/chemical/XEH_preInit.sqf index 17dd4c740..bb2ccaa81 100644 --- a/addons/chemical/XEH_preInit.sqf +++ b/addons/chemical/XEH_preInit.sqf @@ -45,7 +45,7 @@ PREP_RECOMPILE_END; false ] call CBA_Settings_fnc_init; -// Chance of weapon drop by tear gas +// Infection time [ QGVAR(tearGasDropChance), "SLIDER", @@ -54,4 +54,14 @@ PREP_RECOMPILE_END; [0, 1, 0, 2, true], true ] call CBA_Settings_fnc_init; + +// Chance of weapon drop by tear gas +[ + QGVAR(infectionTime), + "SLIDER", + [LLSTRING(SETTING_infectionTime), LLSTRING(SETTING_infectionTime_DESC)], + CBA_SETTINGS_CHEM, + [0, 3600, 60, 0, true], + true +] call CBA_Settings_fnc_init; ADDON = true; diff --git a/addons/chemical/functions/fnc_fullHealLocal.sqf b/addons/chemical/functions/fnc_fullHealLocal.sqf index e749952a0..d9d46d734 100644 --- a/addons/chemical/functions/fnc_fullHealLocal.sqf +++ b/addons/chemical/functions/fnc_fullHealLocal.sqf @@ -21,3 +21,4 @@ TRACE_1("fullHealLocal kat chemical",_patient); _patient setVariable [QGVAR(gasmask_durability), 10, true]; _patient setVariable [QGVAR(CSGas), 0, true]; _patient setVariable [QGVAR(airPoisoning), false, true]; +_patient setVariable [QGVAR(infectionTime), missionNamespace getVariable [QGVAR(infectionTime), 60], true]; diff --git a/addons/chemical/functions/fnc_handleGasMaskDur.sqf b/addons/chemical/functions/fnc_handleGasMaskDur.sqf index 1b0d62ca6..25e65052c 100644 --- a/addons/chemical/functions/fnc_handleGasMaskDur.sqf +++ b/addons/chemical/functions/fnc_handleGasMaskDur.sqf @@ -27,8 +27,8 @@ private _currentHealth = _unit getVariable [QGVAR(gasmask_durability), 10]; // D // Scale the current health (0-10) to the actual time left based on maxTime private _timeLeft = (_currentHealth / 10) * _maxTime; // Convert 0-10 health scale to time left -// Reduce the time left by 1 seconds (each tick reduces by 1 seconds) -_timeLeft = _timeLeft - 1; +// Reduce the time left by 0.25 seconds (each tick reduces by 0.25 seconds) +_timeLeft = _timeLeft - 0.25; // Prevent negative durability _timeLeft = _timeLeft max 0; diff --git a/addons/chemical/functions/fnc_poison.sqf b/addons/chemical/functions/fnc_poison.sqf index e5719029c..fa0c5583e 100644 --- a/addons/chemical/functions/fnc_poison.sqf +++ b/addons/chemical/functions/fnc_poison.sqf @@ -37,15 +37,33 @@ if ((goggles _unit in (missionNamespace getVariable [QGVAR(availGasmaskList), [] [QGVAR(handleGasMaskDur), _unit, _unit] call CBA_fnc_targetEvent; }; -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; +//Get max infection time +private _infectionTime = missionNamespace getVariable [QGVAR(infectionTime), 60]; + +//Get current time left for player +private _currentInfection = _unit getVariable [QGVAR(infectionTime), 60]; + +private _timeLeft = _currentInfection - 0.25; +_timeLeft = _timeLeft max 0; + +private _newTime = _timeLeft; + +if (_currentInfection != _newTime) then { + _unit setVariable [QGVAR(infectionTime), _newTime, true]; +}; + +// Exit if infection reaches 0 or the unit is dead +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 {}; }; - case 1: { - _unit setVariable [QGVAR(airPoisoning), true, true]; - }; - default {}; -}; +}; \ No newline at end of file diff --git a/addons/chemical/stringtable.xml b/addons/chemical/stringtable.xml index b82cc628b..fb43f43fb 100644 --- a/addons/chemical/stringtable.xml +++ b/addons/chemical/stringtable.xml @@ -61,7 +61,7 @@ Определяет, как долго вы можете находиться в газе с противогазом без заражения. Bepaald hoelang je in gas kan staan zonder dat je geïnfecteerd raakt. - + Time until infection Tiempo hasta la infeccion Zeit bis zur Infektion @@ -76,7 +76,7 @@ Время до заражения Tijd tot infectie - + Time you can stand in the gas before you get infected or need a gas mask. Tiempo que puedes resistir en el gas hasta que resultes infectado o requieras una mascara de gas Die Zeit, in der man im Gas stehen kann, bevor man infiziert wird bzw. eine Gasmaske benötigt. diff --git a/addons/vitals/functions/fnc_handlePoisoning.sqf b/addons/vitals/functions/fnc_handlePoisoning.sqf index 25607fd3f..8ac7adbbd 100644 --- a/addons/vitals/functions/fnc_handlePoisoning.sqf +++ b/addons/vitals/functions/fnc_handlePoisoning.sqf @@ -23,3 +23,11 @@ params ["_unit", "_poisonAdjustment", "_deltaT", "_syncValue"]; private _currentCS = _unit getVariable [QEGVAR(chemical,CSGas), 0]; _unit setVariable [QEGVAR(chemical,CSGas), (_currentCS - (_poisonAdjustment * _deltaT)) max 0, _syncValue]; + +if !(_unit getVariable [QEGVAR(chemical,areaIntensity), 0] > 0) then { + private _currentInfection = _unit getVariable [QEGVAR(chemical,infectionTime), missionNamespace getVariable [QEGVAR(chemical,infectionTime), 60]]; + private _updateTime = _currentInfection + (1 * _deltaT); + _updateTime = _updateTime min (missionNamespace getVariable [QEGVAR(chemical,infectionTime), 60]); + + _unit setVariable [QEGVAR(chemical,infectionTime), _updateTime, true]; +}; From 17a9634fdd0dc08a22b23eeaed52c6c29cd3f94d Mon Sep 17 00:00:00 2001 From: MiszczuZPolski <71414303+MiszczuZPolski@users.noreply.github.com> Date: Sun, 8 Dec 2024 00:29:56 +0100 Subject: [PATCH 04/12] Update fnc_handlePoisoning.sqf --- addons/vitals/functions/fnc_handlePoisoning.sqf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/vitals/functions/fnc_handlePoisoning.sqf b/addons/vitals/functions/fnc_handlePoisoning.sqf index 8ac7adbbd..ad29f7ee6 100644 --- a/addons/vitals/functions/fnc_handlePoisoning.sqf +++ b/addons/vitals/functions/fnc_handlePoisoning.sqf @@ -25,9 +25,9 @@ private _currentCS = _unit getVariable [QEGVAR(chemical,CSGas), 0]; _unit setVariable [QEGVAR(chemical,CSGas), (_currentCS - (_poisonAdjustment * _deltaT)) max 0, _syncValue]; if !(_unit getVariable [QEGVAR(chemical,areaIntensity), 0] > 0) then { - private _currentInfection = _unit getVariable [QEGVAR(chemical,infectionTime), missionNamespace getVariable [QEGVAR(chemical,infectionTime), 60]]; - private _updateTime = _currentInfection + (1 * _deltaT); - _updateTime = _updateTime min (missionNamespace getVariable [QEGVAR(chemical,infectionTime), 60]); + private _currentInfection = _unit getVariable [QEGVAR(chemical,infectionTime), missionNamespace getVariable [QEGVAR(chemical,infectionTime), 60]]; + private _updateTime = _currentInfection + (1 * _deltaT); + _updateTime = _updateTime min (missionNamespace getVariable [QEGVAR(chemical,infectionTime), 60]); - _unit setVariable [QEGVAR(chemical,infectionTime), _updateTime, true]; + _unit setVariable [QEGVAR(chemical,infectionTime), _updateTime, true]; }; From e64849bb6fa82f32892ea4e93f7cd16417625cb8 Mon Sep 17 00:00:00 2001 From: MiszczuZPolski <71414303+MiszczuZPolski@users.noreply.github.com> Date: Sun, 8 Dec 2024 00:31:23 +0100 Subject: [PATCH 05/12] Update stringtable.xml --- addons/chemical/stringtable.xml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/addons/chemical/stringtable.xml b/addons/chemical/stringtable.xml index fb43f43fb..44d9f24b6 100644 --- a/addons/chemical/stringtable.xml +++ b/addons/chemical/stringtable.xml @@ -791,12 +791,6 @@ Take off gas mask ガスマスクを外す - - Gas Mask Sound Volume - - - Determines how loud the breathing sounds are when using the stethoscope - Drop Weapon Chance From 7ad0bba68daafcb2a2e97d026acff484c5b5f138 Mon Sep 17 00:00:00 2001 From: MiszczuZPolski <71414303+MiszczuZPolski@users.noreply.github.com> Date: Sun, 8 Dec 2024 00:33:37 +0100 Subject: [PATCH 06/12] Update XEH_preInit.sqf --- addons/chemical/XEH_preInit.sqf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/chemical/XEH_preInit.sqf b/addons/chemical/XEH_preInit.sqf index bb2ccaa81..24ffb6cdb 100644 --- a/addons/chemical/XEH_preInit.sqf +++ b/addons/chemical/XEH_preInit.sqf @@ -45,7 +45,7 @@ PREP_RECOMPILE_END; false ] call CBA_Settings_fnc_init; -// Infection time +// Chance of weapon drop by tear gas [ QGVAR(tearGasDropChance), "SLIDER", @@ -55,13 +55,13 @@ PREP_RECOMPILE_END; true ] call CBA_Settings_fnc_init; -// Chance of weapon drop by tear gas +// Infection time [ QGVAR(infectionTime), - "SLIDER", + "TIME", [LLSTRING(SETTING_infectionTime), LLSTRING(SETTING_infectionTime_DESC)], CBA_SETTINGS_CHEM, - [0, 3600, 60, 0, true], + [0, 3600, 60], true ] call CBA_Settings_fnc_init; ADDON = true; From 490b3949e6f0ffee9566dc9b19f91f67278d400d Mon Sep 17 00:00:00 2001 From: mazinskihenry <33608576+mazinskihenry@users.noreply.github.com> Date: Wed, 11 Dec 2024 22:37:25 -0800 Subject: [PATCH 07/12] Update fnc_handlePoisoning.sqf --- addons/vitals/functions/fnc_handlePoisoning.sqf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/vitals/functions/fnc_handlePoisoning.sqf b/addons/vitals/functions/fnc_handlePoisoning.sqf index ad29f7ee6..07a1d18c1 100644 --- a/addons/vitals/functions/fnc_handlePoisoning.sqf +++ b/addons/vitals/functions/fnc_handlePoisoning.sqf @@ -24,10 +24,12 @@ private _currentCS = _unit getVariable [QEGVAR(chemical,CSGas), 0]; _unit setVariable [QEGVAR(chemical,CSGas), (_currentCS - (_poisonAdjustment * _deltaT)) max 0, _syncValue]; -if !(_unit getVariable [QEGVAR(chemical,areaIntensity), 0] > 0) then { +if (_unit getVariable [QEGVAR(chemical,airPoisoning), false]) then { private _currentInfection = _unit getVariable [QEGVAR(chemical,infectionTime), missionNamespace getVariable [QEGVAR(chemical,infectionTime), 60]]; private _updateTime = _currentInfection + (1 * _deltaT); _updateTime = _updateTime min (missionNamespace getVariable [QEGVAR(chemical,infectionTime), 60]); _unit setVariable [QEGVAR(chemical,infectionTime), _updateTime, true]; -}; +} else { + _unit setVariable [QEGVAR(chemical,infectionTime), 0, true]; +}; \ No newline at end of file From dc5d0325d43f0207ddaf687fa1dcf2262b6cccb8 Mon Sep 17 00:00:00 2001 From: mazinskihenry <33608576+mazinskihenry@users.noreply.github.com> Date: Wed, 11 Dec 2024 23:01:51 -0800 Subject: [PATCH 08/12] Change PFH delay --- addons/chemical/functions/fnc_handleGasMaskDur.sqf | 4 ++-- addons/chemical/functions/fnc_poison.sqf | 2 +- addons/chemical/script_component.hpp | 2 +- addons/vitals/functions/fnc_handlePoisoning.sqf | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/chemical/functions/fnc_handleGasMaskDur.sqf b/addons/chemical/functions/fnc_handleGasMaskDur.sqf index 25e65052c..1b0d62ca6 100644 --- a/addons/chemical/functions/fnc_handleGasMaskDur.sqf +++ b/addons/chemical/functions/fnc_handleGasMaskDur.sqf @@ -27,8 +27,8 @@ private _currentHealth = _unit getVariable [QGVAR(gasmask_durability), 10]; // D // Scale the current health (0-10) to the actual time left based on maxTime private _timeLeft = (_currentHealth / 10) * _maxTime; // Convert 0-10 health scale to time left -// Reduce the time left by 0.25 seconds (each tick reduces by 0.25 seconds) -_timeLeft = _timeLeft - 0.25; +// Reduce the time left by 1 seconds (each tick reduces by 1 seconds) +_timeLeft = _timeLeft - 1; // Prevent negative durability _timeLeft = _timeLeft max 0; diff --git a/addons/chemical/functions/fnc_poison.sqf b/addons/chemical/functions/fnc_poison.sqf index fa0c5583e..2c6c61003 100644 --- a/addons/chemical/functions/fnc_poison.sqf +++ b/addons/chemical/functions/fnc_poison.sqf @@ -43,7 +43,7 @@ private _infectionTime = missionNamespace getVariable [QGVAR(infectionTime), 60] //Get current time left for player private _currentInfection = _unit getVariable [QGVAR(infectionTime), 60]; -private _timeLeft = _currentInfection - 0.25; +private _timeLeft = _currentInfection - 1; _timeLeft = _timeLeft max 0; private _newTime = _timeLeft; diff --git a/addons/chemical/script_component.hpp b/addons/chemical/script_component.hpp index c36096d72..aee23a6cd 100644 --- a/addons/chemical/script_component.hpp +++ b/addons/chemical/script_component.hpp @@ -25,4 +25,4 @@ #define X_PART(num) (W_PART(num) + (safeZoneX + (safeZoneW - SIZEX) / 2)) #define Y_PART(num) (H_PART(num) + (safeZoneY + (safeZoneH - SIZEY) / 2)) -#define GAS_MANAGER_PFH_DELAY 0.25 +#define GAS_MANAGER_PFH_DELAY 1 diff --git a/addons/vitals/functions/fnc_handlePoisoning.sqf b/addons/vitals/functions/fnc_handlePoisoning.sqf index 07a1d18c1..4efe64c97 100644 --- a/addons/vitals/functions/fnc_handlePoisoning.sqf +++ b/addons/vitals/functions/fnc_handlePoisoning.sqf @@ -24,12 +24,12 @@ private _currentCS = _unit getVariable [QEGVAR(chemical,CSGas), 0]; _unit setVariable [QEGVAR(chemical,CSGas), (_currentCS - (_poisonAdjustment * _deltaT)) max 0, _syncValue]; -if (_unit getVariable [QEGVAR(chemical,airPoisoning), false]) then { +if !(_unit getVariable [QEGVAR(chemical,airPoisoning), false]) then { private _currentInfection = _unit getVariable [QEGVAR(chemical,infectionTime), missionNamespace getVariable [QEGVAR(chemical,infectionTime), 60]]; private _updateTime = _currentInfection + (1 * _deltaT); _updateTime = _updateTime min (missionNamespace getVariable [QEGVAR(chemical,infectionTime), 60]); _unit setVariable [QEGVAR(chemical,infectionTime), _updateTime, true]; } else { - _unit setVariable [QEGVAR(chemical,infectionTime), 0, true]; + _unit setVariable [QEGVAR(chemical,infectionTime), 60, true]; }; \ No newline at end of file From 4e46d4437a86637d42df89fd3a57f0dd91d5269b Mon Sep 17 00:00:00 2001 From: mazinskihenry <33608576+mazinskihenry@users.noreply.github.com> Date: Wed, 11 Dec 2024 23:07:26 -0800 Subject: [PATCH 09/12] Update fnc_handlePoisoning.sqf --- addons/vitals/functions/fnc_handlePoisoning.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/vitals/functions/fnc_handlePoisoning.sqf b/addons/vitals/functions/fnc_handlePoisoning.sqf index 4efe64c97..f1a5561b0 100644 --- a/addons/vitals/functions/fnc_handlePoisoning.sqf +++ b/addons/vitals/functions/fnc_handlePoisoning.sqf @@ -31,5 +31,5 @@ if !(_unit getVariable [QEGVAR(chemical,airPoisoning), false]) then { _unit setVariable [QEGVAR(chemical,infectionTime), _updateTime, true]; } else { - _unit setVariable [QEGVAR(chemical,infectionTime), 60, true]; + _unit setVariable [QEGVAR(chemical,infectionTime), 0, true]; }; \ No newline at end of file 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 10/12] 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 +}; From cd28c9a944b959906f13ecef4977b429c52473bb Mon Sep 17 00:00:00 2001 From: mazinskihenry <33608576+mazinskihenry@users.noreply.github.com> Date: Thu, 12 Dec 2024 12:20:47 -0800 Subject: [PATCH 11/12] Add infectionArray --- .../chemical/functions/fnc_fullHealLocal.sqf | 1 + .../chemical/functions/fnc_gasManagerPFH.sqf | 5 +++-- addons/chemical/functions/fnc_poison.sqf | 12 ++++++++++-- .../vitals/functions/fnc_handlePoisoning.sqf | 19 ++++++++++++++++--- 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/addons/chemical/functions/fnc_fullHealLocal.sqf b/addons/chemical/functions/fnc_fullHealLocal.sqf index d9d46d734..5874a2e37 100644 --- a/addons/chemical/functions/fnc_fullHealLocal.sqf +++ b/addons/chemical/functions/fnc_fullHealLocal.sqf @@ -22,3 +22,4 @@ _patient setVariable [QGVAR(gasmask_durability), 10, true]; _patient setVariable [QGVAR(CSGas), 0, true]; _patient setVariable [QGVAR(airPoisoning), false, true]; _patient setVariable [QGVAR(infectionTime), missionNamespace getVariable [QGVAR(infectionTime), 60], true]; +_patient setVariable [QGVAR(infectionArray), [], true]; \ No newline at end of file diff --git a/addons/chemical/functions/fnc_gasManagerPFH.sqf b/addons/chemical/functions/fnc_gasManagerPFH.sqf index f4fb22083..c49c3058b 100644 --- a/addons/chemical/functions/fnc_gasManagerPFH.sqf +++ b/addons/chemical/functions/fnc_gasManagerPFH.sqf @@ -20,6 +20,8 @@ _y params ["_gasLogic", "_radius", "_gasLevel", "_condition", "_conditionArgs", "_isSealable"]; TRACE_2("gasManagerPFH loop",_x,_y); + private _infectedObject = _y; + // Remove when condition is no longer valid if !(_conditionArgs call _condition) then { TRACE_2("condition no longer valid, deleting",_x,_y); @@ -34,7 +36,6 @@ // Poison units (alive or dead) close to the gas source { - // Get the distance of the unit from the center of the sphere (_gasLogic) private _distance = _x distance _gasLogic; @@ -46,7 +47,7 @@ _x setVariable [QGVAR(areaIntensity), _intensity, true]; - [QGVAR(poison), [_x, _gasLevel], _x] call CBA_fnc_targetEvent; + [QGVAR(poison), [_x, _gasLevel, _infectedObject], _x] call CBA_fnc_targetEvent; } forEach nearestObjects [_gasLogic, ["CAManBase"], _radius]; } forEach GVAR(gasSources); diff --git a/addons/chemical/functions/fnc_poison.sqf b/addons/chemical/functions/fnc_poison.sqf index 0c8d549d9..9958334f6 100644 --- a/addons/chemical/functions/fnc_poison.sqf +++ b/addons/chemical/functions/fnc_poison.sqf @@ -15,7 +15,7 @@ * Public: No */ -params ["_unit", "_gasLevel"]; +params ["_unit", "_gasLevel", "_infectedObject"]; // Check if unit is remote (objNull is remote) if (!local _unit) exitWith { @@ -44,6 +44,14 @@ if (_gasLevel == 0) exitWith { }; }; +private _currentInfectionArray = _unit getVariable [QGVAR(infectionArray), []]; + +if ((_currentInfectionArray findIf { _x isEqualTo _infectedObject}) == -1) then { + _currentInfectionArray append [_infectedObject]; +}; + +_unit setVariable [QGVAR(infectionArray), _currentInfectionArray, true]; + //Get max infection time private _infectionTime = missionNamespace getVariable [QGVAR(infectionTime), 60]; @@ -62,4 +70,4 @@ if (_currentInfection != _newTime) then { // Exit if infection reaches 0 if (_newTime <= 0) then { _unit setVariable [QGVAR(airPoisoning), true, true]; -}; +}; \ No newline at end of file diff --git a/addons/vitals/functions/fnc_handlePoisoning.sqf b/addons/vitals/functions/fnc_handlePoisoning.sqf index b8f9e75b8..c150c5eae 100644 --- a/addons/vitals/functions/fnc_handlePoisoning.sqf +++ b/addons/vitals/functions/fnc_handlePoisoning.sqf @@ -24,12 +24,25 @@ private _currentCS = _unit getVariable [QEGVAR(chemical,CSGas), 0]; _unit setVariable [QEGVAR(chemical,CSGas), (_currentCS - (_poisonAdjustment * _deltaT)) max 0, _syncValue]; -if !(_unit getVariable [QEGVAR(chemical,airPoisoning), false]) then { +private _infectionArray = _unit getVariable [QEGVAR(chemical,infectionArray), []]; + +if (count _infectionArray == 0) then { private _currentInfection = _unit getVariable [QEGVAR(chemical,infectionTime), missionNamespace getVariable [QEGVAR(chemical,infectionTime), 60]]; private _updateTime = _currentInfection + (1 * _deltaT); _updateTime = _updateTime min (missionNamespace getVariable [QEGVAR(chemical,infectionTime), 60]); _unit setVariable [QEGVAR(chemical,infectionTime), _updateTime, true]; } else { - _unit setVariable [QEGVAR(chemical,infectionTime), 0, true]; -}; + { + _x params ["_gasLogic", "_radius", "_gasLevel", "_condition", "_conditionArgs", "_isSealable"]; + + // Get the distance of the unit from the center of the sphere (_gasLogic) + private _distance = _unit distance _gasLogic; + + if (_distance > _radius) then { + _infectionArray deleteAt _forEachIndex; + }; + } forEach _infectionArray; + + _unit setVariable [QEGVAR(chemical,infectionArray), _infectionArray, true]; +}; \ No newline at end of file From 26e294f87d694f8f90d8e6bf9ce92763f983f17c Mon Sep 17 00:00:00 2001 From: mazinskihenry <33608576+mazinskihenry@users.noreply.github.com> Date: Thu, 12 Dec 2024 21:20:21 -0800 Subject: [PATCH 12/12] Update fnc_handleSimpleVitals.sqf --- addons/vitals/functions/fnc_handleSimpleVitals.sqf | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/vitals/functions/fnc_handleSimpleVitals.sqf b/addons/vitals/functions/fnc_handleSimpleVitals.sqf index ca3c9d8c4..4645f4ff4 100644 --- a/addons/vitals/functions/fnc_handleSimpleVitals.sqf +++ b/addons/vitals/functions/fnc_handleSimpleVitals.sqf @@ -71,6 +71,7 @@ if !(_adjustments isEqualTo []) then { private _heartRate = [_unit, _hrTargetAdjustment, _deltaT, _syncValues] call ACEFUNC(medical_vitals,updateHeartRate); //Rename [_unit, _painSupressAdjustment, _deltaT, _syncValues] call ACEFUNC(medical_vitals,updatePainSuppress); //Leave alone +[_unit, POISON_DECREASE, _deltaT, _syncValues] call FUNC(handlePoisoning); private _bloodPressure = [80,120]; _unit setVariable [VAR_BLOOD_PRESS, _bloodPressure, _syncValues];