Files
Bubberstation/code/game/movable_luminosity.dm
SkyratBot 0b65cc596b [MIRROR] Overlay lighting component (#469)
* Overlay lighting component (#52413)

Sparks no longer lag, projectile beams move super smoothly, same with mobs and whatnot. This also allows for easy expansion into directional lights, field-of-view, wee-woo rotating lights or whatever.

It does have a downside: things right-clicked or checked through the alt+click tab will show the light overlay:


This is a BYOND limitation, very well worth it IMO.

🆑
add: Smooth movable lighting system implemented. Projectiles, sparks, thrown flashlights or moving mobs with lights should be much smoother and less laggy.
balance: Light sources no longer stack in range, though they still do in intensity.
/🆑

* Overlay lighting component

Co-authored-by: Rohesie <rohesie@gmail.com>
2020-08-23 20:17:12 +02:00

20 lines
650 B
Plaintext

///Keeps track of the sources of dynamic luminosity and updates our visibility with the highest.
/atom/movable/proc/update_dynamic_luminosity()
var/highest = 0
for(var/i in affected_dynamic_lights)
if(affected_dynamic_lights[i] <= highest)
continue
highest = affected_dynamic_lights[i]
if(highest == affecting_dynamic_lumi)
return
luminosity -= affecting_dynamic_lumi
affecting_dynamic_lumi = highest
luminosity += affecting_dynamic_lumi
///Helper to change several lighting overlay settings.
/atom/movable/proc/set_light_range_power_color(range, power, color)
set_light_range(range)
set_light_power(power)
set_light_color(color)