From c9a6a455ec5154a46bb7f5b054d33e65562f7f42 Mon Sep 17 00:00:00 2001 From: Julian | DiGii <45559529+AtrixZockt@users.noreply.github.com> Date: Tue, 17 Dec 2024 01:54:25 +0100 Subject: [PATCH 1/2] New Particle effect for zones --- addons/chemical/CfgCloudlets.hpp | 53 +++++++++++++++++++ addons/chemical/XEH_postInit.sqf | 26 +++++++++ .../chemical/functions/fnc_gasManagerPFH.sqf | 6 +++ 3 files changed, 85 insertions(+) diff --git a/addons/chemical/CfgCloudlets.hpp b/addons/chemical/CfgCloudlets.hpp index 1fac4e64c..c8e2a852d 100644 --- a/addons/chemical/CfgCloudlets.hpp +++ b/addons/chemical/CfgCloudlets.hpp @@ -63,6 +63,59 @@ class CfgCloudlets { position[] = {0,0,0}; }; + class KAT_TOXIC_GAS_PEFFECT: Default { + interval = 0.01; + circleRadius = 0; + circleVelocity[] = {0,0,0}; + particleFSNtieth = 16; + particleFSIndex = 7; + particleFSFrameCount = 16; + particleFSLoop = 1; + angleVar = 1; + particleShape = "\A3\data_f\ParticleEffects\Universal\Universal.p3d"; + particleType = "Billboard"; + timerPeriod = 1; + lifeTime = 20; + moveVelocity[] = {0,0,0}; + rotationVelocity = 1; + weight = 100; + volume = 1; + rubbing = 0.01; + size[] = {0.1,2,0}; + color[] = + { + {0.3,0.3,0.3,0}, + {0.4,0.4,0.4,0.2}, + {0.371, 0.465, 0.044,0.3}, + {0.471, 0.565, 0.084,0.2}, + {0.671, 0.765, 0.184,0.1}, + {0.671, 0.765, 0.184,0} + }; + animationSpeed[] = {0.5,0.3}; + randomDirectionPeriod = 1; + randomDirectionIntensity = 0.04; + onTimerScript = ""; + beforeDestroyScript = ""; + lifeTimeVar = 10; + positionVar[] = {0,0,0}; + moveVelocityVar[] = {0.5,0,0.5}; + rotationVelocityVar = 10; + sizeVar = 0; + colorVar[] = {0,0,0,0.35}; + randomDirectionPeriodVar = 0; + randomDirectionIntensityVar = 0; + coreIntensity = 0; + coreDistance = 0; + damageTime = 0; + damageType = ""; + angle = 0; + position[] = {0,0,0}; + onSurface = 1; + surfaceOffset = 0; + bounceOnSurface = 0; + ignoreWind = 1; + }; + class KAT_CAS_GAS_FX: Default { interval = 0.03; circleRadius = 0; diff --git a/addons/chemical/XEH_postInit.sqf b/addons/chemical/XEH_postInit.sqf index 912450623..ccf861629 100644 --- a/addons/chemical/XEH_postInit.sqf +++ b/addons/chemical/XEH_postInit.sqf @@ -102,6 +102,26 @@ GVAR(gasSources) = createHashMap; _source setVariable [QGVAR(sealable), true, true]; }; + //Create all needed Particle effects + private _particleObjectAmount = (_radius / 10) max 1; + private _particleObjects = []; + private _particleSource; + + for "_i" from 0 to _particleObjectAmount do { + _particleSource = "#particlesource" createVehicle _sourcePos; + _particleSource setParticleClass "KAT_TOXIC_GAS_PEFFECT"; + + if (_i == 0) then { + _particleSource setParticleCircle [1, [0,0,0]]; + } else { + _particleSource setParticleCircle [_i * 10, [0,0,0]]; + }; + + _particleObjects pushBack _particleSource; + }; + + _gasLogic setVariable [QGVAR(particleObjects), _particleObjects, true]; + GVAR(gasSources) set [_hashedKey, [_gasLogic, _radius, _gasLevel, _condition, _conditionArgs]]; }] call CBA_fnc_addEventHandler; @@ -115,6 +135,12 @@ GVAR(gasSources) = createHashMap; (GVAR(gasSources) deleteAt _hashedKey) params [["_gasLogic", objNull]]; + // Delete all particle objects for this zone, if there are some + private _particleObjects = _gasLogic getVariable [QGVAR(particleObjects), []]; + { + deleteVehicle _x; + } forEach _particleObjects; + detach _gasLogic; deleteVehicle _gasLogic; }] call CBA_fnc_addEventHandler; diff --git a/addons/chemical/functions/fnc_gasManagerPFH.sqf b/addons/chemical/functions/fnc_gasManagerPFH.sqf index c49c3058b..240c58edf 100644 --- a/addons/chemical/functions/fnc_gasManagerPFH.sqf +++ b/addons/chemical/functions/fnc_gasManagerPFH.sqf @@ -26,6 +26,12 @@ if !(_conditionArgs call _condition) then { TRACE_2("condition no longer valid, deleting",_x,_y); + // Delete all particle objects for this zone, if there are some + private _particleObjects = _gasLogic getVariable [QGVAR(particleObjects), []]; + { + deleteVehicle _x; + } forEach _particleObjects; + detach _gasLogic; deleteVehicle _gasLogic; From 78c2aa9989842bbb8bcb801eac51a095d2d4bd1c Mon Sep 17 00:00:00 2001 From: MiszczuZPolski <71414303+MiszczuZPolski@users.noreply.github.com> Date: Wed, 18 Dec 2024 18:58:01 +0100 Subject: [PATCH 2/2] macro --- addons/chemical/CfgCloudlets.hpp | 2 +- addons/chemical/XEH_postInit.sqf | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/chemical/CfgCloudlets.hpp b/addons/chemical/CfgCloudlets.hpp index c8e2a852d..b67a2a5d2 100644 --- a/addons/chemical/CfgCloudlets.hpp +++ b/addons/chemical/CfgCloudlets.hpp @@ -63,7 +63,7 @@ class CfgCloudlets { position[] = {0,0,0}; }; - class KAT_TOXIC_GAS_PEFFECT: Default { + class GVAR(Toxic_Gas_Particles): Default { interval = 0.01; circleRadius = 0; circleVelocity[] = {0,0,0}; diff --git a/addons/chemical/XEH_postInit.sqf b/addons/chemical/XEH_postInit.sqf index ccf861629..1dc21a68d 100644 --- a/addons/chemical/XEH_postInit.sqf +++ b/addons/chemical/XEH_postInit.sqf @@ -109,7 +109,7 @@ GVAR(gasSources) = createHashMap; for "_i" from 0 to _particleObjectAmount do { _particleSource = "#particlesource" createVehicle _sourcePos; - _particleSource setParticleClass "KAT_TOXIC_GAS_PEFFECT"; + _particleSource setParticleClass QGVAR(Toxic_Gas_Particles); if (_i == 0) then { _particleSource setParticleCircle [1, [0,0,0]]; @@ -117,7 +117,7 @@ GVAR(gasSources) = createHashMap; _particleSource setParticleCircle [_i * 10, [0,0,0]]; }; - _particleObjects pushBack _particleSource; + _particleObjects pushBack _particleSource; }; _gasLogic setVariable [QGVAR(particleObjects), _particleObjects, true];