Blind port of Bay Radiation Subsystem

This commit is contained in:
Atermonera
2019-10-05 23:29:27 -08:00
committed by VirgoBot
parent d53319f8b3
commit 89aad128cf
45 changed files with 284 additions and 110 deletions

View File

@@ -348,10 +348,12 @@ var/global/list/##LIST_NAME = list();\
#define RCD_MAX_CAPACITY 30 * RCD_SHEETS_PER_MATTER_UNIT
// Radiation 'levels'. Used for the geiger counter, for visuals and sound. They are in different files so this goes here.
#define RAD_LEVEL_LOW 0.01 // Around the level at which radiation starts to become harmful
#define RAD_LEVEL_MODERATE 10
#define RAD_LEVEL_LOW 0.5 // Around the level at which radiation starts to become harmful
#define RAD_LEVEL_MODERATE 5
#define RAD_LEVEL_HIGH 25
#define RAD_LEVEL_VERY_HIGH 50
#define RAD_LEVEL_VERY_HIGH 75
#define RADIATION_THRESHOLD_CUTOFF 0.1 // Radiation will not affect a tile when below this value.
//https://secure.byond.com/docs/ref/info.html#/atom/var/mouse_opacity
#define MOUSE_OPACITY_TRANSPARENT 0

View File

@@ -1,56 +0,0 @@
/datum/controller/process/radiation
var/repository/radiation/linked = null
/datum/controller/process/radiation/setup()
name = "radiation controller"
schedule_interval = 20 // every 2 seconds
linked = radiation_repository
/datum/controller/process/radiation/doWork()
sources_decay()
cache_expires()
irradiate_targets()
// Step 1 - Sources Decay
/datum/controller/process/radiation/proc/sources_decay()
var/list/sources = linked.sources
for(var/thing in sources)
var/datum/radiation_source/S = thing
if(QDELETED(S))
sources.Remove(S)
continue
if(S.decay)
S.update_rad_power(S.rad_power - config.radiation_decay_rate)
if(S.rad_power <= config.radiation_lower_limit)
sources.Remove(S)
SCHECK // This scheck probably just wastes resources, but better safe than sorry in this case.
// Step 2 - Cache Expires
/datum/controller/process/radiation/proc/cache_expires()
var/list/resistance_cache = linked.resistance_cache
for(var/thing in resistance_cache)
var/turf/T = thing
if(QDELETED(T))
resistance_cache.Remove(T)
continue
if((length(T.contents) + 1) != resistance_cache[T])
resistance_cache.Remove(T) // If its stale REMOVE it! It will get added if its needed.
SCHECK
// Step 3 - Registered irradiatable things are checked for radiation
/datum/controller/process/radiation/proc/irradiate_targets()
var/list/registered_listeners = living_mob_list // For now just use this. Nothing else is interested anyway.
if(length(linked.sources) > 0)
for(var/thing in registered_listeners)
var/atom/A = thing
if(QDELETED(A))
continue
var/turf/T = get_turf(thing)
var/rads = linked.get_rads_at_turf(T)
if(rads)
A.rad_act(rads)
SCHECK
/datum/controller/process/radiation/statProcess()
..()
stat(null, "[linked.sources.len] sources, [linked.resistance_cache.len] cached turfs")

View File

@@ -0,0 +1,135 @@
SUBSYSTEM_DEF(radiation)
name = "Radiation"
wait = 2 SECONDS
flags = SS_NO_INIT
var/list/sources = list() // all radiation source datums
var/list/sources_assoc = list() // Sources indexed by turf for de-duplication.
var/list/resistance_cache = list() // Cache of turf's radiation resistance.
var/tmp/list/current_sources = list()
var/tmp/list/current_res_cache = list()
var/tmp/list/listeners = list()
/datum/controller/subsystem/radiation/fire(resumed = FALSE)
if (!resumed)
current_sources = sources.Copy()
current_res_cache = resistance_cache.Copy()
listeners = living_mob_list.Copy()
while(current_sources.len)
var/datum/radiation_source/S = current_sources[current_sources.len]
current_sources.len--
if(QDELETED(S))
sources -= S
else if(S.decay)
S.update_rad_power(S.rad_power - config.radiation_decay_rate)
if (MC_TICK_CHECK)
return
while(current_res_cache.len)
var/turf/T = current_res_cache[current_res_cache.len]
current_res_cache.len--
if(QDELETED(T))
resistance_cache -= T
else if((length(T.contents) + 1) != resistance_cache[T])
resistance_cache -= T // If its stale REMOVE it! It will get added if its needed.
if (MC_TICK_CHECK)
return
if(!sources.len)
listeners.Cut()
while(listeners.len)
var/atom/A = listeners[listeners.len]
listeners.len--
if(!QDELETED(A))
var/turf/T = get_turf(A)
var/rads = get_rads_at_turf(T)
if(rads)
A.rad_act(rads)
if (MC_TICK_CHECK)
return
/datum/controller/subsystem/radiation/stat_entry()
..("S:[sources.len], RC:[resistance_cache.len]")
// Ray trace from all active radiation sources to T and return the strongest effect.
/datum/controller/subsystem/radiation/proc/get_rads_at_turf(var/turf/T)
. = 0
if(!istype(T))
return
for(var/value in sources)
var/datum/radiation_source/source = value
if(source.rad_power < .)
continue // Already being affected by a stronger source
if(source.source_turf.z != T.z)
continue // Radiation is not multi-z
if(source.respect_maint)
var/area/A = T.loc
if(A.flags & RAD_SHIELDED)
continue // In shielded area
var/dist = get_dist(source.source_turf, T)
if(dist > source.range)
continue // Too far to possibly affect
if(source.flat)
. = max(., source.rad_power)
continue // No need to ray trace for flat field
// Okay, now ray trace to find resistence!
var/turf/origin = source.source_turf
var/working = source.rad_power
while(origin != T)
origin = get_step_towards(origin, T) //Raytracing
if(!resistance_cache[origin]) //Only get the resistance if we don't already know it.
origin.calc_rad_resistance()
if(origin.cached_rad_resistance)
working = round((working / (origin.cached_rad_resistance * config.radiation_resistance_multiplier)), 0.1)
if((working <= .) || (working <= RADIATION_THRESHOLD_CUTOFF))
break // Already affected by a stronger source (or its zero...)
. = max((working / (dist ** 2)), .) //Butchered version of the inverse square law. Works for this purpose
if(. <= RADIATION_THRESHOLD_CUTOFF)
. = 0
// Add a radiation source instance to the repository. It will override any existing source on the same turf.
/datum/controller/subsystem/radiation/proc/add_source(var/datum/radiation_source/S)
if(!isturf(S.source_turf))
return
var/datum/radiation_source/existing = sources_assoc[S.source_turf]
if(existing)
qdel(existing)
sources += S
sources_assoc[S.source_turf] = S
// Creates a temporary radiation source that will decay
/datum/controller/subsystem/radiation/proc/radiate(source, power) //Sends out a radiation pulse, taking walls into account
if(!(source && power)) //Sanity checking
return
var/datum/radiation_source/S = new()
S.source_turf = get_turf(source)
S.update_rad_power(power)
add_source(S)
// Sets the radiation in a range to a constant value.
/datum/controller/subsystem/radiation/proc/flat_radiate(source, power, range, var/respect_maint = FALSE)
if(!(source && power && range))
return
var/datum/radiation_source/S = new()
S.flat = TRUE
S.range = range
S.respect_maint = respect_maint
S.source_turf = get_turf(source)
S.update_rad_power(power)
add_source(S)
// Irradiates a full Z-level. Hacky way of doing it, but not too expensive.
/datum/controller/subsystem/radiation/proc/z_radiate(var/atom/source, power, var/respect_maint = FALSE)
if(!(power && source))
return
var/turf/epicentre = locate(round(world.maxx / 2), round(world.maxy / 2), source.z)
flat_radiate(epicentre, power, world.maxx, respect_maint)

View File

@@ -273,7 +273,7 @@
if(explode)
explosion(src.loc, devastation_range = 0, heavy_impact_range = 0, light_impact_range = 4, flash_range = 6, adminlog = 0)
new /obj/effect/decal/cleanable/greenglow(get_turf(src))
radiation_repository.radiate(src, 50)
SSradiation.radiate(src, 50)
// This meteor fries toasters.
/obj/effect/meteor/emp

View File

@@ -387,7 +387,7 @@
/obj/machinery/door/airlock/uranium/process()
if(world.time > last_event+20)
if(prob(50))
radiation_repository.radiate(src, rad_power)
SSradiation.radiate(src, rad_power)
last_event = world.time
..()

View File

@@ -56,7 +56,7 @@
icon_state = icon_state_closed
else
icon_state = icon_state_open
radiation_repository.resistance_cache.Remove(get_turf(src))
SSradiation.resistance_cache.Remove(get_turf(src))
return
// Has to be in here, comment at the top is older than the emag_act code on doors proper

View File

@@ -382,7 +382,7 @@
icon_state = "door1"
else
icon_state = "door0"
radiation_repository.resistance_cache.Remove(get_turf(src))
SSradiation.resistance_cache.Remove(get_turf(src))
return

View File

@@ -133,7 +133,7 @@
..()
if(phasing)
phasing = FALSE
radiation_repository.radiate(get_turf(src), 30)
SSradiation.radiate(get_turf(src), 30)
log_append_to_last("WARNING: BLUESPACE DRIVE INSTABILITY DETECTED. DISABLING DRIVE.",1)
visible_message("<span class='alien'>The [src.name] appears to flicker, before its silhouette stabilizes!</span>")
return

View File

@@ -1201,7 +1201,7 @@
/datum/global_iterator/mecha_generator/nuclear/process(var/obj/item/mecha_parts/mecha_equipment/generator/nuclear/EG)
if(..())
radiation_repository.radiate(EG, (EG.rad_per_cycle * 3))
SSradiation.radiate(EG, (EG.rad_per_cycle * 3))
return 1

View File

@@ -1,3 +1,4 @@
<<<<<<< HEAD
// Constantly emites radiation from the tile it's placed on.
/obj/effect/map_effect/radiation_emitter
name = "radiation emitter"
@@ -16,4 +17,24 @@
radiation_repository.radiate(src, radiation_power)
/obj/effect/map_effect/radiation_emitter/strong
=======
// Constantly emites radiation from the tile it's placed on.
/obj/effect/map_effect/radiation_emitter
name = "radiation emitter"
icon_state = "radiation_emitter"
var/radiation_power = 30 // Bigger numbers means more radiation.
/obj/effect/map_effect/radiation_emitter/Initialize()
START_PROCESSING(SSobj, src)
return ..()
/obj/effect/map_effect/radiation_emitter/Destroy()
STOP_PROCESSING(SSobj, src)
return ..()
/obj/effect/map_effect/radiation_emitter/process()
SSradiation.radiate(src, radiation_power)
/obj/effect/map_effect/radiation_emitter/strong
>>>>>>> b193761... Merge pull request #6471 from Novacat/nova-runtimes
radiation_power = 100

View File

@@ -610,12 +610,12 @@
return 1
/obj/item/weapon/shockpaddles/standalone/checked_use(var/charge_amt)
radiation_repository.radiate(src, charge_amt/12) //just a little bit of radiation. It's the price you pay for being powered by magic I guess
SSradiation.radiate(src, charge_amt/12) //just a little bit of radiation. It's the price you pay for being powered by magic I guess
return 1
/obj/item/weapon/shockpaddles/standalone/process()
if(fail_counter > 0)
radiation_repository.radiate(src, fail_counter--)
SSradiation.radiate(src, fail_counter--)
else
STOP_PROCESSING(SSobj, src)

View File

@@ -28,7 +28,7 @@
/obj/item/device/geiger/proc/get_radiation()
if(!scanning)
return
radiation_count = radiation_repository.get_rads_at_turf(get_turf(src))
radiation_count = SSradiation.get_rads_at_turf(get_turf(src))
update_icon()
update_sound()

View File

@@ -13,7 +13,7 @@
return ..()
/obj/item/poi/pascalb/process()
radiation_repository.radiate(src, 5)
SSradiation.radiate(src, 5)
/obj/item/poi/pascalb/Destroy()
STOP_PROCESSING(SSobj, src)
@@ -41,7 +41,7 @@
return ..()
/obj/item/poi/brokenoldreactor/process()
radiation_repository.radiate(src, 25)
SSradiation.radiate(src, 25)
/obj/item/poi/brokenoldreactor/Destroy()
STOP_PROCESSING(SSobj, src)

View File

@@ -64,7 +64,7 @@
/obj/item/weapon/tool/crowbar/hybrid/is_crowbar()
if(prob(10))
var/turf/T = get_turf(src)
radiation_repository.radiate(get_turf(src), 5)
SSradiation.radiate(get_turf(src), 5)
T.visible_message("<span class='alien'>\The [src] shudders!</span>")
return FALSE
return TRUE

View File

@@ -108,7 +108,7 @@
/obj/item/weapon/tool/screwdriver/hybrid/is_screwdriver()
if(prob(10))
var/turf/T = get_turf(src)
radiation_repository.radiate(get_turf(src), 5)
SSradiation.radiate(get_turf(src), 5)
T.visible_message("<span class='alien'>\The [src] shudders!</span>")
return FALSE
return TRUE

View File

@@ -88,7 +88,7 @@
/obj/item/weapon/tool/wirecutters/hybrid/is_wirecutter()
if(prob(10))
var/turf/T = get_turf(src)
radiation_repository.radiate(get_turf(src), 5)
SSradiation.radiate(get_turf(src), 5)
T.visible_message("<span class='alien'>\The [src] shudders!</span>")
return FALSE
return TRUE

View File

@@ -44,7 +44,7 @@
/obj/item/weapon/tool/wrench/hybrid/is_wrench()
if(prob(10))
var/turf/T = get_turf(src)
radiation_repository.radiate(get_turf(src), 5)
SSradiation.radiate(get_turf(src), 5)
T.visible_message("<span class='alien'>\The [src] shudders!</span>")
return FALSE
return TRUE

View File

@@ -38,7 +38,7 @@
if(!total_radiation)
return
radiation_repository.radiate(src, total_radiation)
SSradiation.radiate(src, total_radiation)
return total_radiation

View File

@@ -196,7 +196,7 @@
/obj/structure/simple_door/process()
if(!material.radioactivity)
return
radiation_repository.radiate(src, round(material.radioactivity/3))
SSradiation.radiate(src, round(material.radioactivity/3))
/obj/structure/simple_door/iron/New(var/newloc,var/material_name)
..(newloc, "iron")

View File

@@ -7,7 +7,7 @@
if(can_open == WALL_OPENING)
return
radiation_repository.resistance_cache.Remove(src)
SSradiation.resistance_cache.Remove(src)
if(density)
can_open = WALL_OPENING

View File

@@ -26,7 +26,7 @@
else if(material.opacity < 0.5 && opacity)
set_light(0)
radiation_repository.resistance_cache.Remove(src)
SSradiation.resistance_cache.Remove(src)
update_connections(1)
update_icon()

View File

@@ -274,7 +274,7 @@
if(!total_radiation)
return
radiation_repository.radiate(src, total_radiation)
SSradiation.radiate(src, total_radiation)
return total_radiation
/turf/simulated/wall/proc/burn(temperature)

View File

@@ -593,7 +593,7 @@
attack_verb = "splashes"
/datum/blob_type/radioactive_ooze/on_pulse(var/obj/structure/blob/B)
radiation_repository.radiate(B, 200)
SSradiation.radiate(B, 200)
/datum/blob_type/volatile_alluvium
name = "volatile alluvium"

View File

@@ -31,7 +31,7 @@
/datum/event/radiation_storm/proc/radiate()
var/radiation_level = rand(15, 35)
for(var/z in using_map.station_levels)
radiation_repository.z_radiate(locate(1, 1, z), radiation_level, 1)
SSradiation.z_radiate(locate(1, 1, z), radiation_level, 1)
for(var/mob/living/carbon/C in living_mob_list)
var/area/A = get_area(C)

View File

@@ -41,7 +41,7 @@
/datum/gm_action/radiation_storm/proc/radiate()
var/radiation_level = rand(15, 35)
for(var/z in using_map.station_levels)
radiation_repository.z_radiate(locate(1, 1, z), radiation_level, 1)
SSradiation.z_radiate(locate(1, 1, z), radiation_level, 1)
for(var/mob/living/carbon/C in living_mob_list)
var/area/A = get_area(C)

View File

@@ -278,7 +278,7 @@
. = ..()
update_mass()
radiation_repository.radiate(src, 5 + amount)
SSradiation.radiate(src, 5 + amount)
var/mob/living/M = user
if(!istype(M))
return
@@ -305,11 +305,11 @@
/obj/item/stack/material/supermatter/ex_act(severity) // An incredibly hard to manufacture material, SM chunks are unstable by their 'stabilized' nature.
if(prob((4 / severity) * 20))
radiation_repository.radiate(get_turf(src), amount * 4)
SSradiation.radiate(get_turf(src), amount * 4)
explosion(get_turf(src),round(amount / 12) , round(amount / 6), round(amount / 3), round(amount / 25))
qdel(src)
return
radiation_repository.radiate(get_turf(src), amount * 2)
SSradiation.radiate(get_turf(src), amount * 2)
..()
/obj/item/stack/material/wood

View File

@@ -574,7 +574,7 @@ turf/simulated/mineral/floor/light_corner
M.flash_eyes()
if(prob(50))
M.Stun(5)
radiation_repository.flat_radiate(src, 25, 100)
SSradiation.flat_radiate(src, 25, 100)
if(prob(25))
excavate_find(prob(5), finds[1])
else if(rand(1,500) == 1)

View File

@@ -466,7 +466,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
var/turf/t = get_turf(src)
if(t)
var/rads = radiation_repository.get_rads_at_turf(t)
var/rads = SSradiation.get_rads_at_turf(t)
to_chat(src, "<span class='notice'>Radiation level: [rads ? rads : "0"] Bq.</span>")

View File

@@ -500,7 +500,7 @@
..()
/mob/living/simple_animal/slime/green/proc/irradiate()
radiation_repository.radiate(src, rads)
SSradiation.radiate(src, rads)
/mob/living/simple_animal/slime/pink

View File

@@ -527,7 +527,7 @@
..()
/mob/living/simple_mob/slime/xenobio/green/proc/irradiate()
radiation_repository.radiate(src, rads)
SSradiation.radiate(src, rads)

View File

@@ -555,4 +555,8 @@ var/datum/planet/sif/planet_sif = null
if(!istype(T))
return
if(T.outdoors)
<<<<<<< HEAD
radiation_repository.radiate(T, rand(fallout_rad_low, fallout_rad_high))
=======
SSradiation.radiate(T, rand(fallout_rad_low, fallout_rad_high))
>>>>>>> b193761... Merge pull request #6471 from Novacat/nova-runtimes

View File

@@ -313,7 +313,7 @@
radiation += plasma_temperature/2
plasma_temperature = 0
radiation_repository.radiate(src, radiation)
SSradiation.radiate(src, radiation)
Radiate()
/obj/effect/fusion_em_field/proc/Radiate()
@@ -522,7 +522,7 @@
//Reaction radiation is fairly buggy and there's at least three procs dealing with radiation here, this is to ensure constant radiation output.
/obj/effect/fusion_em_field/proc/radiation_scale()
radiation_repository.radiate(src, 2 + plasma_temperature / PLASMA_TEMP_RADIATION_DIVISIOR)
SSradiation.radiate(src, 2 + plasma_temperature / PLASMA_TEMP_RADIATION_DIVISIOR)
//Somehow fixing the radiation issue managed to break this, but moving it to it's own proc seemed to have fixed it. I don't know.
/obj/effect/fusion_em_field/proc/temp_dump()

View File

@@ -46,7 +46,7 @@
return PROCESS_KILL
if(istype(loc, /turf))
radiation_repository.radiate(src, max(1,CEILING(radioactivity/30, 1)))
SSradiation.radiate(src, max(1,CEILING(radioactivity/30, 1)))
/obj/item/weapon/fuel_assembly/Destroy()
STOP_PROCESSING(SSobj, src)

View File

@@ -120,7 +120,7 @@ proc/get_fusion_reaction(var/p_react, var/s_react, var/m_energy)
var/radiation_level = 200
// Copied from the SM for proof of concept. //Not any more --Cirra //Use the whole z proc --Leshana
radiation_repository.z_radiate(locate(1, 1, holder.z), radiation_level, 1)
SSradiation.z_radiate(locate(1, 1, holder.z), radiation_level, 1)
for(var/mob/living/mob in living_mob_list)
var/turf/T = get_turf(mob)

View File

@@ -399,13 +399,13 @@
/obj/machinery/power/port_gen/pacman/super/UseFuel()
//produces a tiny amount of radiation when in use
if (prob(2*power_output))
radiation_repository.radiate(src, 4)
SSradiation.radiate(src, 4)
..()
/obj/machinery/power/port_gen/pacman/super/explode()
//a nice burst of radiation
var/rads = 50 + (sheets + sheet_left)*1.5
radiation_repository.radiate(src, (max(20, rads)))
SSradiation.radiate(src, (max(20, rads)))
explosion(src.loc, 3, 3, 5, 3)
qdel(src)

View File

@@ -32,7 +32,7 @@ var/global/list/rad_collectors = list()
if(P && active)
var/rads = radiation_repository.get_rads_at_turf(get_turf(src))
var/rads = SSradiation.get_rads_at_turf(get_turf(src))
if(rads)
receive_pulse(rads * 5) //Maths is hard

View File

@@ -142,13 +142,13 @@
/obj/machinery/particle_smasher/process()
if(!src.anchored) // Rapidly loses focus.
if(energy)
radiation_repository.radiate(src, round(((src.energy-150)/50)*5,1))
SSradiation.radiate(src, round(((src.energy-150)/50)*5,1))
energy = max(0, energy - 30)
update_icon()
return
if(energy)
radiation_repository.radiate(src, round(((src.energy-150)/50)*5,1))
SSradiation.radiate(src, round(((src.energy-150)/50)*5,1))
energy = CLAMP(energy - 5, 0, max_energy)
return
@@ -178,7 +178,7 @@
if(successful_craft)
visible_message("<span class='warning'>\The [src] fizzles.</span>")
if(prob(33)) // Why are you blasting it after it's already done!
radiation_repository.radiate(src, 10 + round(src.energy / 60, 1))
SSradiation.radiate(src, 10 + round(src.energy / 60, 1))
energy = max(0, energy - 30)
update_icon()
return

View File

@@ -408,7 +408,7 @@ GLOBAL_LIST_BOILERPLATE(all_singularities, /obj/singularity)
if (src.energy>200)
toxdamage = round(((src.energy-150)/50)*4,1)
radiation = round(((src.energy-150)/50)*5,1)
radiation_repository.radiate(src, radiation) //Always radiate at max, so a decent dose of radiation is applied
SSradiation.radiate(src, radiation) //Always radiate at max, so a decent dose of radiation is applied
for(var/mob/living/M in view(toxrange, src.loc))
if(M.status_flags & GODMODE)
continue
@@ -451,7 +451,7 @@ GLOBAL_LIST_BOILERPLATE(all_singularities, /obj/singularity)
M << "<span class=\"danger\">You hear an uneartly ringing, then what sounds like a shrilling kettle as you are washed with a wave of heat.</span>"
M << "<span class=\"danger\">You don't even have a moment to react as you are reduced to ashes by the intense radiation.</span>"
M.dust()
radiation_repository.radiate(src, rand(energy))
SSradiation.radiate(src, rand(energy))
return
/obj/singularity/proc/pulse()

View File

@@ -141,7 +141,7 @@
if(!TS)
return
for(var/z in GetConnectedZlevels(TS.z))
radiation_repository.z_radiate(locate(1, 1, z), DETONATION_RADS, 1)
SSradiation.z_radiate(locate(1, 1, z), DETONATION_RADS, 1)
for(var/mob/living/mob in living_mob_list)
var/turf/T = get_turf(mob)
if(T && (loc.z == T.z))
@@ -311,7 +311,7 @@
if(!istype(l.glasses, /obj/item/clothing/glasses/meson)) // VOREStation Edit - Only mesons can protect you!
l.hallucination = max(0, min(200, l.hallucination + power * config_hallucination_power * sqrt( 1 / max(1,get_dist(l, src)) ) ) )
radiation_repository.radiate(src, max(power * 1.5, 50) ) //Better close those shutters!
SSradiation.radiate(src, max(power * 1.5, 50) ) //Better close those shutters!
power -= (power/DECAY_FACTOR)**3 //energy losses due to radiation
@@ -424,7 +424,7 @@
else
l.show_message("<span class=\"warning\">You hear an uneartly ringing and notice your skin is covered in fresh radiation burns.</span>", 2)
var/rads = 500
radiation_repository.radiate(src, rads)
SSradiation.radiate(src, rads)
/proc/supermatter_pull(var/atom/target, var/pull_range = 255, var/pull_power = STAGE_FIVE)
for(var/atom/A in range(pull_range, target))
@@ -467,7 +467,7 @@
return ..()
/obj/item/broken_sm/process()
radiation_repository.radiate(src, 50)
SSradiation.radiate(src, 50)
/obj/item/broken_sm/Destroy()
STOP_PROCESSING(SSobj, src)

View File

@@ -167,4 +167,4 @@
var/rad_power = 50
/obj/item/projectile/arc/radioactive/on_impact(turf/T)
radiation_repository.radiate(T, rad_power)
SSradiation.radiate(T, rad_power)

View File

@@ -0,0 +1,59 @@
// Describes a point source of radiation. Created either in response to a pulse of radiation, or over an irradiated atom.
// Sources will decay over time, unless something is renewing their power!
/datum/radiation_source
var/turf/source_turf // Location of the radiation source.
var/rad_power // Strength of the radiation being emitted.
var/decay = TRUE // True for automatic decay. False if owner promises to handle it (i.e. supermatter)
var/respect_maint = FALSE // True for not affecting RAD_SHIELDED areas.
var/flat = FALSE // True for power falloff with distance.
var/range // Cached maximum range, used for quick checks against mobs.
/datum/radiation_source/Destroy()
SSradiation.sources -= src
if(SSradiation.sources_assoc[src.source_turf] == src)
SSradiation.sources_assoc -= src.source_turf
src.source_turf = null
. = ..()
/datum/radiation_source/proc/update_rad_power(var/new_power = null)
if(new_power == null || new_power == rad_power)
return // No change
else if(new_power <= config.radiation_lower_limit)
qdel(src) // Decayed to nothing
else
rad_power = new_power
if(!flat)
range = min(round(sqrt(rad_power / config.radiation_lower_limit)), 31) // R = rad_power / dist**2 - Solve for dist
/turf
var/cached_rad_resistance = 0
/turf/proc/calc_rad_resistance()
cached_rad_resistance = 0
for(var/obj/O in src.contents)
if(O.rad_resistance) //Override
cached_rad_resistance += O.rad_resistance
else if(O.density) //So open doors don't get counted
var/material/M = O.get_material()
if(!M) continue
cached_rad_resistance += M.weight + M.radiation_resistance
// Looks like storing the contents length is meant to be a basic check if the cache is stale due to items enter/exiting. Better than nothing so I'm leaving it as is. ~Leshana
SSradiation.resistance_cache[src] = (length(contents) + 1)
/turf/simulated/wall/calc_rad_resistance()
SSradiation.resistance_cache[src] = (length(contents) + 1)
cached_rad_resistance = (density ? material.weight + material.radiation_resistance : 0)
/obj
var/rad_resistance = 0 // Allow overriding rad resistance
// If people expand the system, this may be useful. Here as a placeholder until then
/atom/proc/rad_act(var/severity)
return 1
/mob/living/rad_act(var/severity)
if(severity)
src.apply_effect(severity, IRRADIATE, src.getarmor(null, "rad"))
for(var/atom/I in src)
I.rad_act(severity)

View File

@@ -965,7 +965,7 @@ datum/reagent/talum_quem/affect_blood(var/mob/living/carbon/M, var/alien, var/re
metabolism = REM * 4
/datum/reagent/irradiated_nanites/affect_blood(var/mob/living/carbon/M, var/alien, var/removed)
radiation_repository.radiate(get_turf(M), 20) // Irradiate people around you.
SSradiation.radiate(get_turf(M), 20) // Irradiate people around you.
M.radiation = max(M.radiation + 5 * removed, 0) // Irradiate you. Because it's inside you.
/datum/reagent/neurophage_nanites

View File

@@ -15,10 +15,14 @@
/datum/artifact_effect/radiate/DoEffectAura()
if(holder)
radiation_repository.flat_radiate(holder, radiation_amount, src.effectrange)
SSradiation.flat_radiate(holder, radiation_amount, src.effectrange)
return 1
/datum/artifact_effect/radiate/DoEffectPulse()
if(holder)
<<<<<<< HEAD
radiation_repository.radiate(holder, ((radiation_amount * 3) * (sqrt(src.effectrange)))) //Need to get feedback on this //VOREStation Edit - Was too crazy-strong.
=======
SSradiation.radiate(holder, ((radiation_amount * 25) * (sqrt(src.effectrange)))) //Need to get feedback on this
>>>>>>> b193761... Merge pull request #6471 from Novacat/nova-runtimes
return 1

View File

@@ -198,7 +198,7 @@
radiation = rand() * 15 + 85
if(!rad_shield)
//irradiate nearby mobs
radiation_repository.radiate(src, radiation / 25)
SSradiation.radiate(src, radiation / 25)
else
t_left_radspike = pick(10,15,25)

View File

@@ -215,7 +215,11 @@
#include "code\controllers\Processes\alarm.dm"
#include "code\controllers\Processes\emergencyShuttle.dm"
#include "code\controllers\Processes\game_master.dm"
<<<<<<< HEAD:vorestation.dme
#include "code\controllers\Processes\radiation.dm"
=======
#include "code\controllers\Processes\mob.dm"
>>>>>>> b193761... Merge pull request #6471 from Novacat/nova-runtimes:polaris.dme
#include "code\controllers\Processes\supply.dm"
#include "code\controllers\Processes\ticker.dm"
#include "code\controllers\ProcessScheduler\core\process.dm"
@@ -240,6 +244,7 @@
#include "code\controllers\subsystems\overlays.dm"
#include "code\controllers\subsystems\persist_vr.dm"
#include "code\controllers\subsystems\planets.dm"
#include "code\controllers\subsystems\radiation.dm"
#include "code\controllers\subsystems\shuttles.dm"
#include "code\controllers\subsystems\sun.dm"
#include "code\controllers\subsystems\time_track.dm"
@@ -355,7 +360,6 @@
#include "code\datums\repositories\cameras.dm"
#include "code\datums\repositories\crew.dm"
#include "code\datums\repositories\decls.dm"
#include "code\datums\repositories\radiation.dm"
#include "code\datums\repositories\repository.dm"
#include "code\datums\repositories\unique.dm"
#include "code\datums\supplypacks\atmospherics.dm"
@@ -2865,6 +2869,7 @@
#include "code\modules\projectiles\targeting\targeting_mob.dm"
#include "code\modules\projectiles\targeting\targeting_overlay.dm"
#include "code\modules\projectiles\targeting\targeting_triggers.dm"
#include "code\modules\radiation\radiation.dm"
#include "code\modules\random_map\_random_map_setup.dm"
#include "code\modules\random_map\random_map.dm"
#include "code\modules\random_map\random_map_verbs.dm"