PlantAdjustPotency.cs 883 B

12345678910111213141516171819202122232425262728
  1. using Content.Server.Botany.Systems;
  2. using Content.Shared.EntityEffects;
  3. namespace Content.Server.EntityEffects.Effects.PlantMetabolism;
  4. /// <summary>
  5. /// Handles increase or decrease of plant potency.
  6. /// </summary>
  7. public sealed partial class PlantAdjustPotency : PlantAdjustAttribute
  8. {
  9. public override string GuidebookAttributeName { get; set; } = "plant-attribute-potency";
  10. public override void Effect(EntityEffectBaseArgs args)
  11. {
  12. if (!CanMetabolize(args.TargetEntity, out var plantHolderComp, args.EntityManager))
  13. return;
  14. if (plantHolderComp.Seed == null)
  15. return;
  16. var plantHolder = args.EntityManager.System<PlantHolderSystem>();
  17. plantHolder.EnsureUniqueSeed(args.TargetEntity, plantHolderComp);
  18. plantHolderComp.Seed.Potency = Math.Max(plantHolderComp.Seed.Potency + Amount, 1);
  19. }
  20. }