Lighting Overhaul & General process improvements (#1612)

This is it. The big one.
Risk: Very large. This modifies or rewrites several important systems.
Some things still need balancing, but that's probably better done if/when this hits dev.

changes:

New smooth lighting system.
Machinery split into three processes: machinery, powernet, pipenet Removed due to breakage. Refactored into multi-step process.
Mob process rewritten.
NanoUI process rewritten.
Objects process rewritten.
Tweaked color output of station lights.
Slime core lights now emit colored light.
Fixed light update frequency issue with fire alarms, hydroponics trays, and airlocks.
Increased light emission from bolted airlocks.
Miscellaneous performance improvements.
New datum pool implementation.
New lighting usage profiler.
Lighting system now tracks UV light, which is not visible to players.
Space now has a parallax effect.
Disabled Spin View verbs due to incompatibility with the new lighting system.
Disabled hallucination view spin due to incompatibility with the new lighting system.
Lighting system now initializes in the lobby before the round starts to reduce BoR deadtime.
Added UV light tracking to lighting engine; dionae now gain energy exclusively from UV light.
Added colored lighting to a few consoles that used default (white) light.
This commit is contained in:
Lohikar
2017-01-28 17:13:54 -06:00
committed by skull132
parent 2d54cad664
commit 0cba68911d
163 changed files with 2511 additions and 1329 deletions

View File

@@ -0,0 +1,97 @@
#define STAGE_NONE 0
#define STAGE_SOURCE 1
#define STAGE_CORNER 2
#define STAGE_OVERLAY 3
/var/list/lighting_update_lights = list() // List of lighting sources queued for update.
/var/list/lighting_update_corners = list() // List of lighting corners queued for update.
/var/list/lighting_update_overlays = list() // List of lighting overlays queued for update.
// Probably slow.
/var/lighting_profiling = FALSE
/var/datum/controller/process/lighting/lighting_process
/datum/controller/process/lighting
schedule_interval = LIGHTING_INTERVAL
var/list/curr_lights = list()
var/list/curr_corners = list()
var/list/curr_overlays = list()
var/list/resume_pos = 0
/datum/controller/process/lighting/setup()
name = "lighting"
lighting_process = src
/datum/controller/process/lighting/statProcess()
..()
stat(null, "[all_lighting_overlays.len] overlays ([all_lighting_corners.len] corners)")
stat(null, "Lights: [lighting_update_lights.len] queued, [curr_lights.len] processing")
stat(null, "Corners: [lighting_update_corners.len] queued, [curr_corners.len] processing")
stat(null, "Overlays: [lighting_update_overlays.len] queued, [curr_overlays.len] processing")
/datum/controller/process/lighting/doWork()
// -- SOURCES --
if (resume_pos == STAGE_NONE)
curr_lights = lighting_update_lights
lighting_update_lights = list()
resume_pos = STAGE_SOURCE
while (curr_lights.len)
var/datum/light_source/L = curr_lights[curr_lights.len]
curr_lights.len--
if(L.check() || L.destroyed || L.force_update)
L.remove_lum()
if(!L.destroyed)
L.apply_lum()
else if(L.vis_update) //We smartly update only tiles that became (in) visible to use.
L.smart_vis_update()
L.vis_update = FALSE
L.force_update = FALSE
L.needs_update = FALSE
F_SCHECK
// -- CORNERS --
if (resume_pos == STAGE_SOURCE)
curr_corners = lighting_update_corners
lighting_update_corners = list()
resume_pos = STAGE_CORNER
while (curr_corners.len)
var/datum/lighting_corner/C = curr_corners[curr_corners.len]
curr_corners.len--
C.update_overlays()
C.needs_update = FALSE
F_SCHECK
if (resume_pos == STAGE_CORNER)
curr_overlays = lighting_update_overlays
lighting_update_overlays = list()
resume_pos = STAGE_OVERLAY
while (curr_overlays.len)
var/atom/movable/lighting_overlay/O = curr_overlays[curr_overlays.len]
curr_overlays.len--
O.update_overlay()
O.needs_update = FALSE
F_SCHECK
resume_pos = 0
#undef STAGE_NONE
#undef STAGE_SOURCE
#undef STAGE_CORNER
#undef STAGE_OVERLAY