using Content.Shared.Botany.Components; using Content.Shared.Botany.Systems; using Content.Shared.Localizations; using Content.Shared.Random; using Robust.Shared.Prototypes; namespace Content.Shared.EntityEffects.Effects.Botany; /// /// Entity effect that mutates the chemicals of a plant. /// /// public sealed partial class PlantMutateChemicalsEntityEffectSystem : EntityEffectSystem { [Dependency] private PlantChemicalsSystem _plantChemicals = default!; protected override void Effect(Entity entity, ref EntityEffectEvent args) { _plantChemicals.MutateRandomChemical(entity.Owner, args.Effect.RandomChemTables); } } /// public sealed partial class PlantMutateChemicals : EntityEffectBase { /// /// Chemical tables from which this mutation can select. /// [DataField(required: true)] public List> RandomChemTables = []; /// public override string EntityEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) { var list = new List(); // If your table doesn't exist, no guidebook for you! foreach (var tableId in RandomChemTables) { if (!prototype.Resolve(tableId, out var table)) continue; foreach (var fill in table.Fills) { foreach (var reagent in fill.Reagents) { if (!prototype.Resolve(reagent, out var reagentPrototype)) continue; list.Add(reagentPrototype.LocalizedName); } } } var names = ContentLocalizationManager.FormatListToOr(list); return Loc.GetString("entity-effect-guidebook-plant-mutate-chemicals", ("chance", Probability), ("name", names)); } }