Early Assets, Lateloaded Assets, and Debugging Tools (#4696)

<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request
Various asset systems I want in before more TGUI work. and also
byond-tracy support... and also light update debugging...
## Changelog
🆑
tweak: Chem Master UI has been reworked slightly.
This commit is contained in:
Zandario
2022-11-20 17:36:24 -07:00
committed by GitHub
parent d477ee4e43
commit 7bf4c2a34f
191 changed files with 2507 additions and 1591 deletions
+31 -10
View File
@@ -1,14 +1,18 @@
// Because we can control each corner of every lighting object.
// And corners get shared between multiple turfs (unless you're on the corners of the map, then 1 corner doesn't).
// For the record: these should never ever ever be deleted, even if the turf doesn't have dynamic lighting.
/**
* Because we can control each corner of every lighting object.
* And corners get shared between multiple turfs (unless you're on the corners of the map, then 1 corner doesn't).
* For the record: these should never ever ever be deleted, even if the turf doesn't have dynamic lighting.
*/
/datum/lighting_corner
var/turf/northeast
var/turf/northwest
var/turf/southeast
var/turf/southwest
var/list/datum/light_source/affecting // Light sources affecting us.
var/active = FALSE // TRUE if one of our masters has dynamic lighting.
/// Light sources affecting us.
var/list/datum/light_source/affecting
/// TRUE if one of our masters has dynamic lighting.
var/active = FALSE
var/x = 0
var/y = 0
@@ -72,10 +76,15 @@
active = TRUE
// God that was a mess, now to do the rest of the corner code! Hooray!
/datum/lighting_corner/proc/update_lumcount(var/delta_r, var/delta_g, var/delta_b)
/datum/lighting_corner/proc/update_lumcount(delta_r, delta_g, delta_b)
if ((abs(delta_r)+abs(delta_g)+abs(delta_b)) == 0)
#ifdef VISUALIZE_LIGHT_UPDATES
if (!GLOB.allow_duped_values && !(delta_r || delta_g || delta_b)) // 0 is falsey ok
return
#else
if (!(delta_r || delta_g || delta_b)) // 0 is falsey ok
return
#endif
lum_r += delta_r
lum_g += delta_g
@@ -86,7 +95,7 @@
GLOB.lighting_update_corners += src
/datum/lighting_corner/proc/update_objects()
// Cache these values a head of time so 4 individual lighting objects don't all calculate them individually.
// Cache these values ahead of time so 4 individual lighting objects don't all calculate them individually.
var/lum_r = src.lum_r
var/lum_g = src.lum_g
var/lum_b = src.lum_b
@@ -95,6 +104,10 @@
if (mx > 1)
. = 1 / mx
var/old_r = cache_r
var/old_g = cache_g
var/old_b = cache_b
#if LIGHTING_SOFT_THRESHOLD != 0
else if (mx < LIGHTING_SOFT_THRESHOLD)
. = 0 // 0 means soft lighting.
@@ -109,6 +122,14 @@
#endif
cache_mx = round(mx, LIGHTING_ROUND_VALUE)
#ifdef VISUALIZE_LIGHT_UPDATES
if(!GLOB.allow_duped_corners && old_r == cache_r && old_g == cache_g && old_b == cache_b)
return
#else
if(old_r == cache_r && old_g == cache_g && old_b == cache_b)
return
#endif
#define QUEUE(turf) if(turf?.lighting_object && !turf.lighting_object.needs_update) { turf.lighting_object.needs_update = TRUE; GLOB.lighting_update_objects += turf.lighting_object }
QUEUE(northeast)
QUEUE(northwest)
@@ -120,7 +141,7 @@
return
/datum/lighting_corner/Destroy(var/force)
/datum/lighting_corner/Destroy(force)
if (!force)
return QDEL_HINT_LETMELIVE
+21 -15
View File
@@ -1,15 +1,15 @@
/atom/movable/lighting_object
name = ""
anchored = TRUE
flags = ATOM_ABSTRACT
name = ""
anchored = TRUE
flags = ATOM_ABSTRACT
icon = LIGHTING_ICON
icon_state = "transparent"
color = null //we manually set color in init instead
plane = LIGHTING_PLANE
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
layer = LIGHTING_LAYER
invisibility = INVISIBILITY_LIGHTING
icon = LIGHTING_ICON
icon_state = "transparent"
color = null //we manually set color in init instead
plane = LIGHTING_PLANE
layer = LIGHTING_LAYER
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
invisibility = INVISIBILITY_LIGHTING
var/needs_update = FALSE
var/turf/myturf
@@ -33,9 +33,9 @@
needs_update = TRUE
GLOB.lighting_update_objects += src
/atom/movable/lighting_object/Destroy(var/force)
/atom/movable/lighting_object/Destroy(force)
if (force)
GLOB.lighting_update_objects -= src
GLOB.lighting_update_objects -= src
if (loc != myturf)
var/turf/oldturf = get_turf(myturf)
var/turf/newturf = get_turf(loc)
@@ -71,10 +71,16 @@
// See LIGHTING_CORNER_DIAGONAL in lighting_corner.dm for why these values are what they are.
var/static/datum/lighting_corner/dummy/dummy_lighting_corner = new
var/datum/lighting_corner/cr = myturf.lc_bottomleft || dummy_lighting_corner
#ifdef VISUALIZE_LIGHT_UPDATES
myturf.add_atom_colour(LIGHT_COLOR_LIGHT_CYAN, ADMIN_COLOUR_PRIORITY)
animate(myturf, 10, color = null)
addtimer(CALLBACK(myturf, /atom/proc/remove_atom_colour, ADMIN_COLOUR_PRIORITY, LIGHT_COLOR_LIGHT_CYAN), 10, TIMER_UNIQUE|TIMER_OVERRIDE)
#endif
var/datum/lighting_corner/cr = myturf.lc_bottomleft || dummy_lighting_corner
var/datum/lighting_corner/cg = myturf.lc_bottomright || dummy_lighting_corner
var/datum/lighting_corner/cb = myturf.lc_topleft || dummy_lighting_corner
var/datum/lighting_corner/ca = myturf.lc_topright || dummy_lighting_corner
var/datum/lighting_corner/cb = myturf.lc_topleft || dummy_lighting_corner
var/datum/lighting_corner/ca = myturf.lc_topright || dummy_lighting_corner
var/max = max(cr.cache_mx, cg.cache_mx, cb.cache_mx, ca.cache_mx)