Effects
Effect components on entities: particles, volumetric light, reflective surfaces, material shades and fog.
Namespace: caffeine.effects
set#
Lua: caffeine.effects.set
set(entity, kind, quality) -> boolean
Assigns an effect kind and quality to the entity.
| Parameters | Type | Description |
|---|---|---|
entity | number | Entity id. |
kind | number | 0 Particles, 1 VolumetricLight, 2 ReflectiveSurface, 3 MaterialShade, 4 Fog; clamped to 4. |
quality | number | 0 Performance, 1 Balanced, 2 Quality; clamped to 2. |
Returns: boolean. true on success.
Example
caffeine.effects.set(e, 0, 1)
particle#
Lua: caffeine.effects.particle
particle(entity, domain) -> boolean
Turns the entity into a particle emitter for the given domain.
| Parameters | Type | Description |
|---|---|---|
entity | number | Entity id. |
domain | number | 0 Both, 1 2D, 2 3D; clamped to 2. |
Returns: boolean. true on success.
Example
caffeine.effects.particle(e, 2)
particleParams#
Lua: caffeine.effects.particleParams
particleParams(entity, rate, lifetime, maxParticles, startSize, endSize, gravityY) -> boolean
Sets the particle emitter parameters.
| Parameters | Type | Description |
|---|---|---|
entity | number | Entity id. |
rate | number | Emission rate. |
lifetime | number | Particle lifetime. |
maxParticles | number | Maximum live particles. |
startSize | number | Size at birth. |
endSize | number | Size at death. |
gravityY | number | Vertical gravity. |
Returns: boolean. true on success.
Example
caffeine.effects.particleParams(e, 30, 2, 200, 0.2, 0.0, -1)
volumetric#
Lua: caffeine.effects.volumetric
volumetric(entity) -> boolean
Makes the entity a volumetric light and ensures its volume mesh.
| Parameters | Type | Description |
|---|---|---|
entity | number | Entity id. |
Returns: boolean. true on success.
Example
caffeine.effects.volumetric(lamp)
volumetricShape#
Lua: caffeine.effects.volumetricShape
volumetricShape(entity, shape, columns, rows) -> boolean
Sets the shape of a volumetric light.
| Parameters | Type | Description |
|---|---|---|
entity | number | Entity id. |
shape | number | 0 Sphere, 1 Cone, 2 Box, 3 Cylinder, 4 Window; clamped to 4. |
columns | number | Column count. |
rows | number | Row count. |
Returns: boolean. true on success.
Example
caffeine.effects.volumetricShape(lamp, 1, 8, 8)
fog#
Lua: caffeine.effects.fog
fog(entity, domain, style) -> boolean
Turns the entity into a fog effect with the given style.
| Parameters | Type | Description |
|---|---|---|
entity | number | Entity id. |
domain | number | 0 Both, 1 2D, 2 3D; clamped to 2. |
style | number | 0 Fog, 1 Dust, 2 Mist, 3 Smoke; clamped to 3. |
Returns: boolean. true on success.
Example
caffeine.effects.fog(e, 2, 2)