1
0

ToolOpenableComponent.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using Robust.Shared.Prototypes;
  2. using Robust.Shared.GameStates;
  3. using Content.Shared.DoAfter;
  4. using Robust.Shared.Serialization;
  5. namespace Content.Shared.Tools.Components
  6. {
  7. /// <summary>
  8. /// Logic for using tools (Or verbs) to open / close something on an entity.
  9. /// </summary>
  10. [RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
  11. public sealed partial class ToolOpenableComponent : Component
  12. {
  13. /// <summary>
  14. /// Is the openable part open or closed?
  15. /// </summary>
  16. [DataField, AutoNetworkedField]
  17. public bool IsOpen = false;
  18. /// <summary>
  19. /// If a tool is needed to open the entity, this time will be used.
  20. /// </summary>
  21. [DataField]
  22. public float OpenTime = 1f;
  23. /// <summary>
  24. /// If a tool is needed to close the entity, this time will be used.
  25. /// </summary>
  26. [DataField]
  27. public float CloseTime = 1f;
  28. /// <summary>
  29. /// What type of tool quality is needed to open this?
  30. /// If null, the it will only be openable by a verb.
  31. /// </summary>
  32. [DataField]
  33. public ProtoId<ToolQualityPrototype>? OpenToolQualityNeeded;
  34. /// <summary>
  35. /// What type of tool quality is needed to close this.
  36. /// If null, this will only be closable by a verb.
  37. /// </summary>
  38. [DataField]
  39. public ProtoId<ToolQualityPrototype>? CloseToolQualityNeeded;
  40. /// <summary>
  41. /// If true, verbs will appear to help interact with opening / closing.
  42. /// </summary>
  43. [DataField, AutoNetworkedField]
  44. public bool HasVerbs = true;
  45. /// <summary>
  46. /// The name of what is being open and closed.
  47. /// E.g toilet lid, pannel, compartment.
  48. /// </summary>
  49. [DataField, AutoNetworkedField]
  50. public string? Name;
  51. }
  52. /// <summary>
  53. /// Simple do after event for opening or closing.
  54. /// </summary>
  55. [Serializable, NetSerializable]
  56. public sealed partial class ToolOpenableDoAfterEventToggleOpen : SimpleDoAfterEvent
  57. {
  58. }
  59. /// <summary>
  60. /// Visualizers for handling stash open closed state if stash has door.
  61. /// </summary>
  62. [Serializable, NetSerializable]
  63. public enum ToolOpenableVisuals : byte
  64. {
  65. ToolOpenableVisualState,
  66. }
  67. [Serializable, NetSerializable]
  68. public enum ToolOpenableVisualState : byte
  69. {
  70. Open,
  71. Closed
  72. }
  73. }