diff --git a/code/modules/hydroponics/grown/berries.dm b/code/modules/hydroponics/grown/berries.dm index 5f457d83d27..697c7eb41ee 100644 --- a/code/modules/hydroponics/grown/berries.dm +++ b/code/modules/hydroponics/grown/berries.dm @@ -68,8 +68,10 @@ lifespan = 30 potency = 50 mutatelist = null + genes = list(/datum/plant_gene/trait/repeated_harvest, /datum/plant_gene/trait/tox_resistance) reagents_add = list(/datum/reagent/toxin/coniine = 0.08, /datum/reagent/toxin/staminatoxin = 0.1, /datum/reagent/consumable/nutriment/vitamin = 0.04, /datum/reagent/consumable/nutriment = 0.1) rarity = 30 + graft_gene = /datum/plant_gene/trait/tox_resistance /obj/item/food/grown/berries/death seed = /obj/item/seeds/berry/death diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm index 104c4e4384c..8eda5c23fab 100644 --- a/code/modules/hydroponics/hydroponics.dm +++ b/code/modules/hydroponics/hydroponics.dm @@ -333,20 +333,26 @@ //Toxins///////////////////////////////////////////////////////////////// // Too much toxins cause harm, but when the plant drinks the contaiminated water, the toxins disappear slowly - if(toxic >= 40 && toxic < 80) - adjust_plant_health(-1 / rating) - adjust_toxic(-rating * 2) - else if(toxic >= 80) // I don't think it ever gets here tbh unless above is commented out - adjust_plant_health(-3) - adjust_toxic(-rating * 3) + if(toxic >= 10) + if(myseed.get_gene(/datum/plant_gene/trait/plant_type/toxin_adaptation)) + adjust_plant_health(round(toxic / rand(10, 16))) + myseed.adjust_potency(round(toxic / rand(20, 30))) + + else if(toxic >= 40 && !myseed.get_gene(/datum/plant_gene/trait/tox_resistance)) + if(toxic < 80) + adjust_plant_health(-1 / rating) + adjust_toxic(-rating * 2) + else + adjust_plant_health(-3) + adjust_toxic(-rating * 3) //Pests & Weeds////////////////////////////////////////////////////////// if(pestlevel >= 8) if(!myseed.get_gene(/datum/plant_gene/trait/carnivory)) if(myseed.potency >= 30) - myseed.adjust_potency(-rand(2,6)) //Pests eat leaves and nibble on fruit, lowering potency. - myseed.set_potency(min((myseed.potency), CARNIVORY_POTENCY_MIN, MAX_PLANT_POTENCY)) + // Pests eat leaves and nibble on fruit, lowering potency. + myseed.set_potency(min(myseed.potency - rand(2, 6), CARNIVORY_POTENCY_MIN)) else adjust_plant_health(2 / rating) adjust_pestlevel(-1 / rating) @@ -354,8 +360,7 @@ else if(pestlevel >= 4) if(!myseed.get_gene(/datum/plant_gene/trait/carnivory)) if(myseed.potency >= 30) - myseed.adjust_potency(-rand(1,4)) - myseed.set_potency(min((myseed.potency), CARNIVORY_POTENCY_MIN, MAX_PLANT_POTENCY)) + myseed.set_potency(min(myseed.potency - rand(1, 4) , CARNIVORY_POTENCY_MIN)) else adjust_plant_health(1 / rating) @@ -399,7 +404,7 @@ // If the plant is too old, lose health fast if(age > myseed.lifespan) - adjust_plant_health(-rand(1,5) / rating) + adjust_plant_health(-rand(1, 5) / rating) // Harvest code if(age > myseed.production && (age - lastproduce) > myseed.production && plant_status == HYDROTRAY_PLANT_GROWING) @@ -713,19 +718,21 @@ addtimer(CALLBACK(src, PROC_REF(after_mutation), message), 0.5 SECONDS) /obj/machinery/hydroponics/proc/mutateweed() // If the weeds gets the mutagent instead. Mind you, this pretty much destroys the old plant - if( weedlevel > 5 ) - set_seed(null) - var/newWeed = pick(/obj/item/seeds/liberty, /obj/item/seeds/angel, /obj/item/seeds/nettle/death, /obj/item/seeds/kudzu) - set_seed(new newWeed(src)) - hardmutate() - set_plant_health(myseed.endurance, update_icon = FALSE) - lastcycle = world.time - set_weedlevel(0, update_icon = FALSE) // Reset + if(weedlevel <= 5) + visible_message(span_warning("The few weeds in [src] seem to react, but only for a moment...")) + return + + set_seed(null) + var/newWeed = pick(/obj/item/seeds/liberty, /obj/item/seeds/angel, /obj/item/seeds/nettle/death, /obj/item/seeds/kudzu) + set_seed(new newWeed(src)) + hardmutate() + set_plant_health(myseed.endurance, update_icon = FALSE) + lastcycle = world.time + set_weedlevel(0, update_icon = FALSE) // Reset + + var/message = span_warning("The mutated weeds in [src] spawn some [myseed.plantname]!") + addtimer(CALLBACK(src, PROC_REF(after_mutation), message), 0.5 SECONDS) - var/message = span_warning("The mutated weeds in [src] spawn some [myseed.plantname]!") - addtimer(CALLBACK(src, PROC_REF(after_mutation), message), 0.5 SECONDS) - else - to_chat(usr, span_warning("The few weeds in [src] seem to react, but only for a moment...")) /** * Called after plant mutation, update the appearance of the tray content and send a visible_message() */ @@ -785,14 +792,18 @@ * When a tray is mutated with high pest values, it will spawn spiders. * * User - Person who last added chemicals to the tray for logging purposes. */ -/obj/machinery/hydroponics/proc/mutatepest(mob/user) - if(pestlevel > 5) +/obj/machinery/hydroponics/proc/mutatepest() + if(pestlevel <= 5) + visible_message(span_warning("The pests seem to behave oddly in [src], but quickly settle down...")) + return + + var/mob/user = lastuser?.resolve() + if(!isnull(user)) message_admins("[ADMIN_LOOKUPFLW(user)] last altered a hydro tray's contents which spawned spiderlings.") user.log_message("last altered a hydro tray, which spiderlings spawned from.", LOG_GAME) - visible_message(span_warning("The pests seem to behave oddly...")) - spawn_atom_to_turf(/mob/living/basic/spider/growing/spiderling/hunter, src, 3, FALSE) - else if(myseed) - visible_message(span_warning("The pests seem to behave oddly in [myseed.name] tray, but quickly settle down...")) + + visible_message(span_warning("The pests seem to behave oddly...")) + spawn_atom_to_turf(/mob/living/basic/spider/growing/spiderling/hunter, src, 3, FALSE) /obj/machinery/hydroponics/wrench_act(mob/living/user, obj/item/tool) . = ..() diff --git a/code/modules/hydroponics/hydroponics_chemreact.dm b/code/modules/hydroponics/hydroponics_chemreact.dm index 0af7c258f8f..8e10cbb04dc 100644 --- a/code/modules/hydroponics/hydroponics_chemreact.dm +++ b/code/modules/hydroponics/hydroponics_chemreact.dm @@ -26,22 +26,32 @@ src.reagents.add_reagent(reagent.type, reagents[reagent]) update_appearance() -/obj/machinery/hydroponics/proc/mutation_roll(mob/user) - switch(rand(100)) - if(91 to 100) - adjust_plant_health(-10) +/// Called when a radioactive reagent is applied to the tray +/obj/machinery/hydroponics/proc/radioactive_exposure(modifier = 1) + if(isnull(myseed)) + return + + if(prob(min(75, 25 * modifier))) + myseed.adjust_instability(round(2 * modifier)) + adjust_toxic(round(1.5 * modifier)) // It is still toxic, mind you + return + + switch(rand(0, 50)) + if(41 to 50) + adjust_plant_health(round(-5 * modifier)) visible_message(span_warning("\The [myseed.plantname] starts to wilt and burn!")) - return - if(41 to 90) - if(myseed && !self_sustaining) //Stability - myseed.adjust_instability(5) - return + if(21 to 40) visible_message(span_notice("\The [myseed.plantname] appears unusually reactive...")) - return + if(11 to 20) - mutateweed() - return + if(modifier >= 0.5) + mutateweed() + else + adjust_weedlevel(max(1, round(modifier))) + if(0 to 10) - mutatepest(user) - return + if(modifier >= 0.5) + mutatepest() + else + adjust_pestlevel(max(1, round(modifier))) diff --git a/code/modules/hydroponics/plant_genes.dm b/code/modules/hydroponics/plant_genes.dm index 4437353b1d3..0844708b3ff 100644 --- a/code/modules/hydroponics/plant_genes.dm +++ b/code/modules/hydroponics/plant_genes.dm @@ -958,6 +958,13 @@ if(istype(grown_plant)) grown_plant.preserved_food = TRUE +/// Ignores tox damage +/datum/plant_gene/trait/tox_resistance + name = "Toxin Resistance" + description = "It is immune to the negative effects of a toxic environment." + icon = FA_ICON_SKULL_CROSSBONES + mutability_flags = PLANT_GENE_REMOVABLE | PLANT_GENE_MUTATABLE | PLANT_GENE_GRAFTABLE + /datum/plant_gene/trait/carnivory name = "Obligate Carnivory" description = "Pests have positive effect on the plant health." @@ -981,6 +988,12 @@ description = "It is a mushroom that needs no water, less light and can't be overtaken by weeds." icon = FA_ICON_DROPLET_SLASH +/// A plant that thrives in toxic environments. +/datum/plant_gene/trait/plant_type/toxin_adaptation + name = "Toxin Adaptation" + description = "It is a toxic plant that thrives in poisonous environments." + icon = FA_ICON_SKULL_CROSSBONES + /// Currently unused and does nothing. Appears in strange seeds. /datum/plant_gene/trait/plant_type/alien_properties name ="?????" @@ -1002,4 +1015,3 @@ description = "A plant that needs the firm embrace of soil to develop properly, produces small irregular produce when grown hydroponically." icon = FA_ICON_MOUND mutability_flags = PLANT_GENE_REMOVABLE | PLANT_GENE_MUTATABLE | PLANT_GENE_GRAFTABLE - diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm index 5354662a390..c5357772f04 100644 --- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm @@ -60,7 +60,7 @@ if(33 to 65) mytray.mutateweed() if(1 to 32) - mytray.mutatepest(user) + mytray.mutatepest() else if(prob(20)) mytray.visible_message(span_warning("Nothing happens...")) diff --git a/code/modules/reagents/chemistry/reagents/other_reagents.dm b/code/modules/reagents/chemistry/reagents/other_reagents.dm index e55e1b33b32..70685934419 100644 --- a/code/modules/reagents/chemistry/reagents/other_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/other_reagents.dm @@ -1205,9 +1205,9 @@ //Mutagenic chem side-effects. /datum/reagent/uranium/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) - mytray.mutation_roll(user) - mytray.adjust_plant_health(-round(volume)) - mytray.adjust_toxic(round(volume / tox_damage)) // more damage = more + mytray.radioactive_exposure(modifier = volume * 0.1) + mytray.myseed?.adjust_instability(round(volume * 0.1)) + mytray.adjust_toxic(round(0.5 * volume * tox_damage)) /datum/reagent/uranium/radium name = "Radium" diff --git a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm index 0d6988abb69..944fcac731f 100644 --- a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm @@ -71,8 +71,8 @@ return UPDATE_MOB_HEALTH /datum/reagent/toxin/mutagen/on_hydroponics_apply(obj/machinery/hydroponics/mytray, mob/user) - mytray.mutation_roll(user) - mytray.adjust_toxic(3) //It is still toxic, mind you, but not to the same degree. + mytray.radioactive_exposure(modifier = volume * 0.1) + mytray.myseed?.adjust_instability(round(volume * 0.2)) /datum/reagent/toxin/mutagen/used_on_fish(obj/item/fish/fish) ADD_TRAIT(fish, TRAIT_FISH_MUTAGENIC, type)