PortalComponent.cs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using Robust.Shared.Audio;
  2. using Robust.Shared.GameStates;
  3. namespace Content.Shared.Teleportation.Components;
  4. /// <summary>
  5. /// Marks an entity as being a 'portal' which teleports entities sent through it to linked entities.
  6. /// Relies on <see cref="LinkedEntityComponent"/> being set up.
  7. /// </summary>
  8. [RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
  9. public sealed partial class PortalComponent : Component
  10. {
  11. /// <summary>
  12. /// Sound played on arriving to this portal, centered on the destination.
  13. /// The arrival sound of the entered portal will play if the destination is not a portal.
  14. /// </summary>
  15. [DataField("arrivalSound")]
  16. public SoundSpecifier ArrivalSound = new SoundPathSpecifier("/Audio/Effects/teleport_arrival.ogg");
  17. /// <summary>
  18. /// Sound played on departing from this portal, centered on the original portal.
  19. /// </summary>
  20. [DataField("departureSound")]
  21. public SoundSpecifier DepartureSound = new SoundPathSpecifier("/Audio/Effects/teleport_departure.ogg");
  22. /// <summary>
  23. /// If no portals are linked, the subject will be teleported a random distance at maximum this far away.
  24. /// </summary>
  25. [DataField("maxRandomRadius"), ViewVariables(VVAccess.ReadWrite)]
  26. public float MaxRandomRadius = 7.0f;
  27. /// <summary>
  28. /// If false, this portal will fail to teleport and fizzle out if attempting to send an entity to a different map
  29. /// </summary>
  30. /// <remarks>
  31. /// Shouldn't be able to teleport people to centcomm or the eshuttle from the station
  32. /// </remarks>
  33. [DataField("canTeleportToOtherMaps"), ViewVariables(VVAccess.ReadWrite)]
  34. public bool CanTeleportToOtherMaps = false;
  35. /// <summary>
  36. /// Maximum distance that portals can teleport to, in all cases. Mostly this matters for linked portals.
  37. /// Null means no restriction on distance.
  38. /// </summary>
  39. /// <remarks>
  40. /// Obviously this should strictly be larger than <see cref="MaxRandomRadius"/> (or null)
  41. /// </remarks>
  42. [DataField("maxTeleportRadius"), ViewVariables(VVAccess.ReadWrite)]
  43. public float? MaxTeleportRadius;
  44. /// <summary>
  45. /// Should we teleport randomly if nothing is linked.
  46. /// </summary>
  47. [DataField, AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)]
  48. public bool RandomTeleport = true;
  49. }