SingularityGeneratorComponent.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using Robust.Shared.Prototypes;
  2. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
  3. using Content.Shared.Physics;
  4. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
  5. using Robust.Shared.GameStates;
  6. namespace Content.Shared.Singularity.Components;
  7. [RegisterComponent, AutoGenerateComponentPause, NetworkedComponent, AutoGenerateComponentState]
  8. public sealed partial class SingularityGeneratorComponent : Component
  9. {
  10. /// <summary>
  11. /// The amount of power this generator has accumulated.
  12. /// If you want to set this use <see cref="SingularityGeneratorSystem.SetPower"/>
  13. /// </summary>
  14. [DataField]
  15. public float Power = 0;
  16. /// <summary>
  17. /// The power threshold at which this generator will spawn a singularity.
  18. /// If you want to set this use <see cref="SingularityGeneratorSystem.SetThreshold"/>
  19. /// </summary>
  20. [DataField]
  21. public float Threshold = 16;
  22. /// <summary>
  23. /// Allows the generator to ignore all the failsafe stuff, e.g. when emagged
  24. /// </summary>
  25. [DataField, AutoNetworkedField]
  26. public bool FailsafeDisabled = false;
  27. /// <summary>
  28. /// Maximum distance at which the generator will check for a field at
  29. /// </summary>
  30. [DataField]
  31. public float FailsafeDistance = 16;
  32. /// <summary>
  33. /// The prototype ID used to spawn a singularity.
  34. /// </summary>
  35. [DataField("spawnId", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
  36. public string? SpawnPrototype = "Singularity";
  37. /// <summary>
  38. /// The masks the raycast should not go through
  39. /// </summary>
  40. [DataField]
  41. public int CollisionMask = (int)CollisionGroup.FullTileMask;
  42. /// <summary>
  43. /// Message to use when there's no containment field on cardinal directions
  44. /// </summary>
  45. [DataField]
  46. public LocId ContainmentFailsafeMessage = "comp-generator-failsafe";
  47. /// <summary>
  48. /// For how long the failsafe will cause the generator to stop working and not issue a failsafe warning
  49. /// </summary>
  50. [DataField]
  51. public TimeSpan FailsafeCooldown = TimeSpan.FromSeconds(10);
  52. /// <summary>
  53. /// How long until the generator can issue a failsafe warning again
  54. /// </summary>
  55. [DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
  56. [AutoPausedField]
  57. public TimeSpan NextFailsafe = TimeSpan.Zero;
  58. }