1
0

SwapTeleporterComponent.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using Content.Shared.Teleportation.Systems;
  2. using Content.Shared.Whitelist;
  3. using Robust.Shared.Audio;
  4. using Robust.Shared.GameStates;
  5. using Robust.Shared.Serialization;
  6. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
  7. namespace Content.Shared.Teleportation.Components;
  8. /// <summary>
  9. /// This is used for an entity that, when linked to another valid entity, allows the two to swap positions,
  10. /// additionally swapping the positions of the parents.
  11. /// </summary>
  12. [RegisterComponent, NetworkedComponent, AutoGenerateComponentState, AutoGenerateComponentPause]
  13. [Access(typeof(SwapTeleporterSystem))]
  14. public sealed partial class SwapTeleporterComponent : Component
  15. {
  16. /// <summary>
  17. /// The other SwapTeleporterComponent that this one is linked to
  18. /// </summary>
  19. [DataField, AutoNetworkedField]
  20. public EntityUid? LinkedEnt;
  21. /// <summary>
  22. /// the time at which <see cref="TeleportDelay"/> ends and the teleportation occurs
  23. /// </summary>
  24. [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
  25. public TimeSpan? TeleportTime;
  26. /// <summary>
  27. /// Delay after starting the teleport and it occuring.
  28. /// </summary>
  29. [DataField, ViewVariables(VVAccess.ReadWrite)]
  30. public TimeSpan TeleportDelay = TimeSpan.FromSeconds(2.5f);
  31. /// <summary>
  32. /// The time at which <see cref="Cooldown"/> ends and teleportation can occur again.
  33. /// </summary>
  34. [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
  35. [AutoPausedField]
  36. public TimeSpan NextTeleportUse;
  37. /// <summary>
  38. /// A minimum waiting period inbetween teleports.
  39. /// </summary>
  40. [DataField, ViewVariables(VVAccess.ReadWrite)]
  41. public TimeSpan Cooldown = TimeSpan.FromMinutes(5);
  42. /// <summary>
  43. /// Sound played when teleportation begins
  44. /// </summary>
  45. [DataField]
  46. public SoundSpecifier? TeleportSound = new SoundPathSpecifier("/Audio/Weapons/flash.ogg");
  47. /// <summary>
  48. /// A whitelist for what entities are valid for <see cref="LinkedEnt"/>.
  49. /// </summary>
  50. [DataField]
  51. public EntityWhitelist TeleporterWhitelist = new();
  52. }
  53. [Serializable, NetSerializable]
  54. public enum SwapTeleporterVisuals : byte
  55. {
  56. Linked
  57. }