diff --git a/code/datums/components/udder.dm b/code/datums/components/udder.dm index 7a2f7b56b7b..3c8a0297897 100644 --- a/code/datums/components/udder.dm +++ b/code/datums/components/udder.dm @@ -10,11 +10,11 @@ var/datum/callback/on_milk_callback //udder_type and reagent_produced_typepath are typepaths, not reference -/datum/component/udder/Initialize(udder_type = /obj/item/udder, datum/callback/on_milk_callback, datum/callback/on_generate_callback, reagent_produced_typepath = /datum/reagent/consumable/milk) +/datum/component/udder/Initialize(udder_type = /obj/item/udder, datum/callback/on_milk_callback, datum/callback/on_generate_callback, reagent_produced_override) if(!isliving(parent)) //technically is possible to drop this on carbons... but you wouldn't do that to me, would you? return COMPONENT_INCOMPATIBLE udder = new udder_type(null) - udder.add_features(parent, on_generate_callback, reagent_produced_typepath) + udder.add_features(parent, on_generate_callback, reagent_produced_override) src.on_milk_callback = on_milk_callback /datum/component/udder/RegisterWithParent() @@ -67,6 +67,8 @@ var/reagent_produced_typepath = /datum/reagent/consumable/milk ///how much the udder holds var/size = 50 + ///the probability that the udder will produce the reagent (0 - 100) + var/production_probability = 5 ///mob that has the udder component var/mob/living/udder_mob ///optional proc to callback to when the udder generates milk @@ -78,11 +80,12 @@ ///hunger key we set to look for food var/hunger_key = BB_CHECK_HUNGRY -/obj/item/udder/proc/add_features(parent, callback, reagent = /datum/reagent/consumable/milk) +/obj/item/udder/proc/add_features(parent, callback, reagent_override) udder_mob = parent on_generate_callback = callback create_reagents(size, REAGENT_HOLDER_ALIVE) - reagent_produced_typepath = reagent + if(reagent_override) + reagent_produced_typepath = reagent_override initial_conditions() if(isnull(require_consume_type)) return @@ -157,12 +160,13 @@ */ /obj/item/udder/proc/generate() if(!isnull(require_consume_type) && !(locate(require_consume_type) in src)) - return - if(prob(95)) - return + return FALSE + if(!prob(production_probability)) + return FALSE reagents.add_reagent(reagent_produced_typepath, rand(5, 10), added_purity = 1) if(on_generate_callback) on_generate_callback.Invoke(reagents.total_volume, reagents.maximum_volume) + return TRUE /** * Proc called from attacking the component parent with the correct item, moves reagents into the glass basically.