Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disease protection #4524

Merged
merged 8 commits into from
Oct 7, 2023
Merged
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions code/datums/disease.dm
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,11 @@ var/list/diseases = typesof(/datum/disease) - /datum/disease
check_range = 1 // everything else, like infect-on-contact things, only infect things on top of it

if(isturf(source.loc))
for(var/mob/living/carbon/M in oview(check_range, source))
if(isturf(M.loc))
if(AStar(source.loc, M.loc, /turf/proc/AdjacentTurfs, /turf/proc/Distance, check_range))
M.contract_disease(src, 0, 1, force_spread)
for(var/mob/living/carbon/victim in oview(check_range, source))
if(isturf(victim.loc))
if(AStar(source.loc, victim.loc, /turf/proc/AdjacentTurfs, /turf/proc/Distance, check_range) && !locate(src) in victim.viruses)
if(get_infection_chance(victim))
victim.contract_disease(src, 0, 1, force_spread)
kiVts marked this conversation as resolved.
Show resolved Hide resolved

return

Expand Down Expand Up @@ -173,6 +174,21 @@ var/list/diseases = typesof(/datum/disease) - /datum/disease
var/mob/living/carbon/human/H = affected_mob
H.med_hud_set_status()

/datum/disease/proc/get_infection_chance(mob/living/carbon/human/victim)
if(ishuman(victim))
var/protection = 0 //Our current credit protection on how good are we protected from any sort of disease.
if(istype(victim.wear_mask, /obj/item/clothing/mask/surgical))
protection += 30
if(istype(victim.gloves, /obj/item/clothing/gloves/latex))
protection += 20
if(istype(victim.head, /obj/item/clothing/head/bio_hood) && istype(victim.wear_suit, /obj/item/clothing/suit/bio_suit))
protection += 80 // biosuit is VERY helpfull
else if(istype(victim.head, /obj/item/clothing/head/helmet/space) && istype(victim.wear_suit, /obj/item/clothing/suit/space))
protection += 60 // not as usefull but still very helpfull
protection = clamp(protection, 5, 95)
if(prob(protection))
return FALSE
return TRUE


/datum/disease/New(process=TRUE)//process = 1 - adding the object to global list. List is processed by master controller.
Expand Down