Files
Alexis 21b4095dfd [MDB IGNORE] [IDB IGNORE] Upstream Sync - 04/17/2026 (#5453)
Upstream 04/17/2026

fixes https://github.com/Bubberstation/Bubberstation/issues/5549

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: tgstation-ci[bot] <179393467+tgstation-ci[bot]@users.noreply.github.com>
Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com>
Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
Co-authored-by: Rhials <28870487+Rhials@users.noreply.github.com>
Co-authored-by: rageguy505 <54517726+rageguy505@users.noreply.github.com>
Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
Co-authored-by: Aliceee2ch <160794176+Aliceee2ch@users.noreply.github.com>
Co-authored-by: Time-Green <7501474+Time-Green@users.noreply.github.com>
Co-authored-by: Tsar-Salat <62388554+Tsar-Salat@users.noreply.github.com>
Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com>
Co-authored-by: Maxipat <108554989+Maxipat112@users.noreply.github.com>
Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com>
Co-authored-by: deltanedas <39013340+deltanedas@users.noreply.github.com>
Co-authored-by: SimplyLogan <47579821+loganuk@users.noreply.github.com>
Co-authored-by: loganuk <fakeemail123@aol.com>
Co-authored-by: Leland Kemble <70413276+lelandkemble@users.noreply.github.com>
Co-authored-by: FalloutFalcon <86381784+FalloutFalcon@users.noreply.github.com>
Co-authored-by: Roxy <75404941+TealSeer@users.noreply.github.com>
Co-authored-by: Lucy <lucy@absolucy.moe>
Co-authored-by: siliconOpossum <138069572+siliconOpossum@users.noreply.github.com>
Co-authored-by: Isratosh <Isratosh@hotmail.com>
Co-authored-by: TheRyeGuyWhoWillNowDie <70169560+TheRyeGuyWhoWillNowDie@users.noreply.github.com>
Co-authored-by: Neocloudy <88008002+Neocloudy@users.noreply.github.com>
Co-authored-by: Alexander V. <volas@ya.ru>
Co-authored-by: ElGitificador <168473461+ElGitificador@users.noreply.github.com>
Co-authored-by: Twaticus <46540570+Twaticus@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com>
Co-authored-by: Cameron Lennox <killer65311@gmail.com>
Co-authored-by: Tim <timothymtorres@gmail.com>
Co-authored-by: Iamgoofball <iamgoofball@gmail.com>
Co-authored-by: Layzu666 <121319428+Layzu666@users.noreply.github.com>
Co-authored-by: Arturlang <24881678+Arturlang@users.noreply.github.com>
Co-authored-by: _0Steven <42909981+00-Steven@users.noreply.github.com>
Co-authored-by: mrmanlikesbt <99309552+mrmanlikesbt@users.noreply.github.com>
Co-authored-by: Ben10Omintrix <138636438+Ben10Omintrix@users.noreply.github.com>
Co-authored-by: John F. Kennedy <54908920+MacaroniCritter@users.noreply.github.com>
Co-authored-by: Cursor <102828457+theselfish@users.noreply.github.com>
Co-authored-by: Josh <josh.adam.powell@gmail.com>
Co-authored-by: Josh Powell <josh.powell@softwire.com>
Co-authored-by: Yobrocharlie <Charliemiller5617@gmail.com>
Co-authored-by: Hardly3D <66234359+Hardly3D@users.noreply.github.com>
Co-authored-by: shayoki <96078776+shayoki@users.noreply.github.com>
Co-authored-by: LT3 <83487515+lessthnthree@users.noreply.github.com>
2026-05-16 00:56:00 +02:00

125 lines
4.9 KiB
Plaintext

/datum/unit_test/metabolization/Run()
// Pause natural mob life so it can be handled entirely by the test
SSmobs.pause()
var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human/consistent)
var/list/blacklisted_reagents = list(
/datum/reagent/eigenstate, //Creates clones after a delay which get into other tests
)
var/list/reagents_to_check = valid_subtypesof(/datum/reagent) - blacklisted_reagents
for (var/reagent_type in reagents_to_check)
test_reagent(human, reagent_type)
/datum/unit_test/metabolization/proc/test_reagent(mob/living/carbon/C, reagent_type)
C.reagents.add_reagent(reagent_type, 10)
C.reagents.metabolize(C, SSMOBS_DT, 0, can_overdose = TRUE)
C.reagents.clear_reagents()
/datum/unit_test/metabolization/Destroy()
SSmobs.ignite()
return ..()
/datum/unit_test/on_mob_end_metabolize/Run()
SSmobs.pause()
var/mob/living/carbon/human/user = allocate(/mob/living/carbon/human/consistent)
var/obj/item/reagent_containers/applicator/pill/pill = allocate(/obj/item/reagent_containers/applicator/pill)
var/datum/reagent/drug/methamphetamine/meth = /datum/reagent/drug/methamphetamine
// Give them enough meth to be consumed in 2 metabolizations
pill.reagents.add_reagent(meth, 1.9 * initial(meth.metabolization_rate) * SSMOBS_DT)
pill.layers_remaining = 0
pill.interact_with_atom(user, user)
user.Life(SSMOBS_DT)
TEST_ASSERT(user.reagents.has_reagent(meth), "User does not have meth in their system after consuming it")
TEST_ASSERT(user.has_movespeed_modifier(/datum/movespeed_modifier/reagent/methamphetamine), "User consumed meth, but did not gain movespeed modifier")
user.Life(SSMOBS_DT)
TEST_ASSERT(!user.reagents.has_reagent(meth), "User still has meth in their system when it should've finished metabolizing")
TEST_ASSERT(!user.has_movespeed_modifier(/datum/movespeed_modifier/reagent/methamphetamine), "User still has movespeed modifier despite not containing any more meth")
/datum/unit_test/on_mob_end_metabolize/Destroy()
SSmobs.ignite()
return ..()
/datum/unit_test/addictions/Run()
SSmobs.pause()
var/mob/living/carbon/human/pill_user = allocate(/mob/living/carbon/human/consistent)
var/mob/living/carbon/human/syringe_user = allocate(/mob/living/carbon/human/consistent)
var/mob/living/carbon/human/pill_syringe_user = allocate(/mob/living/carbon/human/consistent)
var/datum/mind/pill_mind = new /datum/mind(null)
pill_mind.active = TRUE
pill_mind.transfer_to(pill_user)
var/datum/mind/syringe_mind = new /datum/mind(null)
syringe_mind.active = TRUE
syringe_mind.transfer_to(syringe_user)
var/datum/mind/pill_syringe_mind = new /datum/mind(null)
pill_syringe_mind.active = TRUE
pill_syringe_mind.transfer_to(pill_syringe_user)
var/obj/item/reagent_containers/applicator/pill/pill = allocate(/obj/item/reagent_containers/applicator/pill)
var/obj/item/reagent_containers/applicator/pill/pill_two = allocate(/obj/item/reagent_containers/applicator/pill)
var/obj/item/reagent_containers/syringe/syringe = allocate(/obj/item/reagent_containers/syringe)
var/datum/reagent/drug/methamphetamine/meth = allocate(/datum/reagent/drug/methamphetamine)
var/addiction_type_to_check
for(var/key in meth.addiction_types)
addiction_type_to_check = key //idk how to do this otherwise
// Let's start with stomach metabolism
pill.reagents.add_reagent(meth.type, 5)
pill.layers_remaining = 0
pill.interact_with_atom(pill_user, pill_user)
// Set the metabolism efficiency to 1.0 so it transfers all reagents to the body in one go.
var/obj/item/organ/stomach/pill_belly = pill_user.get_organ_slot(ORGAN_SLOT_STOMACH)
pill_belly.metabolism_efficiency = 1
pill_user.Life()
TEST_ASSERT(pill_user.mind.addiction_points[addiction_type_to_check], "User did not gain addiction points after metabolizing meth")
// Then injected metabolism
syringe.volume = 5
syringe.amount_per_transfer_from_this = 5
syringe.reagents.add_reagent(meth.type, 5)
syringe.melee_attack_chain(syringe_user, syringe_user)
syringe_user.Life()
TEST_ASSERT(syringe_user.mind.addiction_points[addiction_type_to_check], "User did not gain addiction points after metabolizing meth")
// One half syringe
syringe.reagents.remove_all()
syringe.volume = 5
syringe.amount_per_transfer_from_this = 5
syringe.reagents.add_reagent(meth.type, (5 * 0.5) + 1)
// One half pill
pill_two.reagents.add_reagent(meth.type, (5 * 0.5) + 1)
pill_two.layers_remaining = 0
pill_two.interact_with_atom(pill_syringe_user, pill_syringe_user)
syringe.melee_attack_chain(pill_syringe_user, pill_syringe_user)
// Set the metabolism efficiency to 1.0 so it transfers all reagents to the body in one go.
pill_belly = pill_syringe_user.get_organ_slot(ORGAN_SLOT_STOMACH)
pill_belly.metabolism_efficiency = 1
pill_syringe_user.Life()
TEST_ASSERT(pill_syringe_user.mind.addiction_points[addiction_type_to_check], "User did not gain addiction points after metabolizing meth")
/datum/unit_test/addictions/Destroy()
SSmobs.ignite()
return ..()