Files
Yogstation/code/__HELPERS/radiation.dm
Redmoogle a91ef5c4bf Datum lighting (#15931)
* Turns lighting objects into a datum, makes all lighting be performed with an underlay. big maptick fix very good! (#58991)

credit to zewaka for the idea of using underlays

turns the lighting object movables that were unnecessary and increased maptick into a datum which then applies and removes an underlay in update(). also applies a lot of general lighting clean ups (mostly using as anything in loops and fixing single letter var names).

multiz is a little different by necessity, now only the bottom turf's lighting matters in the brightness of the top turf unlike master where the bottom turf's lighting object is hidden from the vis_contents of the top turf. there are still some kinks to iron out here though, since currently objects suspended in openspace (like tram platforms) look bad and glass floors look bad too

only thing i have left to do is make multiz work (well)

UPDATE: multiz now appears the same as far as i can tell, its possible there are other situations in which its different but datum mats work and it automatically updates if the turf below changes. now i just need to make the system less finnicky if at all possible (and possibly merge managed_turf_vis_content with managed_overlays maybe?)

new update: its basically equivalent to normal multiz as far as i can tell (visually at least, in the circumstances ive tested so far)

NEW NEW UPDATE: turfs no longer have the VIS_HIDE vis_flag and multiz works without stacking the lighting from the floor below! so this shouldnt have any overt drawbacks to master anymore

1 needless movable per tile is terrible for maptick. this is probably a larger improvement than my emissive blocker change in terms of maptick. im guessing we'd get around 0.6 average maptick per player after this where currently we get 0.85 or so

Edit: according to lemon, sybil reached 0.71 maptick per person when tm'd with this

if this is a big enough improvement i might finally be able to get rid of the Gone discord avatar

* Revert "Turns lighting objects into a datum, makes all lighting be performed with an underlay. big maptick fix very good! (#58991)"

This reverts commit ffbbeb64f4.

* port from another codebase

Co-authored-by: Kylerace <kylerlumpkin1@gmail.com>
2022-09-30 19:54:14 +02:00

59 lines
2.2 KiB
Plaintext

// A special GetAllContents that doesn't search past things with rad insulation
// Components which return COMPONENT_BLOCK_RADIATION prevent further searching into that object's contents. The object itself will get returned still.
// The ignore list makes those objects never return at all
/proc/get_rad_contents(atom/location)
var/static/list/ignored_things = typecacheof(list(
/mob/dead,
/mob/camera,
/mob/living/silicon/ai,
/obj/effect,
/obj/docking_port,
/obj/item/projectile,
))
var/list/processing_list = list(location)
. = list()
while(processing_list.len)
var/atom/thing = processing_list[1]
processing_list -= thing
if(!thing)
continue
if(ignored_things[thing.type])
continue
. += thing
if((thing.flags_1 & RAD_PROTECT_CONTENTS_1) || (SEND_SIGNAL(thing, COMSIG_ATOM_RAD_PROBE) & COMPONENT_BLOCK_RADIATION))
continue
processing_list += thing.contents
/proc/radiation_pulse(atom/source, intensity, range_modifier, log=FALSE, can_contaminate=TRUE)
if(!SSradiation.can_fire)
return
for(var/dir in GLOB.cardinals)
new /datum/radiation_wave(source, dir, intensity, range_modifier, can_contaminate)
var/list/things = get_rad_contents(source) //copypasta because I don't want to put special code in waves to handle their origin
for(var/k in 1 to things.len)
var/atom/thing = things[k]
if(!thing)
continue
thing.rad_act(intensity)
var/static/last_huge_pulse = 0
if(intensity > 3000 && world.time > last_huge_pulse + 200)
last_huge_pulse = world.time
log = TRUE
if(log)
var/turf/_source_T = isturf(source) ? source : get_turf(source)
log_game("Radiation pulse with intensity: [intensity] and range modifier: [range_modifier] in [loc_name(_source_T)] ")
return TRUE
/proc/get_rad_contamination(atom/location)
var/rad_strength = 0
for(var/i in get_rad_contents(location)) // Yes it's intentional that you can't detect radioactive things under rad protection. Gives traitors a way to hide their glowing green rocks.
var/atom/thing = i
if(!thing)
continue
var/datum/component/radioactive/radiation = thing.GetComponent(/datum/component/radioactive)
if(radiation && rad_strength < radiation.strength)
rad_strength = radiation.strength
return rad_strength