[MIRROR] fixes error food spawning [MDB IGNORE] (#15615)

* fixes error food spawning (#69095)

* fixes error food spawning

* right

* commmmuuuunts

* why am i so fucking stupid

* fixes error food spawning

Co-authored-by: Time-Green <timkoster1@hotmail.com>
This commit is contained in:
SkyratBot
2022-08-13 17:31:16 -07:00
committed by GitHub
co-authored by Time-Green
parent 8aea5d5d5b
commit 8f10fd945a
+11 -2
View File
@@ -1,6 +1,9 @@
///Get a random food item exluding the blocked ones
/proc/get_random_food()
var/list/blocked = list(
var/static/list/allowed_food = list()
if(!LAZYLEN(allowed_food)) //it's static so we only ever do this once
var/list/blocked = list(
/obj/item/food/drug,
/obj/item/food/spaghetti,
/obj/item/food/bread,
@@ -26,7 +29,13 @@
/obj/item/food/grown/shell
)
return pick(subtypesof(/obj/item/food) - blocked)
var/list/unfiltered_allowed_food = subtypesof(/obj/item/food) - blocked
for(var/obj/item/food/food as anything in unfiltered_allowed_food)
if(!initial(food.icon_state)) //food with no icon_state should probably not be spawned
continue
allowed_food.Add(food)
return pick(allowed_food)
///Gets a random drink excluding the blocked type
/proc/get_random_drink()