mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-27 10:02:12 +00:00
* Add the system for managed global variables * Travis ban old globals * So you CAN inline proccall, that's neat * Fix that * master.dm * Remove the hack procs * Move InitGlobals to the proper spot * configuration.dm * Fix the missing pre-slash * clockcult.dm * This is probably for the best * Doy * Fix shit * Rest of the DEFINES tree * Fix * Use global. for access * Update find_references_in_globals Always hated that proc Whoever made it must've bee a r e a l idiot... * __HELPERS tree * Move global initialization to master. Fix the declaration * database.dm * Dat newline * I said DECLARATIVE order! * Here's something you can chew on @Iamgoofball * game_modes.dm * Fix this * genetics.dm * flavor_misc.dm * More stuff * Do it mso's way. Keep the controllers as global * Make master actually see it * Fix * Finish _globalvars/lists * Finish the rest of the _globalvars tree * This is weird * Migrate the controllers * SLOTH -> GLOB * Lighting globals * round_start_time -> ticker * PAI card list -> pai SS * record_id_num -> static * Diseases list -> SSdisease * More disease globals to the SS * More disease stuff * Emote list * Better and better * Bluh * So much stuff * Ahh * Wires * dview * station_areas * Teleportlocs * blood_splatter_icons * Stuff and such * More stuff * RAD IO * More stuff and such * Blob shit * Changeling stuff * Add "Balance" to changelogs * Balance for changelog compiler + Auto Tagging * Update the PR template * hivemind_bank * Bip * sacrificed * Good shit * Better define * More cult shit * Devil shit * Gang shit * > borers Fix shit * Rename the define * Nuke * Objectives * Sandbox * Multiverse sword * Announce systems * Stuff and such * TC con * Airlock * doppllllerrrrrr * holopads * Shut up byond you inconsistent fuck * Sneaky fuck * Burp * Bip * Fixnshit * Port without regard * askdlfjs; * asdfjasoidojfi * Protected globals and more * SO MANY * ajsimkvahsaoisd * akfdsiaopwimfeoiwafaw * gsdfigjosidjfgiosdg * AHHHHHHHHHHHHHHHHHHHHHHH!!!!! * facerolll * ASDFASDFASDF * Removes the unused parts of dmm_suite * WIP * Fix quote * asdfjauwfnkjs * afwlunhskjfda * asfjlaiwuefhaf * SO CLOSE * wwwweeeeeewwwww * agdgmoewranwg * HOLY MOTHER OF FUCK AND THATS JUST HALF THE JOB?!? * Fix syntax errors * 100 errors * Another 100 * So many... * Ugh * More shit * kilme * Stuuuuuufffff * ajrgmrlshio;djfa;sdkl * jkbhkhjbmjvjmh * soi soi soi * butt * TODAY WE LEARNED THAT GLOBAL AND STATIC ARE THE EXACT SAME FUCKING THING * lllllllllllllllllllllllllllllllllllllllllll * afsdijfiawhnflnjhnwsdfs * yugykihlugk,kj * time to go * STUFFF!!! * AAAAAAAAAAAAAAAAAHHHHHHHHHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!!!!! * ngoaijdjlfkamsdlkf * Break time * aufjsdklfalsjfi * CONTROL KAY AND PRAY * IT COMPILEELEELELAKLJFKLDAFJLKFDJLADKJHFLJKAJGAHIEJALDFJ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Goteem * Fix testing mode * This does not belong in this PR * Convert it to a controller * Eh, fuck this option * Revert controllerization Ill do it some other time * Fix * Working controllerization * FOR THE LOVE OF CHRIST PROTECT THE LOGS * Protect admins and deadmins * Use the inbuilt proc
143 lines
3.8 KiB
Plaintext
143 lines
3.8 KiB
Plaintext
GLOBAL_LIST_EMPTY(all_lighting_objects) // Global list of lighting objects.
|
||
|
||
/atom/movable/lighting_object
|
||
name = ""
|
||
|
||
anchored = TRUE
|
||
|
||
icon = LIGHTING_ICON
|
||
color = LIGHTING_BASE_MATRIX
|
||
plane = LIGHTING_PLANE
|
||
mouse_opacity = 0
|
||
layer = LIGHTING_LAYER
|
||
invisibility = INVISIBILITY_LIGHTING
|
||
|
||
blend_mode = BLEND_ADD
|
||
|
||
var/needs_update = FALSE
|
||
|
||
/atom/movable/lighting_object/Initialize(mapload, var/no_update = FALSE)
|
||
. = ..()
|
||
verbs.Cut()
|
||
GLOB.all_lighting_objects += src
|
||
|
||
var/turf/T = loc // If this runtimes atleast we'll know what's creating overlays in things that aren't turfs.
|
||
T.lighting_object = 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()
|
||
|
||
/atom/movable/lighting_object/Destroy(var/force)
|
||
if (force)
|
||
GLOB.all_lighting_objects -= src
|
||
GLOB.lighting_update_objects -= src
|
||
|
||
var/turf/T = loc
|
||
if (istype(T))
|
||
T.lighting_object = null
|
||
T.luminosity = 1
|
||
|
||
return ..()
|
||
else
|
||
return QDEL_HINT_LETMELIVE
|
||
|
||
/atom/movable/lighting_object/proc/update()
|
||
var/turf/T = loc
|
||
if (!istype(T)) // Erm...
|
||
if (loc)
|
||
warning("A lighting object realised its loc was NOT a turf (actual loc: [loc], [loc.type]) in update()!")
|
||
|
||
else
|
||
warning("A lighting object realised it was in nullspace in update()!")
|
||
|
||
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.
|
||
var/static/datum/lighting_corner/dummy/dummy_lighting_corner = new
|
||
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)
|
||
|
||
var/rr = cr.cache_r
|
||
var/rg = cr.cache_g
|
||
var/rb = cr.cache_b
|
||
|
||
var/gr = cg.cache_r
|
||
var/gg = cg.cache_g
|
||
var/gb = cg.cache_b
|
||
|
||
var/br = cb.cache_r
|
||
var/bg = cb.cache_g
|
||
var/bb = cb.cache_b
|
||
|
||
var/ar = ca.cache_r
|
||
var/ag = ca.cache_g
|
||
var/ab = ca.cache_b
|
||
|
||
#if LIGHTING_SOFT_THRESHOLD != 0
|
||
var/set_luminosity = max > LIGHTING_SOFT_THRESHOLD
|
||
#else
|
||
// Because of floating points<74>?, it won't even be a flat 0.
|
||
// This number is mostly arbitrary.
|
||
var/set_luminosity = max > 1e-6
|
||
#endif
|
||
|
||
if((rr & gr & br & ar) && (rg + gg + bg + ag + rb + gb + bb + ab == 8))
|
||
//anything that passes the first case is very likely to pass the second, and addition is a little faster in this case
|
||
icon_state = "transparent"
|
||
color = null
|
||
else if(!set_luminosity)
|
||
icon_state = "dark"
|
||
color = null
|
||
else
|
||
icon_state = null
|
||
color = list(
|
||
rr, rg, rb, 00,
|
||
gr, gg, gb, 00,
|
||
br, bg, bb, 00,
|
||
ar, ag, ab, 00,
|
||
00, 00, 00, 01
|
||
)
|
||
|
||
luminosity = set_luminosity
|
||
|
||
// Variety of overrides so the overlays don't get affected by weird things.
|
||
|
||
/atom/movable/lighting_object/ex_act(severity)
|
||
return 0
|
||
|
||
/atom/movable/lighting_object/singularity_act()
|
||
return
|
||
|
||
/atom/movable/lighting_object/singularity_pull()
|
||
return
|
||
|
||
/atom/movable/lighting_object/blob_act()
|
||
return
|
||
|
||
// Nope nope nope!
|
||
/atom/movable/lighting_object/onShuttleMove(turf/T1, rotation)
|
||
return FALSE
|
||
|
||
// Override here to prevent things accidentally moving around overlays.
|
||
/atom/movable/lighting_object/forceMove(atom/destination, var/no_tp=FALSE, var/harderforce = FALSE)
|
||
if(harderforce)
|
||
. = ..() |