diff --git a/code/__defines/misc.dm b/code/__defines/misc.dm index 7f7e9e705e..69b91d0dc3 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 18043f9270..0000000000 --- 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 71d9c60233..0000000000 --- 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 ac5e4696ab..0000000000 --- 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 0000000000..babc2c7d5d --- /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 4525032e20..0000000000 --- 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 4380331b50..1ac4779414 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 c31c8f650b..480effcf98 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 615309d31c..b2a9941afa 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 c55a7d8345..43fb8340ef 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/machinery/telecomms/broadcaster.dm b/code/game/machinery/telecomms/broadcaster.dm index cd65fb9f91..8f6e8e589e 100644 --- a/code/game/machinery/telecomms/broadcaster.dm +++ b/code/game/machinery/telecomms/broadcaster.dm @@ -22,7 +22,17 @@ var/message_delay = 0 // To make sure restarting the recentmessages list is kept machinetype = 5 produces_heat = 0 delay = 7 - circuitboard = "/obj/item/weapon/circuitboard/telecomms/broadcaster" + circuit = /obj/item/weapon/circuitboard/telecomms/broadcaster + +/obj/machinery/telecomms/processor/Initialize() + . = ..() + component_parts = list() + component_parts += new /obj/item/weapon/stock_parts/subspace/sub_filter(src) + component_parts += new /obj/item/weapon/stock_parts/subspace/crystal(src) + component_parts += new /obj/item/weapon/stock_parts/manipulator(src) + component_parts += new /obj/item/weapon/stock_parts/manipulator(src) + component_parts += new /obj/item/weapon/stock_parts/micro_laser/high(src) + component_parts += new /obj/item/stack/cable_coil(src, 1) /obj/machinery/telecomms/broadcaster/receive_information(datum/signal/signal, obj/machinery/telecomms/machine_from) // Don't broadcast rejected signals diff --git a/code/game/machinery/telecomms/machine_interactions.dm b/code/game/machinery/telecomms/machine_interactions.dm index b9fc81f724..80bea74ed4 100644 --- a/code/game/machinery/telecomms/machine_interactions.dm +++ b/code/game/machinery/telecomms/machine_interactions.dm @@ -12,7 +12,6 @@ /obj/machinery/telecomms var/temp = "" // output message - var/construct_op = 0 /obj/machinery/telecomms/attackby(obj/item/P as obj, mob/user as mob) @@ -21,7 +20,6 @@ if(istype(P, /obj/item/device/multitool)) attack_hand(user) - // REPAIRING: Use Nanopaste to repair 10-20 integrity points. if(istype(P, /obj/item/stack/nanopaste)) var/obj/item/stack/nanopaste/T = P @@ -34,75 +32,10 @@ return - switch(construct_op) - if(0) - if(P.is_screwdriver()) - to_chat(user, "You unfasten the bolts.") - playsound(src.loc, P.usesound, 50, 1) - construct_op ++ - if(1) - if(P.is_screwdriver()) - to_chat(user, "You fasten the bolts.") - playsound(src.loc, P.usesound, 50, 1) - construct_op -- - if(P.is_wrench()) - to_chat(user, "You dislodge the external plating.") - playsound(src.loc, P.usesound, 75, 1) - construct_op ++ - if(2) - if(P.is_wrench()) - to_chat(user, "You secure the external plating.") - playsound(src.loc, P.usesound, 75, 1) - construct_op -- - if(P.is_wirecutter()) - playsound(src.loc, P.usesound, 50, 1) - to_chat(user, "You remove the cables.") - construct_op ++ - var/obj/item/stack/cable_coil/A = new /obj/item/stack/cable_coil( user.loc ) - A.amount = 5 - stat |= BROKEN // the machine's been borked! - if(3) - if(istype(P, /obj/item/stack/cable_coil)) - var/obj/item/stack/cable_coil/A = P - if (A.use(5)) - to_chat(user, "You insert the cables.") - construct_op-- - stat &= ~BROKEN // the machine's not borked anymore! - else - to_chat(user, "You need five coils of wire for this.") - if(P.is_crowbar()) - to_chat(user, "You begin prying out the circuit board other components...") - playsound(src.loc, P.usesound, 50, 1) - if(do_after(user,60 * P.toolspeed)) - to_chat(user, "You finish prying out the components.") - - // Drop all the component stuff - if(contents.len > 0) - for(var/obj/x in src) - x.loc = user.loc - else - - // If the machine wasn't made during runtime, probably doesn't have components: - // manually find the components and drop them! - var/newpath = text2path(circuitboard) - var/obj/item/weapon/circuitboard/C = new newpath - for(var/I in C.req_components) - for(var/i = 1, i <= C.req_components[I], i++) - newpath = text2path(I) - var/obj/item/s = new newpath - s.loc = user.loc - if(istype(P, /obj/item/stack/cable_coil)) - var/obj/item/stack/cable_coil/A = P - A.amount = 1 - - // Drop a circuit board too - C.loc = user.loc - - // Create a frame and delete the current machine - var/obj/structure/frame/F = new - F.loc = src.loc - qdel(src) - + if(default_deconstruction_screwdriver(user, P)) + return + if(default_deconstruction_crowbar(user, P)) + return /obj/machinery/telecomms/attack_ai(var/mob/user as mob) attack_hand(user) diff --git a/code/game/machinery/telecomms/telecomunications.dm b/code/game/machinery/telecomms/telecomunications.dm index 50e2f504c9..d6cefb6828 100644 --- a/code/game/machinery/telecomms/telecomunications.dm +++ b/code/game/machinery/telecomms/telecomunications.dm @@ -32,7 +32,6 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list() var/produces_heat = 1 //whether the machine will produce heat when on. var/delay = 10 // how many process() ticks to delay per heat var/long_range_link = 0 // Can you link it across Z levels or on the otherside of the map? (Relay & Hub) - var/circuitboard = null // string pointing to a circuitboard type var/hide = 0 // Is it a hidden machine? var/listening_level = 0 // 0 = auto set in New() - this is the z level that the machine is listening to. @@ -256,7 +255,17 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list() idle_power_usage = 600 machinetype = 1 produces_heat = 0 - circuitboard = "/obj/item/weapon/circuitboard/telecomms/receiver" + circuit = /obj/item/weapon/circuitboard/telecomms/receiver + +/obj/machinery/telecomms/receiver/Initialize() + . = ..() + component_parts = list() + component_parts += new /obj/item/weapon/stock_parts/subspace/ansible(src) + component_parts += new /obj/item/weapon/stock_parts/subspace/sub_filter(src) + component_parts += new /obj/item/weapon/stock_parts/manipulator(src) + component_parts += new /obj/item/weapon/stock_parts/manipulator(src) + component_parts += new /obj/item/weapon/stock_parts/micro_laser(src) + RefreshParts() /obj/machinery/telecomms/receiver/receive_signal(datum/signal/signal) @@ -312,7 +321,7 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list() use_power = 1 idle_power_usage = 1600 machinetype = 7 - circuitboard = "/obj/item/weapon/circuitboard/telecomms/hub" + circuit = /obj/item/weapon/circuitboard/telecomms/hub long_range_link = 1 netspeed = 40 var/list/telecomms_map @@ -320,6 +329,13 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list() /obj/machinery/telecomms/hub/Initialize() . = ..() LAZYINITLIST(telecomms_map) + component_parts = list() + component_parts += new /obj/item/weapon/stock_parts/subspace/sub_filter(src) + component_parts += new /obj/item/weapon/stock_parts/subspace/sub_filter(src) + component_parts += new /obj/item/weapon/stock_parts/manipulator(src) + component_parts += new /obj/item/weapon/stock_parts/manipulator(src) + component_parts += new /obj/item/stack/cable_coil(src, 2) + RefreshParts() /obj/machinery/telecomms/hub/process() . = ..() @@ -365,12 +381,22 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list() idle_power_usage = 600 machinetype = 8 produces_heat = 0 - circuitboard = "/obj/item/weapon/circuitboard/telecomms/relay" + circuit = /obj/item/weapon/circuitboard/telecomms/relay netspeed = 5 long_range_link = 1 var/broadcasting = 1 var/receiving = 1 +/obj/machinery/telecomms/relay/Initialize() + . = ..() + component_parts = list() + component_parts += new /obj/item/weapon/stock_parts/subspace/sub_filter(src) + component_parts += new /obj/item/weapon/stock_parts/subspace/sub_filter(src) + component_parts += new /obj/item/weapon/stock_parts/manipulator(src) + component_parts += new /obj/item/weapon/stock_parts/manipulator(src) + component_parts += new /obj/item/stack/cable_coil(src, 2) + RefreshParts() + /obj/machinery/telecomms/relay/forceMove(var/newloc) . = ..(newloc) listening_level = z @@ -420,10 +446,19 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list() use_power = 1 idle_power_usage = 1000 machinetype = 2 - circuitboard = "/obj/item/weapon/circuitboard/telecomms/bus" + circuit = /obj/item/weapon/circuitboard/telecomms/bus netspeed = 40 var/change_frequency = 0 +/obj/machinery/telecomms/bus/Initialize() + . = ..() + component_parts = list() + component_parts += new /obj/item/weapon/stock_parts/subspace/sub_filter(src) + component_parts += new /obj/item/weapon/stock_parts/manipulator(src) + component_parts += new /obj/item/weapon/stock_parts/manipulator(src) + component_parts += new /obj/item/stack/cable_coil(src, 1) + RefreshParts() + /obj/machinery/telecomms/bus/receive_information(datum/signal/signal, obj/machinery/telecomms/machine_from) if(is_freq_listening(signal)) @@ -473,23 +508,37 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list() idle_power_usage = 600 machinetype = 3 delay = 5 - circuitboard = "/obj/item/weapon/circuitboard/telecomms/processor" + circuit = /obj/item/weapon/circuitboard/telecomms/processor var/process_mode = 1 // 1 = Uncompress Signals, 0 = Compress Signals - receive_information(datum/signal/signal, obj/machinery/telecomms/machine_from) +/obj/machinery/telecomms/processor/Initialize() + . = ..() + component_parts = list() + component_parts += new /obj/item/weapon/stock_parts/subspace/sub_filter(src) + component_parts += new /obj/item/weapon/stock_parts/subspace/treatment(src) + component_parts += new /obj/item/weapon/stock_parts/subspace/treatment(src) + component_parts += new /obj/item/weapon/stock_parts/subspace/amplifier(src) + component_parts += new /obj/item/weapon/stock_parts/subspace/analyzer(src) + component_parts += new /obj/item/weapon/stock_parts/manipulator(src) + component_parts += new /obj/item/weapon/stock_parts/manipulator(src) + component_parts += new /obj/item/weapon/stock_parts/manipulator(src) + component_parts += new /obj/item/stack/cable_coil(src, 2) + RefreshParts() - if(is_freq_listening(signal)) +/obj/machinery/telecomms/processor/receive_information(datum/signal/signal, obj/machinery/telecomms/machine_from) - if(process_mode) - signal.data["compression"] = 0 // uncompress subspace signal - else - signal.data["compression"] = 100 // even more compressed signal + if(is_freq_listening(signal)) - if(istype(machine_from, /obj/machinery/telecomms/bus)) - relay_direct_information(signal, machine_from) // send the signal back to the machine - else // no bus detected - send the signal to servers instead - signal.data["slow"] += rand(5, 10) // slow the signal down - relay_information(signal, "/obj/machinery/telecomms/server") + if(process_mode) + signal.data["compression"] = 0 // uncompress subspace signal + else + signal.data["compression"] = 100 // even more compressed signal + + if(istype(machine_from, /obj/machinery/telecomms/bus)) + relay_direct_information(signal, machine_from) // send the signal back to the machine + else // no bus detected - send the signal to servers instead + signal.data["slow"] += rand(5, 10) // slow the signal down + relay_information(signal, "/obj/machinery/telecomms/server") /* @@ -510,7 +559,7 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list() use_power = 1 idle_power_usage = 300 machinetype = 4 - circuitboard = "/obj/item/weapon/circuitboard/telecomms/server" + circuit = /obj/item/weapon/circuitboard/telecomms/server var/list/log_entries = list() var/list/stored_names = list() var/list/TrafficActions = list() @@ -534,6 +583,15 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list() Compiler.Holder = src server_radio = new() +/obj/machinery/telecomms/server/Initialize() + . = ..() + component_parts = list() + component_parts += new /obj/item/weapon/stock_parts/subspace/sub_filter(src) + component_parts += new /obj/item/weapon/stock_parts/manipulator(src) + component_parts += new /obj/item/weapon/stock_parts/manipulator(src) + component_parts += new /obj/item/stack/cable_coil(src, 1) + RefreshParts() + /obj/machinery/telecomms/server/receive_information(datum/signal/signal, obj/machinery/telecomms/machine_from) if(signal.data["message"]) diff --git a/code/game/mecha/combat/phazon.dm b/code/game/mecha/combat/phazon.dm index b54368a75e..3ada4824f7 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 f821945144..73f7356ade 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 3fb31d3c5d..8abf946556 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 26fb1b69aa..b66c4a3776 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 76697ddba3..92ff449855 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/devices/radio/encryptionkey_vr.dm b/code/game/objects/items/devices/radio/encryptionkey_vr.dm index 4d2debc341..a70ad6f7df 100644 --- a/code/game/objects/items/devices/radio/encryptionkey_vr.dm +++ b/code/game/objects/items/devices/radio/encryptionkey_vr.dm @@ -18,3 +18,9 @@ name = "research director's encryption key" icon_state = "rd_cypherkey" channels = list("Command" = 1, "Science" = 1, "Explorer" = 1) + +/obj/item/device/encryptionkey/ert + channels = list("Response Team" = 1, "Science" = 1, "Command" = 1, "Medical" = 1, "Engineering" = 1, "Security" = 1, "Supply" = 1, "Service" = 1, "Explorer" = 1) + +/obj/item/device/encryptionkey/omni //Literally only for the admin intercoms + channels = list("Mercenary" = 1, "Raider" = 1, "Response Team" = 1, "Science" = 1, "Command" = 1, "Medical" = 1, "Engineering" = 1, "Security" = 1, "Supply" = 1, "Service" = 1, "Explorer" = 1) diff --git a/code/game/objects/items/devices/radio/headset_vr.dm b/code/game/objects/items/devices/radio/headset_vr.dm index 46d4ead3d8..d7216ed2d4 100644 --- a/code/game/objects/items/devices/radio/headset_vr.dm +++ b/code/game/objects/items/devices/radio/headset_vr.dm @@ -3,6 +3,7 @@ desc = "The headset of the boss's boss." icon_state = "cent_headset" item_state = "headset" + centComm = 1 ks2type = /obj/item/device/encryptionkey/ert /obj/item/device/radio/headset/centcom/alt @@ -13,5 +14,6 @@ name = "\improper NT radio headset" desc = "The headset of a Nanotrasen corporate employee." icon_state = "nt_headset" + centComm = 1 ks2type = /obj/item/device/encryptionkey/ert diff --git a/code/game/objects/items/poi_items.dm b/code/game/objects/items/poi_items.dm index 6fd6d7debd..c12a3a655a 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/manuals.dm b/code/game/objects/items/weapons/manuals.dm index 6ae36ca0dd..4afc7b3c3f 100644 --- a/code/game/objects/items/weapons/manuals.dm +++ b/code/game/objects/items/weapons/manuals.dm @@ -20,7 +20,7 @@
- +