diff --git a/Content.Server/EntityEffects/Effects/PlantMetabolism/PlantAdjustPotency.cs b/Content.Server/EntityEffects/Effects/PlantMetabolism/PlantAdjustPotency.cs new file mode 100644 index 0000000000..5776463ce7 --- /dev/null +++ b/Content.Server/EntityEffects/Effects/PlantMetabolism/PlantAdjustPotency.cs @@ -0,0 +1,28 @@ +using Content.Server.Botany.Systems; +using Content.Shared.EntityEffects; + +namespace Content.Server.EntityEffects.Effects.PlantMetabolism; + +/// +/// Handles increase or decrease of plant potency. +/// + +public sealed partial class PlantAdjustPotency : PlantAdjustAttribute +{ + public override string GuidebookAttributeName { get; set; } = "plant-attribute-potency"; + + public override void Effect(EntityEffectBaseArgs args) + { + if (!CanMetabolize(args.TargetEntity, out var plantHolderComp, args.EntityManager)) + return; + + if (plantHolderComp.Seed == null) + return; + + var plantHolder = args.EntityManager.System(); + + plantHolder.EnsureUniqueSeed(args.TargetEntity, plantHolderComp); + + plantHolderComp.Seed.Potency = Math.Max(plantHolderComp.Seed.Potency + Amount, 1); + } +} diff --git a/Content.Server/EntityEffects/Effects/PlantMetabolism/PlantDestroySeeds.cs b/Content.Server/EntityEffects/Effects/PlantMetabolism/PlantDestroySeeds.cs new file mode 100644 index 0000000000..2929bb6ee9 --- /dev/null +++ b/Content.Server/EntityEffects/Effects/PlantMetabolism/PlantDestroySeeds.cs @@ -0,0 +1,42 @@ +using Content.Server.Botany.Components; +using Content.Server.Botany.Systems; +using Content.Shared.EntityEffects; +using Content.Shared.Popups; +using Robust.Shared.Prototypes; + +namespace Content.Server.EntityEffects.Effects.PlantMetabolism; + +/// +/// Handles removal of seeds on a plant. +/// + +public sealed partial class PlantDestroySeeds : EntityEffect +{ + public override void Effect(EntityEffectBaseArgs args) + { + if ( + !args.EntityManager.TryGetComponent(args.TargetEntity, out PlantHolderComponent? plantHolderComp) + || plantHolderComp.Seed == null + || plantHolderComp.Dead + || plantHolderComp.Seed.Immutable + ) + return; + + var plantHolder = args.EntityManager.System(); + var popupSystem = args.EntityManager.System(); + + if (plantHolderComp.Seed.Seedless == false) + { + plantHolder.EnsureUniqueSeed(args.TargetEntity, plantHolderComp); + popupSystem.PopupEntity( + Loc.GetString("botany-plant-seedsdestroyed"), + args.TargetEntity, + PopupType.SmallCaution + ); + plantHolderComp.Seed.Seedless = true; + } + } + + protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => + Loc.GetString("reagent-effect-guidebook-plant-seeds-remove", ("chance", Probability)); +} diff --git a/Content.Server/EntityEffects/Effects/PlantMetabolism/PlantRestoreSeeds.cs b/Content.Server/EntityEffects/Effects/PlantMetabolism/PlantRestoreSeeds.cs new file mode 100644 index 0000000000..11af8d511f --- /dev/null +++ b/Content.Server/EntityEffects/Effects/PlantMetabolism/PlantRestoreSeeds.cs @@ -0,0 +1,38 @@ +using Content.Server.Botany.Components; +using Content.Server.Botany.Systems; +using Content.Shared.EntityEffects; +using Content.Shared.Popups; +using Robust.Shared.Prototypes; + +namespace Content.Server.EntityEffects.Effects.PlantMetabolism; + +/// +/// Handles restoral of seeds on a plant. +/// + +public sealed partial class PlantRestoreSeeds : EntityEffect +{ + public override void Effect(EntityEffectBaseArgs args) + { + if ( + !args.EntityManager.TryGetComponent(args.TargetEntity, out PlantHolderComponent? plantHolderComp) + || plantHolderComp.Seed == null + || plantHolderComp.Dead + || plantHolderComp.Seed.Immutable + ) + return; + + var plantHolder = args.EntityManager.System(); + var popupSystem = args.EntityManager.System(); + + if (plantHolderComp.Seed.Seedless) + { + plantHolder.EnsureUniqueSeed(args.TargetEntity, plantHolderComp); + popupSystem.PopupEntity(Loc.GetString("botany-plant-seedsrestored"), args.TargetEntity); + plantHolderComp.Seed.Seedless = false; + } + } + + protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => + Loc.GetString("reagent-effect-guidebook-plant-seeds-add", ("chance", Probability)); +} diff --git a/Resources/Locale/en-US/botany/seeds.ftl b/Resources/Locale/en-US/botany/seeds.ftl new file mode 100644 index 0000000000..6fdf78a1ad --- /dev/null +++ b/Resources/Locale/en-US/botany/seeds.ftl @@ -0,0 +1,2 @@ +botany-plant-seedsrestored = You can hear the faint sound of shuffling leaves. +botany-plant-seedsdestroyed = The seeds on the plant start cracking and fall off! diff --git a/Resources/Locale/en-US/guidebook/chemistry/effects.ftl b/Resources/Locale/en-US/guidebook/chemistry/effects.ftl index c60e690d26..b65c332346 100644 --- a/Resources/Locale/en-US/guidebook/chemistry/effects.ftl +++ b/Resources/Locale/en-US/guidebook/chemistry/effects.ftl @@ -386,3 +386,15 @@ reagent-effect-guidebook-plant-robust-harvest = [1] Increases *[other] increase } the plant's potency by {$increase} up to a maximum of {$limit}. Causes the plant to lose its seeds once the potency reaches {$seedlesstreshold}. Trying to add potency over {$limit} may cause decrease in yield at a 10% chance + +reagent-effect-guidebook-plant-seeds-add = + { $chance -> + [1] Restores the + *[other] restore the + } seeds of the plant + +reagent-effect-guidebook-plant-seeds-remove = + { $chance -> + [1] Removes the + *[other] remove the + } seeds of the plant diff --git a/Resources/Locale/en-US/guidebook/chemistry/plant-attributes.ftl b/Resources/Locale/en-US/guidebook/chemistry/plant-attributes.ftl index 2575221008..ee82be04ad 100644 --- a/Resources/Locale/en-US/guidebook/chemistry/plant-attributes.ftl +++ b/Resources/Locale/en-US/guidebook/chemistry/plant-attributes.ftl @@ -1,5 +1,6 @@ plant-attribute-growth = age plant-attribute-water = water level +plant-attribute-potency = potency plant-attribute-weeds = weeds level plant-attribute-toxins = toxins level plant-attribute-nutrition = nutrition level diff --git a/Resources/Locale/en-US/reagents/meta/botany.ftl b/Resources/Locale/en-US/reagents/meta/botany.ftl index c7101c2327..36fad2195b 100644 --- a/Resources/Locale/en-US/reagents/meta/botany.ftl +++ b/Resources/Locale/en-US/reagents/meta/botany.ftl @@ -21,3 +21,6 @@ reagent-desc-ammonia = An effective fertilizer, it gives your plants some nutrie reagent-name-diethylamine = diethylamine reagent-desc-diethylamine = A very potent fertilizer, treats plants with nutrients, eliminates pests, and sometimes it can even speed up growth. + +reagent-name-sedin = sedin +reagent-desc-sedin = A modified version of diethylamine that can restore seeds on plants at the cost of potency. diff --git a/Resources/Prototypes/Reagents/botany.yml b/Resources/Prototypes/Reagents/botany.yml index 99e9182103..23d80f0e79 100644 --- a/Resources/Prototypes/Reagents/botany.yml +++ b/Resources/Prototypes/Reagents/botany.yml @@ -155,6 +155,21 @@ - !type:ReagentThreshold min: 80 +- type: reagent + id: Sedin + name: reagent-name-sedin + group: Botanical + desc: reagent-desc-sedin + flavor: bitter + color: "#3CB371" + physicalDesc: reagent-physical-desc-sickly + plantMetabolism: + - !type:PlantAdjustHealth + amount: -2 + - !type:PlantRestoreSeeds + probability: 0.20 + - !type:PlantAdjustPotency + amount: -3 # Match this with current rate of Robust Harvest potency increase - type: reagent id: WeedKiller diff --git a/Resources/Prototypes/Recipes/Reactions/botany.yml b/Resources/Prototypes/Recipes/Reactions/botany.yml index 0e95bd7ad9..1d96de479a 100644 --- a/Resources/Prototypes/Recipes/Reactions/botany.yml +++ b/Resources/Prototypes/Recipes/Reactions/botany.yml @@ -21,6 +21,18 @@ products: RobustHarvest: 1 +- type: reaction + id: Sedin + reactants: + Cryoxadone: + amount: 1 + RobustHarvest: + amount: 3 + Diethylamine: + amount: 3 + products: + Sedin: 1 + - type: reaction id: Left4Zed reactants: