# Table `Effects`

Functions to generate effects.

## Functions

EmitLightningArc(src, dest, color, lifetime, amplitude, beamWidth, detail, smooth, endDrift) | Emit a lightning arc.
EmitParticle(pos, velocity, spriteIndex, gravity, rot, startColor, endColor, blendMode, startSize, endSize, lifetime, damage, poison) | Emit a particle.
EmitShockwave(pos, innerRadius, outerRadius, color, lifetime, speed, angle, hurtsLara) | Emit a shockwave, similar to that seen when a harpy projectile hits something.
EmitLight(pos[, color][, radius][, shadows][, name]) | Emit dynamic light that lasts for a single frame.
EmitSpotLight(pos, dir[, color][, radius][, falloff][, distance][, shadows][, name]) | Emit dynamic directional spotlight that lasts for a single frame.
EmitBlood(pos, count) | Emit blood.
EmitFire(pos, size) | Emit fire for one frame.
MakeExplosion(pos, size, shockwave) | Make an explosion.
MakeEarthquake(strength) | Make an earthquake
GetWind() | Get the wind vector for the current game frame.

## Functions

EmitLightningArc(src, dest, color, lifetime, amplitude, beamWidth, detail, smooth, endDrift)
  Emit a lightning arc.

  ### Parameters:

  - src Vec3
  - dest Vec3
  - color Color (default Color(255, 255, 255))
  - lifetime float Lifetime in seconds. Clamped to [0, 4.233] for now because of strange internal maths. (default 1.0)
  - amplitude int "strength" of the lightning - the higher the value, the "taller" the arcs. Clamped to [1, 255]. (default 20)
  - beamWidth int Clamped to [1, 127]. (default 2)
  - detail int Higher numbers equal more segments, but it's not a 1:1 correlation. Clamped to [1, 127]. (default 10)
  - smooth bool If true, the arc will have large, smooth curves; if false, it will have small, jagged spikes. (default false)
  - endDrift bool If true, the end of the arc will be able to gradually drift away from its destination in a random direction (default false)
EmitParticle(pos, velocity, spriteIndex, gravity, rot, startColor, endColor, blendMode, startSize, endSize, lifetime, damage, poison)

  Emit a particle.

       See the sprite editor in WadTool for DEFAULT_SPRITES to see a list of sprite indices.

  ### Parameters:

  - pos Vec3
  - velocity Vec3
  - spriteIndex int an index of a sprite in DEFAULT_SPRITES object.
  - gravity int (default 0) Specifies whether particle will fall (positive values) or ascend (negative values) over time. Clamped to [-32768, 32767], but values between -1000 and 1000 are recommended; values too high or too low (e.g. under -2000 or above 2000) will cause the velocity of the particle to "wrap around" and switch directions.
  - rot float (default 0) specifies a speed with which it will rotate (0 = no rotation, negative = anticlockwise rotation, positive = clockwise rotation).
  - startColor Color (default Color(255, 255, 255)) color at start of life
  - endColor Color (default Color(255, 255, 255)) color to fade to - at the time of writing this fade will finish long before the end of the particle's life due to internal maths
  - blendMode BlendID (default TEN.Effects.BlendID.ALPHABLEND) How will we blend this with its surroundings?
  - startSize int (default 10) Size on spawn. A value of 15 is approximately the size of Lara's head.
  - endSize int (default 0) Size on death - the particle will linearly shrink or grow to this size during its lifespan
  - lifetime float (default 2) Lifespan in seconds
  - damage bool (default false) specifies whether particle can damage Lara (does a very small amount of damage, like the small lava emitters in TR1)
  - poison bool (default false) specifies whether particle can poison Lara

  ### Usage:

      EmitParticle(
      	yourPositionVarHere,
      	Vec3(math.random(), math.random(), math.random()),
      	22, -- spriteIndex
      	0, -- gravity
      	-2, -- rot
      	Color(255, 0, 0), -- startColor
      	Color(0,  255, 0), -- endColor
      	TEN.Effects.BlendID.ADDITIVE, -- blendMode
      	15, -- startSize
      	50, -- endSize
      	20, -- lifetime
      	false, -- damage
      	true -- poison
      	)

EmitShockwave(pos, innerRadius, outerRadius, color, lifetime, speed, angle, hurtsLara)
  Emit a shockwave, similar to that seen when a harpy projectile hits something.

  ### Parameters:

  - pos Vec3 Origin position
  - innerRadius int (default 0) Initial inner radius of the shockwave circle - 128 will be approx a click, 512 approx a block
  - outerRadius int (default 128) Initial outer radius of the shockwave circle
  - color Color (default Color(255, 255, 255))
  - lifetime float (default 1.0) Lifetime in seconds (max 8.5 because of inner maths weirdness)
  - speed int (default 50) Initial speed of the shockwave's expansion (the shockwave will always slow as it goes)
  - angle int (default 0) Angle about the X axis - a value of 90 will cause the shockwave to be entirely vertical
  - hurtsLara bool (default false) If true, the shockwave will hurt Lara, with the damage being relative to the shockwave's current speed
EmitLight(pos[, color][, radius][, shadows][, name])
  Emit dynamic light that lasts for a single frame. If you want a light that sticks around, you must call this each frame.

  ### Parameters:

  - pos Vec3 position of the light
  - color Color light color (default Color(255, 255, 255)) (optional)
  - radius int measured in "clicks" or 256 world units (default 20) (optional)
  - shadows bool determines whether light should generate dynamic shadows for applicable moveables (default is false) (optional)
  - name string if provided, engine will interpolate this light for high framerate mode (be careful not to use same name for different lights) (optional)
EmitSpotLight(pos, dir[, color][, radius][, falloff][, distance][, shadows][, name])
  Emit dynamic directional spotlight that lasts for a single frame. If you want a light that sticks around, you must call this each frame.

  ### Parameters:

  - pos Vec3 position of the light
  - dir Vec3 direction, or a point to which spotlight should be directed to
  - color Color (default Color(255, 255, 255)) (optional)
  - radius int overall radius at the endpoint of a light cone, measured in "clicks" or 256 world units (default 10) (optional)
  - falloff int radius, at which light starts to fade out, measured in "clicks" (default 5) (optional)
  - distance int distance, at which light cone fades out, measured in "clicks" (default 20) (optional)
  - shadows bool determines whether light should generate dynamic shadows for applicable moveables (default is false) (optional)
  - name string if provided, engine will interpolate this light for high framerate mode (be careful not to use same name for different lights) (optional)
EmitBlood(pos, count)
  Emit blood.

  ### Parameters:

  - pos Vec3
  - count int (default 1) "amount" of blood. Higher numbers won't add more blood but will make it more "flickery", with higher numbers turning it into a kind of red orb.
EmitFire(pos, size)
  Emit fire for one frame. Will not hurt Lara. Call this each frame if you want a continuous fire.

  ### Parameters:

  - pos Vec3
  - size float (default 1.0)
MakeExplosion(pos, size, shockwave)
  Make an explosion. Does not hurt Lara

  ### Parameters:

  - pos Vec3
  - size float (default 512.0) this will not be the size of the sprites, but rather the distance between the origin and any additional sprites
  - shockwave bool (default false) if true, create a very faint white shockwave which will not hurt Lara
MakeEarthquake(strength)
  Make an earthquake

  ### Parameters:

  - strength int (default 100) How strong should the earthquake be? Increasing this value also increases the lifespan of the earthquake.
GetWind()
  Get the wind vector for the current game frame. This represents the 3D displacement applied by the engine on things like particles affected by wind.()

  ### Returns:

  Vec3 Wind vector.

generated by TEN-LDoc (a fork of LDoc 1.4.6)