| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- using Content.Server.Botany.Components;
- using Content.Shared.Atmos;
- using Content.Shared.EntityEffects;
- using Robust.Shared.Prototypes;
- using Robust.Shared.Random;
- using System.Linq;
- namespace Content.Server.EntityEffects.Effects;
- /// <summary>
- /// changes the gases that a plant or produce create.
- /// </summary>
- public sealed partial class PlantMutateExudeGasses : EntityEffect
- {
- [DataField]
- public float MinValue = 0.01f;
- [DataField]
- public float MaxValue = 0.5f;
- public override void Effect(EntityEffectBaseArgs args)
- {
- var plantholder = args.EntityManager.GetComponent<PlantHolderComponent>(args.TargetEntity);
- if (plantholder.Seed == null)
- return;
- var random = IoCManager.Resolve<IRobustRandom>();
- var gasses = plantholder.Seed.ExudeGasses;
- // Add a random amount of a random gas to this gas dictionary
- float amount = random.NextFloat(MinValue, MaxValue);
- Gas gas = random.Pick(Enum.GetValues(typeof(Gas)).Cast<Gas>().ToList());
- if (gasses.ContainsKey(gas))
- {
- gasses[gas] += amount;
- }
- else
- {
- gasses.Add(gas, amount);
- }
- }
- protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
- {
- return "TODO";
- }
- }
- /// <summary>
- /// changes the gases that a plant or produce consumes.
- /// </summary>
- public sealed partial class PlantMutateConsumeGasses : EntityEffect
- {
- [DataField]
- public float MinValue = 0.01f;
- [DataField]
- public float MaxValue = 0.5f;
- public override void Effect(EntityEffectBaseArgs args)
- {
- var plantholder = args.EntityManager.GetComponent<PlantHolderComponent>(args.TargetEntity);
- if (plantholder.Seed == null)
- return;
- var random = IoCManager.Resolve<IRobustRandom>();
- var gasses = plantholder.Seed.ConsumeGasses;
- // Add a random amount of a random gas to this gas dictionary
- float amount = random.NextFloat(MinValue, MaxValue);
- Gas gas = random.Pick(Enum.GetValues(typeof(Gas)).Cast<Gas>().ToList());
- if (gasses.ContainsKey(gas))
- {
- gasses[gas] += amount;
- }
- else
- {
- gasses.Add(gas, amount);
- }
- }
- protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
- {
- return "TODO";
- }
- }
|