Linuxdirk wrote:Yes, colored light being entirely visual in the client would be absolutely enough. Having it in the API so mods can access (read and write) this value would be a bonus (example use case: a mod that adds mobs that are afraid of red light but attracted to green light).
My thought is that dynamic colored lighting could be implemented as a special type of LuaEntitySAO, therefore no change to the database format or network protocol would even be required (I think). Here is a very basic specification that comes to mind:
Code: Select all
{
visual = "light",
visual_size = {x=1, y=1},
light = {
type = "spot",
color = "#FF000077",
curve = 0.5
focus = 1.0
},
collisionbox = { -0.5,0.0,-0.5, 0.5, 10.0, 5.0 }
intensity = 1.0,
is_visible = true,
}
The
collisionbox property specifies the bounding box of the light. The light source is always located at {0,0,0}. In the case of
"omni", the falloff is half the shortest dimension. Therefore, the bounding box should be specified as a cuboid with a center of {0,0,0} for an even falloff in all six directions. Otherwise, the falloff will be cropped. In the case of
"spot" or
"flat", the falloff is calculated as the length of
ymax minus
ymin. Therefore, the bounding box should be specified as a cuboid with
ymin of zero and with a center of zero in the
x and
z dimensions, otherwise the falloff will be cropped.
The
light.type specifies the light source type:
- "omni" for a point light source
- "spot" for elliptical beam (like from a par-can fixture)
- "flat" for rectangular beam (like from a window opening)
- "gobo" for a textured beam (like from a gobo projector)
The
light.color property specifies the color of the light as projected onto the surface of objects. It may include an optional alpha channel for transparency, otherwise it will be rendered fully opaque.
The
light.curve property specifies the brightness curve of the light from source to terminus, with 0.0 being fully logarithmic, 1.0 being fully exponential, 0.5 being linear fall-off. The terminus distance is determined by the height of the collisionbox.
The
light.focus specifies the sharpness of the beam projection, with 0.0 being fully diffuse and 1.0 being fully sharp. The diffusion is applied inwardly from the collisionbox edges to the center. This property only applies to 'flat' and 'spot' light types.
The
textures property specifies an 8-bit gobo mask to project onto the surface of objects tinted with the specified light color. If a spritesheet is defined, then the gobo mask will be animated. This property only applies to 'gobo' type lights.