Files
braf/braf_weapons_naval/braf_functions/fn_ASMEngineSmoke.sqf
T

86 lines
1.5 KiB
Plaintext

params [
"_unit",
"_weapon",
"_muzzle",
"_mode",
"_ammo",
"_magazine",
"_projectile"
];
private _ammoConfig = configFile >> "CfgAmmo" >> _ammo;
if (
isNull _projectile ||
{!isClass _ammoConfig} ||
{getNumber (_ammoConfig >> "braf_asm") != 1}
) exitWith {};
[_projectile] spawn
{
params ["_projectile"];
sleep 1.5;
if (isNull _projectile) exitWith {};
private _fireBeg = _projectile selectionPosition ["fire_beg", "Memory"];
private _fireEnd = _projectile selectionPosition ["fire_end", "Memory"];
private _fireDirectionModel = _fireBeg vectorFromTo _fireEnd;
if (vectorMagnitude _fireDirectionModel < 0.01) exitWith {};
private _fireDirectionWorld = _projectile vectorModelToWorld _fireDirectionModel;
private _smoke = "#particlesource" createVehicleLocal [0, 0, 0];
if (isNull _smoke) exitWith {};
_smoke setParticleParams
[
["\a3\data_f\particleeffects\universal\universal", 16, 12, 8, 0],
"",
"Billboard",
1,
0.6,
"fire_beg",
_fireDirectionWorld vectorMultiply 2,
0,
0,
1.2,
0.5,
[2, 6, 8.8],
[
[0.5, 0.5, 0.5, 0.1],
[0.6, 0.6, 0.6, 0.06],
[0.7, 0.7, 0.7, 0.04],
[0.8, 0.8, 0.8, 0.005],
[0.9, 0.9, 0.9, 0.003]
],
[5],
0.1,
0.1,
"",
"",
_projectile
];
_smoke setParticleRandom
[
0.1,
[0.3, 0.3, 0.3],
[0.25, 0.25, 0.25],
20,
0.15,
[0, 0, 0, 0],
0,
0
];
_smoke setDropInterval 0.003;
_smoke attachTo [_projectile, [0, 0, 0]];
private _endTime = time + 2;
waitUntil
{
sleep 0.01;
isNull _projectile || {time >= _endTime}
};
deleteVehicle _smoke;
};