mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-30 15:37:36 +01:00
Adds mixing bowls
This commit is contained in:
+18
-5
@@ -53,15 +53,28 @@
|
||||
return -1
|
||||
return .
|
||||
|
||||
/datum/recipe/proc/check_items(obj/container) //1=precisely, 0=insufficiently, -1=superfluous
|
||||
/datum/recipe/proc/check_items(obj/container, list/ignored_items = null) //1=precisely, 0=insufficiently, -1=superfluous
|
||||
if(!items)
|
||||
if(locate(/obj/) in container)
|
||||
return -1
|
||||
else
|
||||
if(ignored_items) //are we supposed to be ignoring anything?
|
||||
var/unignored = FALSE
|
||||
for(var/obj/O in container)
|
||||
if(!is_type_in_list(O, ignored_items))
|
||||
unignored = TRUE //found something we aren't ignoring, quit looking
|
||||
break
|
||||
if(unignored)
|
||||
return -1
|
||||
else //anything we found is something we are ignoring
|
||||
return 1
|
||||
else //not ignoring anything, and we found something
|
||||
return -1
|
||||
else //didn't find anything
|
||||
return 1
|
||||
. = 1
|
||||
var/list/checklist = items.Copy()
|
||||
for(var/obj/O in container)
|
||||
if(ignored_items && is_type_in_list(O, ignored_items)) //skip if this is something we are ignoring
|
||||
continue
|
||||
var/found = 0
|
||||
for(var/type in checklist)
|
||||
if(istype(O,type))
|
||||
@@ -95,12 +108,12 @@
|
||||
container.reagents.clear_reagents()
|
||||
return result_obj
|
||||
|
||||
/proc/select_recipe(list/datum/recipe/available_recipes, obj/obj, exact = 1 as num)
|
||||
/proc/select_recipe(list/datum/recipe/available_recipes, obj/obj, exact = 1 as num, list/ignored_items = null)
|
||||
if(!exact)
|
||||
exact = -1
|
||||
var/list/datum/recipe/possible_recipes = new
|
||||
for(var/datum/recipe/recipe in available_recipes)
|
||||
if(recipe.check_reagents(obj.reagents) == exact && recipe.check_items(obj) == exact)
|
||||
if(recipe.check_reagents(obj.reagents) == exact && recipe.check_items(obj, ignored_items) == exact)
|
||||
possible_recipes += recipe
|
||||
if(possible_recipes.len == 0)
|
||||
return null
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
|
||||
/obj/item/mixing_bowl
|
||||
name = "mixing bowl"
|
||||
desc = "Mixing it up in the kitchen."
|
||||
flags = OPENCONTAINER
|
||||
icon = 'icons/obj/kitchen.dmi'
|
||||
icon_state = "mixing_bowl"
|
||||
var/max_n_of_items = 25
|
||||
var/dirty = FALSE
|
||||
var/clean_icon = "mixing_bowl"
|
||||
var/dirty_icon = "mixing_bowl_dirty"
|
||||
|
||||
/obj/item/mixing_bowl/New()
|
||||
..()
|
||||
create_reagents(100)
|
||||
|
||||
/obj/item/mixing_bowl/attackby(obj/item/I, mob/user, params)
|
||||
if(dirty)
|
||||
if(istype(I, /obj/item/weapon/soap))
|
||||
user.visible_message("<span class='notice'>[user] starts to scrub [src].</span>", "<span class='notice'>You start to scrub [src].</span>")
|
||||
if(do_after(user, 20 * I.toolspeed, target = src))
|
||||
clean()
|
||||
user.visible_message("<span class='notice'>[user] has scrubbed [src] clean.</span>", "<span class='notice'>You have scrubbed [src] clean.</span>")
|
||||
return 1
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You should clean [src] before you use it for food prep.</span>")
|
||||
return 0
|
||||
if(is_type_in_list(I, cooking_ingredients[RECIPE_MICROWAVE]) || is_type_in_list(I, cooking_ingredients[RECIPE_GRILL]) || is_type_in_list(I, cooking_ingredients[RECIPE_OVEN]) || is_type_in_list(I, cooking_ingredients[RECIPE_CANDY]))
|
||||
if(contents.len>=max_n_of_items)
|
||||
to_chat(user, "<span class='alert'>This [src] is full of ingredients, you cannot put more.</span>")
|
||||
return 1
|
||||
if(istype(I, /obj/item/stack) && I:amount > 1)
|
||||
new I.type (src)
|
||||
I:use(1)
|
||||
user.visible_message("<span class='notice'>[user] has added one of [I] to [src].</span>", "<span class='notice'>You add one of [I] to [src].</span>")
|
||||
else
|
||||
if(!user.drop_item())
|
||||
to_chat(user, "<span class='notice'>\The [I] is stuck to your hand, you cannot put it in [src]</span>")
|
||||
return 0
|
||||
I.forceMove(src)
|
||||
user.visible_message("<span class='notice'>[user] has added [I] to [src].</span>", "<span class='notice'>You add [I] to [src].</span>")
|
||||
else if(is_type_in_list(I, list(/obj/item/weapon/reagent_containers/glass, /obj/item/weapon/reagent_containers/food/drinks, /obj/item/weapon/reagent_containers/food/condiment)))
|
||||
if(!I.reagents)
|
||||
return 1
|
||||
for(var/datum/reagent/R in I.reagents.reagent_list)
|
||||
if(!(R.id in cooking_reagents[RECIPE_MICROWAVE]) && !(R.id in cooking_reagents[RECIPE_GRILL]) && !(R.id in cooking_reagents[RECIPE_OVEN]) && !(R.id in cooking_reagents[RECIPE_CANDY]))
|
||||
to_chat(user, "<span class='alert'>Your [I] contains components unsuitable for cookery.</span>")
|
||||
return 1
|
||||
else
|
||||
to_chat(user, "<span class='alert'>You have no idea what you can cook with [I].</span>")
|
||||
return 1
|
||||
|
||||
/obj/item/mixing_bowl/attack_self(mob/user)
|
||||
var/dat = ""
|
||||
if(dirty)
|
||||
dat = {"<TT>This [src] is dirty!<BR>Please clean it before use!</TT>"}
|
||||
else
|
||||
var/list/items_counts = new
|
||||
var/list/items_measures = new
|
||||
var/list/items_measures_p = new
|
||||
for(var/obj/O in contents)
|
||||
var/display_name = O.name
|
||||
if(istype(O,/obj/item/weapon/reagent_containers/food/snacks/egg))
|
||||
items_measures[display_name] = "egg"
|
||||
items_measures_p[display_name] = "eggs"
|
||||
if(istype(O,/obj/item/weapon/reagent_containers/food/snacks/tofu))
|
||||
items_measures[display_name] = "tofu chunk"
|
||||
items_measures_p[display_name] = "tofu chunks"
|
||||
if(istype(O,/obj/item/weapon/reagent_containers/food/snacks/meat)) //any meat
|
||||
items_measures[display_name] = "slab of meat"
|
||||
items_measures_p[display_name] = "slabs of meat"
|
||||
if(istype(O,/obj/item/weapon/reagent_containers/food/snacks/donkpocket))
|
||||
display_name = "Turnovers"
|
||||
items_measures[display_name] = "turnover"
|
||||
items_measures_p[display_name] = "turnovers"
|
||||
if(istype(O,/obj/item/weapon/reagent_containers/food/snacks/carpmeat))
|
||||
items_measures[display_name] = "fillet of meat"
|
||||
items_measures_p[display_name] = "fillets of meat"
|
||||
items_counts[display_name]++
|
||||
for(var/O in items_counts)
|
||||
var/N = items_counts[O]
|
||||
if(!(O in items_measures))
|
||||
dat += {"<B>[capitalize(O)]:</B> [N] [lowertext(O)]\s<BR>"}
|
||||
else
|
||||
if(N==1)
|
||||
dat += {"<B>[capitalize(O)]:</B> [N] [items_measures[O]]<BR>"}
|
||||
else
|
||||
dat += {"<B>[capitalize(O)]:</B> [N] [items_measures_p[O]]<BR>"}
|
||||
|
||||
for(var/datum/reagent/R in reagents.reagent_list)
|
||||
var/display_name = R.name
|
||||
if(R.id == "capsaicin")
|
||||
display_name = "Hotsauce"
|
||||
if(R.id == "frostoil")
|
||||
display_name = "Coldsauce"
|
||||
dat += {"<B>[display_name]:</B> [R.volume] unit\s<BR>"}
|
||||
|
||||
if(items_counts.len==0 && reagents.reagent_list.len==0)
|
||||
dat = {"<B>The [src] is empty</B><BR>"}
|
||||
else
|
||||
dat = {"<b>Ingredients:</b><br>[dat]"}
|
||||
dat += {"<HR><BR> <A href='?src=[UID()];action=dispose'>Eject ingredients!</A><BR>"}
|
||||
|
||||
var/datum/browser/popup = new(user, name, name, 400, 400)
|
||||
popup.set_content(dat)
|
||||
popup.open(0)
|
||||
onclose(user, "[name]")
|
||||
return
|
||||
|
||||
/obj/item/mixing_bowl/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
if("dispose")
|
||||
dispose()
|
||||
return
|
||||
|
||||
/obj/item/mixing_bowl/proc/dispose()
|
||||
for(var/obj/O in contents)
|
||||
O.forceMove(loc)
|
||||
if(reagents.total_volume)
|
||||
make_dirty(5)
|
||||
reagents.clear_reagents()
|
||||
to_chat(usr, "<span class='notice'>You dispose of [src]'s contents.</span>")
|
||||
updateUsrDialog()
|
||||
|
||||
/obj/item/mixing_bowl/proc/make_dirty(chance)
|
||||
if(!chance)
|
||||
return
|
||||
if(prob(chance))
|
||||
dirty = TRUE
|
||||
flags = null
|
||||
icon_state = dirty_icon
|
||||
|
||||
/obj/item/mixing_bowl/proc/clean()
|
||||
dirty = FALSE
|
||||
flags = OPENCONTAINER
|
||||
icon_state = clean_icon
|
||||
|
||||
/obj/item/mixing_bowl/wash(mob/user, atom/source)
|
||||
if(..())
|
||||
clean()
|
||||
|
||||
/obj/item/mixing_bowl/proc/fail(obj/source)
|
||||
if(!source)
|
||||
source = src
|
||||
var/obj/item/weapon/reagent_containers/food/snacks/badrecipe/ffuu = new(src)
|
||||
var/amount = 0
|
||||
for(var/obj/O in contents-ffuu)
|
||||
amount++
|
||||
if(O.reagents)
|
||||
var/id = O.reagents.get_master_reagent_id()
|
||||
if(id)
|
||||
amount+=O.reagents.get_reagent_amount(id)
|
||||
qdel(O)
|
||||
reagents.clear_reagents()
|
||||
ffuu.reagents.add_reagent("carbon", amount)
|
||||
ffuu.reagents.add_reagent("????", amount/10)
|
||||
ffuu.forceMove(get_turf(source))
|
||||
make_dirty(75)
|
||||
@@ -112,8 +112,8 @@
|
||||
)
|
||||
if(do_after(user, 20 * O.toolspeed, target = src))
|
||||
user.visible_message( \
|
||||
"<span class='notice'>[user] has cleaned \the [src].</span>", \
|
||||
"<span class='notice'>You have cleaned \the [src].</span>" \
|
||||
"<span class='notice'>[user] has cleaned [src].</span>", \
|
||||
"<span class='notice'>You have cleaned [src].</span>" \
|
||||
)
|
||||
dirty = 0 // It's clean!
|
||||
broken = 0 // just to be sure
|
||||
@@ -122,7 +122,7 @@
|
||||
else //Otherwise bad luck!!
|
||||
to_chat(user, "<span class='alert'>It's dirty!</span>")
|
||||
return 1
|
||||
else if(is_type_in_list(O, cooking_ingredients[recipe_type]))
|
||||
else if(is_type_in_list(O, cooking_ingredients[recipe_type]) || istype(O, /obj/item/mixing_bowl))
|
||||
if(contents.len>=max_n_of_items)
|
||||
to_chat(user, "<span class='alert'>This [src] is full of ingredients, you cannot put more.</span>")
|
||||
return 1
|
||||
@@ -130,21 +130,16 @@
|
||||
new O.type (src)
|
||||
O:use(1)
|
||||
user.visible_message( \
|
||||
"<span class='notice'>[user] has added one of [O] to \the [src].</span>", \
|
||||
"<span class='notice'>You add one of [O] to \the [src].</span>")
|
||||
"<span class='notice'>[user] has added one of [O] to [src].</span>", \
|
||||
"<span class='notice'>You add one of [O] to [src].</span>")
|
||||
else
|
||||
if(!user.drop_item())
|
||||
to_chat(user, "<span class='notice'>\The [O] is stuck to your hand, you cannot put it in \the [src]</span>")
|
||||
to_chat(user, "<span class='notice'>\The [O] is stuck to your hand, you cannot put it in [src]</span>")
|
||||
return 0
|
||||
|
||||
O.forceMove(src)
|
||||
user.visible_message( \
|
||||
"<span class='notice'>[user] has added \the [O] to \the [src].</span>", \
|
||||
"<span class='notice'>You add \the [O] to \the [src].</span>")
|
||||
else if(istype(O,/obj/item/weapon/reagent_containers/glass) || \
|
||||
istype(O,/obj/item/weapon/reagent_containers/food/drinks) || \
|
||||
istype(O,/obj/item/weapon/reagent_containers/food/condiment) \
|
||||
)
|
||||
user.visible_message("<span class='notice'>[user] has added [O] to [src].</span>", "<span class='notice'>You add [O] to [src].</span>")
|
||||
else if(is_type_in_list(O, list(/obj/item/weapon/reagent_containers/glass, /obj/item/weapon/reagent_containers/food/drinks, /obj/item/weapon/reagent_containers/food/condiment)))
|
||||
if(!O.reagents)
|
||||
return 1
|
||||
for(var/datum/reagent/R in O.reagents.reagent_list)
|
||||
@@ -257,10 +252,10 @@
|
||||
stop()
|
||||
return
|
||||
|
||||
var/datum/recipe/recipe = select_recipe(cooking_recipes[recipe_type], src)
|
||||
var/obj/cooked
|
||||
var/obj/byproduct
|
||||
if(!recipe)
|
||||
var/list/recipes_to_make = choose_recipes()
|
||||
|
||||
|
||||
if(recipes_to_make.len == 1 && recipes_to_make[1][2] == null)
|
||||
dirty += 1
|
||||
if(prob(max(10,dirty*5)))
|
||||
if(!wzhzhzh(4))
|
||||
@@ -286,24 +281,69 @@
|
||||
fail()
|
||||
return
|
||||
else
|
||||
var/halftime = round(recipe.time/10/2)
|
||||
if(!wzhzhzh(halftime))
|
||||
if(!wzhzhzh(5))
|
||||
abort()
|
||||
return
|
||||
if(!wzhzhzh(halftime))
|
||||
if(!wzhzhzh(5))
|
||||
abort()
|
||||
fail()
|
||||
return
|
||||
cooked = recipe.make_food(src)
|
||||
byproduct = recipe.get_byproduct()
|
||||
stop()
|
||||
if(cooked)
|
||||
cooked.forceMove(loc)
|
||||
for(var/i=1,i<efficiency,i++)
|
||||
cooked = new cooked.type(loc)
|
||||
if(byproduct)
|
||||
new byproduct(loc)
|
||||
make_recipes(recipes_to_make)
|
||||
|
||||
/obj/machinery/kitchen_machine/proc/choose_recipes()
|
||||
var/list/recipes_to_make = list()
|
||||
for(var/obj/O in contents)
|
||||
if(istype(O, /obj/item/mixing_bowl))
|
||||
var/obj/item/mixing_bowl/mb = O
|
||||
var/datum/recipe/recipe = select_recipe(cooking_recipes[recipe_type], mb)
|
||||
if(recipe)
|
||||
recipes_to_make.Add(list(list(mb, recipe)))
|
||||
else
|
||||
recipes_to_make.Add(list(list(mb, null)))
|
||||
|
||||
var/datum/recipe/recipe_src = select_recipe(cooking_recipes[recipe_type], src, ignored_items = list(/obj/item/mixing_bowl))
|
||||
if(recipe_src)
|
||||
recipes_to_make.Add(list(list(src, recipe_src)))
|
||||
else
|
||||
if(!recipes_to_make.len)
|
||||
recipes_to_make.Add(list(list(src, null)))
|
||||
return recipes_to_make
|
||||
|
||||
/obj/machinery/kitchen_machine/proc/make_recipes(list/recipes_to_make)
|
||||
if(!recipes_to_make)
|
||||
return
|
||||
var/datum/reagents/temp_reagents = new(500)
|
||||
for(var/i=1 to recipes_to_make.len)
|
||||
var/list/L = recipes_to_make[i]
|
||||
var/obj/source = L[1]
|
||||
var/datum/recipe/recipe = L[2]
|
||||
if(!recipe)
|
||||
//failed recipe
|
||||
fail()
|
||||
else
|
||||
for(var/obj/O in source.contents)
|
||||
if(istype(O, /obj/item/mixing_bowl))
|
||||
continue
|
||||
if(O.reagents)
|
||||
O.reagents.del_reagent("nutriment")
|
||||
O.reagents.update_total()
|
||||
O.reagents.trans_to(temp_reagents, O.reagents.total_volume)
|
||||
qdel(O)
|
||||
source.reagents.clear_reagents()
|
||||
for(var/e=1 to efficiency)
|
||||
var/obj/cooked = new recipe.result()
|
||||
temp_reagents.trans_to(cooked, temp_reagents.total_volume/efficiency)
|
||||
cooked.forceMove(loc)
|
||||
temp_reagents.clear_reagents()
|
||||
var/obj/byproduct = recipe.get_byproduct()
|
||||
if(byproduct)
|
||||
new byproduct(loc)
|
||||
if(istype(source, /obj/item/mixing_bowl))
|
||||
var/obj/item/mixing_bowl/mb = source
|
||||
mb.make_dirty(5 * efficiency)
|
||||
mb.forceMove(loc)
|
||||
stop()
|
||||
return
|
||||
|
||||
/obj/machinery/kitchen_machine/proc/wzhzhzh(seconds)
|
||||
for(var/i=1 to seconds)
|
||||
@@ -315,10 +355,7 @@
|
||||
|
||||
/obj/machinery/kitchen_machine/proc/has_extra_item()
|
||||
for(var/obj/O in contents)
|
||||
if( \
|
||||
!istype(O,/obj/item/weapon/reagent_containers/food) && \
|
||||
!istype(O, /obj/item/weapon/grown) \
|
||||
)
|
||||
if(!is_type_in_list(O, list(/obj/item/weapon/reagent_containers/food, /obj/item/weapon/grown, /obj/item/mixing_bowl)))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
@@ -373,19 +410,29 @@
|
||||
updateUsrDialog()
|
||||
|
||||
/obj/machinery/kitchen_machine/proc/fail()
|
||||
var/obj/item/weapon/reagent_containers/food/snacks/badrecipe/ffuu = new(src)
|
||||
var/amount = 0
|
||||
for(var/obj/O in contents-ffuu)
|
||||
for(var/obj/O in contents)
|
||||
if(istype(O, /obj/item/mixing_bowl))
|
||||
var/obj/item/mixing_bowl/mb = O
|
||||
mb.fail(src)
|
||||
mb.forceMove(get_turf(src))
|
||||
continue
|
||||
amount++
|
||||
if(O.reagents)
|
||||
var/id = O.reagents.get_master_reagent_id()
|
||||
if(id)
|
||||
amount+=O.reagents.get_reagent_amount(id)
|
||||
qdel(O)
|
||||
if(reagents && reagents.total_volume)
|
||||
var/id = reagents.get_master_reagent_id()
|
||||
if(id)
|
||||
amount += reagents.get_reagent_amount(id)
|
||||
reagents.clear_reagents()
|
||||
ffuu.reagents.add_reagent("carbon", amount)
|
||||
ffuu.reagents.add_reagent("????", amount/10)
|
||||
ffuu.forceMove(get_turf(src))
|
||||
if(amount)
|
||||
var/obj/item/weapon/reagent_containers/food/snacks/badrecipe/ffuu = new(src)
|
||||
ffuu.reagents.add_reagent("carbon", amount)
|
||||
ffuu.reagents.add_reagent("????", amount/10)
|
||||
ffuu.forceMove(get_turf(src))
|
||||
|
||||
/obj/machinery/kitchen_machine/Topic(href, href_list)
|
||||
if(..() || panel_open)
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
@@ -751,6 +751,7 @@
|
||||
#include "code\game\objects\items\flag.dm"
|
||||
#include "code\game\objects\items\latexballoon.dm"
|
||||
#include "code\game\objects\items\misc.dm"
|
||||
#include "code\game\objects\items\mixing_bowl.dm"
|
||||
#include "code\game\objects\items\policetape.dm"
|
||||
#include "code\game\objects\items\random_items.dm"
|
||||
#include "code\game\objects\items\shooting_range.dm"
|
||||
|
||||
Reference in New Issue
Block a user