diff --git a/Content.Client/Guidebook/Controls/GuideReagentEmbed.xaml.cs b/Content.Client/Guidebook/Controls/GuideReagentEmbed.xaml.cs index 537494933bc4..e0cd7e6548ab 100644 --- a/Content.Client/Guidebook/Controls/GuideReagentEmbed.xaml.cs +++ b/Content.Client/Guidebook/Controls/GuideReagentEmbed.xaml.cs @@ -128,8 +128,16 @@ private void GenerateControl(ReagentPrototype reagent) continue; var groupLabel = new RichTextLabel(); - groupLabel.SetMarkup(Loc.GetString("guidebook-reagent-effects-metabolism-group-rate", - ("group", _prototype.Index(group).LocalizedName), ("rate", effect.MetabolismRate))); + if (effect.MetabolismRate >= 0) + { + groupLabel.SetMarkup(Loc.GetString("guidebook-reagent-effects-metabolism-group-rate", + ("group", _prototype.Index(group).LocalizedName), ("rate", effect.MetabolismRate))); + } + else + { + groupLabel.SetMarkup(Loc.GetString("guidebook-reagent-effects-metabolism-group-norate", + ("group", _prototype.Index(group).LocalizedName))); + } var descriptionLabel = new RichTextLabel { Margin = new Thickness(25, 0, 10, 0) diff --git a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustAttribute.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustAttribute.cs index f43b4828f932..4ef958ce3e55 100644 --- a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustAttribute.cs +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustAttribute.cs @@ -15,6 +15,18 @@ public abstract partial class PlantAdjustAttribute : ReagentEffect [DataField] public float Prob { get; protected set; } = 1; // = (80); + /// + /// Localisation key for the name of the adjusted attribute. Used for guidebook description. + /// + [DataField] + public string Attribute { get; protected set; } = "missing"; + + /// + /// Whether the attribute in question is a good thing. Used for guidebook description to determine the color of the number. + /// + [DataField] + public bool Positive = true; + /// /// Checks if the plant holder can metabolize the reagent or not. Checks if it has an alive plant by default. /// @@ -40,6 +52,18 @@ public bool CanMetabolize(EntityUid plantHolder, [NotNullWhen(true)] out PlantHo return !(Prob <= 0f) && IoCManager.Resolve().Prob(Prob); } - protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => Loc.GetString("reagent-effect-guidebook-missing", ("chance", Probability)); + protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) + { + string color; + if (Positive ^ Amount < 0.0) + { + color = "green"; + } + else + { + color = "red"; + } + return Loc.GetString("reagent-effect-guidebook-plant-attribute", ("attribute", Loc.GetString(Attribute)), ("amount", Amount.ToString("0.00")), ("colorName", color), ("chance", Probability)); + } } } diff --git a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustHealth.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustHealth.cs index f03464469ebf..7a00f9f49e22 100644 --- a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustHealth.cs +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustHealth.cs @@ -5,6 +5,11 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism { public sealed partial class PlantAdjustHealth : PlantAdjustAttribute { + public PlantAdjustHealth() + { + Attribute = "plant-attribute-health"; + } + public override void Effect(ReagentEffectArgs args) { if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager)) diff --git a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustMutationLevel.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustMutationLevel.cs index 8c8d04765a23..783d4d949303 100644 --- a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustMutationLevel.cs +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustMutationLevel.cs @@ -4,6 +4,11 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism { public sealed partial class PlantAdjustMutationLevel : PlantAdjustAttribute { + public PlantAdjustMutationLevel() + { + Attribute = "plant-attribute-mutation-level"; + } + public override void Effect(ReagentEffectArgs args) { if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager)) diff --git a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustMutationMod.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustMutationMod.cs index af4a00a044e7..3e85638edc43 100644 --- a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustMutationMod.cs +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustMutationMod.cs @@ -6,6 +6,11 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism [UsedImplicitly] public sealed partial class PlantAdjustMutationMod : PlantAdjustAttribute { + public PlantAdjustMutationMod() + { + Attribute = "plant-attribute-mutation-mod"; + } + public override void Effect(ReagentEffectArgs args) { if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager)) diff --git a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustNutrition.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustNutrition.cs index 900121412e84..f44dc9139551 100644 --- a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustNutrition.cs +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustNutrition.cs @@ -7,6 +7,11 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism [UsedImplicitly] public sealed partial class PlantAdjustNutrition : PlantAdjustAttribute { + public PlantAdjustNutrition() + { + Attribute = "plant-attribute-nutrition"; + } + public override void Effect(ReagentEffectArgs args) { if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager, mustHaveAlivePlant: false)) diff --git a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustPests.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustPests.cs index 27729b4b2ca7..daf357d08608 100644 --- a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustPests.cs +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustPests.cs @@ -6,6 +6,12 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism [UsedImplicitly] public sealed partial class PlantAdjustPests : PlantAdjustAttribute { + public PlantAdjustPests() + { + Attribute = "plant-attribute-pests"; + Positive = false; + } + public override void Effect(ReagentEffectArgs args) { if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager)) diff --git a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustToxins.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustToxins.cs index 35130238ad5b..53c998c75eff 100644 --- a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustToxins.cs +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustToxins.cs @@ -6,6 +6,12 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism [UsedImplicitly] public sealed partial class PlantAdjustToxins : PlantAdjustAttribute { + public PlantAdjustToxins() + { + Attribute = "plant-attribute-toxins"; + Positive = false; + } + public override void Effect(ReagentEffectArgs args) { if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager)) diff --git a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustWater.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustWater.cs index 71b4670dc651..54f2f269064f 100644 --- a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustWater.cs +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustWater.cs @@ -7,6 +7,11 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism [UsedImplicitly] public sealed partial class PlantAdjustWater : PlantAdjustAttribute { + public PlantAdjustWater() + { + Attribute = "plant-attribute-water"; + } + public override void Effect(ReagentEffectArgs args) { if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager, mustHaveAlivePlant: false)) diff --git a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustWeeds.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustWeeds.cs index 6184b95adb8e..70243707e3ed 100644 --- a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustWeeds.cs +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAdjustWeeds.cs @@ -6,6 +6,12 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism [UsedImplicitly] public sealed partial class PlantAdjustWeeds : PlantAdjustAttribute { + public PlantAdjustWeeds() + { + Attribute = "plant-attribute-weeds"; + Positive = false; + } + public override void Effect(ReagentEffectArgs args) { if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager)) diff --git a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAffectGrowth.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAffectGrowth.cs index 54ec628fdc93..f12932e9c6d4 100644 --- a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAffectGrowth.cs +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantAffectGrowth.cs @@ -7,6 +7,11 @@ namespace Content.Server.Chemistry.ReagentEffects.PlantMetabolism [UsedImplicitly] public sealed partial class PlantAffectGrowth : PlantAdjustAttribute { + public PlantAffectGrowth() + { + Attribute = "plant-attribute-growth"; + } + public override void Effect(ReagentEffectArgs args) { if (!CanMetabolize(args.SolutionEntity, out var plantHolderComp, args.EntityManager)) diff --git a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantCryoxadone.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantCryoxadone.cs index 83a5f56e5924..55a7e5c97bbe 100644 --- a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantCryoxadone.cs +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantCryoxadone.cs @@ -28,6 +28,6 @@ public override void Effect(ReagentEffectArgs args) plantHolderComp.ForceUpdate = true; } - protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => Loc.GetString("reagent-effect-guidebook-missing", ("chance", Probability)); + protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => Loc.GetString("reagent-effect-guidebook-plant-cryoxadone", ("chance", Probability)); } } diff --git a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantDiethylamine.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantDiethylamine.cs index 23cb436d2f10..c98f0be78cb7 100644 --- a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantDiethylamine.cs +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantDiethylamine.cs @@ -36,6 +36,6 @@ public override void Effect(ReagentEffectArgs args) } } - protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => Loc.GetString("reagent-effect-guidebook-missing", ("chance", Probability)); + protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => Loc.GetString("reagent-effect-guidebook-plant-diethylamine", ("chance", Probability)); } } diff --git a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantPhalanximine.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantPhalanximine.cs index c0640d7fc04c..7aaca63b7dc5 100644 --- a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantPhalanximine.cs +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/PlantPhalanximine.cs @@ -19,6 +19,6 @@ public override void Effect(ReagentEffectArgs args) plantHolderComp.Seed.Viable = true; } - protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => Loc.GetString("reagent-effect-guidebook-missing", ("chance", Probability)); + protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => Loc.GetString("reagent-effect-guidebook-plant-phalanximine", ("chance", Probability)); } } diff --git a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/RobustHarvest.cs b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/RobustHarvest.cs index 990a5a5003f3..4a01cdf51f50 100644 --- a/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/RobustHarvest.cs +++ b/Content.Server/Chemistry/ReagentEffects/PlantMetabolism/RobustHarvest.cs @@ -49,6 +49,6 @@ public override void Effect(ReagentEffectArgs args) } } - protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => Loc.GetString("reagent-effect-guidebook-missing", ("chance", Probability)); + protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => Loc.GetString("reagent-effect-guidebook-plant-robust-harvest", ("seedlesstreshold", PotencySeedlessThreshold), ("limit", PotencyLimit), ("increase", PotencyIncrease), ("chance", Probability)); } } diff --git a/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs b/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs index 6095676b9e0a..d1a1505e9e95 100644 --- a/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs +++ b/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs @@ -201,6 +201,16 @@ public ReagentGuideEntry(ReagentPrototype proto, IPrototypeManager prototype, IE GuideEntries = proto.Metabolisms? .Select(x => (x.Key, x.Value.MakeGuideEntry(prototype, entSys))) .ToDictionary(x => x.Key, x => x.Item2); + if (proto.PlantMetabolisms.Count > 0) + { + if (GuideEntries == null) + GuideEntries = new Dictionary, ReagentEffectsGuideEntry>(); + GuideEntries["PlantMetabolisms"] = new ReagentEffectsGuideEntry(-1.0f, proto.PlantMetabolisms + .Select(x => x.GuidebookEffectDescription(prototype, entSys)) + .Where(x => x is not null) + .Select(x => x!) + .ToArray()); + } } } diff --git a/Resources/Locale/en-US/guidebook/chemistry/core.ftl b/Resources/Locale/en-US/guidebook/chemistry/core.ftl index 5179915e0504..f2404170d09b 100644 --- a/Resources/Locale/en-US/guidebook/chemistry/core.ftl +++ b/Resources/Locale/en-US/guidebook/chemistry/core.ftl @@ -15,6 +15,7 @@ guidebook-reagent-sources-ent-wrapper = [bold]{$name}[/bold] \[1\] guidebook-reagent-sources-gas-wrapper = [bold]{$name} (gas)[/bold] \[1\] guidebook-reagent-effects-header = Effects guidebook-reagent-effects-metabolism-group-rate = [bold]{$group}[/bold] [color=gray]({$rate} units per second)[/color] +guidebook-reagent-effects-metabolism-group-norate = [bold]{$group}[/bold] guidebook-reagent-physical-description = [italic]Seems to be {$description}.[/italic] guidebook-reagent-recipes-mix-info = {$minTemp -> [0] {$hasMax -> diff --git a/Resources/Locale/en-US/guidebook/chemistry/effects.ftl b/Resources/Locale/en-US/guidebook/chemistry/effects.ftl index 5b449cd520a6..5579c95e9df6 100644 --- a/Resources/Locale/en-US/guidebook/chemistry/effects.ftl +++ b/Resources/Locale/en-US/guidebook/chemistry/effects.ftl @@ -339,7 +339,7 @@ reagent-effect-guidebook-innoculate-zombie-infection = *[other] cure } an ongoing zombie infection, and provides immunity to future infections -reagent-effect-guidebook-reduce-rotting = +reagent-effect-guidebook-reduce-rotting = { $chance -> [1] Regenerates *[other] regenerate @@ -350,3 +350,33 @@ reagent-effect-guidebook-missing = [1] Causes *[other] cause } an unknown effect as nobody has written this effect yet + +reagent-effect-guidebook-plant-attribute = + { $chance -> + [1] Adjusts + *[other] adjust + } {$attribute} by [color={$colorName}]{$amount}[/color] + +reagent-effect-guidebook-plant-cryoxadone = + { $chance -> + [1] Ages back + *[other] age back + } the plant, depending on the plant's age and time to grow + +reagent-effect-guidebook-plant-phalanximine = + { $chance -> + [1] Makes + *[other] make + } a plant not viable due to mutation viable again + +reagent-effect-guidebook-plant-diethylamine = + { $chance -> + [1] Increases + *[other] increase + } the plant's lifespan and/or base health with 10% chance for each. + +reagent-effect-guidebook-plant-robust-harvest = + { $chance -> + [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. diff --git a/Resources/Locale/en-US/guidebook/chemistry/plant-attributes.ftl b/Resources/Locale/en-US/guidebook/chemistry/plant-attributes.ftl new file mode 100644 index 000000000000..257522100890 --- /dev/null +++ b/Resources/Locale/en-US/guidebook/chemistry/plant-attributes.ftl @@ -0,0 +1,9 @@ +plant-attribute-growth = age +plant-attribute-water = water level +plant-attribute-weeds = weeds level +plant-attribute-toxins = toxins level +plant-attribute-nutrition = nutrition level +plant-attribute-mutation-level = mutation level +plant-attribute-pests = pests level +plant-attribute-mutation-mod = mutation modifier +plant-attribute-health = health diff --git a/Resources/Locale/en-US/metabolism/metabolism-groups.ftl b/Resources/Locale/en-US/metabolism/metabolism-groups.ftl index 404d0fc78688..b9bd477fbb60 100644 --- a/Resources/Locale/en-US/metabolism/metabolism-groups.ftl +++ b/Resources/Locale/en-US/metabolism/metabolism-groups.ftl @@ -5,3 +5,4 @@ metabolism-group-alcohol = Alcohol metabolism-group-food = Food metabolism-group-drink = Drink metabolism-group-gas = Gas +metabolism-group-plant-metabolisms = Plant Metabolism diff --git a/Resources/Prototypes/Chemistry/metabolism_groups.yml b/Resources/Prototypes/Chemistry/metabolism_groups.yml index b2035671af04..1cc1f19311d7 100644 --- a/Resources/Prototypes/Chemistry/metabolism_groups.yml +++ b/Resources/Prototypes/Chemistry/metabolism_groups.yml @@ -27,3 +27,8 @@ - type: metabolismGroup id: Gas name: metabolism-group-gas + +# Dummy for the guide +- type: metabolismGroup + id: PlantMetabolisms + name: metabolism-group-plant-metabolisms