1
0

fn_rayParticles.sqf 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. Author: TheTimidShade
  3. Description:
  4. Creates particles for main laser beam. Executed internally from tts_beam_fnc_beam.
  5. Parameters:
  6. 0: OBJECT - Beam emitter object passed from fnc_beam.
  7. 1: ARRAY - Colour of laser passed from fnc_beam.
  8. 2: ARRAY - Position of target object passed from fnc_beam.
  9. Returns:
  10. NONE
  11. */
  12. params ["_beamEmitter", "_col", "_targetPos"];
  13. _ray = "#particlesource" createVehicleLocal (getpos _beamEmitter);
  14. _ray setParticleCircle [0, [0, 0, -3]];
  15. _ray setParticleRandom [0, [0.25, 0.25, 0], [0.175, 0.175, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];
  16. _ray setParticleParams [["\A3\data_f\cl_exp", 1, 0, 1], "", "Billboard", 1, 3, [0, 0, 0], [0, 0, 0], 13, 10, 7.6, 0, [15,11,7,3], [[_col#0, _col#1, _col#2, 1]], [0.08], 1, 0, "", "", _ray];
  17. _ray setDropInterval 0.0025;
  18. _ray attachTo [_beamEmitter, [0,0,0]];
  19. // lights
  20. _lights = "#particlesource" createVehicleLocal (getpos _beamEmitter);
  21. _lights setParticleCircle [0, [0, 0, -3]];
  22. _lights setParticleRandom [0, [0.25, 0.25, 0], [0.175, 0.175, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];
  23. _lights setParticleParams [["\A3\data_f\VolumeLight", 1, 0, 1], "", "SpaceObject", 1, 3, [0, 0, 0], [0, 0, 0], 0, 10, 7.6, 0, [8,6,3,1], [[_col#0, _col#1, _col#2, 1]], [0.08], 1, 0, "", "", _lights];
  24. _lights setDropInterval 0.002;
  25. _lights attachTo [_beamEmitter, [0,0,0]];
  26. // lightpoint
  27. _lightp = "#lightpoint" createVehicleLocal (getpos _beamEmitter);
  28. _lightp setLightBrightness 80;
  29. _lightp setLightAmbient _col;
  30. _lightp setLightColor _col;
  31. _lightp lightAttachObject [_beamEmitter, [20,20,200]];
  32. sleep 1; // sleep to let beamEmitter accelerate first
  33. waitUntil {sleep 0.01; vectorMagnitude (velocity _beamEmitter) < 20 || _beamEmitter distance _targetPos < 5 || (getPosATL _beamEmitter)#2 < 5};
  34. sleep 0.1; // small sleep to let dust cloud get created to hide deletion of beam
  35. {deleteVehicle _x} forEach [_ray, _lights, _lightp];