Caffeine

Effects

Reference Rendering Last updated: Lua 6 · Dryad 0

Effect components on entities: particles, volumetric light, reflective surfaces, material shades and fog.

All namespaces

Namespace: caffeine.effects

set#

Lua: caffeine.effects.set

text
set(entity, kind, quality) -> boolean

Assigns an effect kind and quality to the entity.

ParametersTypeDescription
entitynumberEntity id.
kindnumber0 Particles, 1 VolumetricLight, 2 ReflectiveSurface, 3 MaterialShade, 4 Fog; clamped to 4.
qualitynumber0 Performance, 1 Balanced, 2 Quality; clamped to 2.

Returns: boolean. true on success.

Example

lua
caffeine.effects.set(e, 0, 1)

particle#

Lua: caffeine.effects.particle

text
particle(entity, domain) -> boolean

Turns the entity into a particle emitter for the given domain.

ParametersTypeDescription
entitynumberEntity id.
domainnumber0 Both, 1 2D, 2 3D; clamped to 2.

Returns: boolean. true on success.

Example

lua
caffeine.effects.particle(e, 2)

particleParams#

Lua: caffeine.effects.particleParams

text
particleParams(entity, rate, lifetime, maxParticles, startSize, endSize, gravityY) -> boolean

Sets the particle emitter parameters.

ParametersTypeDescription
entitynumberEntity id.
ratenumberEmission rate.
lifetimenumberParticle lifetime.
maxParticlesnumberMaximum live particles.
startSizenumberSize at birth.
endSizenumberSize at death.
gravityYnumberVertical gravity.

Returns: boolean. true on success.

Example

lua
caffeine.effects.particleParams(e, 30, 2, 200, 0.2, 0.0, -1)

volumetric#

Lua: caffeine.effects.volumetric

text
volumetric(entity) -> boolean

Makes the entity a volumetric light and ensures its volume mesh.

ParametersTypeDescription
entitynumberEntity id.

Returns: boolean. true on success.

Example

lua
caffeine.effects.volumetric(lamp)

volumetricShape#

Lua: caffeine.effects.volumetricShape

text
volumetricShape(entity, shape, columns, rows) -> boolean

Sets the shape of a volumetric light.

ParametersTypeDescription
entitynumberEntity id.
shapenumber0 Sphere, 1 Cone, 2 Box, 3 Cylinder, 4 Window; clamped to 4.
columnsnumberColumn count.
rowsnumberRow count.

Returns: boolean. true on success.

Example

lua
caffeine.effects.volumetricShape(lamp, 1, 8, 8)

fog#

Lua: caffeine.effects.fog

text
fog(entity, domain, style) -> boolean

Turns the entity into a fog effect with the given style.

ParametersTypeDescription
entitynumberEntity id.
domainnumber0 Both, 1 2D, 2 3D; clamped to 2.
stylenumber0 Fog, 1 Dust, 2 Mist, 3 Smoke; clamped to 3.

Returns: boolean. true on success.

Example

lua
caffeine.effects.fog(e, 2, 2)