mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2026-01-04 14:33:30 +00:00
Blind port of Bay Radiation Subsystem
Figured I would do my part to move everything over to subsystems. Not tested yet.
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -461,7 +461,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>")
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -527,7 +527,7 @@
|
||||
..()
|
||||
|
||||
/mob/living/simple_mob/slime/xenobio/green/proc/irradiate()
|
||||
radiation_repository.radiate(src, rads)
|
||||
SSradiation.radiate(src, rads)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -555,4 +555,4 @@ var/datum/planet/sif/planet_sif = null
|
||||
if(!istype(T))
|
||||
return
|
||||
if(T.outdoors)
|
||||
radiation_repository.radiate(T, rand(fallout_rad_low, fallout_rad_high))
|
||||
SSradiation.radiate(T, rand(fallout_rad_low, fallout_rad_high))
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -403,7 +403,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
|
||||
@@ -446,7 +446,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()
|
||||
|
||||
@@ -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))
|
||||
@@ -312,7 +312,7 @@
|
||||
if(eye_shield < 1)
|
||||
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
|
||||
|
||||
@@ -425,7 +425,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))
|
||||
@@ -468,7 +468,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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
59
code/modules/radiation/radiation.dm
Normal file
59
code/modules/radiation/radiation.dm
Normal 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)
|
||||
@@ -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
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
|
||||
/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)
|
||||
radiation_repository.radiate(holder, ((radiation_amount * 25) * (sqrt(src.effectrange)))) //Need to get feedback on this
|
||||
SSradiation.radiate(holder, ((radiation_amount * 25) * (sqrt(src.effectrange)))) //Need to get feedback on this
|
||||
return 1
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user