Files
GS13NG/code/modules/lighting/lighting_overlay.dm
L.E.D e1956df149 Glorious /vg/ Lighting Port (#66)
* fuck

* [CANT WAKE UP]

* AAAAAAAAAHHHHHHHHHHHH

* SAAAAVE MEEEEEEEEEEEEEEEE

* this is so bad how can i even call myself a coder

* thanks fam

* hello darkness my old friend

i've come to talk with you again

* ugh go away

* OH

* much less broken

* ayy

* aaaaa

* OH YEAAAAAAAAHHHHHHHHHHH

* aaaa

* k

* dfgjtxkytkjyd

* debug

* dangerously cheesy

* mm

* OH YEAAAAAAAAAAAAAAAAAAAAAAAAAA

* oH YEAH

* Some final touches and cleanup of the lighting port.

* One more

* More fixes.

* varedit hack for easy modification

* fixed

* C O L O R

* slym

* fffff

* oh great what the fuck is wrong now

* Revert "oh great what the fuck is wrong now"

This reverts commit e589ad51facb5464e107ca515317d41136dd1e5e.

* fu

* will it blend

* aaaaaaaaaaaaaaaaaaaa

* this is why im bad at porting

falalalala, lala la la

* k

* yeh

* can't forget majestic fire
2016-11-06 09:51:16 -05:00

113 lines
3.2 KiB
Plaintext

/var/list/all_lighting_overlays = list() // Global list of lighting overlays.
/atom/movable/lighting_overlay
name = ""
anchored = TRUE
icon = LIGHTING_ICON
color = LIGHTING_BASE_MATRIX
mouse_opacity = 0
layer = LIGHTING_LAYER
invisibility = INVISIBILITY_LIGHTING
blend_mode = BLEND_MULTIPLY
var/needs_update = FALSE
/atom/movable/lighting_overlay/New(var/atom/loc, var/no_update = FALSE)
. = ..()
verbs.Cut()
global.all_lighting_overlays += src
var/turf/T = loc // If this runtimes atleast we'll know what's creating overlays in things that aren't turfs.
T.lighting_overlay = src
T.luminosity = 0
for(var/turf/open/space/S in RANGE_TURFS(1,src)) //RANGE_TURFS is in code\__HELPERS\game.dm
S.update_starlight()
if (no_update)
return
update_overlay()
/atom/movable/lighting_overlay/Destroy(var/force)
global.all_lighting_overlays -= src
global.lighting_update_overlays -= src
global.lighting_update_overlays_old -= src
var/turf/T = loc
if (istype(T))
T.lighting_overlay = null
T.luminosity = 1
if (force)
..()
return QDEL_HINT_PUTINPOOL
else
return QDEL_HINT_LETMELIVE
/atom/movable/lighting_overlay/proc/update_overlay()
var/turf/T = loc
if (!istype(T)) // Erm...
if (loc)
warning("A lighting overlay realised its loc was NOT a turf (actual loc: [loc], [loc.type]) in update_overlay() and got pooled!")
else
warning("A lighting overlay realised it was in nullspace in update_overlay() and got pooled!")
qdel(src, TRUE)
return
// To the future coder who sees this and thinks
// "Why didn't he just use a loop?"
// Well my man, it's because the loop performed like shit.
// And there's no way to improve it because
// without a loop you can make the list all at once which is the fastest you're gonna get.
// Oh it's also shorter line wise.
// Including with these comments.
// See LIGHTING_CORNER_DIAGONAL in lighting_corner.dm for why these values are what they are.
// No I seriously cannot think of a more efficient method, fuck off Comic.
var/datum/lighting_corner/cr = T.corners[3] || dummy_lighting_corner
var/datum/lighting_corner/cg = T.corners[2] || dummy_lighting_corner
var/datum/lighting_corner/cb = T.corners[4] || dummy_lighting_corner
var/datum/lighting_corner/ca = T.corners[1] || dummy_lighting_corner
var/max = max(cr.cache_mx, cg.cache_mx, cb.cache_mx, ca.cache_mx)
color = list(
cr.cache_r, cr.cache_g, cr.cache_b, 0,
cg.cache_r, cg.cache_g, cg.cache_b, 0,
cb.cache_r, cb.cache_g, cb.cache_b, 0,
ca.cache_r, ca.cache_g, ca.cache_b, 0,
0, 0, 0, 1
)
luminosity = max > LIGHTING_SOFT_THRESHOLD
// Variety of overrides so the overlays don't get affected by weird things.
/atom/movable/lighting_overlay/ex_act(severity)
return 0
/atom/movable/lighting_overlay/singularity_act()
return
/atom/movable/lighting_overlay/singularity_pull()
return
/atom/movable/lighting_overlay/blob_act()
return
// Override here to prevent things accidentally moving around overlays.
/atom/movable/lighting_overlay/forceMove(atom/destination, var/no_tp=FALSE, var/harderforce = FALSE)
if(harderforce)
. = ..()
/atom/movable/lighting_overlay/ResetVars()
color = LIGHTING_BASE_MATRIX
..("color")