From 562114342182c8aece7b1cd61fdb34ff04f32234 Mon Sep 17 00:00:00 2001 From: Time-Green Date: Thu, 24 Jan 2019 16:50:56 +0100 Subject: [PATCH] Gibbing transfers reagents to meat (#42492) * adds reagent from mob to meat * actually makes reagents transfer on gibbing * Apply suggestions from code review Co-Authored-By: Time-Green --- code/modules/food_and_drinks/kitchen_machinery/gibber.dm | 6 +++++- code/modules/reagents/chemistry/holder.dm | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/code/modules/food_and_drinks/kitchen_machinery/gibber.dm b/code/modules/food_and_drinks/kitchen_machinery/gibber.dm index 7a78a8be857..b2cab42ff3f 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/gibber.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/gibber.dm @@ -178,13 +178,17 @@ typeofskin = /obj/item/stack/sheet/animalhide/monkey else if(isalien(C)) typeofskin = /obj/item/stack/sheet/animalhide/xeno - + var/occupant_volume + if(occupant?.reagents) + occupant_volume = occupant.reagents.total_volume for (var/i=1 to meat_produced) var/obj/item/reagent_containers/food/snacks/meat/slab/newmeat = new typeofmeat newmeat.name = "[sourcename] [newmeat.name]" if(istype(newmeat)) newmeat.subjectname = sourcename newmeat.reagents.add_reagent ("nutriment", sourcenutriment / meat_produced) // Thehehe. Fat guys go first + if(occupant_volume) + occupant.reagents.trans_to(newmeat, occupant_volume / meat_produced, remove_blacklisted = TRUE) if(sourcejob) newmeat.subjectjob = sourcejob allmeat[i] = newmeat diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index 57918acd185..39f4981c95f 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -163,7 +163,8 @@ return master -/datum/reagents/proc/trans_to(obj/target, amount=1, multiplier=1, preserve_data=1, no_react = 0, mob/transfered_by)//if preserve_data=0, the reagents data will be lost. Usefull if you use data for some strange stuff and don't want it to be transferred. +/datum/reagents/proc/trans_to(obj/target, amount = 1, multiplier = 1, preserve_data = TRUE, no_react = FALSE, mob/transfered_by, remove_blacklisted = FALSE) + //if preserve_data=0, the reagents data will be lost. Usefull if you use data for some strange stuff and don't want it to be transferred. var/list/cached_reagents = reagent_list if(!target || !total_volume) return @@ -190,6 +191,8 @@ var/trans_data = null for(var/reagent in cached_reagents) var/datum/reagent/T = reagent + if(remove_blacklisted && !T.can_synth) + continue var/transfer_amount = T.volume * part if(preserve_data) trans_data = copy_data(T)