From 25cfbef9cda60271651bd7bb41aa56c958ec7d58 Mon Sep 17 00:00:00 2001 From: necromanceranne <40847847+necromanceranne@users.noreply.github.com> Date: Sat, 18 Sep 2021 18:40:16 +1000 Subject: [PATCH] Food decomposition can mold stuff into different items, and not just moldy messes. (#61233) Originally the component only allowed food to decompose into the generic moldy mess. This PR changes the component so that what item the component decomposes something into can be changed per attached object. I've added a few examples; bread types > moldy bread, pizza slice types > moldy pizza slices, dead mice > moldy dead mice (they need a sprite still, I'll get to that later. Kinda catbrained rn.) edit: Makes sure that none of this moldy food touches cytology unnecessarily. Rotten eggs have been added (decomposed eggs), along with rotten boiled eggs. The only way to determine if an egg is good or not requires using a container of water on the egg. If it floats, it's rotten! They also do not produce ants when they decompose, so chickens no longer get eaten alive by swarms of ants for producing all these eggs. fixes #61188 --- _maps/map_files/MetaStation/MetaStation.dmm | 2 +- code/datums/components/food/decomposition.dm | 14 +++++++--- code/game/objects/items/food/_food.dm | 7 ++++- code/game/objects/items/food/bread.dm | 10 +++++-- code/game/objects/items/food/egg.dm | 27 +++++++++++++++++++ code/game/objects/items/food/misc.dm | 6 ++++- code/game/objects/items/food/pizza.dm | 10 +++++-- .../crates_lockers/closets/gimmick.dm | 5 +++- .../living/simple_animal/friendly/mouse.dm | 9 +++++++ .../chemistry/reagents/food_reagents.dm | 7 +++++ 10 files changed, 86 insertions(+), 11 deletions(-) diff --git a/_maps/map_files/MetaStation/MetaStation.dmm b/_maps/map_files/MetaStation/MetaStation.dmm index e1e29dfa8aa..d3b0a37760b 100644 --- a/_maps/map_files/MetaStation/MetaStation.dmm +++ b/_maps/map_files/MetaStation/MetaStation.dmm @@ -44962,7 +44962,7 @@ "nWN" = ( /obj/effect/decal/cleanable/dirt/dust, /obj/structure/bed/roller, -/obj/item/food/pizzaslice/moldy, +/obj/item/food/pizzaslice/moldy/bacteria, /turf/open/floor/iron/white, /area/medical/abandoned) "nXg" = ( diff --git a/code/datums/components/food/decomposition.dm b/code/datums/components/food/decomposition.dm index 55a86d5354b..ff3da2bdc96 100644 --- a/code/datums/components/food/decomposition.dm +++ b/code/datums/components/food/decomposition.dm @@ -20,16 +20,23 @@ var/time_remaining = DECOMPOSITION_TIME /// Used to give raw/gross food lower timers var/decomp_flags + /// Use for determining what kind of item the food decomposes into. + var/decomp_result + /// Does our food attract ants? + var/produce_ants = TRUE /// Used for examining var/examine_type = DECOMP_EXAM_NORMAL -/datum/component/decomposition/Initialize(mapload, decomp_req_handle, decomp_flags = NONE) +/datum/component/decomposition/Initialize(mapload, decomp_req_handle, decomp_flags = NONE, decomp_result, ant_attracting = TRUE) if(!isobj(parent)) return COMPONENT_INCOMPATIBLE src.decomp_flags = decomp_flags + src.decomp_result = decomp_result if(mapload || decomp_req_handle) handled = FALSE + if(!ant_attracting) + produce_ants = FALSE RegisterSignal(parent, COMSIG_MOVABLE_MOVED, .proc/handle_movement) RegisterSignal(parent, list( @@ -104,8 +111,9 @@ /datum/component/decomposition/proc/decompose() var/obj/decomp = parent //Lets us spawn things at decomp - new /obj/effect/decal/cleanable/ants(decomp.loc) - new /obj/item/food/badrecipe/moldy(decomp.loc) + if(produce_ants) + new /obj/effect/decal/cleanable/ants(decomp.loc) + new decomp_result(decomp.loc) decomp.visible_message("[decomp] gets overtaken by mold and ants! Gross!") qdel(decomp) return diff --git a/code/game/objects/items/food/_food.dm b/code/game/objects/items/food/_food.dm index 6e684628f6b..f2991861cbb 100644 --- a/code/game/objects/items/food/_food.dm +++ b/code/game/objects/items/food/_food.dm @@ -40,6 +40,10 @@ var/venue_value ///Food that's immune to decomposition. var/preserved_food = FALSE + ///Does our food normally attract ants? + var/ant_attracting = TRUE + ///What our food decomposes into. + var/decomp_type = /obj/item/food/badrecipe/moldy ///Food that needs to be picked up in order to decompose. var/decomp_req_handle = FALSE @@ -102,4 +106,5 @@ ///Set decomp_req_handle to TRUE to only make it decompose when someone picks it up. /obj/item/food/proc/MakeDecompose(mapload) if(!preserved_food) - AddComponent(/datum/component/decomposition, mapload, decomp_req_handle, decomp_flags = foodtypes) + AddComponent(/datum/component/decomposition, mapload, decomp_req_handle, decomp_flags = foodtypes, decomp_result = decomp_type, ant_attracting = ant_attracting) + diff --git a/code/game/objects/items/food/bread.dm b/code/game/objects/items/food/bread.dm index 6fb231e7ce2..0e1a56aef4b 100644 --- a/code/game/objects/items/food/bread.dm +++ b/code/game/objects/items/food/bread.dm @@ -48,20 +48,26 @@ foodtypes = GRAIN food_reagents = list(/datum/reagent/consumable/nutriment = 2) venue_value = FOOD_PRICE_TRASH + decomp_type = /obj/item/food/breadslice/moldy /obj/item/food/breadslice/plain/Initialize() . = ..() AddComponent(/datum/component/customizable_reagent_holder, null, CUSTOM_INGREDIENT_ICON_STACK) /obj/item/food/breadslice/moldy - name = "moldy bread slice" + name = "moldy 'bread' slice" desc = "Entire stations have been ripped apart over arguing whether this is still good to eat." icon_state = "moldybreadslice" food_reagents = list(/datum/reagent/consumable/nutriment = 2, /datum/reagent/consumable/mold = 10) tastes = list("decaying fungus" = 1) foodtypes = GROSS + preserved_food = TRUE -/obj/item/food/breadslice/moldy/Initialize() +/obj/item/food/breadslice/moldy/bacteria + name = "bacteria rich moldy 'bread' slice" + desc = "Something (possibly necroyeast) has caused this bread to rise in a macabre state of unlife. It lurchs about when unattended. You might want to locate a priest if you see this. Or maybe a flamethrower." + +/obj/item/food/breadslice/moldy/bacteria/Initialize() . = ..() AddElement(/datum/element/swabable, CELL_LINE_TABLE_MOLD, CELL_VIRUS_TABLE_GENERIC, rand(2,4), 25) diff --git a/code/game/objects/items/food/egg.dm b/code/game/objects/items/food/egg.dm index 6d52c7575d5..fb05b662919 100644 --- a/code/game/objects/items/food/egg.dm +++ b/code/game/objects/items/food/egg.dm @@ -19,8 +19,17 @@ microwaved_type = /obj/item/food/boiledegg foodtypes = MEAT w_class = WEIGHT_CLASS_TINY + ant_attracting = FALSE + decomp_type = /obj/item/food/egg/rotten + decomp_req_handle = TRUE //so laid eggs can actually become chickens var/static/chick_count = 0 //I copied this from the chicken_count (note the "en" in there) variable from chicken code. +/obj/item/food/egg/rotten + food_reagents = list(/datum/reagent/consumable/eggrot = 10, /datum/reagent/consumable/mold = 10) + microwaved_type = /obj/item/food/boiledegg/rotten + foodtypes = GROSS + preserved_food = TRUE + /obj/item/food/egg/gland desc = "An egg! It looks weird..." @@ -53,11 +62,21 @@ to_chat(usr, span_notice("You colour [src] with [W].")) icon_state = "egg-[clr]" + else if(istype(W, /obj/item/stamp/clown)) var/clowntype = pick("grock", "grimaldi", "rainbow", "chaos", "joker", "sexy", "standard", "bobble", "krusty", "bozo", "pennywise", "ronald", "jacobs", "kelly", "popov", "cluwne") icon_state = "egg-clown-[clowntype]" desc = "An egg that has been decorated with the grotesque, robustable likeness of a clown's face. " to_chat(usr, span_notice("You stamp [src] with [W], creating an artistic and not remotely horrifying likeness of clown makeup.")) + + else if(is_reagent_container(W)) + var/obj/item/reagent_containers/dunk_test_container = W + if(dunk_test_container.is_drainable() && dunk_test_container.reagents.has_reagent(/datum/reagent/water)) + to_chat(user, span_notice("You check if [src] is rotten.")) + if(istype(src, /obj/item/food/egg/rotten)) + to_chat(user, span_warning("[src] floats in the [dunk_test_container]!")) + else + to_chat(user, span_notice("[src] sinks into the [dunk_test_container]!")) else ..() @@ -104,6 +123,14 @@ foodtypes = MEAT | BREAKFAST food_flags = FOOD_FINGER_FOOD w_class = WEIGHT_CLASS_SMALL + ant_attracting = FALSE + decomp_type = /obj/item/food/boiledegg/rotten + +/obj/item/food/boiledegg/rotten + food_reagents = list(/datum/reagent/consumable/eggrot = 10) + tastes = list("rotten egg" = 1) + foodtypes = GROSS + preserved_food = TRUE /obj/item/food/omelette //FUCK THIS name = "omelette du fromage" diff --git a/code/game/objects/items/food/misc.dm b/code/game/objects/items/food/misc.dm index 0ea1795de9e..80b123a2d9f 100644 --- a/code/game/objects/items/food/misc.dm +++ b/code/game/objects/items/food/misc.dm @@ -201,7 +201,11 @@ desc = "A rancid, disgusting culture of mold and ants. Somewhere under there, at some point, there was food." food_reagents = list(/datum/reagent/consumable/mold = 30) -/obj/item/food/badrecipe/moldy/Initialize() +/obj/item/food/badrecipe/moldy/bacteria + name = "bacteria rich moldy mess" + desc = "Not only is this rancid lump of disgusting bile crawling with insect life, but it is also teeming with various microscopic cultures. It moves when you're not looking." + +/obj/item/food/badrecipe/moldy/bacteria/Initialize() . = ..() AddElement(/datum/element/swabable, CELL_LINE_TABLE_MOLD, CELL_VIRUS_TABLE_GENERIC, rand(2,4), 25) diff --git a/code/game/objects/items/food/pizza.dm b/code/game/objects/items/food/pizza.dm index 4f7a354517e..5898d47604c 100644 --- a/code/game/objects/items/food/pizza.dm +++ b/code/game/objects/items/food/pizza.dm @@ -33,8 +33,9 @@ food_reagents = list(/datum/reagent/consumable/nutriment = 5) foodtypes = GRAIN | DAIRY | VEGETABLES w_class = WEIGHT_CLASS_SMALL + decomp_type = /obj/item/food/pizzaslice/moldy -/obj/item/food/pizzaslice/MakeProcessable() +/obj/item/food/pizzaslice/bacteria/MakeProcessable() AddElement(/datum/element/processable, TOOL_ROLLINGPIN, /obj/item/stack/sheet/pizza, 1, 10) @@ -277,8 +278,13 @@ food_reagents = list(/datum/reagent/consumable/nutriment = 4, /datum/reagent/consumable/nutriment/peptides = 3, /datum/reagent/consumable/tomatojuice = 1, /datum/reagent/toxin/amatoxin = 2) tastes = list("stale crust" = 1, "rancid cheese" = 2, "mushroom" = 1) foodtypes = GRAIN | VEGETABLES | DAIRY | GROSS + preserved_food = TRUE -/obj/item/food/pizzaslice/moldy/Initialize() +/obj/item/food/pizzaslice/moldy/bacteria + name = "bacteria rich moldy pizza slice" + desc = "Not only is this once delicious pizza encrusted with a layer of spore-spewing fungus, it also seems to shift and slide when unattended, teeming with new life." + +/obj/item/food/pizzaslice/moldy/bacteria/Initialize() . = ..() AddElement(/datum/element/swabable, CELL_LINE_TABLE_MOLD, CELL_VIRUS_TABLE_GENERIC, rand(2,4), 25) diff --git a/code/game/objects/structures/crates_lockers/closets/gimmick.dm b/code/game/objects/structures/crates_lockers/closets/gimmick.dm index 1587bff56e0..e07b7b47cd1 100644 --- a/code/game/objects/structures/crates_lockers/closets/gimmick.dm +++ b/code/game/objects/structures/crates_lockers/closets/gimmick.dm @@ -125,6 +125,9 @@ if(prob(50)) new /obj/effect/spawner/lootdrop/refreshing_beverage(src) if(prob(40)) - new /obj/item/food/pizzaslice/moldy(src) + if(prob(50)) + new /obj/item/food/pizzaslice/moldy/bacteria(src) + else + new /obj/item/food/breadslice/moldy/bacteria(src) else if(prob(30)) new /obj/item/food/syndicake(src) diff --git a/code/modules/mob/living/simple_animal/friendly/mouse.dm b/code/modules/mob/living/simple_animal/friendly/mouse.dm index aab6ef03a91..02546eec655 100644 --- a/code/modules/mob/living/simple_animal/friendly/mouse.dm +++ b/code/modules/mob/living/simple_animal/friendly/mouse.dm @@ -203,6 +203,7 @@ foodtypes = GROSS | MEAT | RAW grind_results = list(/datum/reagent/blood = 20, /datum/reagent/liquidgibs = 5) decomp_req_handle = TRUE + decomp_type = /obj/item/food/deadmouse/moldy /obj/item/food/deadmouse/Initialize() . = ..() @@ -240,3 +241,11 @@ /obj/item/food/deadmouse/on_grind() . = ..() reagents.clear_reagents() + +/obj/item/food/deadmouse/moldy + name = "moldy dead mouse" + desc = "A dead rodent, consumed by mold and rot. There is a slim chance that a lizard might still eat it." + icon_state = "mouse_gray_dead" + food_reagents = list(/datum/reagent/consumable/nutriment = 3, /datum/reagent/consumable/nutriment/vitamin = 2, /datum/reagent/consumable/mold = 10) + grind_results = list(/datum/reagent/blood = 20, /datum/reagent/liquidgibs = 5, /datum/reagent/consumable/mold = 10) + preserved_food = TRUE diff --git a/code/modules/reagents/chemistry/reagents/food_reagents.dm b/code/modules/reagents/chemistry/reagents/food_reagents.dm index 3db25a88afd..44f5a5d8043 100644 --- a/code/modules/reagents/chemistry/reagents/food_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/food_reagents.dm @@ -656,6 +656,13 @@ taste_description = "rancid fungus" chemical_flags = REAGENT_CAN_BE_SYNTHESIZED +/datum/reagent/consumable/eggrot + name = "Rotten Eggyolk" + description = "It smells absolutely dreadful." + color ="#708a88" + taste_description = "rotten eggs" + chemical_flags = REAGENT_CAN_BE_SYNTHESIZED + /datum/reagent/consumable/tearjuice name = "Tear Juice" description = "A blinding substance extracted from certain onions."