mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 18:53:06 +00:00
Fixes #5532 and increases the time required for organs to become infected from wounds
Also removes the now unnecessary get_cure_threshold() proc, caps the rate at which an organ can receive germs from wounds, and makes germs spread from external to internal organs happen one organ at a time instead of all at once.
This commit is contained in:
@@ -18,16 +18,10 @@
|
|||||||
return icon('icons/mob/human.dmi',"blank")
|
return icon('icons/mob/human.dmi',"blank")
|
||||||
|
|
||||||
//Germs
|
//Germs
|
||||||
/datum/organ/proc/get_cure_threshold()
|
|
||||||
//before reaching level three, the amount of spaceacillin required to cure infections scales between 5 and 30 units
|
|
||||||
//var/germ_scale = max((germ_level - INFECTION_LEVEL_ONE)/(INFECTION_LEVEL_THREE - INFECTION_LEVEL_ONE), 0)
|
|
||||||
//return min(5 + germ_scale*25, 30)
|
|
||||||
return 5 //Based on Hubble's suggestion
|
|
||||||
|
|
||||||
/datum/organ/proc/handle_antibiotics()
|
/datum/organ/proc/handle_antibiotics()
|
||||||
var/antibiotics = owner.reagents.get_reagent_amount("spaceacillin")
|
var/antibiotics = owner.reagents.get_reagent_amount("spaceacillin")
|
||||||
|
|
||||||
if (antibiotics <= get_cure_threshold())
|
if (antibiotics < 5)
|
||||||
return
|
return
|
||||||
|
|
||||||
if (germ_level < INFECTION_LEVEL_ONE)
|
if (germ_level < INFECTION_LEVEL_ONE)
|
||||||
|
|||||||
@@ -377,13 +377,18 @@ Note that amputating the affected organ does in fact remove the infection from t
|
|||||||
if (owner.germ_level > W.germ_level && W.infection_check())
|
if (owner.germ_level > W.germ_level && W.infection_check())
|
||||||
W.germ_level++
|
W.germ_level++
|
||||||
|
|
||||||
//Infected wounds raise the organ's germ level
|
if (antibiotics < 5)
|
||||||
if (W.germ_level > germ_level && antibiotics < 5) //Badly infected wounds raise internal germ levels
|
for(var/datum/wound/W in wounds)
|
||||||
germ_level++
|
//Infected wounds raise the organ's germ level
|
||||||
|
if (W.germ_level > germ_level)
|
||||||
|
germ_level++
|
||||||
|
break //limit increase to a maximum of one per second
|
||||||
|
|
||||||
/datum/organ/external/proc/handle_germ_effects()
|
/datum/organ/external/proc/handle_germ_effects()
|
||||||
var/antibiotics = owner.reagents.get_reagent_amount("spaceacillin")
|
var/antibiotics = owner.reagents.get_reagent_amount("spaceacillin")
|
||||||
var/cure_threshold = get_cure_threshold()
|
|
||||||
|
if (germ_level < INFECTION_LEVEL_ONE & prob(60)) //this could be an else clause, but it looks cleaner this way
|
||||||
|
germ_level-- //since germ_level increases at a rate of 1 per second with dirty wounds, prob(60) should give us about 5 minutes before level one.
|
||||||
|
|
||||||
if(germ_level >= INFECTION_LEVEL_ONE)
|
if(germ_level >= INFECTION_LEVEL_ONE)
|
||||||
//having an infection raises your body temperature
|
//having an infection raises your body temperature
|
||||||
@@ -393,17 +398,29 @@ Note that amputating the affected organ does in fact remove the infection from t
|
|||||||
owner.bodytemperature++
|
owner.bodytemperature++
|
||||||
|
|
||||||
if(prob(round(germ_level/10)))
|
if(prob(round(germ_level/10)))
|
||||||
if (antibiotics < cure_threshold)
|
if (antibiotics < 5)
|
||||||
germ_level++
|
germ_level++
|
||||||
|
|
||||||
if (prob(3)) //adjust this to tweak how fast people take toxin damage from infections
|
if (prob(5)) //adjust this to tweak how fast people take toxin damage from infections
|
||||||
owner.adjustToxLoss(1)
|
owner.adjustToxLoss(1)
|
||||||
|
|
||||||
if(germ_level >= INFECTION_LEVEL_TWO && antibiotics < cure_threshold)
|
if(germ_level >= INFECTION_LEVEL_TWO && antibiotics < 5)
|
||||||
//spread the infection
|
//spread the infection
|
||||||
|
var/datum/organ/internal/target_organ //make internal organs become infected one at a time instead of all at once
|
||||||
for (var/datum/organ/internal/I in internal_organs)
|
for (var/datum/organ/internal/I in internal_organs)
|
||||||
if (I.germ_level < germ_level)
|
if (I.germ_level > 0 && I.germ_level < min(germ_level, INFECTION_LEVEL_TWO)) //once the organ reaches whatever we can give it, or level two, switch to a different one
|
||||||
I.germ_level++
|
if (!target_organ || I.germ_level > target_organ.germ_level) //choose the organ with the highest germ_level
|
||||||
|
target_organ = I
|
||||||
|
|
||||||
|
if (!target_organ)
|
||||||
|
//figure out which organs we can spread germs to and pick one at random
|
||||||
|
var/list/candidate_organs = list()
|
||||||
|
for (var/datum/organ/internal/I in internal_organs)
|
||||||
|
if (I.germ_level < germ_level)
|
||||||
|
candidate_organs += I
|
||||||
|
target_organ = pick(candidate_organs)
|
||||||
|
|
||||||
|
target_organ.germ_level++
|
||||||
|
|
||||||
if (children) //To child organs
|
if (children) //To child organs
|
||||||
for (var/datum/organ/external/child in children)
|
for (var/datum/organ/external/child in children)
|
||||||
@@ -470,8 +487,8 @@ Note that amputating the affected organ does in fact remove the infection from t
|
|||||||
|
|
||||||
// Salving also helps against infection
|
// Salving also helps against infection
|
||||||
if(W.germ_level > 0 && W.salved && prob(2))
|
if(W.germ_level > 0 && W.salved && prob(2))
|
||||||
W.germ_level = 0
|
|
||||||
W.disinfected = 1
|
W.disinfected = 1
|
||||||
|
W.germ_level = 0
|
||||||
|
|
||||||
// sync the organ's damage with its wounds
|
// sync the organ's damage with its wounds
|
||||||
src.update_damages()
|
src.update_damages()
|
||||||
|
|||||||
@@ -32,7 +32,6 @@
|
|||||||
src.owner = H
|
src.owner = H
|
||||||
|
|
||||||
/datum/organ/internal/process()
|
/datum/organ/internal/process()
|
||||||
|
|
||||||
//Process infections
|
//Process infections
|
||||||
if (!germ_level)
|
if (!germ_level)
|
||||||
return
|
return
|
||||||
@@ -48,23 +47,23 @@
|
|||||||
//** Handle the effects of infections
|
//** Handle the effects of infections
|
||||||
var/antibiotics = owner.reagents.get_reagent_amount("spaceacillin")
|
var/antibiotics = owner.reagents.get_reagent_amount("spaceacillin")
|
||||||
|
|
||||||
|
if (germ_level < INFECTION_LEVEL_ONE/2 && prob(60))
|
||||||
|
germ_level--
|
||||||
|
|
||||||
if (germ_level >= INFECTION_LEVEL_ONE/2)
|
if (germ_level >= INFECTION_LEVEL_ONE/2)
|
||||||
//aiming for germ level to go from ambient to INFECTION_LEVEL_TWO in an average of 15 minutes
|
//aiming for germ level to go from ambient to INFECTION_LEVEL_TWO in an average of 15 minutes
|
||||||
if(antibiotics < 5 && prob(round(germ_level/6)))
|
if(antibiotics < 5 && prob(round(germ_level/6)))
|
||||||
germ_level++
|
germ_level++
|
||||||
if(prob(1))
|
|
||||||
take_damage(1,silent=prob(60))
|
|
||||||
|
|
||||||
if (germ_level >= INFECTION_LEVEL_TWO)
|
if (germ_level >= INFECTION_LEVEL_TWO)
|
||||||
var/datum/organ/external/parent = owner.get_organ(parent_organ)
|
var/datum/organ/external/parent = owner.get_organ(parent_organ)
|
||||||
//spread germs
|
//spread germs
|
||||||
if (antibiotics < get_cure_threshold() && parent.germ_level < germ_level && ( parent.germ_level < INFECTION_LEVEL_ONE*2 || prob(30) ))
|
if (antibiotics < 5 && parent.germ_level < germ_level && ( parent.germ_level < INFECTION_LEVEL_ONE*2 || prob(30) ))
|
||||||
parent.germ_level++
|
parent.germ_level++
|
||||||
|
|
||||||
if (prob(3)) //about once every 30 seconds
|
if (prob(3)) //about once every 30 seconds
|
||||||
take_damage(1,silent=prob(30))
|
take_damage(1,silent=prob(30))
|
||||||
|
|
||||||
|
|
||||||
/datum/organ/internal/proc/take_damage(amount, var/silent=0)
|
/datum/organ/internal/proc/take_damage(amount, var/silent=0)
|
||||||
if(src.robotic == 2)
|
if(src.robotic == 2)
|
||||||
src.damage += (amount * 0.8)
|
src.damage += (amount * 0.8)
|
||||||
@@ -124,6 +123,11 @@
|
|||||||
parent_organ = "chest"
|
parent_organ = "chest"
|
||||||
|
|
||||||
process()
|
process()
|
||||||
|
..()
|
||||||
|
if (germ_level > INFECTION_LEVEL_ONE)
|
||||||
|
if(prob(1))
|
||||||
|
owner.emote("cough") //respitory tract infection
|
||||||
|
|
||||||
if(is_bruised())
|
if(is_bruised())
|
||||||
if(prob(2))
|
if(prob(2))
|
||||||
spawn owner.emote("me", 1, "coughs up blood!")
|
spawn owner.emote("me", 1, "coughs up blood!")
|
||||||
@@ -138,6 +142,14 @@
|
|||||||
var/process_accuracy = 10
|
var/process_accuracy = 10
|
||||||
|
|
||||||
process()
|
process()
|
||||||
|
..()
|
||||||
|
if (germ_level > INFECTION_LEVEL_ONE)
|
||||||
|
if(prob(1))
|
||||||
|
owner << "\red Your skin itches."
|
||||||
|
if (germ_level > INFECTION_LEVEL_TWO)
|
||||||
|
if(prob(1))
|
||||||
|
spawn owner.vomit()
|
||||||
|
|
||||||
if(owner.life_tick % process_accuracy == 0)
|
if(owner.life_tick % process_accuracy == 0)
|
||||||
if(src.damage < 0)
|
if(src.damage < 0)
|
||||||
src.damage = 0
|
src.damage = 0
|
||||||
@@ -180,6 +192,7 @@
|
|||||||
parent_organ = "head"
|
parent_organ = "head"
|
||||||
|
|
||||||
process() //Eye damage replaces the old eye_stat var.
|
process() //Eye damage replaces the old eye_stat var.
|
||||||
|
..()
|
||||||
if(is_bruised())
|
if(is_bruised())
|
||||||
owner.eye_blurry = 20
|
owner.eye_blurry = 20
|
||||||
if(is_broken())
|
if(is_broken())
|
||||||
|
|||||||
@@ -774,7 +774,7 @@ var/list/RESTRICTED_CAMERA_NETWORKS = list( //Those networks can only be accesse
|
|||||||
|
|
||||||
#define INFECTION_LEVEL_ONE 100
|
#define INFECTION_LEVEL_ONE 100
|
||||||
#define INFECTION_LEVEL_TWO 500
|
#define INFECTION_LEVEL_TWO 500
|
||||||
#define INFECTION_LEVEL_THREE 1500
|
#define INFECTION_LEVEL_THREE 1000
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user