1
0

AmeControllerComponent.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. using Content.Server.Ame.EntitySystems;
  2. using Content.Shared.Ame.Components;
  3. using Content.Shared.Containers.ItemSlots;
  4. using Robust.Shared.Audio;
  5. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
  6. namespace Content.Server.Ame.Components;
  7. /// <summary>
  8. /// The component used to make an entity the controller/fuel injector port of an AntiMatter Engine.
  9. /// Connects to adjacent entities with this component or <see cref="AmeShieldComponent"/> to make an AME.
  10. /// </summary>
  11. [Access(typeof(AmeControllerSystem), typeof(AmeNodeGroup))]
  12. [RegisterComponent]
  13. public sealed partial class AmeControllerComponent : SharedAmeControllerComponent
  14. {
  15. /// <summary>
  16. /// Antimatter fuel slot.
  17. /// </summary>
  18. [DataField("fuelSlot")]
  19. [ViewVariables(VVAccess.ReadWrite)]
  20. public ItemSlot FuelSlot = new();
  21. /// <summary>
  22. /// Whether or not the AME controller is currently injecting animatter into the reactor.
  23. /// </summary>
  24. [DataField("injecting")]
  25. [ViewVariables(VVAccess.ReadWrite)]
  26. public bool Injecting = false;
  27. /// <summary>
  28. /// How much antimatter the AME controller is set to inject into the reactor per update.
  29. /// </summary>
  30. [DataField("injectionAmount")]
  31. [ViewVariables(VVAccess.ReadWrite)]
  32. public int InjectionAmount = 2;
  33. /// <summary>
  34. /// How stable the reactor currently is.
  35. /// When this falls to <= 0 the reactor explodes.
  36. /// </summary>
  37. [DataField("stability")]
  38. [ViewVariables(VVAccess.ReadWrite)]
  39. public int Stability = 100;
  40. /// <summary>
  41. /// The sound used when pressing buttons in the UI.
  42. /// </summary>
  43. [DataField("clickSound")]
  44. [ViewVariables(VVAccess.ReadWrite)]
  45. public SoundSpecifier ClickSound = new SoundPathSpecifier("/Audio/Machines/machine_switch.ogg");
  46. /// <summary>
  47. /// The sound used when injecting antimatter into the AME.
  48. /// </summary>
  49. [DataField("injectSound")]
  50. [ViewVariables(VVAccess.ReadWrite)]
  51. public SoundSpecifier InjectSound = new SoundPathSpecifier("/Audio/Machines/ame_fuelinjection.ogg");
  52. /// <summary>
  53. /// The last time this could have injected fuel into the AME.
  54. /// </summary>
  55. [DataField("lastUpdate")]
  56. public TimeSpan LastUpdate = default!;
  57. /// <summary>
  58. /// The next time this will try to inject fuel into the AME.
  59. /// </summary>
  60. [DataField("nextUpdate")]
  61. public TimeSpan NextUpdate = default!;
  62. /// <summary>
  63. /// The next time this will try to update the controller UI.
  64. /// </summary>
  65. public TimeSpan NextUIUpdate = default!;
  66. /// <summary>
  67. /// The the amount of time that passes between injection attempts.
  68. /// </summary>
  69. [DataField("updatePeriod")]
  70. [ViewVariables(VVAccess.ReadWrite)]
  71. public TimeSpan UpdatePeriod = TimeSpan.FromSeconds(10.0);
  72. /// <summary>
  73. /// The maximum amount of time that passes between UI updates.
  74. /// </summary>
  75. [ViewVariables]
  76. public TimeSpan UpdateUIPeriod = TimeSpan.FromSeconds(3.0);
  77. /// <summary>
  78. /// Time at which the admin alarm sound effect can next be played.
  79. /// </summary>
  80. [DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
  81. public TimeSpan EffectCooldown;
  82. /// <summary>
  83. /// Time between admin alarm sound effects. Prevents spam
  84. /// </summary>
  85. [DataField]
  86. public TimeSpan CooldownDuration = TimeSpan.FromSeconds(10f);
  87. }