overlay_lighting 
Movable atom overlay-based lighting component.
-
Component works by applying a visual object to the parent target.
-
The component tracks the parent's loc to determine the current_holder.
-
The current_holder is either the parent or its loc, whichever is on a turf. If none, then the current_holder is null and the light is not visible.
-
Lighting works at its base by applying a dark overlay and "cutting" said darkness with light, adding (possibly colored) transparency.
-
This component uses the visible_mask visual object to apply said light mask on the darkness.
-
The main limitation of this system is that it uses a limited number of pre-baked geometrical shapes, but for most uses it does the job.
-
Another limitation is for big lights: you only see the light if you see the object emiting it.
-
For small objects this is good (you can't see them behind a wall), but for big ones this quickly becomes prety clumsy.
Vars | |
| light | Datum that actually creates the overlay we manage |
|---|---|
| lum_power | How much this light affects the dynamic_lumcount of turfs. |
| lumcount_range | Ceiling of range, integer without decimal entries. |
| luminosity_turf | The turf we are currently displaying light on, if any |
Procs | |
| add_dynamic_lumi | Adds the luminosity and source for the affected movable atoms to keep track of their visibility. |
| clean_old_cells | Clears ourselves from spatial grid's dynlights lists |
| on_holder_moved | Called when current_holder changes loc. |
| on_light_eater | Handles putting the source for overlay lights into the light eater queue since we aren't tracked by /atom/var/light_sources |
| on_light_flags_change | Triggered right after the parent light flags change. |
| on_toggle | Toggles the light on and off. |
| register_new_cells | Populates the affected_turfs lazylist, adding to its contents the effects of being near the light. |
| remove_dynamic_lumi | Removes the luminosity and source for the affected movable atoms to keep track of their visibility. |
| set_color | Changes the light's color, pretty straightforward. |
| set_light_render_source | Changes the light's color, pretty straightforward. |
| set_power | Changes the intensity/brightness of the light by altering the visual object's alpha. |
| set_range | Changes the range which the light reaches. 0 means no light, 6 is the maximum value. |
| turn_off | Toggles the light off. |
| turn_on | Toggles the light on. |
| update_luminosity_cells | Clears the old affected cells and populates the new ones. |
Var Details
light 
Datum that actually creates the overlay we manage
lum_power 
How much this light affects the dynamic_lumcount of turfs.
lumcount_range 
Ceiling of range, integer without decimal entries.
luminosity_turf 
The turf we are currently displaying light on, if any
Proc Details
add_dynamic_lumi
Adds the luminosity and source for the affected movable atoms to keep track of their visibility.
clean_old_cells
Clears ourselves from spatial grid's dynlights lists
on_holder_moved
Called when current_holder changes loc.
on_light_eater
Handles putting the source for overlay lights into the light eater queue since we aren't tracked by /atom/var/light_sources
on_light_flags_change
Triggered right after the parent light flags change.
on_toggle
Toggles the light on and off.
register_new_cells
Populates the affected_turfs lazylist, adding to its contents the effects of being near the light.
remove_dynamic_lumi
Removes the luminosity and source for the affected movable atoms to keep track of their visibility.
set_color
Changes the light's color, pretty straightforward.
set_light_render_source
Changes the light's color, pretty straightforward.
set_power
Changes the intensity/brightness of the light by altering the visual object's alpha.
set_range
Changes the range which the light reaches. 0 means no light, 6 is the maximum value.
turn_off
Toggles the light off.
turn_on
Toggles the light on.
update_luminosity_cells
Clears the old affected cells and populates the new ones.