WiresPanelComponent.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. using Content.Shared.Tools;
  2. using Robust.Shared.Audio;
  3. using Robust.Shared.GameStates;
  4. using Robust.Shared.Prototypes;
  5. namespace Content.Shared.Wires;
  6. [NetworkedComponent, RegisterComponent]
  7. [Access(typeof(SharedWiresSystem))]
  8. [AutoGenerateComponentState]
  9. public sealed partial class WiresPanelComponent : Component
  10. {
  11. /// <summary>
  12. /// Is the panel open for this entity's wires?
  13. /// </summary>
  14. [DataField("open")]
  15. [AutoNetworkedField]
  16. public bool Open;
  17. /// <summary>
  18. /// Should this entity's wires panel be visible at all?
  19. /// </summary>
  20. [ViewVariables]
  21. [AutoNetworkedField]
  22. public bool Visible = true;
  23. [DataField("screwdriverOpenSound")]
  24. public SoundSpecifier ScrewdriverOpenSound = new SoundPathSpecifier("/Audio/Machines/screwdriveropen.ogg");
  25. [DataField("screwdriverCloseSound")]
  26. public SoundSpecifier ScrewdriverCloseSound = new SoundPathSpecifier("/Audio/Machines/screwdriverclose.ogg");
  27. /// <summary>
  28. /// Amount of times in seconds it takes to open
  29. /// </summary>
  30. [DataField]
  31. public TimeSpan OpenDelay = TimeSpan.FromSeconds(1);
  32. /// <summary>
  33. /// The tool quality needed to open this panel.
  34. /// </summary>
  35. [DataField]
  36. public ProtoId<ToolQualityPrototype> OpeningTool = "Screwing";
  37. /// <summary>
  38. /// Text showed on examine when the panel is closed.
  39. /// </summary>
  40. /// <returns></returns>
  41. [DataField]
  42. public LocId? ExamineTextClosed = "wires-panel-component-on-examine-closed";
  43. /// <summary>
  44. /// Text showed on examine when the panel is open.
  45. /// </summary>
  46. /// <returns></returns>
  47. [DataField]
  48. public LocId? ExamineTextOpen = "wires-panel-component-on-examine-open";
  49. }
  50. /// <summary>
  51. /// Event raised on a <see cref="WiresPanelComponent"/> before its open state is about to be changed.
  52. /// </summary>
  53. [ByRefEvent]
  54. public record struct AttemptChangePanelEvent(bool Open, EntityUid? User, bool Cancelled = false);
  55. /// <summary>
  56. /// Event raised when a panel is opened or closed.
  57. /// </summary>
  58. [ByRefEvent]
  59. public readonly record struct PanelChangedEvent(bool Open);