Files
Bubberstation/code/modules/unit_tests/food_edibility_check.dm
cacogen 74d29d5c2d Adds unit test for spawned food edibility (#57232)
* Adds unit test for spawned food having reagents

- Adds stack trace for biting food failing due to a lack of reagents
- Adds checks for seed var being set under food/grown's initialize() in grown.dm
- Fixes issue with gondola meat code duplicated for penguin meat slabs resulting in a runtime and being unable to slice penguin meat
- Adds seeds for bombananas

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
2021-02-27 16:50:09 -08:00

25 lines
783 B
Plaintext

/// Makes sure that spawned food has reagents and the edible component (or else it can't be eaten).
/datum/unit_test/food_edibility_check
/datum/unit_test/food_edibility_check/Run()
var/list/not_food = list(
/obj/item/food/grown,
/obj/item/food/grown/mushroom,
/obj/item/food/deepfryholder,
/obj/item/food/clothing,
/obj/item/food/meat/slab/human/mutant,
/obj/item/food/grown/shell)
var/list/food_paths = subtypesof(/obj/item/food) - not_food
for(var/food_path in food_paths)
var/obj/item/food/spawned_food = allocate(food_path)
if(!spawned_food.reagents)
Fail("[food_path] does not have any reagents, making it inedible!")
if(!IS_EDIBLE(spawned_food))
Fail("[food_path] does not have the edible component, making it inedible!")
qdel(spawned_food)