From f7be1250a38bfe72b85e3803ded5b6896da57a60 Mon Sep 17 00:00:00 2001 From: cib Date: Fri, 30 Dec 2011 21:07:52 -0800 Subject: [PATCH] Many improvements to vira. Implemented an efficient system for infection. Made sneeze and cough increase infection chance. Increased the lifespan of spaceacillin in a host. Removed the drool symptom. --- code/WorkInProgress/virus2/base.dm | 83 +++++++++++--------- code/WorkInProgress/virus2/isolator.dm | 8 +- code/modules/chemical/Chemistry-Reagents.dm | 3 +- code/modules/mob/living/carbon/human/life.dm | 15 +--- 4 files changed, 50 insertions(+), 59 deletions(-) diff --git a/code/WorkInProgress/virus2/base.dm b/code/WorkInProgress/virus2/base.dm index 7cc2c105dfc..14e64e7b1f7 100644 --- a/code/WorkInProgress/virus2/base.dm +++ b/code/WorkInProgress/virus2/base.dm @@ -1,17 +1,3 @@ -/obj/virus - // a virus instance that is placed on the map, moves, and infects - invisibility = 100 - - var/datum/disease2/disease - - New() - ..() - step(src, pick(cardinal)) - step(src, pick(cardinal)) - step(src, pick(cardinal)) - anchored = 1 - spawn(300) del(src) - /mob/living/carbon/proc/get_infection_chance() var/score = 0 var/mob/living/carbon/M = src @@ -45,6 +31,17 @@ return 1 +proc/airborne_can_reach(turf/source, turf/target) + var/obj/dummy = new(source) + dummy.flags = FPRINT | TABLEPASS + dummy.pass_flags = PASSTABLE + + for(var/i=0, i<5, i++) if(!step_towards(dummy, target)) break + + var/rval = (dummy.loc == target) + del dummy + return rval + /proc/infect_virus2(var/mob/living/carbon/M,var/datum/disease2/disease/disease,var/forced = 0) if(M.virus2) return @@ -218,13 +215,12 @@ // with a certain chance, the mob may become immune to the disease before it starts properly if(stage <= 1 && clicks == 0) if(prob(3)) - mob.antibodies |= antigen // 20% immunity is a good chance IMO, because it allows finding an immune person easily + mob.antibodies |= antigen // 3% chance of spontanous immunity else if(mob.radiation > 50) if(prob(1)) majormutate() if(mob.reagents.has_reagent("spaceacillin")) - mob.reagents.remove_reagent("spaceacillin",0.3) return if(mob.reagents.has_reagent("virusfood")) mob.reagents.remove_reagent("virusfood",0.1) @@ -243,6 +239,8 @@ e.runeffect(mob,stage) clicks+=speed + if(prob(5)) spread_airborne(mob) + proc/cure(var/mob/living/carbon/mob) var/datum/disease2/effectholder/E if(stage>1) @@ -288,6 +286,12 @@ // world << "[disease]" return disease + proc/spread_airborne(var/mob/living/carbon/mob) + for(var/mob/living/carbon/target in view(null, mob)) if(!target.virus2) + if(airborne_can_reach(mob.loc, target.loc)) + if(mob.get_infection_chance() && target.get_infection_chance()) + infect_virus2(target,src) + /datum/disease2/effect var/chance_maxm = 100 var/name = "Blanking effect" @@ -334,13 +338,13 @@ /datum/disease2/effect/greater/scream name = "Random screaming syndrome" - stage = 2 + stage = 3 activate(var/mob/living/carbon/mob,var/multiplier) mob.say("*scream") /datum/disease2/effect/greater/drowsness name = "Automated sleeping syndrome" - stage = 2 + stage = 3 activate(var/mob/living/carbon/mob,var/multiplier) mob.drowsyness += 10 @@ -387,9 +391,20 @@ /datum/disease2/effect/greater/sneeze name = "Coldingtons Effect" - stage = 1 + stage = 2 activate(var/mob/living/carbon/mob,var/multiplier) mob.say("*sneeze") + if(mob.virus2) mob.virus2.spread_airborne(mob) + if(mob.virus2) mob.virus2.spread_airborne(mob) + + +/datum/disease2/effect/greater/cough + name = "Anima Syndrome" + stage = 2 + activate(var/mob/living/carbon/mob,var/multiplier) + mob.say("*cough") + if(mob.virus2) mob.virus2.spread_airborne(mob) + if(mob.virus2) mob.virus2.spread_airborne(mob) /datum/disease2/effect/greater/gunck name = "Flemmingtons" @@ -411,7 +426,7 @@ /datum/disease2/effect/greater/sleepy name = "Resting syndrome" - stage = 2 + stage = 3 activate(var/mob/living/carbon/mob,var/multiplier) mob.say("*collapse") @@ -461,15 +476,19 @@ /datum/disease2/effect/lesser/sneeze name = "Coldingtons Effect" - stage = 1 + stage = 2 activate(var/mob/living/carbon/mob,var/multiplier) mob.say("*sneeze") + if(mob.virus2) mob.virus2.spread_airborne(mob) + if(mob.virus2) mob.virus2.spread_airborne(mob) /datum/disease2/effect/lesser/cough name = "Anima Syndrome" stage = 2 activate(var/mob/living/carbon/mob,var/multiplier) mob.say("*cough") + if(mob.virus2) mob.virus2.spread_airborne(mob) + if(mob.virus2) mob.virus2.spread_airborne(mob) /*/datum/disease2/effect/lesser/hallucinations name = "Hallucinational Syndrome" @@ -487,7 +506,7 @@ /datum/disease2/effect/lesser/hungry name = "Appetiser Effect" - stage = 2 + stage = 3 activate(var/mob/living/carbon/mob,var/multiplier) mob.nutrition = max(0, mob.nutrition - 200) @@ -497,21 +516,15 @@ activate(var/mob/living/carbon/mob,var/multiplier) mob.say("*groan") -/datum/disease2/effect/lesser/drool - name = "Saliva Effect" - stage = 1 - activate(var/mob/living/carbon/mob,var/multiplier) - mob.say("*drool") - /datum/disease2/effect/lesser/fridge name = "Refridgerator Syndrome" - stage = 2 + stage = 1 activate(var/mob/living/carbon/mob,var/multiplier) mob.say("*shiver") /datum/disease2/effect/lesser/twitch name = "Twitcher" - stage = 1 + stage = 3 activate(var/mob/living/carbon/mob,var/multiplier) mob.say("*twitch") @@ -539,14 +552,6 @@ activate(var/mob/living/carbon/mob,var/multiplier) mob.disease_symptoms |= DISEASE_HOARSE - -/*Removed on request by Spaceman, due to it being detrimental to RP. -CN -/datum/disease2/effect/lesser/deathgasp - name = "Zombie Syndrome" - stage = 4 - activate(var/mob/living/carbon/mob,var/multiplier) - mob.say("*deathgasp")*/ - var/global/const/DISEASE_HOARSE = 2 var/global/const/DISEASE_WHISPER = 4 @@ -598,4 +603,4 @@ var/global/const/DISEASE_WHISPER = 4 getrandomeffect_greater() /proc/dprob(var/p) - return(prob(sqrt(p)) && prob(sqrt(p))) \ No newline at end of file + return(prob(sqrt(p)) && prob(sqrt(p))) diff --git a/code/WorkInProgress/virus2/isolator.dm b/code/WorkInProgress/virus2/isolator.dm index 2da3be53ec3..326424d5918 100644 --- a/code/WorkInProgress/virus2/isolator.dm +++ b/code/WorkInProgress/virus2/isolator.dm @@ -141,10 +141,10 @@ if(prob(50)) user << "The dish shatters" if(virus2.infectionchance > 0) - // spread around some pathogens - for(var/i = 0, i<= (growth / 3), i++) - var/obj/virus/V = new(src.loc) - V.disease = virus2.getcopy() + for(var/mob/living/carbon/target in view(null, src)) if(!target.virus2) + if(airborne_can_reach(src.loc, target.loc)) + if(target.get_infection_chance()) + infect_virus2(target,src.virus2) del src /obj/item/weapon/virusdish/examine() diff --git a/code/modules/chemical/Chemistry-Reagents.dm b/code/modules/chemical/Chemistry-Reagents.dm index 8c72b65a452..683fcd0ab3e 100644 --- a/code/modules/chemical/Chemistry-Reagents.dm +++ b/code/modules/chemical/Chemistry-Reagents.dm @@ -1456,8 +1456,7 @@ datum color = "#C8A5DC" // rgb: 200, 165, 220 on_mob_life(var/mob/living/M as mob)//no more mr. panacea - holder.remove_reagent(src.id, 0.2) - ..() + holder.remove_reagent(src.id, 0.1) return carpotoxin diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index c759807ff72..1c38fe1637d 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -998,14 +998,7 @@ D.cure() if(!virus2) - // the following is silly since it lets you infect people through glass - /*for(var/mob/living/carbon/M in oviewers(4,src)) - if(M.virus2) - infect_virus2(src,M.virus2)*/ - // instead we're going to use little floating disease objects - for(var/obj/virus/V in src.loc) if(src.get_infection_chance()) - infect_virus2(src,V.disease) - for(var/obj/effect/decal/cleanable/blood/B in view(4, src)) + for(var/obj/effect/decal/cleanable/blood/B in src.loc) if(B.virus2) infect_virus2(src,B.virus2) else @@ -1016,12 +1009,6 @@ // check if we're immune if(virus2.antigen & src.antibodies) virus2.dead = 1 - if(src.get_infection_chance()) - // need more pathogens - for(var/i=0, i<3, i++) - var/obj/virus/V = new(src.loc) - V.disease = src.virus2 - return