diff --git a/code/datums/components/food/edible.dm b/code/datums/components/food/edible.dm index b7283078464..5c77b3581c5 100644 --- a/code/datums/components/food/edible.dm +++ b/code/datums/components/food/edible.dm @@ -192,7 +192,7 @@ Behavior that's still missing from this component that original food items had t var/atom/this_food = parent - this_food.reagents.clear_reagents() + this_food.reagents.multiply_reagents(CRAFTED_FOOD_BASE_REAGENT_MODIFIER) for(var/obj/item/crafted_part in this_food.contents) crafted_part.reagents?.trans_to(this_food.reagents, crafted_part.reagents.maximum_volume, CRAFTED_FOOD_INGREDIENT_REAGENT_MODIFIER) @@ -208,13 +208,6 @@ Behavior that's still missing from this component that original food items had t QDEL_LIST(objects_to_delete) - for(var/r_id in initial_reagents) - var/amount = initial_reagents[r_id] * CRAFTED_FOOD_BASE_REAGENT_MODIFIER - if(r_id == /datum/reagent/consumable/nutriment || r_id == /datum/reagent/consumable/nutriment/vitamin || r_id == /datum/reagent/consumable/nutriment/protein) - this_food.reagents.add_reagent(r_id, amount, tastes) - else - this_food.reagents.add_reagent(r_id, amount) - SSblackbox.record_feedback("tally", "food_made", 1, type) /datum/component/edible/proc/OnMicrowaved(datum/source, obj/machinery/microwave/used_microwave) @@ -245,17 +238,10 @@ Behavior that's still missing from this component that original food items had t var/atom/this_food = parent - this_food.reagents.clear_reagents() + this_food.reagents.multiply_reagents(cooking_efficiency * CRAFTED_FOOD_BASE_REAGENT_MODIFIER) source_item.reagents?.trans_to(this_food, source_item.reagents.total_volume) - for(var/r_id in initial_reagents) - var/amount = initial_reagents[r_id] * cooking_efficiency * CRAFTED_FOOD_BASE_REAGENT_MODIFIER - if(r_id == /datum/reagent/consumable/nutriment || r_id == /datum/reagent/consumable/nutriment/vitamin || r_id == /datum/reagent/consumable/nutriment/protein) - this_food.reagents.add_reagent(r_id, amount, tastes) - else - this_food.reagents.add_reagent(r_id, amount) - ///Makes sure the thing hasn't been destroyed or fully eaten to prevent eating phantom edibles /datum/component/edible/proc/IsFoodGone(atom/owner, mob/living/feeder) if(QDELETED(owner)|| !(IS_EDIBLE(owner))) diff --git a/code/datums/elements/food/food_trash.dm b/code/datums/elements/food/food_trash.dm index fb1c5bdf924..0ab8f615b89 100644 --- a/code/datums/elements/food/food_trash.dm +++ b/code/datums/elements/food/food_trash.dm @@ -65,7 +65,7 @@ /datum/element/food_trash/proc/open_trash(datum/source, mob/user) SIGNAL_HANDLER - to_chat(user, "You open the [src]\'s shell, revealing \a [initial(trash.name)].") + to_chat(user, "You open the [source], revealing \a [initial(trash.name)].") INVOKE_ASYNC(src, .proc/async_generate_trash, source) qdel(source) diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index d3a3c65096e..2e7f3ef203d 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -324,6 +324,22 @@ src.handle_reactions() return amount +///Multiplies the reagents inside this holder by a specific amount +/datum/reagents/proc/multiply_reagents(multiplier=1) + var/list/cached_reagents = reagent_list + if(!total_volume) + return + var/change = (multiplier - 1) //Get the % change + for(var/reagent in cached_reagents) + var/datum/reagent/T = reagent + if(change > 0) + add_reagent(T.type, T.volume * change) + else + remove_reagent(T.type, abs(T.volume * change)) //absolute value to prevent a double negative situation (removing -50% would be adding 50%) + + update_total() + handle_reactions() + /// Transfer a specific reagent id to the target object /datum/reagents/proc/trans_id_to(obj/target, reagent, amount=1, preserve_data=1)//Not sure why this proc didn't exist before. It does now! /N var/list/cached_reagents = reagent_list