GhostComponent.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. using Content.Shared.Actions;
  2. using Robust.Shared.GameStates;
  3. using Robust.Shared.Prototypes;
  4. namespace Content.Shared.Ghost;
  5. [RegisterComponent, NetworkedComponent, Access(typeof(SharedGhostSystem))]
  6. [AutoGenerateComponentState(true), AutoGenerateComponentPause]
  7. public sealed partial class GhostComponent : Component
  8. {
  9. // Actions
  10. [DataField]
  11. public EntProtoId ToggleLightingAction = "ActionToggleLighting";
  12. [DataField, AutoNetworkedField]
  13. public EntityUid? ToggleLightingActionEntity;
  14. [DataField]
  15. public EntProtoId ToggleFoVAction = "ActionToggleFov";
  16. [DataField, AutoNetworkedField]
  17. public EntityUid? ToggleFoVActionEntity;
  18. [DataField]
  19. public EntProtoId ToggleGhostsAction = "ActionToggleGhosts";
  20. [DataField, AutoNetworkedField]
  21. public EntityUid? ToggleGhostsActionEntity;
  22. [DataField]
  23. public EntProtoId ToggleGhostHearingAction = "ActionToggleGhostHearing";
  24. [DataField]
  25. public EntityUid? ToggleGhostHearingActionEntity;
  26. [DataField]
  27. public EntProtoId BooAction = "ActionGhostBoo";
  28. [DataField, AutoNetworkedField]
  29. public EntityUid? BooActionEntity;
  30. // End actions
  31. [ViewVariables(VVAccess.ReadWrite), DataField, AutoPausedField]
  32. public TimeSpan TimeOfDeath = TimeSpan.Zero;
  33. [DataField("booRadius"), ViewVariables(VVAccess.ReadWrite)]
  34. public float BooRadius = 3;
  35. [DataField("booMaxTargets"), ViewVariables(VVAccess.ReadWrite)]
  36. public int BooMaxTargets = 3;
  37. // TODO: instead of this funny stuff just give it access and update in system dirtying when needed
  38. [ViewVariables(VVAccess.ReadWrite)]
  39. public bool CanGhostInteract
  40. {
  41. get => _canGhostInteract;
  42. set
  43. {
  44. if (_canGhostInteract == value) return;
  45. _canGhostInteract = value;
  46. Dirty();
  47. }
  48. }
  49. [DataField("canInteract"), AutoNetworkedField]
  50. private bool _canGhostInteract;
  51. /// <summary>
  52. /// Changed by <see cref="SharedGhostSystem.SetCanReturnToBody"/>
  53. /// </summary>
  54. // TODO MIRROR change this to use friend classes when thats merged
  55. [ViewVariables(VVAccess.ReadWrite)]
  56. public bool CanReturnToBody
  57. {
  58. get => _canReturnToBody;
  59. set
  60. {
  61. if (_canReturnToBody == value) return;
  62. _canReturnToBody = value;
  63. Dirty();
  64. }
  65. }
  66. /// <summary>
  67. /// Ghost color
  68. /// </summary>
  69. /// <remarks>Used to allow admins to change ghost colors. Should be removed if the capability to edit existing sprite colors is ever added back.</remarks>
  70. [DataField, AutoNetworkedField]
  71. public Color Color = Color.White;
  72. [DataField("canReturnToBody"), AutoNetworkedField]
  73. private bool _canReturnToBody;
  74. }
  75. public sealed partial class ToggleFoVActionEvent : InstantActionEvent { }
  76. public sealed partial class ToggleGhostsActionEvent : InstantActionEvent { }
  77. public sealed partial class ToggleLightingActionEvent : InstantActionEvent { }
  78. public sealed partial class ToggleGhostHearingActionEvent : InstantActionEvent { }
  79. public sealed partial class ToggleGhostVisibilityToAllEvent : InstantActionEvent { }
  80. public sealed partial class BooActionEvent : InstantActionEvent { }