ChemVomit.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. using Content.Server.Medical;
  2. using Content.Shared.EntityEffects;
  3. using JetBrains.Annotations;
  4. using Robust.Shared.Prototypes;
  5. namespace Content.Server.EntityEffects.Effects
  6. {
  7. /// <summary>
  8. /// Forces you to vomit.
  9. /// </summary>
  10. [UsedImplicitly]
  11. public sealed partial class ChemVomit : EntityEffect
  12. {
  13. /// How many units of thirst to add each time we vomit
  14. [DataField]
  15. public float ThirstAmount = -8f;
  16. /// How many units of hunger to add each time we vomit
  17. [DataField]
  18. public float HungerAmount = -8f;
  19. protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
  20. => Loc.GetString("reagent-effect-guidebook-chem-vomit", ("chance", Probability));
  21. public override void Effect(EntityEffectBaseArgs args)
  22. {
  23. if (args is EntityEffectReagentArgs reagentArgs)
  24. if (reagentArgs.Scale != 1f)
  25. return;
  26. var vomitSys = args.EntityManager.EntitySysManager.GetEntitySystem<VomitSystem>();
  27. vomitSys.Vomit(args.TargetEntity, ThirstAmount, HungerAmount);
  28. }
  29. }
  30. }