Files
CHOMPstation/code/datums/diseases/dna_spread.dm
T
Rob Nelson 3121e4fb2d DNA2 Bug Fixes - Part 2
We discovered that most of the problems were were having was because of BYOND passing lists (e.g. SE and UI) by-ref instead of the assumed by-val.

This commit adds dna.Clone() and (UI|SE).Copy() where needed.  These should be used where DNA or SE/UI lists are COPIED, otherwise changes made in the reference will affect the real strand.

This change also messes with the gene activation logic.
2014-02-06 23:07:35 -08:00

69 lines
2.1 KiB
Plaintext

/datum/disease/dnaspread
name = "Space Retrovirus"
max_stages = 4
spread = "On contact"
spread_type = CONTACT_GENERAL
cure = "Ryetalyn"
cure_id = "ryetalyn"
curable = 1
agent = "S4E1 retrovirus"
affected_species = list("Human")
var/list/original_dna = list()
var/transformed = 0
desc = "This disease transplants the genetic code of the intial vector into new hosts."
severity = "Medium"
/datum/disease/dnaspread/stage_act()
..()
switch(stage)
if(2 || 3) //Pretend to be a cold and give time to spread.
if(prob(8))
affected_mob.emote("sneeze")
if(prob(8))
affected_mob.emote("cough")
if(prob(1))
affected_mob << "\red Your muscles ache."
if(prob(20))
affected_mob.take_organ_damage(1)
if(prob(1))
affected_mob << "\red Your stomach hurts."
if(prob(20))
affected_mob.adjustToxLoss(2)
affected_mob.updatehealth()
if(4)
if(!src.transformed)
if ((!strain_data["name"]) || (!strain_data["UI"]) || (!strain_data["SE"]))
del(affected_mob.virus)
return
//Save original dna for when the disease is cured.
src.original_dna["name"] = affected_mob.real_name
src.original_dna["UI"] = affected_mob.dna.UI.Copy()
src.original_dna["SE"] = affected_mob.dna.SE.Copy()
affected_mob << "\red You don't feel like yourself.."
var/list/newUI=strain_data["UI"]
var/list/newSE=strain_data["SE"]
affected_mob.UpdateAppearance(newUI.Copy())
affected_mob.dna.SE = newSE.Copy()
affected_mob.dna.UpdateSE()
affected_mob.real_name = strain_data["name"]
domutcheck(affected_mob)
src.transformed = 1
src.carrier = 1 //Just chill out at stage 4
return
/datum/disease/dnaspread/Del()
if ((original_dna["name"]) && (original_dna["UI"]) && (original_dna["SE"]))
var/list/newUI=original_dna["UI"]
var/list/newSE=original_dna["SE"]
affected_mob.UpdateAppearance(newUI.Copy())
affected_mob.dna.SE = newSE.Copy()
affected_mob.dna.UpdateSE()
affected_mob.real_name = original_dna["name"]
affected_mob << "\blue You feel more like yourself."
..()