diff --git a/code/__defines/misc.dm b/code/__defines/misc.dm index 7f7e9e705ef..69b91d0dc32 100644 --- a/code/__defines/misc.dm +++ b/code/__defines/misc.dm @@ -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 diff --git a/code/controllers/Processes/planet.dm b/code/controllers/Processes/planet.dm deleted file mode 100644 index 18043f92702..00000000000 --- a/code/controllers/Processes/planet.dm +++ /dev/null @@ -1,96 +0,0 @@ -var/datum/controller/process/planet/planet_controller = null - -/datum/controller/process/planet - var/list/planets = list() - var/list/z_to_planet = list() - -/datum/controller/process/planet/setup() - name = "planet controller" - planet_controller = src - schedule_interval = 1 MINUTE - start_delay = 20 SECONDS - - var/list/planet_datums = typesof(/datum/planet) - /datum/planet - for(var/P in planet_datums) - var/datum/planet/NP = new P() - planets.Add(NP) - - allocateTurfs() - -/datum/controller/process/planet/proc/allocateTurfs() - for(var/turf/simulated/OT in outdoor_turfs) - for(var/datum/planet/P in planets) - if(OT.z in P.expected_z_levels) - P.planet_floors |= OT - OT.vis_contents |= P.weather_holder.visuals - break - outdoor_turfs.Cut() //Why were you in there INCORRECTLY? - - for(var/turf/unsimulated/wall/planetary/PW in planetary_walls) - for(var/datum/planet/P in planets) - if(PW.type == P.planetary_wall_type) - P.planet_walls |= PW - break - planetary_walls.Cut() - -/datum/controller/process/planet/proc/unallocateTurf(var/turf/T) - for(var/planet in planets) - var/datum/planet/P = planet - if(T.z in P.expected_z_levels) - P.planet_floors -= T - T.vis_contents -= P.weather_holder.visuals - -/datum/controller/process/planet/doWork() - if(outdoor_turfs.len || planetary_walls.len) - allocateTurfs() - - for(var/datum/planet/P in planets) - P.process(schedule_interval / 10) - SCHECK //Your process() really shouldn't take this long... - - //Sun light needs changing - if(P.needs_work & PLANET_PROCESS_SUN) - P.needs_work &= ~PLANET_PROCESS_SUN - // Remove old value from corners - var/list/sunlit_corners = P.sunlit_corners - var/old_lum_r = -P.sun["lum_r"] - var/old_lum_g = -P.sun["lum_g"] - var/old_lum_b = -P.sun["lum_b"] - if(old_lum_r || old_lum_g || old_lum_b) - for(var/C in P.sunlit_corners) - var/datum/lighting_corner/LC = C - LC.update_lumcount(old_lum_r, old_lum_g, old_lum_b) - SCHECK - sunlit_corners.Cut() - - // Calculate new values to apply - var/new_brightness = P.sun["brightness"] - var/new_color = P.sun["color"] - var/lum_r = new_brightness * GetRedPart (new_color) / 255 - var/lum_g = new_brightness * GetGreenPart(new_color) / 255 - var/lum_b = new_brightness * GetBluePart (new_color) / 255 - var/static/update_gen = -1 // Used to prevent double-processing corners. Otherwise would happen when looping over adjacent turfs. - for(var/I in P.planet_floors) - var/turf/simulated/T = I - if(!T.lighting_corners_initialised) - T.generate_missing_corners() - for(var/C in T.get_corners()) - var/datum/lighting_corner/LC = C - if(LC.update_gen != update_gen && LC.active) - sunlit_corners += LC - LC.update_gen = update_gen - LC.update_lumcount(lum_r, lum_g, lum_b) - SCHECK - update_gen-- - P.sun["lum_r"] = lum_r - P.sun["lum_g"] = lum_g - P.sun["lum_b"] = lum_b - - //Temperature needs updating - if(P.needs_work & PLANET_PROCESS_TEMP) - P.needs_work &= ~PLANET_PROCESS_TEMP - //Set new temperatures - for(var/W in P.planet_walls) - var/turf/unsimulated/wall/planetary/wall = W - wall.set_temperature(P.weather_holder.temperature) - SCHECK diff --git a/code/controllers/Processes/radiation.dm b/code/controllers/Processes/radiation.dm deleted file mode 100644 index 71d9c60233e..00000000000 --- a/code/controllers/Processes/radiation.dm +++ /dev/null @@ -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") diff --git a/code/controllers/Processes/scheduler.dm b/code/controllers/Processes/scheduler.dm deleted file mode 100644 index ac5e4696abc..00000000000 --- a/code/controllers/Processes/scheduler.dm +++ /dev/null @@ -1,169 +0,0 @@ -/var/datum/controller/process/scheduler/scheduler - -/************ -* Scheduler * -************/ -/datum/controller/process/scheduler - var/list/scheduled_tasks - -/datum/controller/process/scheduler/setup() - name = "scheduler" - schedule_interval = 1 SECOND - scheduled_tasks = list() - scheduler = src - -/datum/controller/process/scheduler/doWork() - var/world_time = world.time - for(last_object in scheduled_tasks) - var/datum/scheduled_task/scheduled_task = last_object - if(world_time < scheduled_task.trigger_time) - break // Too early for this one, and therefore too early for all remaining. - try - unschedule(scheduled_task) - scheduled_task.pre_process() - scheduled_task.process() - scheduled_task.post_process() - catch(var/exception/e) - catchException(e, last_object) - SCHECK - -// We've been restarted, probably due to having a massive list of tasks. -// Lets copy over the task list as safely as we can and try to chug thru it... -// Note: We won't be informed about tasks being destroyed, but this is the best we can do. -/datum/controller/process/scheduler/copyStateFrom(var/datum/controller/process/scheduler/target) - scheduled_tasks = list() - for(var/datum/scheduled_task/st in target.scheduled_tasks) - if(!QDELETED(st) && istype(st)) - schedule(st) - scheduler = src - -// We are being killed. Least we can do is deregister all those events we registered -/datum/controller/process/scheduler/onKill() - for(var/st in scheduled_tasks) - GLOB.destroyed_event.unregister(st, src) - -/datum/controller/process/scheduler/statProcess() - ..() - stat(null, "[scheduled_tasks.len] task\s") - -/datum/controller/process/scheduler/proc/schedule(var/datum/scheduled_task/st) - dd_insertObjectList(scheduled_tasks, st) - -/datum/controller/process/scheduler/proc/unschedule(var/datum/scheduled_task/st) - scheduled_tasks -= st - -/********** -* Helpers * -**********/ -/proc/schedule_task_in(var/in_time, var/procedure, var/list/arguments = list()) - return schedule_task(world.time + in_time, procedure, arguments) - -/proc/schedule_callback_in(var/in_time, var/datum/callback) - return schedule_callback(world.time + in_time, callback) - -/proc/schedule_task_with_source_in(var/in_time, var/source, var/procedure, var/list/arguments = list()) - return schedule_task_with_source(world.time + in_time, source, procedure, arguments) - -/proc/schedule_task(var/trigger_time, var/procedure, var/list/arguments) - var/datum/scheduled_task/st = new/datum/scheduled_task(trigger_time, procedure, arguments, /proc/destroy_scheduled_task, list()) - scheduler.schedule(st) - return st - -/proc/schedule_callback(var/trigger_time, var/datum/callback) - var/datum/scheduled_task/callback/st = new/datum/scheduled_task/callback(trigger_time, callback, /proc/destroy_scheduled_task, list()) - scheduler.schedule(st) - return st - -/proc/schedule_task_with_source(var/trigger_time, var/source, var/procedure, var/list/arguments) - var/datum/scheduled_task/st = new/datum/scheduled_task/source(trigger_time, source, procedure, arguments, /proc/destroy_scheduled_task, list()) - scheduler.schedule(st) - return st - -/proc/schedule_repeating_task(var/trigger_time, var/repeat_interval, var/procedure, var/list/arguments) - var/datum/scheduled_task/st = new/datum/scheduled_task(trigger_time, procedure, arguments, /proc/repeat_scheduled_task, list(repeat_interval)) - scheduler.schedule(st) - return st - -/proc/schedule_repeating_task_with_source(var/trigger_time, var/repeat_interval, var/source, var/procedure, var/list/arguments) - var/datum/scheduled_task/st = new/datum/scheduled_task/source(trigger_time, source, procedure, arguments, /proc/repeat_scheduled_task, list(repeat_interval)) - scheduler.schedule(st) - return st - -/************* -* Task Datum * -*************/ -/datum/scheduled_task - var/trigger_time - var/procedure - var/list/arguments - var/task_after_process - var/list/task_after_process_args - -/datum/scheduled_task/New(var/trigger_time, var/procedure, var/list/arguments, var/proc/task_after_process, var/list/task_after_process_args) - ..() - src.trigger_time = trigger_time - src.procedure = procedure - src.arguments = arguments ? arguments : list() - src.task_after_process = task_after_process ? task_after_process : /proc/destroy_scheduled_task - src.task_after_process_args = istype(task_after_process_args) ? task_after_process_args : list() - task_after_process_args += src - -/datum/scheduled_task/Destroy() - scheduler.unschedule(src) - procedure = null - arguments.Cut() - task_after_process = null - task_after_process_args.Cut() - return ..() - -/datum/scheduled_task/dd_SortValue() - return trigger_time - -/datum/scheduled_task/proc/pre_process() - task_triggered_event.raise_event(list(src)) - -/datum/scheduled_task/proc/process() - if(procedure) - call(procedure)(arglist(arguments)) - -/datum/scheduled_task/proc/post_process() - call(task_after_process)(arglist(task_after_process_args)) - -// Resets the trigger time, has no effect if the task has already triggered -/datum/scheduled_task/proc/trigger_task_in(var/trigger_in) - src.trigger_time = world.time + trigger_in - -/datum/scheduled_task/callback - var/datum/callback/callback - -/datum/scheduled_task/callback/New(var/trigger_time, var/datum/callback, var/proc/task_after_process, var/list/task_after_process_args) - src.callback = callback - ..(trigger_time = trigger_time, task_after_process = task_after_process, task_after_process_args = task_after_process_args) - -/datum/scheduled_task/callback/process() - callback.Invoke() - -/datum/scheduled_task/source - var/datum/source - -/datum/scheduled_task/source/New(var/trigger_time, var/datum/source, var/procedure, var/list/arguments, var/proc/task_after_process, var/list/task_after_process_args) - src.source = source - GLOB.destroyed_event.register(src.source, src, /datum/scheduled_task/source/proc/source_destroyed) - ..(trigger_time, procedure, arguments, task_after_process, task_after_process_args) - -/datum/scheduled_task/source/Destroy() - source = null - return ..() - -/datum/scheduled_task/source/process() - call(source, procedure)(arglist(arguments)) - -/datum/scheduled_task/source/proc/source_destroyed() - qdel(src) - -/proc/destroy_scheduled_task(var/datum/scheduled_task/st) - qdel(st) - -/proc/repeat_scheduled_task(var/trigger_delay, var/datum/scheduled_task/st) - st.trigger_time = world.time + trigger_delay - scheduler.schedule(st) diff --git a/code/controllers/subsystems/radiation.dm b/code/controllers/subsystems/radiation.dm new file mode 100644 index 00000000000..babc2c7d5d4 --- /dev/null +++ b/code/controllers/subsystems/radiation.dm @@ -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 = TRUE) //VOREStation edit; Respect shielded areas by default please. + 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 = TRUE) //VOREStation edit; Respect shielded areas by default please. + 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) \ No newline at end of file diff --git a/code/datums/repositories/radiation.dm b/code/datums/repositories/radiation.dm deleted file mode 100644 index 4525032e200..00000000000 --- a/code/datums/repositories/radiation.dm +++ /dev/null @@ -1,138 +0,0 @@ -var/global/repository/radiation/radiation_repository = new() - -/repository/radiation - 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. - -// 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() - radiation_repository.sources -= src - if(radiation_repository.sources_assoc[src.source_turf] == src) - radiation_repository.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 <= 0) - 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 - -// Ray trace from all active radiation sources to T and return the strongest effect. -/repository/radiation/proc/get_rads_at_turf(var/turf/T) - if(!istype(T)) return 0 - - . = 0 - 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 - var/dist = get_dist(source.source_turf, T) - if(dist > source.range) - continue // Too far to possibly affect - if(source.respect_maint) - var/atom/A = T.loc - if(A.flags & RAD_SHIELDED) - continue // In shielded area - 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(!(origin in resistance_cache)) //Only get the resistance if we don't already know it. - origin.calc_rad_resistance() - working = max((working - (origin.cached_rad_resistance * config.radiation_resistance_multiplier)), 0) - if(working <= .) - break // Already affected by a stronger source (or its zero...) - . = max((working * (1 / (dist ** 2))), .) //Butchered version of the inverse square law. Works for this purpose - -// Add a radiation source instance to the repository. It will override any existing source on the same turf. -/repository/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 -/repository/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. -/repository/radiation/proc/flat_radiate(source, power, range, var/respect_maint = TRUE) //VOREStation edit; Respect shielded areas by default please. - 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. -/repository/radiation/proc/z_radiate(var/atom/source, power, var/respect_maint = TRUE) //VOREStation edit; Respect shielded areas by default please. - 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) - -/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 - radiation_repository.resistance_cache[src] = (length(contents) + 1) - -/turf/simulated/wall/calc_rad_resistance() - radiation_repository.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 && !isbelly(loc)) //eaten mobs are made immune to radiation //VOREStation Edit Start - src.apply_effect(severity, IRRADIATE, src.getarmor(null, "rad")) - for(var/atom/I in src) - I.rad_act(severity) ///VOREStation Edit End diff --git a/code/game/gamemodes/meteor/meteors.dm b/code/game/gamemodes/meteor/meteors.dm index 4380331b50d..1ac4779414d 100644 --- a/code/game/gamemodes/meteor/meteors.dm +++ b/code/game/gamemodes/meteor/meteors.dm @@ -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 diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index c31c8f650b9..480effcf98e 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -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 ..() diff --git a/code/game/machinery/doors/blast_door.dm b/code/game/machinery/doors/blast_door.dm index ea881323c8c..bf201989fea 100644 --- a/code/game/machinery/doors/blast_door.dm +++ b/code/game/machinery/doors/blast_door.dm @@ -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 diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index c55a7d8345f..43fb8340ef3 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -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 diff --git a/code/game/mecha/combat/phazon.dm b/code/game/mecha/combat/phazon.dm index b54368a75e8..3ada4824f74 100644 --- a/code/game/mecha/combat/phazon.dm +++ b/code/game/mecha/combat/phazon.dm @@ -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("The [src.name] appears to flicker, before its silhouette stabilizes!") return diff --git a/code/game/mecha/equipment/tools/tools.dm b/code/game/mecha/equipment/tools/tools.dm index f8219451440..73f7356ade6 100644 --- a/code/game/mecha/equipment/tools/tools.dm +++ b/code/game/mecha/equipment/tools/tools.dm @@ -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 diff --git a/code/game/objects/effects/map_effects/radiation_emitter.dm b/code/game/objects/effects/map_effects/radiation_emitter.dm index 3fb31d3c5dc..8abf946556d 100644 --- a/code/game/objects/effects/map_effects/radiation_emitter.dm +++ b/code/game/objects/effects/map_effects/radiation_emitter.dm @@ -1,19 +1,19 @@ -// 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() - radiation_repository.radiate(src, radiation_power) - +// 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 radiation_power = 100 \ No newline at end of file diff --git a/code/game/objects/items/devices/defib.dm b/code/game/objects/items/devices/defib.dm index 26fb1b69aa8..b66c4a37765 100644 --- a/code/game/objects/items/devices/defib.dm +++ b/code/game/objects/items/devices/defib.dm @@ -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) diff --git a/code/game/objects/items/devices/geiger.dm b/code/game/objects/items/devices/geiger.dm index 76697ddba30..92ff449855e 100644 --- a/code/game/objects/items/devices/geiger.dm +++ b/code/game/objects/items/devices/geiger.dm @@ -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() diff --git a/code/game/objects/items/poi_items.dm b/code/game/objects/items/poi_items.dm index 6fd6d7debdd..c12a3a655aa 100644 --- a/code/game/objects/items/poi_items.dm +++ b/code/game/objects/items/poi_items.dm @@ -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) diff --git a/code/game/objects/items/weapons/tools/crowbar.dm b/code/game/objects/items/weapons/tools/crowbar.dm index 73b62f07418..fab0a6fb983 100644 --- a/code/game/objects/items/weapons/tools/crowbar.dm +++ b/code/game/objects/items/weapons/tools/crowbar.dm @@ -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("\The [src] shudders!") return FALSE return TRUE diff --git a/code/game/objects/items/weapons/tools/screwdriver.dm b/code/game/objects/items/weapons/tools/screwdriver.dm index a9bdd6cee86..1969987ff96 100644 --- a/code/game/objects/items/weapons/tools/screwdriver.dm +++ b/code/game/objects/items/weapons/tools/screwdriver.dm @@ -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("\The [src] shudders!") return FALSE return TRUE diff --git a/code/game/objects/items/weapons/tools/wirecutters.dm b/code/game/objects/items/weapons/tools/wirecutters.dm index 181c786c4c4..4d61609db44 100644 --- a/code/game/objects/items/weapons/tools/wirecutters.dm +++ b/code/game/objects/items/weapons/tools/wirecutters.dm @@ -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("\The [src] shudders!") return FALSE return TRUE diff --git a/code/game/objects/items/weapons/tools/wrench.dm b/code/game/objects/items/weapons/tools/wrench.dm index 652e32cf75c..3f02a2f8b36 100644 --- a/code/game/objects/items/weapons/tools/wrench.dm +++ b/code/game/objects/items/weapons/tools/wrench.dm @@ -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("\The [src] shudders!") return FALSE return TRUE diff --git a/code/game/objects/structures/girders.dm b/code/game/objects/structures/girders.dm index 072dd43de6e..26487233852 100644 --- a/code/game/objects/structures/girders.dm +++ b/code/game/objects/structures/girders.dm @@ -38,7 +38,7 @@ if(!total_radiation) return - radiation_repository.radiate(src, total_radiation) + SSradiation.radiate(src, total_radiation) return total_radiation diff --git a/code/game/objects/structures/simple_doors.dm b/code/game/objects/structures/simple_doors.dm index 431ef0cdbb0..60b94841eac 100644 --- a/code/game/objects/structures/simple_doors.dm +++ b/code/game/objects/structures/simple_doors.dm @@ -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") diff --git a/code/game/turfs/simulated/wall_attacks.dm b/code/game/turfs/simulated/wall_attacks.dm index bd6adfe32f4..8599def4a55 100644 --- a/code/game/turfs/simulated/wall_attacks.dm +++ b/code/game/turfs/simulated/wall_attacks.dm @@ -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 diff --git a/code/game/turfs/simulated/wall_icon.dm b/code/game/turfs/simulated/wall_icon.dm index b8a0980de41..f277ea79f56 100644 --- a/code/game/turfs/simulated/wall_icon.dm +++ b/code/game/turfs/simulated/wall_icon.dm @@ -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() diff --git a/code/game/turfs/simulated/walls.dm b/code/game/turfs/simulated/walls.dm index 1847767083e..bf5f711b206 100644 --- a/code/game/turfs/simulated/walls.dm +++ b/code/game/turfs/simulated/walls.dm @@ -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) diff --git a/code/modules/blob2/overmind/types.dm b/code/modules/blob2/overmind/types.dm index 6049ccfc726..49b968cfccd 100644 --- a/code/modules/blob2/overmind/types.dm +++ b/code/modules/blob2/overmind/types.dm @@ -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" diff --git a/code/modules/events/radiation_storm.dm b/code/modules/events/radiation_storm.dm index 6140ae2de0c..13f853dd3c2 100644 --- a/code/modules/events/radiation_storm.dm +++ b/code/modules/events/radiation_storm.dm @@ -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) diff --git a/code/modules/gamemaster/actions/radiation_storm.dm b/code/modules/gamemaster/actions/radiation_storm.dm index 243af5dbee0..678ad16ab64 100644 --- a/code/modules/gamemaster/actions/radiation_storm.dm +++ b/code/modules/gamemaster/actions/radiation_storm.dm @@ -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) diff --git a/code/modules/materials/material_sheets.dm b/code/modules/materials/material_sheets.dm index 4ca50889ead..64eee7ddbee 100644 --- a/code/modules/materials/material_sheets.dm +++ b/code/modules/materials/material_sheets.dm @@ -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 diff --git a/code/modules/mining/mine_turfs.dm b/code/modules/mining/mine_turfs.dm index 3da050bacb8..b006808a1eb 100644 --- a/code/modules/mining/mine_turfs.dm +++ b/code/modules/mining/mine_turfs.dm @@ -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) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 2c74029eb8a..758c438a254 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -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, "Radiation level: [rads ? rads : "0"] Bq.") diff --git a/code/modules/mob/living/simple_animal/slime/subtypes.dm b/code/modules/mob/living/simple_animal/slime/subtypes.dm index 18b43dc33c9..75f33cdcef6 100644 --- a/code/modules/mob/living/simple_animal/slime/subtypes.dm +++ b/code/modules/mob/living/simple_animal/slime/subtypes.dm @@ -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 diff --git a/code/modules/mob/living/simple_mob/subtypes/slime/xenobio/subtypes.dm b/code/modules/mob/living/simple_mob/subtypes/slime/xenobio/subtypes.dm index 41eaccebc9d..68adaed6607 100644 --- a/code/modules/mob/living/simple_mob/subtypes/slime/xenobio/subtypes.dm +++ b/code/modules/mob/living/simple_mob/subtypes/slime/xenobio/subtypes.dm @@ -527,7 +527,7 @@ ..() /mob/living/simple_mob/slime/xenobio/green/proc/irradiate() - radiation_repository.radiate(src, rads) + SSradiation.radiate(src, rads) diff --git a/code/modules/planet/sif.dm b/code/modules/planet/sif.dm index eada6f33cbe..921142812d3 100644 --- a/code/modules/planet/sif.dm +++ b/code/modules/planet/sif.dm @@ -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)) diff --git a/code/modules/planet/virgo3b_vr.dm b/code/modules/planet/virgo3b_vr.dm index 1248fb40be3..791841aca71 100644 --- a/code/modules/planet/virgo3b_vr.dm +++ b/code/modules/planet/virgo3b_vr.dm @@ -531,5 +531,5 @@ var/datum/planet/virgo3b/planet_virgo3b = 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)) diff --git a/code/modules/power/fusion/core/core_field.dm b/code/modules/power/fusion/core/core_field.dm index f0eca3add60..5444c46b037 100644 --- a/code/modules/power/fusion/core/core_field.dm +++ b/code/modules/power/fusion/core/core_field.dm @@ -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() diff --git a/code/modules/power/fusion/fuel_assembly/fuel_assembly.dm b/code/modules/power/fusion/fuel_assembly/fuel_assembly.dm index 41492743510..73543ead92b 100644 --- a/code/modules/power/fusion/fuel_assembly/fuel_assembly.dm +++ b/code/modules/power/fusion/fuel_assembly/fuel_assembly.dm @@ -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) diff --git a/code/modules/power/fusion/fusion_reactions.dm b/code/modules/power/fusion/fusion_reactions.dm index 623f70bd6bd..88117f8164b 100644 --- a/code/modules/power/fusion/fusion_reactions.dm +++ b/code/modules/power/fusion/fusion_reactions.dm @@ -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) diff --git a/code/modules/power/port_gen.dm b/code/modules/power/port_gen.dm index 5e4c2e6207c..2443f3ea279 100644 --- a/code/modules/power/port_gen.dm +++ b/code/modules/power/port_gen.dm @@ -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) diff --git a/code/modules/power/singularity/collector.dm b/code/modules/power/singularity/collector.dm index 0bac07c2dc9..1dc29c7fd75 100644 --- a/code/modules/power/singularity/collector.dm +++ b/code/modules/power/singularity/collector.dm @@ -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 diff --git a/code/modules/power/singularity/particle_accelerator/particle_smasher.dm b/code/modules/power/singularity/particle_accelerator/particle_smasher.dm index b3a1556395f..921b0000781 100644 --- a/code/modules/power/singularity/particle_accelerator/particle_smasher.dm +++ b/code/modules/power/singularity/particle_accelerator/particle_smasher.dm @@ -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("\The [src] fizzles.") 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 diff --git a/code/modules/power/singularity/singularity.dm b/code/modules/power/singularity/singularity.dm index 3768ab95358..b75a81e1e4b 100644 --- a/code/modules/power/singularity/singularity.dm +++ b/code/modules/power/singularity/singularity.dm @@ -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 << "You hear an uneartly ringing, then what sounds like a shrilling kettle as you are washed with a wave of heat." M << "You don't even have a moment to react as you are reduced to ashes by the intense radiation." M.dust() - radiation_repository.radiate(src, rand(energy)) + SSradiation.radiate(src, rand(energy)) return /obj/singularity/proc/pulse() diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm index 10583d0d663..9e1f3f06c29 100644 --- a/code/modules/power/supermatter/supermatter.dm +++ b/code/modules/power/supermatter/supermatter.dm @@ -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("You hear an uneartly ringing and notice your skin is covered in fresh radiation burns.", 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) diff --git a/code/modules/projectiles/projectile/arc.dm b/code/modules/projectiles/projectile/arc.dm index 0c4c9f4caa9..1f19dc0242e 100644 --- a/code/modules/projectiles/projectile/arc.dm +++ b/code/modules/projectiles/projectile/arc.dm @@ -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) diff --git a/code/modules/radiation/radiation.dm b/code/modules/radiation/radiation.dm new file mode 100644 index 00000000000..d913ad7cab4 --- /dev/null +++ b/code/modules/radiation/radiation.dm @@ -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 && !isbelly(loc)) //eaten mobs are made immune to radiation //VOREStation Edit + src.apply_effect(severity, IRRADIATE, src.getarmor(null, "rad")) + for(var/atom/I in src) + I.rad_act(severity) \ No newline at end of file diff --git a/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Toxins.dm b/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Toxins.dm index 38a65a78d86..43635aba5b6 100644 --- a/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Toxins.dm +++ b/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Toxins.dm @@ -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 diff --git a/code/modules/xenoarcheaology/effects/radiate.dm b/code/modules/xenoarcheaology/effects/radiate.dm index a083cdddbc4..e38540eb045 100644 --- a/code/modules/xenoarcheaology/effects/radiate.dm +++ b/code/modules/xenoarcheaology/effects/radiate.dm @@ -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 * 3) * (sqrt(src.effectrange)))) //Need to get feedback on this //VOREStation Edit - Was too crazy-strong. + SSradiation.radiate(holder, ((radiation_amount * 3) * (sqrt(src.effectrange)))) //Need to get feedback on this //VOREStation Edit - Was too crazy-strong. return 1 diff --git a/code/modules/xenoarcheaology/tools/geosample_scanner.dm b/code/modules/xenoarcheaology/tools/geosample_scanner.dm index b97a34e48fa..7f266f454e9 100644 --- a/code/modules/xenoarcheaology/tools/geosample_scanner.dm +++ b/code/modules/xenoarcheaology/tools/geosample_scanner.dm @@ -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) diff --git a/vorestation.dme b/vorestation.dme index c62ebf19d96..01ae78f794a 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -215,7 +215,6 @@ #include "code\controllers\Processes\alarm.dm" #include "code\controllers\Processes\emergencyShuttle.dm" #include "code\controllers\Processes\game_master.dm" -#include "code\controllers\Processes\radiation.dm" #include "code\controllers\Processes\supply.dm" #include "code\controllers\Processes\ticker.dm" #include "code\controllers\ProcessScheduler\core\process.dm" @@ -240,6 +239,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 +355,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" @@ -2869,6 +2868,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"