Files
Bubberstation/code/modules/unit_tests/stomach.dm
SkyratBot 3464b6bfb2 [MIRROR] Refactors Regenerate Organs, and a few organ helpers [MDB IGNORE] (#20094)
* Refactors Regenerate Organs, and a few organ helpers

* MERGE CONFLICTS

* GETORGANSLOT > GET_ORGAN_SLOT

* GETORGAN > get_organ_by_type

* lint repairs

* more lint

* Update tgstation.dme

* Update surgery_step.dm

---------

Co-authored-by: Zephyr <12817816+ZephyrTFA@users.noreply.github.com>
Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
2023-04-01 02:51:06 +01:00

41 lines
1.8 KiB
Plaintext

/datum/unit_test/stomach/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/obj/item/food/hotdog/debug/fooditem = allocate(/obj/item/food/hotdog/debug)
var/obj/item/organ/internal/stomach/belly = human.get_organ_slot(ORGAN_SLOT_STOMACH)
var/obj/item/reagent_containers/pill/pill = allocate(/obj/item/reagent_containers/pill)
var/datum/reagent/drug/methamphetamine/meth = /datum/reagent/drug/methamphetamine
TEST_ASSERT_EQUAL(human.has_reagent(/datum/reagent/consumable/ketchup), FALSE, "Human somehow has ketchup before eating")
fooditem.attack(human, human)
TEST_ASSERT(belly.reagents.has_reagent(/datum/reagent/consumable/ketchup), "Stomach doesn't have ketchup after eating")
TEST_ASSERT_EQUAL(human.reagents.has_reagent(/datum/reagent/consumable/ketchup), FALSE, "Human body has ketchup after eating it should only be in the stomach")
//Give them meth and let it kick in
pill.reagents.add_reagent(meth, 1.9 * initial(meth.metabolization_rate) * SSMOBS_DT)
pill.attack(human, human)
human.Life(SSMOBS_DT)
TEST_ASSERT(human.reagents.has_reagent(meth), "Human body does not have meth after life tick")
TEST_ASSERT(human.has_movespeed_modifier(/datum/movespeed_modifier/reagent/methamphetamine), "Human consumed meth, but did not gain movespeed modifier")
belly.Remove(human)
human.reagents.remove_all(human.reagents.total_volume)
TEST_ASSERT_EQUAL(human.has_reagent(/datum/reagent/consumable/ketchup), FALSE, "Human has reagents after clearing")
fooditem.attack(human, human)
TEST_ASSERT_EQUAL(human.has_reagent(/datum/reagent/consumable/ketchup), FALSE, "Human has ketchup without a stomach")
/datum/unit_test/stomach/Destroy()
SSmobs.ignite()
return ..()