AnomalyGeneratorComponent.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using Content.Shared.Anomaly;
  2. using Content.Shared.Materials;
  3. using Content.Shared.Radio;
  4. using Robust.Shared.Audio;
  5. using Robust.Shared.Prototypes;
  6. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
  7. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
  8. namespace Content.Server.Anomaly.Components;
  9. /// <summary>
  10. /// This is used for a machine that is able to generate
  11. /// anomalies randomly on the station.
  12. /// </summary>
  13. [RegisterComponent, Access(typeof(SharedAnomalySystem)), AutoGenerateComponentPause]
  14. public sealed partial class AnomalyGeneratorComponent : Component
  15. {
  16. /// <summary>
  17. /// The time at which the cooldown for generating another anomaly will be over
  18. /// </summary>
  19. [DataField("cooldownEndTime", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)]
  20. [AutoPausedField]
  21. public TimeSpan CooldownEndTime = TimeSpan.Zero;
  22. /// <summary>
  23. /// The cooldown between generating anomalies.
  24. /// </summary>
  25. [DataField("cooldownLength"), ViewVariables(VVAccess.ReadWrite)]
  26. public TimeSpan CooldownLength = TimeSpan.FromMinutes(5);
  27. /// <summary>
  28. /// How long it takes to generate an anomaly after pushing the button.
  29. /// </summary>
  30. [DataField("generationLength"), ViewVariables(VVAccess.ReadWrite)]
  31. public TimeSpan GenerationLength = TimeSpan.FromSeconds(8);
  32. /// <summary>
  33. /// The material needed to generate an anomaly
  34. /// </summary>
  35. [DataField("requiredMaterial", customTypeSerializer: typeof(PrototypeIdSerializer<MaterialPrototype>)), ViewVariables(VVAccess.ReadWrite)]
  36. public string RequiredMaterial = "Plasma";
  37. /// <summary>
  38. /// The amount of material needed to generate a single anomaly
  39. /// </summary>
  40. [DataField("materialPerAnomaly"), ViewVariables(VVAccess.ReadWrite)]
  41. public int MaterialPerAnomaly = 1500; // a bit less than a stack of plasma
  42. /// <summary>
  43. /// The random anomaly spawner entity
  44. /// </summary>
  45. [DataField("spawnerPrototype", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>)), ViewVariables(VVAccess.ReadWrite)]
  46. public string SpawnerPrototype = "RandomAnomalySpawner";
  47. /// <summary>
  48. /// The radio channel for science
  49. /// </summary>
  50. [DataField("scienceChannel", customTypeSerializer: typeof(PrototypeIdSerializer<RadioChannelPrototype>))]
  51. public string ScienceChannel = "Common";
  52. /// <summary>
  53. /// The sound looped while an anomaly generates
  54. /// </summary>
  55. [DataField("generatingSound")]
  56. public SoundSpecifier? GeneratingSound;
  57. /// <summary>
  58. /// Sound played on generation completion.
  59. /// </summary>
  60. [DataField("generatingFinishedSound")]
  61. public SoundSpecifier? GeneratingFinishedSound;
  62. }