FaxMachineComponent.cs 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. using Content.Shared.Containers.ItemSlots;
  2. using Content.Shared.Paper;
  3. using Robust.Shared.Audio;
  4. using Robust.Shared.GameStates;
  5. using Robust.Shared.Prototypes;
  6. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
  7. namespace Content.Shared.Fax.Components;
  8. [RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
  9. public sealed partial class FaxMachineComponent : Component
  10. {
  11. /// <summary>
  12. /// Name with which the fax will be visible to others on the network
  13. /// </summary>
  14. [ViewVariables(VVAccess.ReadWrite)]
  15. [DataField("name")]
  16. public string FaxName { get; set; } = "Unknown";
  17. /// <summary>
  18. /// Sprite to use when inserting an object.
  19. /// </summary>
  20. [ViewVariables(VVAccess.ReadWrite)]
  21. [DataField, AutoNetworkedField]
  22. public string InsertingState = "inserting";
  23. /// <summary>
  24. /// Device address of fax in network to which data will be send
  25. /// </summary>
  26. [ViewVariables(VVAccess.ReadWrite)]
  27. [DataField("destinationAddress")]
  28. public string? DestinationFaxAddress { get; set; }
  29. /// <summary>
  30. /// Contains the item to be sent, assumes it's paper...
  31. /// </summary>
  32. [DataField(required: true)]
  33. public ItemSlot PaperSlot = new();
  34. /// <summary>
  35. /// Is fax machine should respond to pings in network
  36. /// This will make it visible to others on the network
  37. /// </summary>
  38. [ViewVariables(VVAccess.ReadWrite)]
  39. [DataField]
  40. public bool ResponsePings { get; set; } = true;
  41. /// <summary>
  42. /// Should admins be notified on message receive
  43. /// </summary>
  44. [ViewVariables(VVAccess.ReadWrite)]
  45. [DataField]
  46. public bool NotifyAdmins { get; set; } = false;
  47. /// <summary>
  48. /// Should that fax receive nuke codes send by admins. Probably should be captain fax only
  49. /// </summary>
  50. [ViewVariables(VVAccess.ReadWrite)]
  51. [DataField]
  52. public bool ReceiveNukeCodes { get; set; } = false;
  53. /// <summary>
  54. /// Sound to play when fax printing new message
  55. /// </summary>
  56. [DataField]
  57. public SoundSpecifier PrintSound = new SoundPathSpecifier("/Audio/Machines/printer.ogg");
  58. /// <summary>
  59. /// Sound to play when fax successfully send message
  60. /// </summary>
  61. [DataField]
  62. public SoundSpecifier SendSound = new SoundPathSpecifier("/Audio/Machines/high_tech_confirm.ogg");
  63. /// <summary>
  64. /// Known faxes in network by address with fax names
  65. /// </summary>
  66. [ViewVariables]
  67. public Dictionary<string, string> KnownFaxes { get; } = new();
  68. /// <summary>
  69. /// Print queue of the incoming message
  70. /// </summary>
  71. [ViewVariables]
  72. [DataField]
  73. public Queue<FaxPrintout> PrintingQueue { get; private set; } = new();
  74. /// <summary>
  75. /// Message sending timeout
  76. /// </summary>
  77. [ViewVariables]
  78. [DataField]
  79. public float SendTimeoutRemaining;
  80. /// <summary>
  81. /// Message sending timeout
  82. /// </summary>
  83. [ViewVariables]
  84. [DataField]
  85. public float SendTimeout = 5f;
  86. /// <summary>
  87. /// Remaining time of inserting animation
  88. /// </summary>
  89. [DataField]
  90. public float InsertingTimeRemaining;
  91. /// <summary>
  92. /// How long the inserting animation will play
  93. /// </summary>
  94. [ViewVariables]
  95. public float InsertionTime = 1.88f; // 0.02 off for correct animation
  96. /// <summary>
  97. /// Remaining time of printing animation
  98. /// </summary>
  99. [DataField]
  100. public float PrintingTimeRemaining;
  101. /// <summary>
  102. /// How long the printing animation will play
  103. /// </summary>
  104. [ViewVariables]
  105. public float PrintingTime = 2.3f;
  106. /// <summary>
  107. /// The prototype ID to use for faxed or copied entities if we can't get one from
  108. /// the paper entity for whatever reason.
  109. /// </summary>
  110. [DataField]
  111. public EntProtoId PrintPaperId = "Paper";
  112. /// <summary>
  113. /// The prototype ID to use for faxed or copied entities if we can't get one from
  114. /// the paper entity for whatever reason of the Office type.
  115. /// </summary>
  116. [DataField]
  117. public EntProtoId PrintOfficePaperId = "PaperOffice";
  118. }
  119. [DataDefinition]
  120. public sealed partial class FaxPrintout
  121. {
  122. [DataField(required: true)]
  123. public string Name { get; private set; } = default!;
  124. [DataField]
  125. public string? Label { get; private set; }
  126. [DataField(required: true)]
  127. public string Content { get; private set; } = default!;
  128. [DataField(customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>), required: true)]
  129. public string PrototypeId { get; private set; } = default!;
  130. [DataField("stampState")]
  131. public string? StampState { get; private set; }
  132. [DataField("stampedBy")]
  133. public List<StampDisplayInfo> StampedBy { get; private set; } = new();
  134. [DataField]
  135. public bool Locked { get; private set; }
  136. private FaxPrintout()
  137. {
  138. }
  139. public FaxPrintout(string content, string name, string? label = null, string? prototypeId = null, string? stampState = null, List<StampDisplayInfo>? stampedBy = null, bool locked = false)
  140. {
  141. Content = content;
  142. Name = name;
  143. Label = label;
  144. PrototypeId = prototypeId ?? "";
  145. StampState = stampState;
  146. StampedBy = stampedBy ?? new List<StampDisplayInfo>();
  147. Locked = locked;
  148. }
  149. }