Refactors virus spreading
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
return 1
|
||||
|
||||
|
||||
/mob/proc/ContractDisease(datum/disease/D)
|
||||
/mob/proc/ContactContractDisease(datum/disease/D)
|
||||
if(!CanContractDisease(D))
|
||||
return 0
|
||||
AddDisease(D)
|
||||
@@ -56,42 +56,31 @@
|
||||
DD.affected_mob.med_hud_set_status()
|
||||
|
||||
|
||||
/mob/living/carbon/ContractDisease(datum/disease/D)
|
||||
/mob/living/carbon/ContactContractDisease(datum/disease/D, target_zone)
|
||||
if(!CanContractDisease(D))
|
||||
return 0
|
||||
|
||||
var/obj/item/clothing/Cl = null
|
||||
var/passed = 1
|
||||
var/passed = TRUE
|
||||
|
||||
var/head_ch = 100
|
||||
var/head_ch = 80
|
||||
var/body_ch = 100
|
||||
var/hands_ch = 25
|
||||
var/feet_ch = 25
|
||||
|
||||
if(D.spread_flags & CONTACT_HANDS)
|
||||
head_ch = 0
|
||||
body_ch = 0
|
||||
hands_ch = 100
|
||||
feet_ch = 0
|
||||
if(D.spread_flags & CONTACT_FEET)
|
||||
head_ch = 0
|
||||
body_ch = 0
|
||||
hands_ch = 0
|
||||
feet_ch = 100
|
||||
var/hands_ch = 35
|
||||
var/feet_ch = 15
|
||||
|
||||
if(prob(15/D.permeability_mod))
|
||||
return
|
||||
|
||||
if(satiety>0 && prob(satiety/10)) // positive satiety makes it harder to contract the disease.
|
||||
return
|
||||
|
||||
var/target_zone = pick(head_ch;1,body_ch;2,hands_ch;3,feet_ch;4)
|
||||
if(!target_zone)
|
||||
target_zone = pick(head_ch;"head",body_ch;"body",hands_ch;"hands",feet_ch;"feet")
|
||||
|
||||
if(ishuman(src))
|
||||
var/mob/living/carbon/human/H = src
|
||||
|
||||
switch(target_zone)
|
||||
if(1)
|
||||
if("head")
|
||||
if(isobj(H.head) && !istype(H.head, /obj/item/paper))
|
||||
Cl = H.head
|
||||
passed = prob((Cl.permeability_coefficient*100) - 1)
|
||||
@@ -101,14 +90,14 @@
|
||||
if(passed && isobj(H.wear_neck))
|
||||
Cl = H.wear_neck
|
||||
passed = prob((Cl.permeability_coefficient*100) - 1)
|
||||
if(2)
|
||||
if("body")
|
||||
if(isobj(H.wear_suit))
|
||||
Cl = H.wear_suit
|
||||
passed = prob((Cl.permeability_coefficient*100) - 1)
|
||||
if(passed && isobj(slot_w_uniform))
|
||||
Cl = slot_w_uniform
|
||||
passed = prob((Cl.permeability_coefficient*100) - 1)
|
||||
if(3)
|
||||
if("hands")
|
||||
if(isobj(H.wear_suit) && H.wear_suit.body_parts_covered&HANDS)
|
||||
Cl = H.wear_suit
|
||||
passed = prob((Cl.permeability_coefficient*100) - 1)
|
||||
@@ -116,7 +105,7 @@
|
||||
if(passed && isobj(H.gloves))
|
||||
Cl = H.gloves
|
||||
passed = prob((Cl.permeability_coefficient*100) - 1)
|
||||
if(4)
|
||||
if("feet")
|
||||
if(isobj(H.wear_suit) && H.wear_suit.body_parts_covered&FEET)
|
||||
Cl = H.wear_suit
|
||||
passed = prob((Cl.permeability_coefficient*100) - 1)
|
||||
@@ -128,19 +117,30 @@
|
||||
else if(ismonkey(src))
|
||||
var/mob/living/carbon/monkey/M = src
|
||||
switch(target_zone)
|
||||
if(1)
|
||||
if("head")
|
||||
if(M.wear_mask && isobj(M.wear_mask))
|
||||
Cl = M.wear_mask
|
||||
passed = prob((Cl.permeability_coefficient*100) - 1)
|
||||
|
||||
if(!passed && (D.spread_flags & AIRBORNE) && !internal)
|
||||
passed = (prob((50*D.permeability_mod) - 1))
|
||||
|
||||
if(passed)
|
||||
AddDisease(D)
|
||||
|
||||
/mob/proc/AirborneContractDisease(datum/disease/D)
|
||||
if((D.spread_flags & VIRUS_SPREAD_AIRBORNE) && prob((50*D.permeability_mod) - 1))
|
||||
ForceContractDisease(D)
|
||||
|
||||
//Same as ContractDisease, except never overidden clothes checks
|
||||
/mob/living/carbon/AirborneContractDisease(datum/disease/D)
|
||||
if(internal)
|
||||
return
|
||||
..()
|
||||
|
||||
/mob/living/carbon/human/AirborneContractDisease(datum/disease/D)
|
||||
if(dna && (NOBREATH in dna.species.species_traits))
|
||||
return
|
||||
..()
|
||||
|
||||
|
||||
//Proc to use when you 100% want to infect someone, as long as they aren't immune
|
||||
/mob/proc/ForceContractDisease(datum/disease/D)
|
||||
if(!CanContractDisease(D))
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user