mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-26 06:29:23 +01:00
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:
@@ -252,7 +252,10 @@
|
||||
trans_data = copy_data(T)
|
||||
R.add_reagent(T.type, transfer_amount * multiplier, trans_data, chem_temp, no_react = 1) //we only handle reaction after every reagent has been transfered.
|
||||
if(methods)
|
||||
R.expose_single(T, target_atom, methods, part, show_message)
|
||||
if(istype(target_atom, /obj/item/organ/stomach))
|
||||
R.expose_single(T, target, methods, part, show_message)
|
||||
else
|
||||
R.expose_single(T, target_atom, methods, part, show_message)
|
||||
T.on_transfer(target_atom, methods, transfer_amount * multiplier)
|
||||
remove_reagent(T.type, transfer_amount)
|
||||
transfer_log[T.type] = transfer_amount
|
||||
@@ -272,7 +275,10 @@
|
||||
R.add_reagent(T.type, transfer_amount * multiplier, trans_data, chem_temp, no_react = 1)
|
||||
to_transfer = max(to_transfer - transfer_amount , 0)
|
||||
if(methods)
|
||||
R.expose_single(T, target_atom, methods, transfer_amount, show_message)
|
||||
if(istype(target_atom, /obj/item/organ/stomach))
|
||||
R.expose_single(T, target, methods, transfer_amount, show_message)
|
||||
else
|
||||
R.expose_single(T, target_atom, methods, transfer_amount, show_message)
|
||||
T.on_transfer(target_atom, methods, transfer_amount * multiplier)
|
||||
remove_reagent(T.type, transfer_amount)
|
||||
transfer_log[T.type] = transfer_amount
|
||||
@@ -766,6 +772,10 @@
|
||||
|
||||
if(isliving(my_atom))
|
||||
R.on_mob_add(my_atom) //Must occur befor it could posibly run on_mob_delete
|
||||
else if(istype(my_atom, /obj/item/organ/stomach))
|
||||
var/obj/item/organ/stomach/belly = my_atom
|
||||
var/mob/living/carbon/body = belly.owner
|
||||
R.on_mob_add(body)
|
||||
update_total()
|
||||
if(my_atom)
|
||||
my_atom.on_reagent_change(ADD_REAGENT)
|
||||
|
||||
@@ -654,7 +654,7 @@ All effects don't start immediately, but rather get worse over time; the rate is
|
||||
|
||||
/datum/reagent/consumable/ethanol/tequila_sunrise/on_mob_life(mob/living/carbon/M)
|
||||
if(QDELETED(light_holder))
|
||||
M.reagents.del_reagent(/datum/reagent/consumable/ethanol/tequila_sunrise) //If we lost our light object somehow, remove the reagent
|
||||
holder.del_reagent(type) //If we lost our light object somehow, remove the reagent
|
||||
else if(light_holder.loc != M)
|
||||
light_holder.forceMove(M)
|
||||
return ..()
|
||||
@@ -1730,7 +1730,7 @@ All effects don't start immediately, but rather get worse over time; the rate is
|
||||
/datum/reagent/consumable/ethanol/alexander/on_mob_life(mob/living/L)
|
||||
..()
|
||||
if(mighty_shield && !(mighty_shield in L.contents)) //If you had a shield and lose it, you lose the reagent as well. Otherwise this is just a normal drink.
|
||||
L.reagents.del_reagent(/datum/reagent/consumable/ethanol/alexander)
|
||||
holder.remove_reagent(type)
|
||||
|
||||
/datum/reagent/consumable/ethanol/alexander/on_mob_end_metabolize(mob/living/L)
|
||||
if(mighty_shield)
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
to_chat(M, "<span class='hierophant'>You win, and the malevolent spirits fade away as well as your wounds.</span>")
|
||||
M.client.give_award(/datum/award/achievement/misc/helbitaljanken, M)
|
||||
M.revive(full_heal = TRUE, admin_revive = FALSE)
|
||||
M.reagents.del_reagent(type)
|
||||
holder.del_reagent(type)
|
||||
return
|
||||
|
||||
..()
|
||||
@@ -268,7 +268,7 @@
|
||||
radbonustemp = rand(radbonustemp - 50, radbonustemp + 50) // Basically this means 50K and below will always give the percent heal, and upto 150K could. Calculated once.
|
||||
|
||||
/datum/reagent/medicine/c2/seiver/on_mob_life(mob/living/carbon/human/M)
|
||||
var/chemtemp = min(M.reagents?.chem_temp, 1000)
|
||||
var/chemtemp = min(holder.chem_temp, 1000)
|
||||
chemtemp = chemtemp ? chemtemp : 273 //why do you have null sweaty
|
||||
var/healypoints = 0 //5 healypoints = 1 heart damage; 5 rads = 1 tox damage healed for the purpose of healypoints
|
||||
|
||||
|
||||
@@ -211,8 +211,8 @@
|
||||
if(M.getBruteLoss() && prob(20))
|
||||
M.heal_bodypart_damage(1,0, 0)
|
||||
. = 1
|
||||
if(holder.has_reagent(/datum/reagent/consumable/capsaicin))
|
||||
holder.remove_reagent(/datum/reagent/consumable/capsaicin, 2)
|
||||
if(M.has_reagent(/datum/reagent/consumable/capsaicin))
|
||||
M.remove_reagent(/datum/reagent/consumable/capsaicin, 2)
|
||||
..()
|
||||
|
||||
/datum/reagent/consumable/soymilk
|
||||
@@ -266,8 +266,8 @@
|
||||
M.AdjustSleeping(-40, FALSE)
|
||||
//310.15 is the normal bodytemp.
|
||||
M.adjust_bodytemperature(25 * TEMPERATURE_DAMAGE_COEFFICIENT, 0, M.get_body_temp_normal())
|
||||
if(holder.has_reagent(/datum/reagent/consumable/frostoil))
|
||||
holder.remove_reagent(/datum/reagent/consumable/frostoil, 5)
|
||||
if(M.has_reagent(/datum/reagent/consumable/frostoil))
|
||||
M.remove_reagent(/datum/reagent/consumable/frostoil, 5)
|
||||
..()
|
||||
. = 1
|
||||
|
||||
|
||||
@@ -237,8 +237,8 @@
|
||||
switch(current_cycle)
|
||||
if(1 to 15)
|
||||
heating = 5 * TEMPERATURE_DAMAGE_COEFFICIENT
|
||||
if(holder.has_reagent(/datum/reagent/cryostylane))
|
||||
holder.remove_reagent(/datum/reagent/cryostylane, 5)
|
||||
if(M.has_reagent(/datum/reagent/cryostylane))
|
||||
M.remove_reagent(/datum/reagent/cryostylane, 5)
|
||||
if(isslime(M))
|
||||
heating = rand(5,20)
|
||||
if(15 to 25)
|
||||
@@ -267,8 +267,8 @@
|
||||
switch(current_cycle)
|
||||
if(1 to 15)
|
||||
cooling = -10 * TEMPERATURE_DAMAGE_COEFFICIENT
|
||||
if(holder.has_reagent(/datum/reagent/consumable/capsaicin))
|
||||
holder.remove_reagent(/datum/reagent/consumable/capsaicin, 5)
|
||||
if(M.has_reagent(/datum/reagent/consumable/capsaicin))
|
||||
M.remove_reagent(/datum/reagent/consumable/capsaicin, 5)
|
||||
if(isslime(M))
|
||||
cooling = -rand(5,20)
|
||||
if(15 to 25)
|
||||
@@ -343,7 +343,7 @@
|
||||
victim.vomit()
|
||||
|
||||
/datum/reagent/consumable/condensedcapsaicin/on_mob_life(mob/living/carbon/M)
|
||||
if(!holder.has_reagent(/datum/reagent/consumable/milk))
|
||||
if(!M.has_reagent(/datum/reagent/consumable/milk))
|
||||
if(prob(10))
|
||||
M.visible_message("<span class='warning'>[M] [pick("dry heaves!","coughs!","splutters!")]</span>")
|
||||
..()
|
||||
@@ -596,7 +596,7 @@
|
||||
mytray.adjustPests(rand(1,2))
|
||||
|
||||
/datum/reagent/consumable/honey/on_mob_life(mob/living/carbon/M)
|
||||
M.reagents.add_reagent(/datum/reagent/consumable/sugar,3)
|
||||
holder.add_reagent(/datum/reagent/consumable/sugar,3)
|
||||
if(prob(55))
|
||||
M.adjustBruteLoss(-1*REM, 0)
|
||||
M.adjustFireLoss(-1*REM, 0)
|
||||
|
||||
@@ -111,8 +111,8 @@
|
||||
M.AdjustUnconscious(-20, FALSE)
|
||||
M.AdjustImmobilized(-20, FALSE)
|
||||
M.AdjustParalyzed(-20, FALSE)
|
||||
if(holder.has_reagent(/datum/reagent/toxin/mindbreaker))
|
||||
holder.remove_reagent(/datum/reagent/toxin/mindbreaker, 5)
|
||||
if(M.has_reagent(/datum/reagent/toxin/mindbreaker))
|
||||
M.remove_reagent(/datum/reagent/toxin/mindbreaker, 5)
|
||||
M.hallucination = max(0, M.hallucination - 10)
|
||||
if(prob(30))
|
||||
M.adjustToxLoss(1, 0)
|
||||
@@ -126,10 +126,10 @@
|
||||
|
||||
/datum/reagent/medicine/synaphydramine/on_mob_life(mob/living/carbon/M)
|
||||
M.drowsyness = max(M.drowsyness-5, 0)
|
||||
if(holder.has_reagent(/datum/reagent/toxin/mindbreaker))
|
||||
holder.remove_reagent(/datum/reagent/toxin/mindbreaker, 5)
|
||||
if(holder.has_reagent(/datum/reagent/toxin/histamine))
|
||||
holder.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(prob(30))
|
||||
M.adjustToxLoss(1, 0)
|
||||
@@ -570,7 +570,7 @@
|
||||
if(prob(10))
|
||||
M.drowsyness += 1
|
||||
M.jitteriness -= 1
|
||||
M.reagents.remove_reagent(/datum/reagent/toxin/histamine,3)
|
||||
M.remove_reagent(/datum/reagent/toxin/histamine,3)
|
||||
..()
|
||||
|
||||
/datum/reagent/medicine/morphine
|
||||
@@ -726,11 +726,11 @@
|
||||
|
||||
/datum/reagent/medicine/epinephrine/on_mob_life(mob/living/carbon/M)
|
||||
. = TRUE
|
||||
if(holder.has_reagent(/datum/reagent/toxin/lexorin))
|
||||
holder.remove_reagent(/datum/reagent/toxin/lexorin, 2)
|
||||
holder.remove_reagent(/datum/reagent/medicine/epinephrine, 1)
|
||||
if(M.has_reagent(/datum/reagent/toxin/lexorin))
|
||||
M.remove_reagent(/datum/reagent/toxin/lexorin, 2)
|
||||
M.remove_reagent(/datum/reagent/medicine/epinephrine, 1)
|
||||
if(prob(20))
|
||||
holder.add_reagent(/datum/reagent/toxin/histamine, 4)
|
||||
M.reagents.add_reagent(/datum/reagent/toxin/histamine, 4)
|
||||
..()
|
||||
return
|
||||
if(M.health <= M.crit_threshold)
|
||||
@@ -824,8 +824,8 @@
|
||||
color = "#C0C0C0" //ditto
|
||||
|
||||
/datum/reagent/medicine/neurine/on_mob_life(mob/living/carbon/C)
|
||||
if(holder.has_reagent(/datum/reagent/consumable/ethanol/neurotoxin))
|
||||
holder.remove_reagent(/datum/reagent/consumable/ethanol/neurotoxin, 5)
|
||||
if(C.has_reagent(/datum/reagent/consumable/ethanol/neurotoxin))
|
||||
C.remove_reagent(/datum/reagent/consumable/ethanol/neurotoxin, 5)
|
||||
if(prob(15))
|
||||
C.cure_trauma_type(resilience = TRAUMA_RESILIENCE_BASIC)
|
||||
..()
|
||||
@@ -908,7 +908,7 @@
|
||||
/datum/reagent/medicine/insulin/on_mob_life(mob/living/carbon/M)
|
||||
if(M.AdjustSleeping(-20, FALSE))
|
||||
. = 1
|
||||
M.reagents.remove_reagent(/datum/reagent/consumable/sugar, 3)
|
||||
M.remove_reagent(/datum/reagent/consumable/sugar, 3)
|
||||
..()
|
||||
|
||||
//Trek Chems, used primarily by medibots. Only heals a specific damage type, but is very efficient.
|
||||
|
||||
@@ -535,7 +535,7 @@
|
||||
if(current_cycle >= cycles_to_turn)
|
||||
var/datum/species/species_type = race
|
||||
H.set_species(species_type)
|
||||
H.reagents.del_reagent(type)
|
||||
holder.del_reagent(type)
|
||||
to_chat(H, "<span class='warning'>You've become \a [lowertext(initial(species_type.name))]!</span>")
|
||||
return
|
||||
..()
|
||||
@@ -592,12 +592,12 @@
|
||||
to_chat(H, "<span class='warning'>Your jelly shifts and morphs, turning you into another subspecies!</span>")
|
||||
var/species_type = pick(subtypesof(/datum/species/jelly))
|
||||
H.set_species(species_type)
|
||||
H.reagents.del_reagent(type)
|
||||
holder.del_reagent(type)
|
||||
return TRUE
|
||||
if(current_cycle >= cycles_to_turn) //overwrite since we want subtypes of jelly
|
||||
var/datum/species/species_type = pick(subtypesof(race))
|
||||
H.set_species(species_type)
|
||||
H.reagents.del_reagent(type)
|
||||
holder.del_reagent(type)
|
||||
to_chat(H, "<span class='warning'>You've become \a [initial(species_type.name)]!</span>")
|
||||
return TRUE
|
||||
return ..()
|
||||
@@ -2195,7 +2195,7 @@
|
||||
var/yuck_cycle = 0 //! The `current_cycle` when puking starts.
|
||||
|
||||
/datum/reagent/yuck/on_mob_add(mob/living/L)
|
||||
if(HAS_TRAIT(src, TRAIT_NOHUNGER)) //they can't puke
|
||||
if(HAS_TRAIT(L, TRAIT_NOHUNGER)) //they can't puke
|
||||
holder.del_reagent(type)
|
||||
|
||||
#define YUCK_PUKE_CYCLES 3 // every X cycle is a puke
|
||||
|
||||
@@ -211,8 +211,8 @@
|
||||
|
||||
|
||||
/datum/reagent/cryostylane/on_mob_life(mob/living/carbon/M) //TODO: code freezing into an ice cube
|
||||
if(M.reagents.has_reagent(/datum/reagent/oxygen))
|
||||
M.reagents.remove_reagent(/datum/reagent/oxygen, 0.5)
|
||||
if(M.has_reagent(/datum/reagent/oxygen))
|
||||
M.remove_reagent(/datum/reagent/oxygen, 0.5)
|
||||
M.adjust_bodytemperature(-15)
|
||||
..()
|
||||
|
||||
@@ -232,8 +232,8 @@
|
||||
self_consuming = TRUE
|
||||
|
||||
/datum/reagent/pyrosium/on_mob_life(mob/living/carbon/M)
|
||||
if(M.reagents.has_reagent(/datum/reagent/oxygen))
|
||||
M.reagents.remove_reagent(/datum/reagent/oxygen, 0.5)
|
||||
if(M.has_reagent(/datum/reagent/oxygen))
|
||||
M.remove_reagent(/datum/reagent/oxygen, 0.5)
|
||||
M.adjust_bodytemperature(15)
|
||||
..()
|
||||
|
||||
|
||||
@@ -74,8 +74,8 @@
|
||||
penetrates_skin = NONE
|
||||
|
||||
/datum/reagent/toxin/plasma/on_mob_life(mob/living/carbon/C)
|
||||
if(holder.has_reagent(/datum/reagent/medicine/epinephrine))
|
||||
holder.remove_reagent(/datum/reagent/medicine/epinephrine, 2*REM)
|
||||
if(C.has_reagent(/datum/reagent/medicine/epinephrine))
|
||||
C.remove_reagent(/datum/reagent/medicine/epinephrine, 2*REM)
|
||||
C.adjustPlasma(20)
|
||||
return ..()
|
||||
|
||||
@@ -120,8 +120,8 @@
|
||||
material = /datum/material/hot_ice
|
||||
|
||||
/datum/reagent/toxin/hot_ice/on_mob_life(mob/living/carbon/M)
|
||||
if(holder.has_reagent(/datum/reagent/medicine/epinephrine))
|
||||
holder.remove_reagent(/datum/reagent/medicine/epinephrine, 2*REM)
|
||||
if(M.has_reagent(/datum/reagent/medicine/epinephrine))
|
||||
M.remove_reagent(/datum/reagent/medicine/epinephrine, 2*REM)
|
||||
M.adjustPlasma(20)
|
||||
M.adjust_bodytemperature(-7 * TEMPERATURE_DAMAGE_COEFFICIENT, M.get_body_temp_normal())
|
||||
return ..()
|
||||
@@ -214,7 +214,7 @@
|
||||
. = ..()
|
||||
exposed_mob.adjustOxyLoss(0.5*REM, 0)
|
||||
if(methods & INGEST)
|
||||
var/datum/reagent/toxin/zombiepowder/zombiepowder = exposed_mob.reagents.has_reagent(/datum/reagent/toxin/zombiepowder)
|
||||
var/datum/reagent/toxin/zombiepowder/zombiepowder = exposed_mob.has_reagent(/datum/reagent/toxin/zombiepowder)
|
||||
if(istype(zombiepowder))
|
||||
zombiepowder.fakedeath_active = TRUE
|
||||
|
||||
@@ -530,7 +530,7 @@
|
||||
. = 1
|
||||
if(prob(15))
|
||||
M.reagents.add_reagent(/datum/reagent/toxin/histamine, pick(5,10))
|
||||
M.reagents.remove_reagent(/datum/reagent/toxin/venom, 1.1)
|
||||
holder.remove_reagent(/datum/reagent/toxin/venom, 1.1)
|
||||
else
|
||||
..()
|
||||
|
||||
@@ -604,7 +604,7 @@
|
||||
. = 1
|
||||
if(prob(3))
|
||||
M.reagents.add_reagent(/datum/reagent/toxin/histamine,rand(1,3))
|
||||
M.reagents.remove_reagent(/datum/reagent/toxin/itching_powder,1.2)
|
||||
holder.remove_reagent(/datum/reagent/toxin/itching_powder,1.2)
|
||||
return
|
||||
..()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user