Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /obj/item/organ/liver/on_life()
- var/mob/living/carbon/C = owner
- var/processchem = FALSE //To process all chems when iecure is detected
- var/sendmessage = FALSE //To stop the liver damage message being sent if iecure is detected
- if(istype(C))
- if(!failing) //can't process reagents with a failing liver - however process the one that heals the liver
- //slowly heal liver damage
- damage = max(0, damage - 0.1)
- if(filterToxins && !owner.has_trait(TRAIT_TOXINLOVER))
- //handle liver toxin filtration
- var/static/list/toxinstypecache = typecacheof(/datum/reagent/toxin)
- for(var/I in C.reagents.reagent_list)
- var/datum/reagent/pickedreagent = I
- if(is_type_in_typecache(pickedreagent, toxinstypecache))
- var/thisamount = C.reagents.get_reagent_amount(initial(pickedreagent.id))
- if (thisamount <= toxTolerance && thisamount)
- C.reagents.remove_reagent(initial(pickedreagent.id), 1)
- else
- damage += (thisamount*toxLethality)
- //metabolize reagents
- C.reagents.metabolize(C, can_overdose=TRUE)
- to_chat(world, "normal metabolise")
- if(failing) //This special check only needs to be done on liver failure
- to_chat(world, "oh fug we dying")
- for(var/I in C.reagents.reagent_list) //Override for liver, if the liver fixing chem is detected we will process everything
- if(I == /datum/reagent/medicine/iecure)
- for(owner in GLOB.alive_mob_list)
- processchem = TRUE
- else
- for(owner in GLOB.alive_mob_list)
- processchem = FALSE
- if(processchem == TRUE)
- to_chat(world, "METABOLISE GOOOOOO")
- C.reagents.metabolize(C, can_overdose=TRUE)
- if(damage > 10 && prob(damage/3)) //the higher the damage the higher the probability
- for(var/I in C.reagents.reagent_list)
- if(I == /datum/reagent/medicine/iecure)
- for(owner in GLOB.alive_mob_list)
- sendmessage = FALSE
- else
- for(owner in GLOB.alive_mob_list)
- sendmessage = TRUE
- if(sendmessage == TRUE)
- to_chat(C, "<span class='notice'>You feel [pick("nauseous", "a dull pain in your lower body", "confused")].</span>") //no liver damage message if they have the liver fixing chemical
- if(damage > maxHealth)//cap liver damage
- damage = maxHealth
- if(damage < maxHealth && failing) //if their liver is healed, stop killing them!!
- failing = FALSE
- to_chat(C, "<span class='notice'>You feel [pick("the pain in your lower body fading", "awake and alert again")].</span>")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement