Files
Bubberstation/code/datums/components/genetic_damage.dm
T
MothblocksandGitHub 0f3c4e51f7 Modernizing Radiation -- TL;DR: Radiation is now a status effect healed by tox healing, and contamination is removed (#62265)
Implements the Modernizing radiation design document ( https://hackmd.io/@tgstation/rJNIyeBHt ) and replaces the current radiation sources with the new system, as well as replacing/removing a bunch of old consumers of radiation that either had no reason to exist, or could be replaced by something else.

Diverges from the doc in that items radiation don't go up like explained. I was going to, but items get irradiated so easily that it just feels pretty lame. Items still get irradiated, but it's mostly just so that radiation sources look cooler (wow, lots of stuff around going green), and for things like the geiger counter.

Instead of the complicated radiation_wave system, radiation now just checks everything between the radiation source and the potential target, losing power along the way based on the radiation insulation of whats in between. If this reaches too low a point (specified by radiation_pulse consumers), then the radiation will not pass. Otherwise, will roll a chance to irradiate. Uranium structures allow a delay before irradiating, so stay away!
2021-11-01 04:20:39 -03:00

73 lines
2.5 KiB
Plaintext

#define GORILLA_MUTATION_CHANCE_PER_SECOND 0.25
#define GORILLA_MUTATION_MINIMUM_DAMAGE 2500
/// Genetic damage, given by DNA consoles, will start to deal toxin damage
/// past a certain threshold, and will go down consistently.
/// Adding multiple of this component will increase the total damage.
/// Can turn monkeys into gorillas.
/datum/component/genetic_damage
dupe_mode = COMPONENT_DUPE_UNIQUE
/// The total genetic damage on the mob
var/total_damage = 0
/// The amount of genetic damage a mob can sustain before taking damage
var/minimum_before_damage = 500
/// The amount of genetic damage to remove per second
var/remove_per_second = 1 / 3
/// The amount of toxin damage to deal per second, if over the minimum before taking damage
var/toxin_damage_per_second = 1 / 3
/datum/component/genetic_damage/Initialize(genetic_damage)
if (!isliving(parent))
return COMPONENT_INCOMPATIBLE
src.total_damage = genetic_damage
START_PROCESSING(SSprocessing, src)
/datum/component/genetic_damage/RegisterWithParent()
RegisterSignal(parent, COMSIG_LIVING_HEALTHSCAN, .proc/on_healthscan)
/datum/component/genetic_damage/UnregisterFromParent()
UnregisterSignal(parent, COMSIG_LIVING_HEALTHSCAN)
/datum/component/genetic_damage/Destroy(force, silent)
STOP_PROCESSING(SSprocessing, src)
return ..()
/datum/component/genetic_damage/InheritComponent(datum/component/genetic_damage/old_component)
total_damage += old_component.total_damage
/datum/component/genetic_damage/process(delta_time)
if (ismonkey(parent) && total_damage >= GORILLA_MUTATION_MINIMUM_DAMAGE && DT_PROB(GORILLA_MUTATION_CHANCE_PER_SECOND, delta_time))
var/mob/living/carbon/carbon_parent = parent
carbon_parent.gorillize()
qdel(src)
return PROCESS_KILL
if (total_damage >= minimum_before_damage)
var/mob/living/living_mob = parent
living_mob.adjustToxLoss(toxin_damage_per_second * delta_time)
total_damage -= remove_per_second * delta_time
if (total_damage <= 0)
qdel(src)
return PROCESS_KILL
/datum/component/genetic_damage/proc/on_healthscan(datum/source, list/render_list, advanced)
SIGNAL_HANDLER
if (advanced)
render_list += "<span class='alert ml-1'>Genetic damage: [round(total_damage / minimum_before_damage * 100, 0.1)]%</span>\n"
else if (total_damage >= minimum_before_damage)
render_list += "<span class='alert ml-1'>Severe genetic damage detected.</span>\n"
else
render_list += "<span class='alert ml-1'>Minor genetic damage detected.</span>\n"
#undef GORILLA_MUTATION_CHANCE_PER_SECOND
#undef GORILLA_MUTATION_MINIMUM_DAMAGE