From 24b9d4b9f41539537c20255a32a6d0f379a331fb Mon Sep 17 00:00:00 2001 From: Emmett Gaines Date: Sat, 14 Oct 2017 18:39:51 -0400 Subject: [PATCH 1/2] Fixes camera mobs becoming contaminated and other tweaks (#31731) --- code/__DEFINES/radiation.dm | 2 +- code/__HELPERS/radiation.dm | 14 +++++++++----- code/datums/components/radioactive.dm | 9 ++++++--- code/datums/radiation_wave.dm | 11 +++++++---- code/game/gamemodes/meteor/meteors.dm | 2 +- code/game/objects/items/grenades/syndieminibomb.dm | 2 +- code/game/objects/items/theft_tools.dm | 8 ++++---- code/game/objects/structures/false_walls.dm | 2 +- code/game/objects/structures/statues.dm | 2 +- code/game/turfs/simulated/floor/mineral_floor.dm | 2 +- code/game/turfs/simulated/wall/mineral_walls.dm | 2 +- .../atmospherics/machinery/atmosmachinery.dm | 4 ---- .../living/carbon/human/species_types/golems.dm | 2 +- code/modules/power/gravitygenerator.dm | 2 +- code/modules/power/rtg.dm | 2 +- code/modules/power/singularity/singularity.dm | 4 ++-- code/modules/power/supermatter/supermatter.dm | 6 +++--- .../chemistry/reagents/medicine_reagents.dm | 4 ++-- code/modules/research/experimentor.dm | 2 +- tgstation.dme | 2 +- 20 files changed, 45 insertions(+), 39 deletions(-) diff --git a/code/__DEFINES/radiation.dm b/code/__DEFINES/radiation.dm index e6b38dd4af..4787754e3a 100644 --- a/code/__DEFINES/radiation.dm +++ b/code/__DEFINES/radiation.dm @@ -15,7 +15,7 @@ Ask ninjanomnom if they're around #define RAD_MOB_COEFFICIENT 0.25 // Radiation applied is multiplied by this #define RAD_LOSS_PER_TICK 1 -#define RAD_TOX_COEFFICIENT 0.1 // Toxin damage per tick coefficient +#define RAD_TOX_COEFFICIENT 0.05 // Toxin damage per tick coefficient #define RAD_MOB_SAFE 300 // How much stored radiation in a mob with no ill effects #define RAD_MOB_KNOCKDOWN 1500 // How much stored radiation to start stunning diff --git a/code/__HELPERS/radiation.dm b/code/__HELPERS/radiation.dm index a5beca0c5c..189949b80b 100644 --- a/code/__HELPERS/radiation.dm +++ b/code/__HELPERS/radiation.dm @@ -11,25 +11,29 @@ return for(var/i in 1 to location.contents.len) - var/static/list/ignored_things = typecacheof(list(/mob/dead, /obj/effect, /obj/docking_port, /turf, /atom/movable/lighting_object)) + var/static/list/ignored_things = typecacheof(list(/mob/dead, /obj/effect, /obj/docking_port, /turf, /atom/movable/lighting_object, /mob/camera)) var/atom/thing = location.contents[i] if(ignored_things[thing.type]) continue get_rad_contents(thing, output) -/proc/radiation_pulse(turf/epicenter, intensity, range_modifier, log=FALSE, can_contaminate=TRUE) +/proc/radiation_pulse(atom/source, intensity, range_modifier, log=FALSE, can_contaminate=TRUE) if(!SSradiation.can_fire) return for(var/dir in GLOB.cardinals) - new /datum/radiation_wave(epicenter, dir, intensity, range_modifier, can_contaminate) + new /datum/radiation_wave(source, dir, intensity, range_modifier, can_contaminate) - var/list/things = get_rad_contents(epicenter) //copypasta because I don't want to put special code in waves to handle their origin + var/list/things = get_rad_contents(source) //copypasta because I don't want to put special code in waves to handle their origin for(var/k in 1 to things.len) var/atom/thing = things[k] if(!thing) continue thing.rad_act(intensity) + var/static/last_huge_pulse = 0 + if(intensity > 3000 && world.time > last_huge_pulse + 200) + last_huge_pulse = world.time + log = TRUE if(log) - log_game("Radiation pulse with intensity:[intensity] and range modifier:[range_modifier] in area [epicenter.loc.name] ") + log_game("Radiation pulse with intensity:[intensity] and range modifier:[range_modifier] in area [get_area(source)] ") return TRUE \ No newline at end of file diff --git a/code/datums/components/radioactive.dm b/code/datums/components/radioactive.dm index c04a35cf3e..1661056e8c 100644 --- a/code/datums/components/radioactive.dm +++ b/code/datums/components/radioactive.dm @@ -6,12 +6,15 @@ /datum/component/radioactive dupe_mode = COMPONENT_DUPE_UNIQUE + var/source + var/hl3_release_date //the half-life measured in ticks var/strength var/can_contaminate -/datum/component/radioactive/Initialize(_strength=0, _half_life=RAD_HALF_LIFE, _can_contaminate=TRUE) +/datum/component/radioactive/Initialize(_strength=0, _source, _half_life=RAD_HALF_LIFE, _can_contaminate=TRUE) strength = _strength + source = _source hl3_release_date = _half_life can_contaminate = _can_contaminate @@ -31,7 +34,7 @@ return ..() /datum/component/radioactive/process() - radiation_pulse(get_turf(parent),strength,1,FALSE,can_contaminate) + radiation_pulse(parent,strength,1,FALSE,can_contaminate) if(hl3_release_date && prob(50)) strength -= strength / hl3_release_date @@ -64,7 +67,7 @@ to_chat(user, out.Join()) /datum/component/radioactive/proc/rad_attack(atom/movable/target, mob/living/user) - radiation_pulse(get_turf(target), strength/20) + radiation_pulse(parent, strength/20) target.rad_act(strength/2) #undef RAD_AMOUNT_LOW diff --git a/code/datums/radiation_wave.dm b/code/datums/radiation_wave.dm index 8aafb271e5..91b57414c7 100644 --- a/code/datums/radiation_wave.dm +++ b/code/datums/radiation_wave.dm @@ -1,4 +1,5 @@ /datum/radiation_wave + var/source var/turf/master_turf //The center of the wave var/steps=0 //How far we've moved var/intensity //How strong it was originaly @@ -7,8 +8,9 @@ var/list/__dirs //The directions to the side of the wave, stored for easy looping var/can_contaminate -/datum/radiation_wave/New(turf/place, dir, _intensity=0, _range_modifier=RAD_DISTANCE_COEFFICIENT, _can_contaminate=TRUE) - master_turf = place +/datum/radiation_wave/New(atom/_source, dir, _intensity=0, _range_modifier=RAD_DISTANCE_COEFFICIENT, _can_contaminate=TRUE) + source = _source + master_turf = get_turf(_source) move_dir = dir __dirs = list() @@ -87,7 +89,7 @@ continue thing.rad_act(strength) - var/static/list/blacklisted = typecacheof(list(/turf)) + var/static/list/blacklisted = typecacheof(list(/turf, /obj/structure/cable, /obj/machinery/atmospherics)) if(!can_contaminate || blacklisted[thing.type]) continue if(prob((strength-RAD_MINIMUM_CONTAMINATION) * RAD_CONTAMINATION_CHANCE_COEFFICIENT * min(1/(steps*range_modifier), 1))) // Only stronk rads get to have little baby rads @@ -95,4 +97,5 @@ if(insulation && insulation.contamination_proof) continue else - thing.AddComponent(/datum/component/radioactive, (strength-RAD_MINIMUM_CONTAMINATION) * RAD_CONTAMINATION_STR_COEFFICIENT * min(1/(steps*range_modifier), 1)) \ No newline at end of file + var/rad_strength = (strength-RAD_MINIMUM_CONTAMINATION) * RAD_CONTAMINATION_STR_COEFFICIENT * min(1/(steps*range_modifier), 1) + thing.AddComponent(/datum/component/radioactive, rad_strength, source) \ No newline at end of file diff --git a/code/game/gamemodes/meteor/meteors.dm b/code/game/gamemodes/meteor/meteors.dm index 7fa418c10b..d2c6da2c60 100644 --- a/code/game/gamemodes/meteor/meteors.dm +++ b/code/game/gamemodes/meteor/meteors.dm @@ -268,7 +268,7 @@ GLOBAL_LIST_INIT(meteorsC, list(/obj/effect/meteor/dust)) //for space dust event ..() explosion(src.loc, 0, 0, 4, 3, 0) new /obj/effect/decal/cleanable/greenglow(get_turf(src)) - radiation_pulse(get_turf(src), 500) + radiation_pulse(src, 500) //Meaty Ore /obj/effect/meteor/meaty diff --git a/code/game/objects/items/grenades/syndieminibomb.dm b/code/game/objects/items/grenades/syndieminibomb.dm index 8279dc399d..34ea3d0d31 100644 --- a/code/game/objects/items/grenades/syndieminibomb.dm +++ b/code/game/objects/items/grenades/syndieminibomb.dm @@ -41,7 +41,7 @@ /obj/item/grenade/gluon/prime() update_mob() playsound(loc, 'sound/effects/empulse.ogg', 50, 1) - radiation_pulse(get_turf(src), rad_damage) + radiation_pulse(src, rad_damage) for(var/turf/T in view(freeze_range,loc)) if(isfloorturf(T)) var/turf/open/floor/F = T diff --git a/code/game/objects/items/theft_tools.dm b/code/game/objects/items/theft_tools.dm index 635229b70e..628b731197 100644 --- a/code/game/objects/items/theft_tools.dm +++ b/code/game/objects/items/theft_tools.dm @@ -33,7 +33,7 @@ if(cooldown < world.time - 60) cooldown = world.time flick(pulseicon, src) - radiation_pulse(get_turf(src), 400, 2) + radiation_pulse(src, 400, 2) //nuke core box, for carrying the core /obj/item/nuke_core_container @@ -140,7 +140,7 @@ return else to_chat(user, "As it touches \the [src], both \the [src] and \the [W] burst into dust!") - radiation_pulse(get_turf(user), 100) + radiation_pulse(user, 100) playsound(src, 'sound/effects/supermatter.ogg', 50, 1) qdel(W) qdel(src) @@ -151,7 +151,7 @@ return FALSE var/mob/ded = user to_chat(user, "You reach for the supermatter sliver with your hands. That was dumb.") - radiation_pulse(get_turf(user), 500, 2) + radiation_pulse(user, 500, 2) playsound(get_turf(user), 'sound/effects/supermatter.ogg', 50, 1) ded.dust() @@ -240,7 +240,7 @@ user.visible_message("As [user] touches \the [AM] with \a [src], silence fills the room...",\ "You touch \the [AM] with \the [src], and everything suddenly goes silent.\n\The [AM] flashes into dust, and soon as you can register this, you do as well.",\ "Everything suddenly goes silent.") - radiation_pulse(get_turf(user), 500, 2) + radiation_pulse(user, 500, 2) playsound(src, 'sound/effects/supermatter.ogg', 50, 1) user.dust() icon_state = "supermatter_tongs" diff --git a/code/game/objects/structures/false_walls.dm b/code/game/objects/structures/false_walls.dm index 94d1b1ca7c..3b59bdbcec 100644 --- a/code/game/objects/structures/false_walls.dm +++ b/code/game/objects/structures/false_walls.dm @@ -199,7 +199,7 @@ if(!active) if(world.time > last_event+15) active = 1 - radiation_pulse(get_turf(src), 150) + radiation_pulse(src, 150) for(var/turf/closed/wall/mineral/uranium/T in orange(1,src)) T.radiate() last_event = world.time diff --git a/code/game/objects/structures/statues.dm b/code/game/objects/structures/statues.dm index a046f687c4..65011b5770 100644 --- a/code/game/objects/structures/statues.dm +++ b/code/game/objects/structures/statues.dm @@ -131,7 +131,7 @@ if(!active) if(world.time > last_event+15) active = 1 - radiation_pulse(get_turf(src), 30) + radiation_pulse(src, 30) last_event = world.time active = null return diff --git a/code/game/turfs/simulated/floor/mineral_floor.dm b/code/game/turfs/simulated/floor/mineral_floor.dm index 2d68c06761..5de453d531 100644 --- a/code/game/turfs/simulated/floor/mineral_floor.dm +++ b/code/game/turfs/simulated/floor/mineral_floor.dm @@ -206,7 +206,7 @@ if(!active) if(world.time > last_event+15) active = 1 - radiation_pulse(get_turf(src), 10) + radiation_pulse(src, 10) for(var/turf/open/floor/mineral/uranium/T in orange(1,src)) T.radiate() last_event = world.time diff --git a/code/game/turfs/simulated/wall/mineral_walls.dm b/code/game/turfs/simulated/wall/mineral_walls.dm index 144fc18572..5595009778 100644 --- a/code/game/turfs/simulated/wall/mineral_walls.dm +++ b/code/game/turfs/simulated/wall/mineral_walls.dm @@ -70,7 +70,7 @@ if(!active) if(world.time > last_event+15) active = 1 - radiation_pulse(get_turf(src), 40) + radiation_pulse(src, 40) for(var/turf/closed/wall/mineral/uranium/T in orange(1,src)) T.radiate() last_event = world.time diff --git a/code/modules/atmospherics/machinery/atmosmachinery.dm b/code/modules/atmospherics/machinery/atmosmachinery.dm index 4cbca66a84..ce68eecdc9 100644 --- a/code/modules/atmospherics/machinery/atmosmachinery.dm +++ b/code/modules/atmospherics/machinery/atmosmachinery.dm @@ -48,10 +48,6 @@ Pipelines + Other Objects -> Pipe network SSair.atmos_machinery += src SetInitDirections() -/obj/machinery/atmospherics/ComponentInitialize() - . = ..() - AddComponent(/datum/component/rad_insulation, RAD_NO_INSULATION) //This would be a bad idea - /obj/machinery/atmospherics/Destroy() for(DEVICE_TYPE_LOOP) nullifyNode(I) diff --git a/code/modules/mob/living/carbon/human/species_types/golems.dm b/code/modules/mob/living/carbon/human/species_types/golems.dm index 519f7bf441..d04bd867ff 100644 --- a/code/modules/mob/living/carbon/human/species_types/golems.dm +++ b/code/modules/mob/living/carbon/human/species_types/golems.dm @@ -295,7 +295,7 @@ if(!active) if(world.time > last_event+30) active = 1 - radiation_pulse(get_turf(H), 50) + radiation_pulse(H, 50) last_event = world.time active = null ..() diff --git a/code/modules/power/gravitygenerator.dm b/code/modules/power/gravitygenerator.dm index 534460260f..b98ea7f6c9 100644 --- a/code/modules/power/gravitygenerator.dm +++ b/code/modules/power/gravitygenerator.dm @@ -363,7 +363,7 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne /obj/machinery/gravity_generator/main/proc/pulse_radiation() - radiation_pulse(get_turf(src), 200) + radiation_pulse(src, 200) // Shake everyone on the z level to let them know that gravity was enagaged/disenagaged. /obj/machinery/gravity_generator/main/proc/shake_everyone() diff --git a/code/modules/power/rtg.dm b/code/modules/power/rtg.dm index c9a3db895f..f88e713dda 100644 --- a/code/modules/power/rtg.dm +++ b/code/modules/power/rtg.dm @@ -28,7 +28,7 @@ ..() add_avail(power_gen) if(panel_open && irradiate) - radiation_pulse(get_turf(src), 60) + radiation_pulse(src, 60) /obj/machinery/power/rtg/RefreshParts() var/part_level = 0 diff --git a/code/modules/power/singularity/singularity.dm b/code/modules/power/singularity/singularity.dm index 7ca49fbf3a..d7094d8c85 100644 --- a/code/modules/power/singularity/singularity.dm +++ b/code/modules/power/singularity/singularity.dm @@ -114,7 +114,7 @@ /obj/singularity/process() if(current_size >= STAGE_TWO) move() - radiation_pulse(get_turf(src), energy, 0.5) + radiation_pulse(src, energy, 0.5) if(prob(event_chance))//Chance for it to run a special event TODO:Come up with one or two more that fit event() eat() @@ -388,7 +388,7 @@ var/radiation = 15 if (energy>200) radiation += round((energy-150)/10,1) - radiation_pulse(get_turf(src), radiation) + radiation_pulse(src, radiation) /obj/singularity/proc/combust_mobs() diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm index 8cdbb1af5f..d9aabd1197 100644 --- a/code/modules/power/supermatter/supermatter.dm +++ b/code/modules/power/supermatter/supermatter.dm @@ -332,7 +332,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_shard) power = max( (removed.temperature * temp_factor / T0C) * gasmix_power_ratio + power, 0) //Total laser power plus an overload if(prob(50)) - radiation_pulse(get_turf(src), power * (1 + power_transmission_bonus/10 * freon_transmit_modifier)) + radiation_pulse(src, power * (1 + power_transmission_bonus/10 * freon_transmit_modifier)) var/device_energy = power * REACTION_POWER_MODIFIER @@ -545,7 +545,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_shard) Consume(W) playsound(get_turf(src), 'sound/effects/supermatter.ogg', 50, 1) - radiation_pulse(get_turf(src), 150, 4) + radiation_pulse(src, 150, 4) /obj/machinery/power/supermatter_shard/CollidedWith(atom/movable/AM) @@ -579,7 +579,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_shard) matter_power += 200 //Some poor sod got eaten, go ahead and irradiate people nearby. - radiation_pulse(get_turf(src), 3000, 2, TRUE) + radiation_pulse(src, 3000, 2, TRUE) for(var/mob/living/L in range(10)) investigate_log("has irradiated [L] after consuming [AM].", INVESTIGATE_SUPERMATTER) if(L in view()) diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm index 23d2714b52..dcf725819d 100644 --- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm @@ -454,7 +454,7 @@ /datum/reagent/medicine/potass_iodide/on_mob_life(mob/living/M) if(M.radiation > 0) - M.radiation-=2 + M.radiation -= min(M.radiation, 4) ..() /datum/reagent/medicine/pen_acid @@ -466,7 +466,7 @@ metabolization_rate = 0.5 * REAGENTS_METABOLISM /datum/reagent/medicine/pen_acid/on_mob_life(mob/living/M) - M.radiation -= min(M.radiation, 8) + M.radiation -= min(M.radiation, log(M.radiation)*10) M.adjustToxLoss(-2*REM, 0) for(var/datum/reagent/R in M.reagents.reagent_list) if(R != src) diff --git a/code/modules/research/experimentor.dm b/code/modules/research/experimentor.dm index 94b75dd3e6..08b5872686 100644 --- a/code/modules/research/experimentor.dm +++ b/code/modules/research/experimentor.dm @@ -255,7 +255,7 @@ ejectItem() else if(prob(EFFECT_PROB_VERYLOW-badThingCoeff)) visible_message("[src] malfunctions, melting [exp_on] and leaking radiation!") - radiation_pulse(get_turf(src), 50) + radiation_pulse(src, 500) ejectItem(TRUE) else if(prob(EFFECT_PROB_LOW-badThingCoeff)) visible_message("[src] malfunctions, spewing toxic waste!") diff --git a/tgstation.dme b/tgstation.dme index 5cc0d11238..c2ee860831 100755 --- a/tgstation.dme +++ b/tgstation.dme @@ -295,9 +295,9 @@ #include "code\datums\soullink.dm" #include "code\datums\spawners_menu.dm" #include "code\datums\verbs.dm" +#include "code\datums\world_topic.dm" #include "code\datums\actions\flightsuit.dm" #include "code\datums\actions\ninja.dm" -#include "code\datums\world_topic.dm" #include "code\datums\antagonists\antag_datum.dm" #include "code\datums\antagonists\datum_abductor.dm" #include "code\datums\antagonists\datum_brother.dm"