Disease Refactor (#2021)

This commit is contained in:
CitadelStationBot
2017-07-15 13:40:49 -05:00
committed by kevinz000
parent 2ae38397c9
commit f2ac487927
56 changed files with 210 additions and 255 deletions
+7 -3
View File
@@ -1,6 +1,7 @@
/mob/proc/HasDisease(datum/disease/D)
for(var/datum/disease/DD in viruses)
for(var/thing in viruses)
var/datum/disease/DD = thing
if(D.IsSame(DD))
return 1
return 0
@@ -39,7 +40,7 @@
var/datum/disease/DD = new D.type(1, D, 0)
viruses += DD
DD.affected_mob = src
DD.holder = src
SSdisease.active_diseases += DD //Add it to the active diseases list, now that it's actually in a mob and being processed.
//Copy properties over. This is so edited diseases persist.
var/list/skipped = list("affected_mob","holder","carrier","stage","type","parent_type","vars","transformed")
@@ -147,6 +148,9 @@
/mob/living/carbon/human/CanContractDisease(datum/disease/D)
if(dna && (VIRUSIMMUNE in dna.species.species_traits))
if(dna && (VIRUSIMMUNE in dna.species.species_traits) && !D.bypasses_immunity)
return 0
for(var/thing in D.required_organs)
if(!((locate(thing) in bodyparts) || (locate(thing) in internal_organs)))
return 0
return ..()
+15 -58
View File
@@ -46,21 +46,23 @@
var/stage_prob = 4
//Other
var/longevity = 150 //Time in ticks disease stays in objects, Syringes and such are infinite.
var/list/viable_mobtypes = list() //typepaths of viable mobs
var/mob/living/carbon/affected_mob = null
var/atom/movable/holder = null
var/list/cures = list() //list of cures if the disease has the CURABLE flag, these are reagent ids
var/infectivity = 65
var/cure_chance = 8
var/carrier = 0 //If our host is only a carrier
var/carrier = FALSE //If our host is only a carrier
var/bypasses_immunity = FALSE //Does it skip species virus immunity check? Some things may diseases and not viruses
var/permeability_mod = 1
var/severity = NONTHREAT
var/list/required_organs = list()
var/needs_all_cures = TRUE
var/list/strain_data = list() //dna_spread special bullshit
/datum/disease/Destroy()
affected_mob = null
SSdisease.active_diseases.Remove(src)
return ..()
/datum/disease/proc/stage_act()
var/cure = has_cure()
@@ -93,13 +95,16 @@
if(!. || (needs_all_cures && . < cures.len))
return 0
/datum/disease/proc/spread(atom/source, force_spread = 0)
/datum/disease/proc/spread(force_spread = 0)
if(!affected_mob)
return
if((spread_flags & SPECIAL || spread_flags & NON_CONTAGIOUS || spread_flags & BLOOD) && !force_spread)
return
if(affected_mob)
if( affected_mob.reagents.has_reagent("spaceacillin") || (affected_mob.satiety > 0 && prob(affected_mob.satiety/10)) )
return
if(affected_mob.reagents.has_reagent("spaceacillin") || (affected_mob.satiety > 0 && prob(affected_mob.satiety/10)))
return
var/spread_range = 1
@@ -109,15 +114,9 @@
if(spread_flags & AIRBORNE)
spread_range++
if(!source)
if(affected_mob)
source = affected_mob
else
return
var/turf/T = source.loc
var/turf/T = affected_mob.loc
if(istype(T))
for(var/mob/living/carbon/C in oview(spread_range, source))
for(var/mob/living/carbon/C in oview(spread_range, affected_mob))
var/turf/V = get_turf(C)
if(V)
while(TRUE)
@@ -129,29 +128,6 @@
break
V = Temp
/datum/disease/process()
if(!holder)
SSdisease.processing -= src
return
if(prob(infectivity))
spread(holder)
if(affected_mob)
for(var/datum/disease/D in affected_mob.viruses)
if(D != src)
if(IsSame(D))
qdel(D)
if(holder == affected_mob)
if(affected_mob.stat != DEAD)
stage_act()
if(!affected_mob)
if(prob(70))
if(--longevity<=0)
cure()
/datum/disease/proc/cure()
if(affected_mob)
@@ -161,20 +137,6 @@
remove_virus()
qdel(src)
/datum/disease/New()
if(required_organs && required_organs.len)
if(ishuman(affected_mob))
var/mob/living/carbon/human/H = affected_mob
for(var/obj/item/organ/O in required_organs)
if(!locate(O) in H.bodyparts)
if(!locate(O) in H.internal_organs)
cure()
return
SSdisease.processing += src
/datum/disease/proc/IsSame(datum/disease/D)
if(istype(src, D.type))
return 1
@@ -191,11 +153,6 @@
return type
/datum/disease/Destroy()
SSdisease.processing.Remove(src)
return ..()
/datum/disease/proc/IsSpreadByTouch()
if(spread_flags & CONTACT_FEET || spread_flags & CONTACT_HANDS || spread_flags & CONTACT_GENERAL)
return 1
+3 -11
View File
@@ -91,7 +91,7 @@
if(!(istype(D, /datum/disease/advance)))
return 0
if(src.GetDiseaseID() != D.GetDiseaseID())
if(GetDiseaseID() != D.GetDiseaseID())
return 0
return 1
@@ -116,7 +116,7 @@
// Mix the symptoms of two diseases (the src and the argument)
/datum/disease/advance/proc/Mix(datum/disease/advance/D)
if(!(src.IsSame(D)))
if(!(IsSame(D)))
var/list/possible_symptoms = shuffle(D.symptoms)
for(var/datum/symptom/S in possible_symptoms)
AddSymptom(new S.type)
@@ -156,7 +156,6 @@
return generated
/datum/disease/advance/proc/Refresh(new_name = 0)
//to_chat(world, "[src.name] \ref[src] - REFRESH!")
GenerateProperties()
AssignProperties()
id = null
@@ -395,7 +394,7 @@
D.AssignName(new_name)
D.Refresh()
for(var/datum/disease/advance/AD in SSdisease.processing)
for(var/datum/disease/advance/AD in SSdisease.active_diseases)
AD.Refresh()
for(var/mob/living/carbon/human/H in shuffle(GLOB.living_mob_list))
@@ -410,13 +409,6 @@
name_symptoms += S.name
message_admins("[key_name_admin(user)] has triggered a custom virus outbreak of [D.name]! It has these symptoms: [english_list(name_symptoms)]")
/*
/mob/verb/test()
for(var/datum/disease/D in SSdisease.processing)
to_chat(src, "<a href='?_src_=vars;Vars=\ref[D]'>[D.name] - [D.holder]</a>")
*/
/datum/disease/advance/proc/totalStageSpeed()
return properties["stage_rate"]
@@ -35,5 +35,5 @@ Bonus
M.emote("sniff")
else
M.emote("sneeze")
A.spread(A.holder, 5)
A.spread(5)
return
@@ -18,7 +18,7 @@
/datum/symptom/New()
var/list/S = SSdisease.list_symptoms
for(var/i = 1; i <= S.len; i++)
if(src.type == S[i])
if(type == S[i])
id = "[i]"
return
CRASH("We couldn't assign an ID!")
+1 -1
View File
@@ -8,11 +8,11 @@
permeability_mod = 1
desc = "If left untreated the subject will become very weak, and may vomit often."
severity = "Dangerous!"
longevity = 1000
disease_flags = CAN_CARRY|CAN_RESIST
spread_flags = NON_CONTAGIOUS
visibility_flags = HIDDEN_PANDEMIC
required_organs = list(/obj/item/organ/appendix)
bypasses_immunity = TRUE // Immunity is based on not having an appendix; this isn't a virus
/datum/disease/appendicitis/stage_act()
..()
+1 -1
View File
@@ -9,7 +9,7 @@
viable_mobtypes = list(/mob/living/carbon/human)
cure_chance = 15//higher chance to cure, since two reagents are required
desc = "This disease destroys the braincells, causing brain fever, brain necrosis and general intoxication."
required_organs = list(/obj/item/bodypart/head)
required_organs = list(/obj/item/organ/brain)
severity = DANGEROUS
/datum/disease/brainrot/stage_act() //Removed toxloss because damaging diseases are pretty horrible. Last round it killed the entire station because the cure didn't work -- Urist -ACTUALLY Removed rather than commented out, I don't see it returning - RR
+2 -2
View File
@@ -25,8 +25,8 @@
//Absorbs the target DNA.
strain_data["dna"] = new affected_mob.dna.type
affected_mob.dna.copy_dna(strain_data["dna"])
src.carrier = 1
src.stage = 4
carrier = TRUE
stage = 4
return
switch(stage)
-1
View File
@@ -10,7 +10,6 @@
permeability_mod = 0.75
desc = "If left untreated the subject will probably drive others to insanity."
severity = MEDIUM
longevity = 400
/datum/disease/pierrot_throat/stage_act()
..()
+1 -1
View File
@@ -13,7 +13,7 @@
/datum/disease/rhumba_beat/stage_act()
..()
if(affected_mob.ckey == "rosham")
src.cure()
cure()
return
switch(stage)
if(2)
-1
View File
@@ -73,7 +73,6 @@
permeability_mod = 1
cure_chance = 1
disease_flags = CAN_CARRY|CAN_RESIST
longevity = 30
desc = "Monkeys with this disease will bite humans, causing humans to mutate into a monkey."
severity = BIOHAZARD
stage_prob = 4
+3 -1
View File
@@ -1,4 +1,5 @@
/datum/disease/tuberculosis
form = "Disease"
name = "Fungal tuberculosis"
max_stages = 5
spread_text = "Airborne"
@@ -8,8 +9,9 @@
viable_mobtypes = list(/mob/living/carbon/human)
cure_chance = 5//like hell are you getting out of hell
desc = "A rare highly transmittable virulent virus. Few samples exist, rumoured to be carefully grown and cultured by clandestine bio-weapon specialists. Causes fever, blood vomiting, lung damage, weight loss, and fatigue."
required_organs = list(/obj/item/bodypart/head)
required_organs = list(/obj/item/organ/lungs)
severity = DANGEROUS
bypasses_immunity = TRUE // TB primarily impacts the lungs; it's also bacterial or fungal in nature; viral immunity should do nothing.
/datum/disease/tuberculosis/stage_act() //it begins
..()
+10 -9
View File
@@ -629,10 +629,11 @@
text = "<i><b>[text]</b></i>: "
if (ishuman(current))
text += "<a href='?src=\ref[src];monkey=healthy'>healthy</a>|<a href='?src=\ref[src];monkey=infected'>infected</a>|<b>HUMAN</b>|other"
else if (ismonkey(current))
var/found = 0
for(var/datum/disease/D in current.viruses)
if(istype(D, /datum/disease/transformation/jungle_fever)) found = 1
else if(ismonkey(current))
var/found = FALSE
for(var/datum/disease/transformation/jungle_fever/JF in current.viruses)
found = TRUE
break
if(found)
text += "<a href='?src=\ref[src];monkey=healthy'>healthy</a>|<b>INFECTED</b>|<a href='?src=\ref[src];monkey=human'>human</a>|other"
@@ -1342,7 +1343,8 @@
src = M.mind
//to_chat(world, "DEBUG: \"healthy\": M=[M], M.mind=[M.mind], src=[src]!")
else if (istype(M) && length(M.viruses))
for(var/datum/disease/D in M.viruses)
for(var/thing in M.viruses)
var/datum/disease/D = thing
D.cure(0)
if("infected")
if (check_rights(R_ADMIN, 0))
@@ -1362,10 +1364,9 @@
var/mob/living/carbon/human/H = current
var/mob/living/carbon/monkey/M = current
if (istype(M))
for(var/datum/disease/D in M.viruses)
if (istype(D,/datum/disease/transformation/jungle_fever))
D.cure(0)
sleep(0) //because deleting of virus is doing throught spawn(0)
for(var/datum/disease/transformation/jungle_fever/JF in M.viruses)
JF.cure(0)
sleep(0) //because deleting of virus is doing throught spawn(0) //What
log_admin("[key_name(usr)] attempting to humanize [key_name(current)]")
message_admins("<span class='notice'>[key_name_admin(usr)] attempting to humanize [key_name_admin(current)]</span>")
H = M.humanize(TR_KEEPITEMS | TR_KEEPIMPLANTS | TR_KEEPORGANS | TR_KEEPDAMAGE | TR_KEEPVIRUS | TR_DEFAULTMSG)