From ecfe23398b946406ae6f77d53d59cd1a9b93dea1 Mon Sep 17 00:00:00 2001 From: Rykka Date: Thu, 30 Jul 2020 04:59:01 -0400 Subject: [PATCH] Makes Changes requested by maintainer --- code/_helpers/type2type.dm | 2 +- code/modules/food/food/snacks.dm | 37 +++++----- .../kitchen/cooking_machines/_appliance.dm | 39 +++++------ .../food/kitchen/cooking_machines/_cooker.dm | 8 +-- .../food/kitchen/cooking_machines/_mixer.dm | 6 +- code/modules/food/kitchen/microwave.dm | 12 ++-- code/modules/food/recipe.dm | 68 +++++++++---------- code/modules/food/recipes_fryer.dm | 7 +- code/modules/food/recipes_microwave.dm | 19 +++--- code/modules/food/recipes_oven.dm | 1 + .../Chemistry-Reagents-Food-Drinks.dm | 8 +-- 11 files changed, 103 insertions(+), 104 deletions(-) diff --git a/code/_helpers/type2type.dm b/code/_helpers/type2type.dm index 1234919996..77019ab7b9 100644 --- a/code/_helpers/type2type.dm +++ b/code/_helpers/type2type.dm @@ -289,7 +289,7 @@ var/l = ls.len // Made local for sanic speed. var/i = 0 // Incremented every time a list index is accessed. - if (sep <> null) + if (sep != null) // Macros expand to long argument lists like so: sep, ls[++i], sep, ls[++i], sep, ls[++i], etc... #define S1 sep, ls[++i] #define S4 S1, S1, S1, S1 diff --git a/code/modules/food/food/snacks.dm b/code/modules/food/food/snacks.dm index bbb1e70721..25398b744a 100644 --- a/code/modules/food/food/snacks.dm +++ b/code/modules/food/food/snacks.dm @@ -142,7 +142,7 @@ . = ..() if(Adjacent(user)) if(coating) - to_chat(user, "It's coated in [coating.name]!") + . += "It's coated in [coating.name]!" if(bitecount==0) return . else if (bitecount==1) @@ -4513,12 +4513,14 @@ filling_color = "#DB0000" center_of_mass = list("x"=16, "y"=16) do_coating_prefix = 0 - New() - . = ..() - reagents.add_reagent("protein", 6) - reagents.add_reagent("batter", 1.7) - reagents.add_reagent("oil", 1.5) - bitesize = 2 + bitesize = 2 + + +/obj/item/weapon/reagent_containers/food/snacks/sausage/battered/Initialize() + . = ..() + reagents.add_reagent("protein", 6) + reagents.add_reagent("batter", 1.7) + reagents.add_reagent("oil", 1.5) /obj/item/weapon/reagent_containers/food/snacks/jalapeno_poppers name = "jalapeno popper" @@ -4543,10 +4545,11 @@ icon = 'icons/obj/food_syn.dmi' icon_state = "ratburger" center_of_mass = list("x"=16, "y"=11) - New() - . = ..() - reagents.add_reagent("protein", 4) - bitesize = 2 + bitesize = 2 + +/obj/item/weapon/reagent_containers/food/snacks/mouseburger/Initialize() + . = ..() + reagents.add_reagent("protein", 4) /obj/item/weapon/reagent_containers/food/snacks/chickenkatsu name = "chicken katsu" @@ -4622,13 +4625,13 @@ nutriment_amt = 25 nutriment_desc = list("fried pizza" = 25) center_of_mass = list("x"=16, "y"=11) + bitesize = 2 - New() - . = ..() - reagents.add_reagent("batter", 6.5) - coating = reagents.get_reagent("batter") - reagents.add_reagent("oil", 4) - bitesize = 2 +/obj/item/weapon/reagent_containers/food/snacks/sliceable/pizza/crunch/Initialize() + . = ..() + reagents.add_reagent("batter", 6.5) + coating = reagents.get_reagent("batter") + reagents.add_reagent("oil", 4) /obj/item/weapon/reagent_containers/food/snacks/pizzacrunchslice name = "pizza crunch" diff --git a/code/modules/food/kitchen/cooking_machines/_appliance.dm b/code/modules/food/kitchen/cooking_machines/_appliance.dm index 19177fde0a..775808be64 100644 --- a/code/modules/food/kitchen/cooking_machines/_appliance.dm +++ b/code/modules/food/kitchen/cooking_machines/_appliance.dm @@ -53,12 +53,10 @@ if (!available_recipes) available_recipes = new - for (var/type in subtypesof(/datum/recipe)) - var/datum/recipe/test = new type - if ((appliancetype & test.appliance)) - available_recipes += test - else - qdel(test) + for(var/type in subtypesof(/datum/recipe)) + var/datum/recipe/test = type + if((appliancetype & initial(test.appliance))) + available_recipes += new test /obj/machinery/appliance/Destroy() for (var/a in cooking_objs) @@ -79,7 +77,7 @@ for (var/a in cooking_objs) var/datum/cooking_item/CI = a string += "-\a [CI.container.label(null, CI.combine_target)], [report_progress(CI)]
" - to_chat(user, string) + return string else to_chat(user, "") @@ -125,14 +123,14 @@ return if (!user.IsAdvancedToolUser()) - to_chat(user, "You lack the dexterity to do that!") + to_chat(user, "You lack the dexterity to do that!") return if (user.stat || user.restrained() || user.incapacitated()) return if (!Adjacent(user) && !issilicon(user)) - to_chat(user, "You can't reach [src] from here.") + to_chat(user, "You can't reach [src] from here!") return if (stat & POWEROFF)//Its turned off @@ -234,10 +232,10 @@ //This function is overridden by cookers that do stuff with containers /obj/machinery/appliance/proc/has_space(var/obj/item/I) - if (cooking_objs.len >= max_contents) + if(cooking_objs.len >= max_contents) return FALSE - else return TRUE + return TRUE /obj/machinery/appliance/attackby(var/obj/item/I, var/mob/user) if(!cook_type || (stat & (BROKEN))) @@ -246,12 +244,9 @@ var/result = can_insert(I, user) if(!result) - if(default_deconstruction_screwdriver(user, I)) - return - else if(default_part_replacement(user, I)) - return - else - return + if(!(default_deconstruction_screwdriver(user, I))) + default_part_replacement(user, I) + return if(result == 2) var/obj/item/weapon/grab/G = I @@ -572,17 +567,17 @@ var/datum/cooking_item/CI = menuoptions[selection] eject(CI, user) update_icon() - return 1 - return 0 + return TRUE + return FALSE /obj/machinery/appliance/proc/can_remove_items(var/mob/user) if (!Adjacent(user)) - return 0 + return FALSE if (isanimal(user)) - return 0 + return FALSE - return 1 + return TRUE /obj/machinery/appliance/proc/eject(var/datum/cooking_item/CI, var/mob/user = null) var/obj/item/thing diff --git a/code/modules/food/kitchen/cooking_machines/_cooker.dm b/code/modules/food/kitchen/cooking_machines/_cooker.dm index 1e7193f166..94b40b44b2 100644 --- a/code/modules/food/kitchen/cooking_machines/_cooker.dm +++ b/code/modules/food/kitchen/cooking_machines/_cooker.dm @@ -19,12 +19,12 @@ if(.) //no need to duplicate adjacency check if(!stat) if (temperature < min_temp) - to_chat(user, "\The [src] is still heating up and is too cold to cook anything yet.") + . += "\The [src] is still heating up and is too cold to cook anything yet." else - to_chat(user, "It is running at [round(get_efficiency(), 0.1)]% efficiency!") - to_chat(user, "Temperature: [round(temperature - T0C, 0.1)]C / [round(optimal_temp - T0C, 0.1)]C") + . += "It is running at [round(get_efficiency(), 0.1)]% efficiency!" + . += "Temperature: [round(temperature - T0C, 0.1)]C / [round(optimal_temp - T0C, 0.1)]C" else - to_chat(user, "It is switched off.") + . += "It is switched off." /obj/machinery/appliance/cooker/list_contents(var/mob/user) if (cooking_objs.len) diff --git a/code/modules/food/kitchen/cooking_machines/_mixer.dm b/code/modules/food/kitchen/cooking_machines/_mixer.dm index 18b75998d9..ce17e55d91 100644 --- a/code/modules/food/kitchen/cooking_machines/_mixer.dm +++ b/code/modules/food/kitchen/cooking_machines/_mixer.dm @@ -17,7 +17,7 @@ fundamental differences /obj/machinery/appliance/mixer/examine(var/mob/user) . = ..() if(Adjacent(user)) - to_chat(user, "It is currently set to make a [selected_option]") + . += "It is currently set to make a [selected_option]" /obj/machinery/appliance/mixer/Initialize() . = ..() @@ -27,7 +27,7 @@ fundamental differences //Mixers cannot-not do combining mode. So the default option is removed from this. A combine target must be chosen /obj/machinery/appliance/mixer/choose_output() - set src in oview(1) + set src in view(1) set name = "Choose output" set category = "Object" @@ -91,7 +91,7 @@ fundamental differences /obj/machinery/appliance/mixer/toggle_power() - set src in view() + set src in view(1) set name = "Toggle Power" set category = "Object" diff --git a/code/modules/food/kitchen/microwave.dm b/code/modules/food/kitchen/microwave.dm index 7d6ffacedb..373368f823 100644 --- a/code/modules/food/kitchen/microwave.dm +++ b/code/modules/food/kitchen/microwave.dm @@ -268,7 +268,7 @@ return start() if(reagents.total_volume==0 && !(locate(/obj) in ((contents - component_parts) - circuit))) //dry run - if(!wzhzhzh(16)) //VOREStation Edit - Quicker Microwaves (Undone during Auroraport, left note in case of reversion, was 5) + if(!wzhzhzh(16)) abort() return abort() @@ -279,23 +279,23 @@ if(!recipe) dirty += 1 if(prob(max(10,dirty*5))) - if(!wzhzhzh(16)) //VOREStation Edit - Quicker Microwaves (Undone during Auroraport, left note in case of reversion, was 2) + if(!wzhzhzh(16)) abort() return muck_start() - wzhzhzh(2) //VOREStation Edit - Quicker Microwaves (Undone during Auroraport, left note in case of reversion, was 2) + wzhzhzh(2) muck_finish() cooked = fail() cooked.forceMove(src.loc) else if(has_extra_item()) - if(!wzhzhzh(16)) //VOREStation Edit - Quicker Microwaves (Undone during Auroraport, left note in case of reversion, was 2) + if(!wzhzhzh(16)) abort() return broke() cooked = fail() cooked.forceMove(src.loc) else - if(!wzhzhzh(40)) //VOREStation Edit - Quicker Microwaves (Undone during Auroraport, left note in case of reversion, was 5) + if(!wzhzhzh(40)) abort() return stop() @@ -304,7 +304,7 @@ return //Making multiple copies of a recipe - var/halftime = round(recipe.time*4/10/2) // VOREStation Edit - Quicker Microwaves (Undone during Auroraport, left note in case of reversion, was round(recipe.time/20/2)) + var/halftime = round(recipe.time*4/10/2) if(!wzhzhzh(halftime)) abort() return diff --git a/code/modules/food/recipe.dm b/code/modules/food/recipe.dm index e5b5a02eb0..119f68a5b1 100644 --- a/code/modules/food/recipe.dm +++ b/code/modules/food/recipe.dm @@ -71,31 +71,31 @@ // This is a bitfield, more than one type can be used // Grill is presently unused and not listed -/datum/recipe/proc/check_reagents(var/datum/reagents/avail_reagents) +/datum/recipe/proc/check_reagents(var/datum/reagents/avail_reagents, var/exact = 0) if(!reagents || !reagents.len) - return 1 + return TRUE if(!avail_reagents) - return 0 + return FALSE - . = 1 + . = TRUE for(var/r_r in reagents) var/aval_r_amnt = avail_reagents.get_reagent_amount(r_r) if(aval_r_amnt - reagents[r_r] >= 0) - if(aval_r_amnt>reagents[r_r]) - . = 0 + if(aval_r_amnt>(reagents[r_r] && exact)) + . = FALSE else - return -1 + return FALSE if((reagents?(reagents.len):(0)) < avail_reagents.reagent_list.len) - return 0 + return FALSE return . -/datum/recipe/proc/check_fruit(var/obj/container) +/datum/recipe/proc/check_fruit(var/obj/container, var/exact = 0) if (!fruit || !fruit.len) - return 1 + return TRUE - . = 1 + . = TRUE if(fruit && fruit.len) var/list/checklist = list() // You should trust Copy(). @@ -107,18 +107,18 @@ checklist[G.seed.kitchen_tag]-- for(var/ktag in checklist) if(!isnull(checklist[ktag])) - if(checklist[ktag] < 0) - . = 0 + if(checklist[ktag] < 0 && exact) + . = FALSE else if(checklist[ktag] > 0) - . = -1 + . = FALSE break return . -/datum/recipe/proc/check_items(var/obj/container as obj) +/datum/recipe/proc/check_items(var/obj/container as obj, var/exact = 0) if(!items || !items.len) - return 1 + return TRUE - . = 1 + . = TRUE if(items && items.len) var/list/checklist = list() checklist = items.Copy() // You should really trust Copy @@ -127,50 +127,50 @@ for(var/obj/O in ((machine.contents - machine.component_parts) - machine.circuit)) if(istype(O,/obj/item/weapon/reagent_containers/food/snacks/grown)) continue // Fruit is handled in check_fruit(). - var/found = 0 + var/found = FALSE for(var/i = 1; i < checklist.len+1; i++) var/item_type = checklist[i] if (istype(O,item_type)) checklist.Cut(i, i+1) - found = 1 + found = TRUE break - if(!found) - . = 0 + if(!found && exact) + return FALSE else for(var/obj/O in container.contents) if(istype(O,/obj/item/weapon/reagent_containers/food/snacks/grown)) continue // Fruit is handled in check_fruit(). - var/found = 0 + var/found = FALSE for(var/i = 1; i < checklist.len+1; i++) var/item_type = checklist[i] if (istype(O,item_type)) if(check_coating(O)) checklist.Cut(i, i+1) - found = 1 + found = TRUE break - if (!found) - . = 0 + if (!found && exact) + return FALSE if(checklist.len) - . = -1 + return FALSE return . //This is called on individual items within the container. -/datum/recipe/proc/check_coating(var/obj/O) +/datum/recipe/proc/check_coating(var/obj/O, var/exact = FALSE) if(!istype(O,/obj/item/weapon/reagent_containers/food/snacks)) - return 1//Only snacks can be battered + return TRUE //Only snacks can be battered if (coating == -1) - return 1 //-1 value doesnt care + return TRUE //-1 value doesnt care var/obj/item/weapon/reagent_containers/food/snacks/S = O if (!S.coating) if (!coating) - return 1 - return 0 + return TRUE + return FALSE else if (S.coating.type == coating) - return 1 + return TRUE - return 0 + return FALSE //general version /datum/recipe/proc/make(var/obj/container as obj) @@ -308,7 +308,7 @@ /proc/select_recipe(var/list/datum/recipe/available_recipes, var/obj/obj as obj, var/exact) var/list/datum/recipe/possible_recipes = list() for (var/datum/recipe/recipe in available_recipes) - if((recipe.check_reagents(obj.reagents) < exact) || (recipe.check_items(obj) < exact) || (recipe.check_fruit(obj) < exact)) + if(!recipe.check_reagents(obj.reagents, exact) || !recipe.check_items(obj, exact) || !recipe.check_fruit(obj, exact)) continue possible_recipes |= recipe if (!possible_recipes.len) diff --git a/code/modules/food/recipes_fryer.dm b/code/modules/food/recipes_fryer.dm index a0d5149468..5cc2b1531b 100644 --- a/code/modules/food/recipes_fryer.dm +++ b/code/modules/food/recipes_fryer.dm @@ -6,6 +6,7 @@ result = /obj/item/weapon/reagent_containers/food/snacks/fries /datum/recipe/cheesyfries + appliance = FRYER items = list( /obj/item/weapon/reagent_containers/food/snacks/fries, /obj/item/weapon/reagent_containers/food/snacks/cheesewedge, @@ -100,13 +101,11 @@ ) result = /obj/item/weapon/reagent_containers/food/snacks/donut/poisonberry -/datum/recipe/jellydonut/slime - appliance = FRYER +/datum/recipe/jellydonut/slime // Subtypes of jellydonut, appliance inheritance applies. reagents = list("slimejelly" = 5, "sugar" = 5) result = /obj/item/weapon/reagent_containers/food/snacks/donut/slimejelly -/datum/recipe/jellydonut/cherry - appliance = FRYER +/datum/recipe/jellydonut/cherry // Subtypes of jellydonut, appliance inheritance applies. reagents = list("cherryjelly" = 5, "sugar" = 5) result = /obj/item/weapon/reagent_containers/food/snacks/donut/cherryjelly diff --git a/code/modules/food/recipes_microwave.dm b/code/modules/food/recipes_microwave.dm index 8697055bec..465b3f736a 100644 --- a/code/modules/food/recipes_microwave.dm +++ b/code/modules/food/recipes_microwave.dm @@ -208,10 +208,11 @@ I said no! /datum/recipe/amanitajelly reagents = list("water" = 5, "vodka" = 5, "amatoxin" = 5) result = /obj/item/weapon/reagent_containers/food/snacks/amanitajelly - make_food(var/obj/container as obj) - . = ..(container) - for(var/obj/item/weapon/reagent_containers/food/snacks/amanitajelly/being_cooked in .) - being_cooked.reagents.del_reagent("amatoxin") + +/datum/recipe/amanitajelly/make_food(var/obj/container as obj) + . = ..(container) + for(var/obj/item/weapon/reagent_containers/food/snacks/amanitajelly/being_cooked in .) + being_cooked.reagents.del_reagent("amatoxin") /datum/recipe/meatballsoup fruit = list("carrot" = 1, "potato" = 1) @@ -531,11 +532,11 @@ I said no! fruit = list("potato" = 1, "ambrosia" = 3) items = list(/obj/item/weapon/reagent_containers/food/snacks/meatball) result = /obj/item/weapon/reagent_containers/food/snacks/validsalad - make_food(var/obj/container as obj) - - . = ..(container) - for (var/obj/item/weapon/reagent_containers/food/snacks/validsalad/being_cooked in .) - being_cooked.reagents.del_reagent("toxin") + +/datum/recipe/validsalad/make_food(var/obj/container as obj) + . = ..(container) + for (var/obj/item/weapon/reagent_containers/food/snacks/validsalad/being_cooked in .) + being_cooked.reagents.del_reagent("toxin") /datum/recipe/stuffing reagents = list("water" = 5, "sodiumchloride" = 1, "blackpepper" = 1) diff --git a/code/modules/food/recipes_oven.dm b/code/modules/food/recipes_oven.dm index 3f89560372..7a477cf943 100644 --- a/code/modules/food/recipes_oven.dm +++ b/code/modules/food/recipes_oven.dm @@ -83,6 +83,7 @@ result = /obj/item/weapon/reagent_containers/food/snacks/flatbread /datum/recipe/tortilla + appliance = OVEN reagents = list("flour" = 5) items = list( /obj/item/weapon/reagent_containers/food/snacks/sliceable/flatdough diff --git a/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Food-Drinks.dm b/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Food-Drinks.dm index 8f3143eb82..d07b305b54 100644 --- a/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Food-Drinks.dm +++ b/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Food-Drinks.dm @@ -67,14 +67,14 @@ /datum/reagent/nutriment/coating/affect_ingest(var/mob/living/carbon/M, var/alien, var/removed) //We'll assume that the batter isnt going to be regurgitated and eaten by someone else. Only show this once - if (data["cooked"] != 1) + if(data["cooked"] != 1) if (!messaged) - to_chat(M, "Ugh, this raw [name] tastes disgusting.") + to_chat(M, "Ugh, this raw [name] tastes disgusting.") nutriment_factor *= 0.5 messaged = 1 - //Raw coatings will sometimes cause vomiting - if (prob(1)) + //Raw coatings will sometimes cause vomiting. 75% chance of this happening. + if(prob(75)) M.vomit() ..()