AmeShieldIntegrity.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using Content.Server.Ame.Components;
  2. using Content.Shared.Construction;
  3. using JetBrains.Annotations;
  4. using Content.Shared.Examine;
  5. namespace Content.Server.Construction.Conditions;
  6. [UsedImplicitly]
  7. [DataDefinition]
  8. public sealed partial class AmeShieldIntegrity : IGraphCondition
  9. {
  10. [DataField]
  11. public float IntegrityThreshold = 80;
  12. /// <summary>
  13. /// If true, checks for the integrity being above the threshold.
  14. /// if false, checks for it being below.
  15. /// </summary>
  16. [DataField]
  17. public bool CheckAbove = true;
  18. public bool Condition(EntityUid uid, IEntityManager entityManager)
  19. {
  20. if (!entityManager.TryGetComponent<AmeShieldComponent>(uid, out var shield))
  21. return true;
  22. if (CheckAbove)
  23. {
  24. return shield.CoreIntegrity >= IntegrityThreshold;
  25. }
  26. return shield.CoreIntegrity < IntegrityThreshold;
  27. }
  28. public bool DoExamine(ExaminedEvent args)
  29. {
  30. return false;
  31. }
  32. public IEnumerable<ConstructionGuideEntry> GenerateGuideEntry()
  33. {
  34. yield return new ConstructionGuideEntry();
  35. }
  36. }