From 294a5a1b6982617b4e26cdec4b3dde45074a4c1e Mon Sep 17 00:00:00 2001 From: drakewill-CRL <46307022+drakewill-CRL@users.noreply.github.com> Date: Tue, 29 Apr 2025 00:45:10 -0400 Subject: [PATCH] Display obvious plant mutations in examine text (#32650) * Effect mutations now display on examine * ChangeSpecies shouldn't stay on the list after running. Name cleanup * EmoGarbage Review - convert description to LocId and add minor logic fix * fix the dastardly yaml --------- Co-authored-by: PraxisMapper Co-authored-by: EmoGarbage404 --- .../Botany/Systems/BotanySystem.Produce.cs | 20 +++++++++++++++++++ .../Botany/Systems/BotanySystem.Seed.cs | 1 + .../Botany/Systems/PlantHolderSystem.cs | 14 +++++++++++++ Content.Shared/Random/RandomPlantMutation.cs | 6 ++++++ Resources/Locale/en-US/plants/mutations.ftl | 7 +++++++ .../Hydroponics/randomMutations.yml | 7 +++++-- 6 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 Resources/Locale/en-US/plants/mutations.ftl diff --git a/Content.Server/Botany/Systems/BotanySystem.Produce.cs b/Content.Server/Botany/Systems/BotanySystem.Produce.cs index 8fdf96f57b..f6f3f99c09 100644 --- a/Content.Server/Botany/Systems/BotanySystem.Produce.cs +++ b/Content.Server/Botany/Systems/BotanySystem.Produce.cs @@ -1,5 +1,6 @@ using Content.Server.Botany.Components; using Content.Shared.EntityEffects; +using Content.Shared.Examine; using Content.Shared.FixedPoint; namespace Content.Server.Botany.Systems; @@ -37,4 +38,23 @@ public sealed partial class BotanySystem solutionContainer.AddReagent(chem, amount); } } + + public void OnProduceExamined(EntityUid uid, ProduceComponent comp, ExaminedEvent args) + { + if (comp.Seed == null) + return; + + using (args.PushGroup(nameof(ProduceComponent))) + { + foreach (var m in comp.Seed.Mutations) + { + // Don't show mutations that have no effect on produce (sentience) + if (!m.AppliesToProduce) + continue; + + if (m.Description != null) + args.PushMarkup(Loc.GetString(m.Description)); + } + } + } } diff --git a/Content.Server/Botany/Systems/BotanySystem.Seed.cs b/Content.Server/Botany/Systems/BotanySystem.Seed.cs index e10414ebe5..fd65c141aa 100644 --- a/Content.Server/Botany/Systems/BotanySystem.Seed.cs +++ b/Content.Server/Botany/Systems/BotanySystem.Seed.cs @@ -36,6 +36,7 @@ public sealed partial class BotanySystem : EntitySystem base.Initialize(); SubscribeLocalEvent(OnExamined); + SubscribeLocalEvent(OnProduceExamined); } public bool TryGetSeed(SeedComponent comp, [NotNullWhen(true)] out SeedData? seed) diff --git a/Content.Server/Botany/Systems/PlantHolderSystem.cs b/Content.Server/Botany/Systems/PlantHolderSystem.cs index 2661ed479c..0686f32097 100644 --- a/Content.Server/Botany/Systems/PlantHolderSystem.cs +++ b/Content.Server/Botany/Systems/PlantHolderSystem.cs @@ -116,6 +116,20 @@ public sealed class PlantHolderSystem : EntitySystem ? "plant-holder-component-plant-old-adjective" : "plant-holder-component-plant-unhealthy-adjective")))); } + + // For future reference, mutations should only appear on examine if they apply to a plant, not to produce. + + if (component.Seed.Ligneous) + args.PushMarkup(Loc.GetString("mutation-plant-ligneous")); + + if (component.Seed.TurnIntoKudzu) + args.PushMarkup(Loc.GetString("mutation-plant-kudzu")); + + if (component.Seed.CanScream) + args.PushMarkup(Loc.GetString("mutation-plant-scream")); + + if (component.Seed.Viable == false) + args.PushMarkup(Loc.GetString("mutation-plant-unviable")); } else { diff --git a/Content.Shared/Random/RandomPlantMutation.cs b/Content.Shared/Random/RandomPlantMutation.cs index d95cf7bf42..7d04aa626d 100644 --- a/Content.Shared/Random/RandomPlantMutation.cs +++ b/Content.Shared/Random/RandomPlantMutation.cs @@ -22,6 +22,12 @@ public sealed partial class RandomPlantMutation [DataField] public string Name = ""; + /// + /// The text to display to players when examining something with this mutation. + /// + [DataField] + public LocId? Description; + /// /// The actual EntityEffect to apply to the target /// diff --git a/Resources/Locale/en-US/plants/mutations.ftl b/Resources/Locale/en-US/plants/mutations.ftl new file mode 100644 index 0000000000..80f4052ce6 --- /dev/null +++ b/Resources/Locale/en-US/plants/mutations.ftl @@ -0,0 +1,7 @@ +mutation-plant-bioluminescent = It glows with a gentle light. +mutation-plant-kudzu = It is growing unusually fast and thin. +mutation-plant-ligneous = It is woody and will need a sharp tool to harvest. +mutation-plant-scream = This plant seems nervous somehow. +mutation-plant-sentient = It seems to be examining its surroundings. +mutation-plant-slippery = It is slick to the touch. +mutation-plant-unviable = It is wilting and sickly. \ No newline at end of file diff --git a/Resources/Prototypes/Hydroponics/randomMutations.yml b/Resources/Prototypes/Hydroponics/randomMutations.yml index f203f84547..1120c38f31 100644 --- a/Resources/Prototypes/Hydroponics/randomMutations.yml +++ b/Resources/Prototypes/Hydroponics/randomMutations.yml @@ -3,15 +3,18 @@ mutations: # disabled until 50 morbillion point lights don't cause the renderer to die #- name: Bioluminescent + # description: mutation-plant-bioluminescent # baseOdds: 0.036 # appliesToPlant: false # effect: !type:Glow - name: Sentient + description: mutation-plant-sentient baseOdds: 0.0072 appliesToProduce: false persists: false effect: !type:MakeSentient # existing effect. - name: Slippery + description: mutation-plant-slippery baseOdds: 0.036 appliesToPlant: false effect: !type:Slipify @@ -150,12 +153,12 @@ persists: false effect: !type:PlantChangeStat targetValue: Seedless - - name: ChangeLigneous + - name: Lignification baseOdds: 0.036 persists: false effect: !type:PlantChangeStat targetValue: Ligneous - - name: ChangeTurnIntoKudzu + - name: Kudzufication baseOdds: 0.036 persists: false effect: !type:PlantChangeStat