mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
KITCHEN CODE IS WORKING. YES. I CAN DIE NOW.
This commit is contained in:
@@ -57,7 +57,7 @@
|
|||||||
for(var/fruittype in fruit) // I do not trust Copy().
|
for(var/fruittype in fruit) // I do not trust Copy().
|
||||||
checklist[fruittype] = fruit[fruittype]
|
checklist[fruittype] = fruit[fruittype]
|
||||||
for(var/obj/item/weapon/reagent_containers/food/snacks/grown/G in container)
|
for(var/obj/item/weapon/reagent_containers/food/snacks/grown/G in container)
|
||||||
if(!G.seed || !G.seed.kitchen_tag || isnull(checklist[G.seed.kitchen_tag]) || checklist[G.seed.kitchen_tag] <= 0)
|
if(!G.seed || !G.seed.kitchen_tag || isnull(checklist[G.seed.kitchen_tag]))
|
||||||
continue
|
continue
|
||||||
checklist[G.seed.kitchen_tag]--
|
checklist[G.seed.kitchen_tag]--
|
||||||
for(var/ktag in checklist)
|
for(var/ktag in checklist)
|
||||||
@@ -72,12 +72,16 @@
|
|||||||
/datum/recipe/proc/check_items(var/obj/container as obj)
|
/datum/recipe/proc/check_items(var/obj/container as obj)
|
||||||
. = 1
|
. = 1
|
||||||
if (items && items.len)
|
if (items && items.len)
|
||||||
var/list/checklist = items.Copy()
|
var/list/checklist = list()
|
||||||
|
for(var/item_type in items)
|
||||||
|
checklist |= item_type //Still don't trust Copy().
|
||||||
for(var/obj/O in container)
|
for(var/obj/O in container)
|
||||||
|
if(istype(O,/obj/item/weapon/reagent_containers/food/snacks/grown))
|
||||||
|
continue // Fruit is handled in check_fruit().
|
||||||
var/found = 0
|
var/found = 0
|
||||||
for (var/type in checklist)
|
for(var/item_type in checklist)
|
||||||
if (istype(O,type))
|
if (istype(O,item_type))
|
||||||
checklist-=type
|
checklist-=item_type
|
||||||
found = 1
|
found = 1
|
||||||
break
|
break
|
||||||
if (!found)
|
if (!found)
|
||||||
@@ -97,9 +101,8 @@
|
|||||||
|
|
||||||
// food-related
|
// food-related
|
||||||
/datum/recipe/proc/make_food(var/obj/container as obj)
|
/datum/recipe/proc/make_food(var/obj/container as obj)
|
||||||
world << "trying to make [result]."
|
|
||||||
if(!result)
|
if(!result)
|
||||||
world << "<span class='danger'>Recipe is defined without a result, please bug this.</span>"
|
world << "<span class='danger'>Recipe [type] is defined without a result, please bug this.</span>"
|
||||||
return
|
return
|
||||||
var/obj/result_obj = new result(container)
|
var/obj/result_obj = new result(container)
|
||||||
for (var/obj/O in (container.contents-result_obj))
|
for (var/obj/O in (container.contents-result_obj))
|
||||||
@@ -113,10 +116,11 @@
|
|||||||
|
|
||||||
/proc/select_recipe(var/list/datum/recipe/avaiable_recipes, var/obj/obj as obj, var/exact)
|
/proc/select_recipe(var/list/datum/recipe/avaiable_recipes, var/obj/obj as obj, var/exact)
|
||||||
var/list/datum/recipe/possible_recipes = new
|
var/list/datum/recipe/possible_recipes = new
|
||||||
|
var/target = exact ? 0 : 1
|
||||||
for (var/datum/recipe/recipe in avaiable_recipes)
|
for (var/datum/recipe/recipe in avaiable_recipes)
|
||||||
var/target = exact ? 0 : 1
|
if((recipe.check_reagents(obj.reagents) < target) || (recipe.check_items(obj) < target) || (recipe.check_fruit(obj) < target))
|
||||||
if(recipe.check_reagents(obj.reagents) >= target && recipe.check_items(obj) >= target && recipe.check_fruit(obj) >= target)
|
continue
|
||||||
possible_recipes |= recipe
|
possible_recipes |= recipe
|
||||||
if (possible_recipes.len==0)
|
if (possible_recipes.len==0)
|
||||||
return null
|
return null
|
||||||
else if (possible_recipes.len==1)
|
else if (possible_recipes.len==1)
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ I said no!
|
|||||||
)
|
)
|
||||||
result = /obj/item/weapon/reagent_containers/food/snacks/donut/normal
|
result = /obj/item/weapon/reagent_containers/food/snacks/donut/normal
|
||||||
|
|
||||||
/datum/recipe/human/burger
|
/datum/recipe/humanburger
|
||||||
items = list(
|
items = list(
|
||||||
/obj/item/weapon/reagent_containers/food/snacks/meat/human,
|
/obj/item/weapon/reagent_containers/food/snacks/meat/human,
|
||||||
/obj/item/weapon/reagent_containers/food/snacks/bun
|
/obj/item/weapon/reagent_containers/food/snacks/bun
|
||||||
@@ -365,7 +365,7 @@ I said no!
|
|||||||
)
|
)
|
||||||
result = /obj/item/weapon/reagent_containers/food/snacks/donut/chaos
|
result = /obj/item/weapon/reagent_containers/food/snacks/donut/chaos
|
||||||
|
|
||||||
/datum/recipe/human/kabob
|
/datum/recipe/humankabob
|
||||||
items = list(
|
items = list(
|
||||||
/obj/item/stack/rods,
|
/obj/item/stack/rods,
|
||||||
/obj/item/weapon/reagent_containers/food/snacks/meat/human,
|
/obj/item/weapon/reagent_containers/food/snacks/meat/human,
|
||||||
@@ -435,7 +435,6 @@ I said no!
|
|||||||
fruit = list("corn" = 1)
|
fruit = list("corn" = 1)
|
||||||
result = /obj/item/weapon/reagent_containers/food/snacks/popcorn
|
result = /obj/item/weapon/reagent_containers/food/snacks/popcorn
|
||||||
|
|
||||||
|
|
||||||
/datum/recipe/cookie
|
/datum/recipe/cookie
|
||||||
reagents = list("milk" = 5, "sugar" = 5)
|
reagents = list("milk" = 5, "sugar" = 5)
|
||||||
items = list(
|
items = list(
|
||||||
|
|||||||
Reference in New Issue
Block a user