1
0

MobStateCondition.cs 827 B

1234567891011121314151617181920212223242526272829
  1. using Content.Shared.EntityEffects;
  2. using Content.Shared.Mobs;
  3. using Content.Shared.Mobs.Components;
  4. using Robust.Shared.Prototypes;
  5. namespace Content.Server.EntityEffects.EffectConditions;
  6. public sealed partial class MobStateCondition : EntityEffectCondition
  7. {
  8. [DataField]
  9. public MobState Mobstate = MobState.Alive;
  10. public override bool Condition(EntityEffectBaseArgs args)
  11. {
  12. if (args.EntityManager.TryGetComponent(args.TargetEntity, out MobStateComponent? mobState))
  13. {
  14. if (mobState.CurrentState == Mobstate)
  15. return true;
  16. }
  17. return false;
  18. }
  19. public override string GuidebookExplanation(IPrototypeManager prototype)
  20. {
  21. return Loc.GetString("reagent-effect-condition-guidebook-mob-state-condition", ("state", Mobstate));
  22. }
  23. }