PlantAdjustNutrition.cs 723 B

123456789101112131415161718192021
  1. using Content.Server.Botany.Systems;
  2. using Content.Shared.EntityEffects;
  3. using JetBrains.Annotations;
  4. namespace Content.Server.EntityEffects.Effects.PlantMetabolism;
  5. [UsedImplicitly]
  6. public sealed partial class PlantAdjustNutrition : PlantAdjustAttribute
  7. {
  8. public override string GuidebookAttributeName { get; set; } = "plant-attribute-nutrition";
  9. public override void Effect(EntityEffectBaseArgs args)
  10. {
  11. if (!CanMetabolize(args.TargetEntity, out var plantHolderComp, args.EntityManager, mustHaveAlivePlant: false))
  12. return;
  13. var plantHolder = args.EntityManager.System<PlantHolderSystem>();
  14. plantHolder.AdjustNutrient(args.TargetEntity, Amount, plantHolderComp);
  15. }
  16. }