Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chemical - Add gas particle effect for zones #664

Open
wants to merge 4 commits into
base: dev-Tomcat
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions addons/chemical/CfgCloudlets.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,59 @@ class CfgCloudlets {
position[] = {0,0,0};
};

class KAT_TOXIC_GAS_PEFFECT: Default {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
class KAT_TOXIC_GAS_PEFFECT: Default {
class GVAR(Toxic_Gas_Particles): 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;
Expand Down
26 changes: 26 additions & 0 deletions addons/chemical/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions addons/chemical/functions/fnc_gasManagerPFH.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Loading