Radiation Rework (#28320)

* initial changes

* Rad wave is working. now to implement the rest

* Makes the waves square

* Makes wave square

* multiplies the strength in all instances of radiation_pulse by 4 because each pulse makes one wave instead of 4 now

* Undef thing and apply suggestion

* Make radiation_pulse() not radiate the radiation source and implements contamination

* Adds contamination to uranium walls and meteors

* Fixes stuff

* Handle some contamination on attack still need to take care of meteors

* Fixed the meteor stuff

* Introduce emission types

* moves contaminate_touch to an atom proc and renames it to contaminate_atom

* deduplicates some contamination code

* Move inherent radioactivity to a component and signals from the atom vars and behaviour

* fix some things with the new component

* Update inherent_radioactivity.dm

* implement contaminating things that hit things that are inherently radioactive

* window things

* adds emission type to the rad_act call

* Changes radiation insulation values on a bunch of stuff

* fixes radioactive component radiating the wrong type

* more adjustments

* refactros rad_act

* adjustments to collector power production

* Adds plastitaniumglass windows and makes further adjustments

* Adds sprites to the shards and plastitanium directional window

* Update misc_cleanables.dm

* removes alpha rad insulation from floor turfs

* Fixes a bug with the starting tile of radiation waves

* More adjustments

* Adjusting singularity rad production

* reduces window half life a bit to make power smoother and buffs full window rad conversion

* Strengthens gamma and beta radiation effect on mobs.

* Makes radsuit block radiation completely

* Fixes Geiger Counters

* Fixes contamination not irradiating the contaminated thing

* Fixes inherent radioactivity not processing. Also makes it stop processing when a nuke core is contained

* Fixes ghost contamination

* Adds info to the collector

* Handles alpha radiation better on humans and changes some instances of rad_act to base_rad_act

* oops

* adjustments and fixes to alpha rad handling on mobs

* Make collector info more compact

* Core no longer radiates and contaminates from within the nuke until the plates are removed

* Contamination no longer counts as being inside a mob(it is supposed to be surface level)

* Adds inherent radioactivity to a bunch of uranium things. makes it all process.

* Nerf full windows

* Adjustments to collector and fulltile window radiation absorption

* Reduces passive contamination, especially while on the floor

* Adds different rad types to the geiger counter and fixes a runtime

* Makes full tile windows strong again and disallows building them on top of collectors

* adds emissive blockers to the rad blacklist and gives windows and collectors priority when irradiating for increased consistency

* Gives each contamination type it's own color.

* Gives each contamination type it's own color.  And makes the rad hud display them separately

* Changes how much the radiation wave affects the source tile, adds decay for performance reasons and adjusts collector parameters as well as SM and singulo rad production

* improves performance at very high rad amounts

* Fixes supermatter sliver box not containing radiation

* Restores supermatter sliver to old behaviour(not inherently radioactive)

* Slight nerf to fulltile windows and removes an unnecessary multiplication from rad wave processing

* Removes redundant line from window rad act

* Fixes radiation waves ignoring walls

* fixes it better

* more adjustments to collector stats

* Adjustment to collector gamma absorption

* increases grille beta blocking

* Review changes
This commit is contained in:
Migratingcocofruit
2025-03-02 22:34:45 +02:00
committed by GitHub
parent e29a599118
commit ebf7fdbfd2
66 changed files with 945 additions and 384 deletions
@@ -1,12 +1,12 @@
// stored_energy += (pulse_strength - RAD_COLLECTOR_EFFICIENCY) * RAD_COLLECTOR_COEFFICIENT
#define RAD_COLLECTOR_EFFICIENCY 80 // radiation needs to be over this amount to get power
#define RAD_COLLECTOR_COEFFICIENT 100
// stored_energy += (pulse_strength - RAD_COLLECTOR_THRESHOLD) * RAD_COLLECTOR_COEFFICIENT
#define RAD_COLLECTOR_THRESHOLD 80 // This gets subtracted from the value of absorbed radiation
#define RAD_COLLECTOR_COEFFICIENT 400
#define RAD_COLLECTOR_STORED_OUT 0.04 // (this * 100)% of stored power outputted per tick. Doesn't actualy change output total, lower numbers just means collectors output for longer in absence of a source
#define RAD_COLLECTOR_OUTPUT min(stored_energy, (stored_energy * RAD_COLLECTOR_STORED_OUT) + 1000) //Produces at least 1000 watts if it has more than that stored
/obj/machinery/power/rad_collector
name = "radiation collector array"
desc = "A device which uses Hawking Radiation and plasma to produce power."
desc = "A device which converts raditation to useable electical energy using plasma. It absorbs Beta particles extremely well, and Gamma particles to a lesser extent"
icon = 'icons/obj/singularity.dmi'
icon_state = "ca"
anchored = FALSE
@@ -14,13 +14,24 @@
req_access = list(ACCESS_ENGINE_EQUIP)
max_integrity = 350
integrity_failure = 80
rad_insulation = RAD_EXTREME_INSULATION
rad_insulation_beta = RAD_BETA_COLLECTOR
rad_insulation_gamma = RAD_LIGHT_INSULATION
var/obj/item/tank/internals/plasma/loaded_tank = null
var/stored_energy = 0
var/active = FALSE
var/locked = FALSE
var/drainratio = 1
var/powerproduction_drain = 0.001
var/power_threshold = RAD_COLLECTOR_THRESHOLD
var/power_coefficient = RAD_COLLECTOR_COEFFICIENT
/// A record of the absorbed strength of each beta wave that hit the collector. This keeps record up to rad_time old, and only the maximum absorption for each time point.
var/beta_waves = list()
/// A record of the absorbed strength of each gamma wave that hit the collector. This keeps record up to rad_time old, and only the maximum absorption for each time point.
var/gamma_waves = list()
/// Amount of time across which the maximum wave is checked
var/rad_time = 5 SECONDS
/// The current time count for clearing old data from the lists
var/rad_time_counter = 0
/obj/machinery/power/rad_collector/process()
if(!loaded_tank)
@@ -36,6 +47,20 @@
var/power_produced = RAD_COLLECTOR_OUTPUT
produce_direct_power(power_produced)
stored_energy -= power_produced
if(world.time > rad_time_counter)
rad_time_counter = world.time + rad_time
for(var/listing in gamma_waves)
if(world.time > text2num(listing) + rad_time)
gamma_waves -= listing
// We put the listing in oldest to newest so as soon as we hit something new enough we can keep the rest
else
break
for(var/listing in beta_waves)
if(world.time > text2num(listing) + rad_time)
beta_waves -= listing
// We put the listing in oldest to newest so as soon as we hit something new enough we can keep the rest
else
break
/obj/machinery/power/rad_collector/attack_hand(mob/user)
@@ -109,7 +134,21 @@
// Therefore, its units are joules per SSmachines.wait * 0.1 seconds.
// So joules = stored_energy * SSmachines.wait * 0.1
var/joules = stored_energy * SSmachines.wait * 0.1
. += "<span class='notice'>[src]'s display states that it has stored <b>[DisplayJoules(joules)]</b>, and is processing <b>[DisplayPower(RAD_COLLECTOR_OUTPUT)]</b>.</span>"
var/max_beta = 0
var/max_gamma = 0
// Find the maximum beta and gamma absorptions we have logged
for(var/listing in beta_waves)
if(max_beta < beta_waves[listing])
max_beta = beta_waves[listing]
for(var/listing in gamma_waves)
if(max_gamma < gamma_waves[listing])
max_gamma = gamma_waves[listing]
var/beta_delta = max_beta - RAD_COLLECTOR_THRESHOLD
var/gamma_delta = max_gamma - RAD_COLLECTOR_THRESHOLD
. += "<span class='notice'>[src]'s display states that it has stored <b>[DisplayJoules(joules)]</b>, and is processing <b>[DisplayPower(RAD_COLLECTOR_OUTPUT)]</b></span>"
. +="<span class='notice'>Strongest Beta absorption over the last [rad_time /(1 SECONDS)] seconds: <b>[max_beta]</b>, <b>[abs(beta_delta)]</b> [beta_delta >= 0 ? "above" : "below"] threshold</span>"
. +="<span class='notice'>Strongest Gamma absorption over the last [rad_time /(1 SECONDS)] seconds: <b>[max_gamma]</b>, <b>[abs(gamma_delta)]</b> [gamma_delta >= 0 ? "above" : "below"] threshold</span>"
else
. += "<span class='notice'><b>[src]'s display displays the words:</b> \"Power production mode. Please insert <b>Plasma</b>.\"</span>"
@@ -132,10 +171,21 @@
else
update_icons()
/obj/machinery/power/rad_collector/rad_act(amount)
. = ..()
if(loaded_tank && active && amount > RAD_COLLECTOR_EFFICIENCY)
stored_energy += (amount - RAD_COLLECTOR_EFFICIENCY) * RAD_COLLECTOR_COEFFICIENT
/// Converts absorbed Beta or Gamma radiation into electrical energy
/obj/machinery/power/rad_collector/rad_act(atom/source, amount, emission_type)
// Log the absorption at current time. If we already have one logged and the new value is bigger overwrite it.
if(emission_type == BETA_RAD)
if(!beta_waves["[world.time]"])
beta_waves += list("[world.time]" = amount)
else if(beta_waves["[world.time]"] < amount)
beta_waves["[world.time]"] = amount
if(emission_type == GAMMA_RAD)
if(!gamma_waves["[world.time]"])
gamma_waves += list("[world.time]" = amount)
else if(gamma_waves["[world.time]"] < amount)
gamma_waves["[world.time]"] = amount
if(emission_type != ALPHA_RAD && loaded_tank && active && amount > power_threshold)
stored_energy += (amount - power_threshold) * power_coefficient
/obj/machinery/power/rad_collector/proc/update_icons()
@@ -158,7 +208,7 @@
flick("ca_deactive", src)
update_icons()
#undef RAD_COLLECTOR_EFFICIENCY
#undef RAD_COLLECTOR_THRESHOLD
#undef RAD_COLLECTOR_COEFFICIENT
#undef RAD_COLLECTOR_STORED_OUT
#undef RAD_COLLECTOR_OUTPUT
@@ -39,7 +39,7 @@
/obj/effect/accelerated_particle/proc/try_irradiate(src, atom/A)
if(isliving(A))
var/mob/living/L = A
L.rad_act(energy * 6)
L.base_rad_act(src, energy * 6, GAMMA_RAD)
else if(istype(A, /obj/machinery/the_singularitygen))
var/obj/machinery/the_singularitygen/S = A
S.energy += energy
@@ -151,7 +151,7 @@ GLOBAL_VAR_INIT(global_singulo_id, 1)
// it might mean we are stuck in a corner somewere. So move around to try to expand.
move()
if(current_size >= STAGE_TWO)
radiation_pulse(src, (energy * 4.5) + 1000, RAD_DISTANCE_COEFFICIENT, source_radius = consume_range + 1)
radiation_pulse(src, (energy * 90) + 8000, GAMMA_RAD)
if(prob(event_chance))//Chance for it to run a special event TODO:Come up with one or two more that fit
event()
eat()
@@ -377,7 +377,7 @@
var/hallucination_amount = (max(50, min(300, DETONATION_HALLUCINATION * sqrt(1 / (get_dist(mob, src) + 1))))) SECONDS
H.AdjustHallucinate(hallucination_amount)
var/rads = DETONATION_RADS * sqrt(1 / (get_dist(L, src) + 1))
L.rad_act(rads)
L.base_rad_act(src, rads, GAMMA_RAD)
var/turf/T = get_turf(src)
var/super_matter_charge_sound = sound('sound/magic/charge.ogg')
@@ -568,8 +568,8 @@
var/crush_ratio = combined_gas / MOLE_CRUNCH_THRESHOLD
gas_coefficient = 1 + (crush_ratio ** 2 * (crush_ratio <= 1) + (crush_ratio > 1) * 2 * crush_ratio / (crush_ratio + 1)) * (plasmacomp * PLASMA_CRUNCH + o2comp * O2_CRUNCH + co2comp * CO2_CRUNCH + n2comp * N2_CRUNCH + n2ocomp * N2O_CRUNCH)
if(prob(50))
radiation_pulse(src, power * (gas_coefficient + max(0, ((power_transmission_bonus / 10)))))
radiation_pulse(src, 6 * power * (gas_coefficient + max(0, ((power_transmission_bonus / 10)))), GAMMA_RAD)
//Power * 0.55 * a value between 1 and 0.8
var/device_energy = power * REACTION_POWER_MODIFIER
@@ -597,7 +597,7 @@
l.AdjustHallucinate(hallucination_amount, 0, 200 SECONDS)
for(var/mob/living/l in range(src, round((power / 100) ** 0.25)))
var/rads = (power / 10) * sqrt( 1 / max(get_dist(l, src), 1) )
l.rad_act(rads)
l.base_rad_act(src, rads, GAMMA_RAD)
//Transitions between one function and another, one we use for the fast inital startup, the other is used to prevent errors with fusion temperatures.
//Use of the second function improves the power gain imparted by using co2
@@ -832,7 +832,7 @@
Consume(used)
playsound(get_turf(src), 'sound/effects/supermatter.ogg', 50, TRUE)
radiation_pulse(src, 150, 4)
radiation_pulse(src, 600, GAMMA_RAD)
/obj/machinery/atmospherics/supermatter_crystal/Bumped(atom/movable/AM)
@@ -887,7 +887,7 @@
matter_power += 200
//Some poor sod got eaten, go ahead and irradiate people nearby.
radiation_pulse(src, 3000, 2, TRUE)
radiation_pulse(src, 12000, GAMMA_RAD, TRUE)
for(var/mob/living/L in range(10))
investigate_log("has irradiated [key_name(L)] after consuming [AM].", "supermatter")
if(L in view())
@@ -333,12 +333,12 @@
/obj/machinery/power/port_gen/pacman/super/use_fuel()
//produces a tiny amount of radiation when in use
if(prob(2 * power_output))
radiation_pulse(get_turf(src), 50)
radiation_pulse(get_turf(src), 200, ALPHA_RAD)
..()
/obj/machinery/power/port_gen/pacman/super/explode()
//a nice burst of radiation
radiation_pulse(get_turf(src), 500, 2)
radiation_pulse(get_turf(src), 2000, ALPHA_RAD)
explosion(loc, 3, 3, 5, 3)
qdel(src)
+2 -2
View File
@@ -343,9 +343,9 @@ GLOBAL_LIST_EMPTY(gravity_generators)
/obj/machinery/gravity_generator/main/proc/pulse_radiation()
radiation_pulse(src, 600, 2)
radiation_pulse(src, 2400, BETA_RAD)
for(var/mob/living/L in view(7, src)) //Windows kinda make it a non threat, no matter how much I amp it up, so let us cheat a little
radiation_pulse(get_turf(L), 600, 2)
radiation_pulse(get_turf(L), 2400, BETA_RAD)
/**
* Shake everyone on the area list and play an alarm to let them know that gravity was enagaged/disenagaged.