Many issue fixes for stomachs and chem interactions (#53440) (#671)

This changes the has_reagent check to work with stomachs.
Several supporting procs have been added to fully support this behavior.
end_metabolization will work as expected again
expose is working with INGEST items again
on_mob_add working as intended
on_mob_life has been reviewed and worked over.

Health Analyzers now show stomach contents, same with the medical kiosk.

Included the unit test to validate reagent checks.
Unit tests for the new procs on mob

Co-authored-by: NightRed <nightred@gmail.com>
This commit is contained in:
SkyratBot
2020-09-07 04:10:16 +02:00
committed by GitHub
co-authored by NightRed
parent afe04f1b94
commit c6007727cd
41 changed files with 281 additions and 97 deletions
+1 -1
View File
@@ -47,7 +47,7 @@
return
// No decay if formaldehyde in corpse or when the corpse is charred
if(C.reagents.has_reagent(/datum/reagent/toxin/formaldehyde, 15) || HAS_TRAIT(C, TRAIT_HUSK))
if(C.has_reagent(/datum/reagent/toxin/formaldehyde, 15) || HAS_TRAIT(C, TRAIT_HUSK))
return
// Also no decay if corpse chilled or not organic/undead
+2 -2
View File
@@ -88,7 +88,7 @@
. = cures.len
for(var/C_id in cures)
if(!affected_mob.reagents.has_reagent(C_id))
if(!affected_mob.has_reagent(C_id))
.--
if(!. || (needs_all_cures && . < cures.len))
return FALSE
@@ -101,7 +101,7 @@
if(!(spread_flags & DISEASE_SPREAD_AIRBORNE) && !force_spread)
return
if(affected_mob.reagents.has_reagent(/datum/reagent/medicine/spaceacillin) || (affected_mob.satiety > 0 && prob(affected_mob.satiety/10)))
if(affected_mob.has_reagent(/datum/reagent/medicine/spaceacillin) || (affected_mob.satiety > 0 && prob(affected_mob.satiety/10)))
return
var/spread_range = 2
@@ -342,11 +342,11 @@
if(M.fire_stacks < 0)
M.set_fire_stacks(min(M.fire_stacks + 1 * absorption_coeff, 0))
. += power
if(M.reagents.has_reagent(/datum/reagent/water/holywater, needs_metabolizing = FALSE))
M.reagents.remove_reagent(/datum/reagent/water/holywater, 0.5 * absorption_coeff)
if(M.has_reagent(/datum/reagent/water/holywater, needs_metabolizing = FALSE))
M.remove_reagent(/datum/reagent/water/holywater, 0.5 * absorption_coeff)
. += power * 0.75
else if(M.reagents.has_reagent(/datum/reagent/water, needs_metabolizing = FALSE))
M.reagents.remove_reagent(/datum/reagent/water, 0.5 * absorption_coeff)
else if(M.has_reagent(/datum/reagent/water, needs_metabolizing = FALSE))
M.remove_reagent(/datum/reagent/water, 0.5 * absorption_coeff)
. += power * 0.5
/datum/symptom/heal/water/Heal(mob/living/carbon/M, datum/disease/advance/A, actual_power)
@@ -407,7 +407,7 @@
gases = environment.gases
if(gases[/datum/gas/plasma] && gases[/datum/gas/plasma][MOLES] > gases[/datum/gas/plasma][GAS_META][META_GAS_MOLES_VISIBLE]) //if there's enough plasma in the air to see
. += power * 0.5
if(M.reagents.has_reagent(/datum/reagent/toxin/plasma, needs_metabolizing = TRUE))
if(M.has_reagent(/datum/reagent/toxin/plasma, needs_metabolizing = TRUE))
. += power * 0.75
/datum/symptom/heal/plasma/Heal(mob/living/carbon/M, datum/disease/advance/A, actual_power)
@@ -46,10 +46,10 @@
if(A.stage >= 4)
M.drowsyness = max(0, M.drowsyness - 2)
if(M.reagents.has_reagent(/datum/reagent/toxin/mindbreaker))
M.reagents.remove_reagent(/datum/reagent/toxin/mindbreaker, 5)
if(M.reagents.has_reagent(/datum/reagent/toxin/histamine))
M.reagents.remove_reagent(/datum/reagent/toxin/histamine, 5)
if(M.has_reagent(/datum/reagent/toxin/mindbreaker))
M.remove_reagent(/datum/reagent/toxin/mindbreaker, 5)
if(M.has_reagent(/datum/reagent/toxin/histamine))
M.remove_reagent(/datum/reagent/toxin/histamine, 5)
M.hallucination = max(0, M.hallucination - 10)
if(A.stage >= 5)
+5 -1
View File
@@ -195,7 +195,11 @@
. = ..()
if(.)
update_time_of_death()
owner.reagents?.end_metabolization(owner, FALSE)
if(istype(owner, /mob/living/carbon))
var/mob/living/carbon/body = owner
body.end_metabolization(FALSE)
else
owner.reagents?.end_metabolization(owner, FALSE)
/datum/status_effect/grouped/stasis/on_apply()
. = ..()
+3 -3
View File
@@ -463,7 +463,7 @@
hardcore_value = 6
/datum/quirk/insanity/on_process()
if(quirk_holder.reagents.has_reagent(/datum/reagent/toxin/mindbreaker, needs_metabolizing = TRUE))
if(quirk_holder.has_reagent(/datum/reagent/toxin/mindbreaker, needs_metabolizing = TRUE))
quirk_holder.hallucination = 0
return
if(prob(2)) //we'll all be mad soon enough
@@ -710,11 +710,11 @@
return
var/mob/living/carbon/carbon_quirk_holder = quirk_holder
for(var/M in allergies)
var/datum/reagent/instantiated_med = carbon_quirk_holder.reagents.has_reagent(M)
var/datum/reagent/instantiated_med = carbon_quirk_holder.has_reagent(M)
if(!instantiated_med)
continue
//Just halts the progression, I'd suggest you run to medbay asap to get it fixed
if(carbon_quirk_holder.reagents.has_reagent(/datum/reagent/medicine/epinephrine))
if(carbon_quirk_holder.has_reagent(/datum/reagent/medicine/epinephrine))
instantiated_med.reagent_removal_skip_list |= ALLERGIC_REMOVAL_SKIP
return //intentionally stops the entire proc so we avoid the organ damage after the loop
instantiated_med.reagent_removal_skip_list -= ALLERGIC_REMOVAL_SKIP
+2 -2
View File
@@ -363,9 +363,9 @@
var/painkiller_bonus = 0
if(victim.drunkenness)
painkiller_bonus += 5
if(victim.reagents?.has_reagent(/datum/reagent/medicine/morphine))
if(victim.has_reagent(/datum/reagent/medicine/morphine))
painkiller_bonus += 10
if(victim.reagents?.has_reagent(/datum/reagent/determination))
if(victim.has_reagent(/datum/reagent/determination))
painkiller_bonus += 5
if(prob(25 + (20 * severity - 2) - painkiller_bonus)) // 25%/45% chance to fail self-applying with severe and critical wounds, modded by painkillers
+3 -3
View File
@@ -41,11 +41,11 @@
return
if(victim.reagents)
if(victim.reagents.has_reagent(/datum/reagent/medicine/spaceacillin))
if(victim.has_reagent(/datum/reagent/medicine/spaceacillin))
sanitization += 0.9
if(victim.reagents.has_reagent(/datum/reagent/space_cleaner/sterilizine/))
if(victim.has_reagent(/datum/reagent/space_cleaner/sterilizine/))
sanitization += 0.9
if(victim.reagents.has_reagent(/datum/reagent/medicine/mine_salve))
if(victim.has_reagent(/datum/reagent/medicine/mine_salve))
sanitization += 0.3
flesh_healing += 0.5
+1 -1
View File
@@ -57,7 +57,7 @@
if(prob(5))
to_chat(victim, "<span class='notice'>You feel the [lowertext(name)] in your [limb.name] firming up from the cold!</span>")
if(victim.reagents?.has_reagent(/datum/reagent/toxin/heparin))
if(victim.has_reagent(/datum/reagent/toxin/heparin))
blood_flow += 0.5 // old herapin used to just add +2 bleed stacks per tick, this adds 0.5 bleed flow to all open cuts which is probably even stronger as long as you can cut them first
if(limb.current_gauze)
+1 -1
View File
@@ -96,7 +96,7 @@
blood_flow = min(blood_flow, WOUND_SLASH_MAX_BLOODFLOW)
if(victim.reagents?.has_reagent(/datum/reagent/toxin/heparin))
if(victim.has_reagent(/datum/reagent/toxin/heparin))
blood_flow += 0.5 // old herapin used to just add +2 bleed stacks per tick, this adds 0.5 bleed flow to all open cuts which is probably even stronger as long as you can cut them first
if(limb.current_gauze)