Refactors virus spreading

This commit is contained in:
XDTM
2017-10-09 14:08:21 +02:00
committed by CitadelStationBot
parent 6f2b89ae88
commit 7a0ce217db
60 changed files with 1057 additions and 187 deletions
+3 -3
View File
@@ -412,10 +412,10 @@ GLOBAL_LIST_EMPTY(blood_splatter_icons)
. = ..()
transfer_blood = rand(2, 4)
/turf/add_blood(list/blood_dna)
/turf/add_blood(list/blood_dna, list/datum/disease/diseases)
var/obj/effect/decal/cleanable/blood/splatter/B = locate() in src
if(!B)
B = new /obj/effect/decal/cleanable/blood/splatter(src)
B = new /obj/effect/decal/cleanable/blood/splatter(src, diseases)
B.transfer_blood_dna(blood_dna) //give blood info to the blood decal.
return 1 //we bloodied the floor
@@ -524,7 +524,7 @@ GLOBAL_LIST_EMPTY(blood_splatter_icons)
/atom/proc/add_vomit_floor(mob/living/carbon/M, toxvomit = 0)
if(isturf(src))
var/obj/effect/decal/cleanable/vomit/V = new /obj/effect/decal/cleanable/vomit(src)
var/obj/effect/decal/cleanable/vomit/V = new /obj/effect/decal/cleanable/vomit(src, M.get_static_viruses())
// Make toxins vomit look different
if(toxvomit)
V.icon_state = "vomittox_[pick(1,4)]"
+27 -8
View File
@@ -61,16 +61,12 @@
//called when a carbon changes virus
/mob/living/carbon/proc/check_virus()
var/threat = 0
var/threat
for(var/thing in viruses)
var/datum/disease/D = thing
if(!(D.visibility_flags & HIDDEN_SCANNER))
if (D.severity != NONTHREAT) //a buffing virus gets an icon
threat = 2
return threat //harmful viruses have priority
else
threat = 1 //aka good virus
if(!threat || D.severity > threat) //a buffing virus gets an icon
threat = D.severity
return threat
//helper for getting the appropriate health status
@@ -162,21 +158,44 @@
/mob/living/carbon/med_hud_set_status()
var/image/holder = hud_list[STATUS_HUD]
var/icon/I = icon(icon, icon_state, dir)
<<<<<<< HEAD
var/virus_state = check_virus()
var/mob/living/simple_animal/borer/B = has_brain_worms()
=======
var/virus_threat = check_virus()
>>>>>>> db0c10e... Refactors virus spreading (#31066)
holder.pixel_y = I.Height() - world.icon_size
if(status_flags & XENO_HOST)
holder.icon_state = "hudxeno"
else if(stat == DEAD || (status_flags & FAKEDEATH))
holder.icon_state = "huddead"
<<<<<<< HEAD
else if(has_brain_worms() && B != null && B.controlling)
holder.icon_state = "hudbrainworm"
else if(virus_state == 2)
holder.icon_state = "hudill"
else if(virus_state == 1)
holder.icon_state = "hudbuff"
=======
>>>>>>> db0c10e... Refactors virus spreading (#31066)
else
holder.icon_state = "hudhealthy"
switch(virus_threat)
if(VIRUS_SEVERITY_BIOHAZARD)
holder.icon_state = "hudill5"
if(VIRUS_SEVERITY_DANGEROUS)
holder.icon_state = "hudill4"
if(VIRUS_SEVERITY_HARMFUL)
holder.icon_state = "hudill3"
if(VIRUS_SEVERITY_MEDIUM)
holder.icon_state = "hudill2"
if(VIRUS_SEVERITY_MINOR)
holder.icon_state = "hudill1"
if(VIRUS_SEVERITY_NONTHREAT)
holder.icon_state = "hudill0"
if(VIRUS_SEVERITY_POSITIVE)
holder.icon_state = "hudbuff"
if(null)
holder.icon_state = "hudhealthy"
/***********************************************
@@ -43,7 +43,7 @@
for(var/thing in user.viruses)
var/datum/disease/D = thing
if(D.severity == NONTHREAT)
if(D.severity == VIRUS_SEVERITY_POSITIVE)
continue
D.cure()
return TRUE
@@ -2,7 +2,7 @@
name = "Unnatural Wasting"
max_stages = 5
stage_prob = 10
spread_flags = NON_CONTAGIOUS
spread_flags = VIRUS_SPREAD_NON_CONTAGIOUS
cure_text = "Holy water or extensive rest."
spread_text = "A burst of unholy energy"
cures = list("holywater")
@@ -11,7 +11,7 @@
viable_mobtypes = list(/mob/living/carbon/human)
disease_flags = CURABLE
permeability_mod = 1
severity = BIOHAZARD
severity = VIRUS_SEVERITY_HARMFUL
var/stagedamage = 0 //Highest stage reached.
var/finalstage = 0 //Because we're spawning off the cure in the final stage, we need to check if we've done the final stage's effects.
@@ -6,7 +6,7 @@
var/bloodiness = 0 //0-100, amount of blood in this decal, used for making footprints and affecting the alpha of bloody footprints
var/mergeable_decal = 1 //when two of these are on a same tile or do we need to merge them into just one?
/obj/effect/decal/cleanable/Initialize(mapload)
/obj/effect/decal/cleanable/Initialize(mapload, list/datum/disease/diseases)
if (random_icon_states && length(src.random_icon_states) > 0)
src.icon_state = pick(src.random_icon_states)
create_reagents(300)
@@ -14,10 +14,15 @@
for(var/obj/effect/decal/cleanable/C in src.loc)
if(C != src && C.type == src.type)
replace_decal(C)
if(LAZYLEN(diseases))
var/list/datum/disease/diseases_to_add = list()
for(var/datum/disease/D in diseases)
if(D.spread_flags & VIRUS_SPREAD_CONTACT_FLUIDS)
diseases_to_add += D
if(LAZYLEN(diseases_to_add))
AddComponent(/datum/component/infective, diseases_to_add)
. = ..()
/obj/effect/decal/cleanable/proc/replace_decal(obj/effect/decal/cleanable/C)
if(mergeable_decal)
qdel(C)
@@ -65,6 +70,7 @@
//Add "bloodiness" of this blood's type, to the human's shoes
//This is on /cleanable because fuck this ancient mess
/obj/effect/decal/cleanable/Crossed(atom/movable/O)
..()
if(ishuman(O))
var/mob/living/carbon/human/H = O
if(H.shoes && blood_state && bloodiness)
@@ -18,7 +18,7 @@
desc = "Looks like it's been here a while. Eew."
bloodiness = 0
/obj/effect/decal/cleanable/blood/old/Initialize()
/obj/effect/decal/cleanable/blood/old/Initialize(mapload, list/datum/disease/diseases)
. = ..()
icon_state += "-old" //This IS necessary because the parent /blood type uses icon randomization.
blood_DNA["Non-human DNA"] = "A+"
@@ -39,7 +39,6 @@
var/list/existing_dirs = list()
blood_DNA = list()
/obj/effect/decal/cleanable/trail_holder/can_bloodcrawl_in()
return 1
@@ -53,7 +52,7 @@
random_icon_states = list("gib1", "gib2", "gib3", "gib4", "gib5", "gib6")
mergeable_decal = 0
/obj/effect/decal/cleanable/blood/gibs/Initialize()
/obj/effect/decal/cleanable/blood/gibs/Initialize(mapload, list/datum/disease/diseases)
. = ..()
reagents.add_reagent("liquidgibs", 5)
@@ -66,7 +65,11 @@
for(var/i = 0, i < pick(1, 200; 2, 150; 3, 50), i++)
sleep(2)
if(i > 0)
new /obj/effect/decal/cleanable/blood/splatter(loc)
var/list/datum/disease/diseases
GET_COMPONENT(infective, /datum/component/infective)
if(infective)
diseases = infective.diseases
new /obj/effect/decal/cleanable/blood/splatter(loc, diseases)
if(!step_to(src, get_step(src, direction), 0))
break
@@ -93,7 +96,7 @@
desc = "Space Jesus, why didn't anyone clean this up? It smells terrible."
bloodiness = 0
/obj/effect/decal/cleanable/blood/gibs/old/Initialize()
/obj/effect/decal/cleanable/blood/gibs/old/Initialize(mapload, list/datum/disease/diseases)
. = ..()
setDir(pick(1,2,4,8))
icon_state += "-old"
@@ -126,6 +129,7 @@
var/list/shoe_types = list()
/obj/effect/decal/cleanable/blood/footprints/Crossed(atom/movable/O)
..()
if(ishuman(O))
var/mob/living/carbon/human/H = O
var/obj/item/clothing/shoes/S = H.shoes
@@ -136,6 +140,7 @@
update_icon()
/obj/effect/decal/cleanable/blood/footprints/Uncrossed(atom/movable/O)
..()
if(ishuman(O))
var/mob/living/carbon/human/H = O
var/obj/item/clothing/shoes/S = H.shoes
@@ -101,7 +101,7 @@
name = "crusty dried vomit"
desc = "You try not to look at the chunks, and fail."
/obj/effect/decal/cleanable/vomit/old/Initialize()
/obj/effect/decal/cleanable/vomit/old/Initialize(mapload, list/datum/disease/diseases)
. = ..()
icon_state += "-old"
@@ -6,7 +6,7 @@
var/list/gibamounts = list() //amount to spawn for each gib decal type we'll spawn.
var/list/gibdirections = list() //of lists of possible directions to spread each gib decal type towards.
/obj/effect/gibspawner/Initialize(mapload, datum/dna/MobDNA)
/obj/effect/gibspawner/Initialize(mapload, datum/dna/MobDNA, list/datum/disease/diseases)
. = ..()
if(gibtypes.len != gibamounts.len || gibamounts.len != gibdirections.len)
@@ -24,7 +24,7 @@
if(gibamounts[i])
for(var/j = 1, j<= gibamounts[i], j++)
var/gibType = gibtypes[i]
gib = new gibType(loc)
gib = new gibType(loc, diseases)
if(iscarbon(loc))
var/mob/living/carbon/digester = loc
digester.stomach_contents += gib