mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-29 15:08:34 +01:00
Optimization/Rewrite of Radiation Controller
* The performance of the radiation controller as-is was not fast enough for inclusion in production servers, but it has some nice featuers, so rewrote it to be more performant. * Instead of storing the radiation strength for every turf, we only store the sources of radiation, and calculate the strength only for mobs who might be in range. * Old method was ray-tracing to every turf in range whether anything was there to be irradiated or not. Could be hundreds of turfs. New method only lazily calcualtes strength at a turf if we actually need to know it. Often times this is zero turfs if nobody is standing in engineering. * Removed the automatic processing of objects with "rad_power" set. Objects are responsible for calling the repository to create/update their radiation sources. Saves some extra overhead that in practice was redundant with other process controllers. * Also tweaked to be more respectful of qdel'd objects and added some comments.
This commit is contained in:
@@ -186,4 +186,4 @@ var/global/list/severity_to_string = list(EVENT_LEVEL_MUNDANE = "Mundane", EVENT
|
||||
#undef ASSIGNMENT_JANITOR
|
||||
#undef ASSIGNMENT_MEDICAL
|
||||
#undef ASSIGNMENT_SCIENTIST
|
||||
#undef ASSIGNMENT_SECURITY
|
||||
#undef ASSIGNMENT_SECURITY
|
||||
|
||||
@@ -27,14 +27,17 @@
|
||||
radiate()
|
||||
|
||||
/datum/event/solar_storm/proc/radiate()
|
||||
var/radiation_level = rand(15, 30)
|
||||
for(var/area/A in all_areas)
|
||||
if(!(A.z in using_map.player_levels))
|
||||
// Note: Too complicated to be worth trying to use the radiation system for this. Its only in space anyway, so we make an exception in this case.
|
||||
for(var/mob/living/L in living_mob_list)
|
||||
var/turf/T = get_turf(L)
|
||||
if(!T)
|
||||
continue
|
||||
for(var/turf/T in A)
|
||||
if(!istype(T.loc,/area/space) && !istype(T,/turf/space))
|
||||
continue
|
||||
radiation_repository.irradiated_turfs[T] = radiation_level
|
||||
|
||||
if(!istype(T.loc,/area/space) && !istype(T,/turf/space)) //Make sure you're in a space area or on a space turf
|
||||
continue
|
||||
|
||||
//Todo: Apply some burn damage from the heat of the sun. Until then, enjoy some moderate radiation.
|
||||
L.rad_act(rand(15, 30))
|
||||
|
||||
/datum/event/solar_storm/end()
|
||||
command_announcement.Announce("The solar storm has passed the station. It is now safe to resume EVA activities. Please report to medbay if you experience any unusual symptoms. ", "Anomaly Alert")
|
||||
|
||||
@@ -559,4 +559,4 @@ var/list/mining_overlay_cache = list()
|
||||
if(mineral_name && (mineral_name in ore_data))
|
||||
mineral = ore_data[mineral_name]
|
||||
UpdateMineral()
|
||||
update_icon()
|
||||
update_icon()
|
||||
|
||||
@@ -31,10 +31,10 @@ var/global/list/rad_collectors = list()
|
||||
last_power_new = 0
|
||||
|
||||
|
||||
var/turf/T = get_turf(src)
|
||||
if(T in radiation_repository.irradiated_turfs)
|
||||
receive_pulse((radiation_repository.irradiated_turfs[T] * 5)) //Maths is hard
|
||||
|
||||
if(P && active)
|
||||
var/rads = radiation_repository.get_rads_at_turf(get_turf(src))
|
||||
if(rads)
|
||||
receive_pulse(rads * 5) //Maths is hard
|
||||
|
||||
if(P)
|
||||
if(P.air_contents.gas["phoron"] == 0)
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
anchored = 0
|
||||
light_range = 4
|
||||
|
||||
rad_power = 1 //So it gets added to the repository
|
||||
var/gasefficency = 0.25
|
||||
|
||||
var/base_icon_state = "darkmatter"
|
||||
@@ -112,7 +111,7 @@
|
||||
var/mob/living/carbon/human/H = mob
|
||||
H.hallucination += max(50, min(300, DETONATION_HALLUCINATION * sqrt(1 / (get_dist(mob, src) + 1)) ) )
|
||||
spawn(pull_time)
|
||||
explosion(TS, explosion_power, explosion_power * 2, explosion_power * 3, explosion_power * 4, 1)
|
||||
explosion(get_turf(src), explosion_power, explosion_power * 2, explosion_power * 3, explosion_power * 4, 1)
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
@@ -273,7 +272,7 @@
|
||||
var/rads = (power / 10) * ( 1 / (radius**2) )
|
||||
l.apply_effect(rads, IRRADIATE)
|
||||
*/
|
||||
rad_power = power * 1.5//Better close those shutters!
|
||||
radiation_repository.radiate(src, power * 1.5) //Better close those shutters!
|
||||
|
||||
power -= (power/DECAY_FACTOR)**3 //energy losses due to radiation
|
||||
|
||||
@@ -403,7 +402,6 @@
|
||||
return
|
||||
|
||||
|
||||
|
||||
/obj/machinery/power/supermatter/GotoAirflowDest(n) //Supermatter not pushed around by airflow
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user