HandTeleporterComponent.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using Content.Shared.DoAfter;
  2. using Robust.Shared.Audio;
  3. using Robust.Shared.GameStates;
  4. using Robust.Shared.Prototypes;
  5. using Robust.Shared.Serialization;
  6. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
  7. namespace Content.Shared.Teleportation.Components;
  8. /// <summary>
  9. /// Creates portals. If two are created, both are linked together--otherwise the first teleports randomly.
  10. /// Using it with both portals active deactivates both.
  11. /// </summary>
  12. [RegisterComponent, NetworkedComponent]
  13. public sealed partial class HandTeleporterComponent : Component
  14. {
  15. [ViewVariables, DataField("firstPortal")]
  16. public EntityUid? FirstPortal = null;
  17. [ViewVariables, DataField("secondPortal")]
  18. public EntityUid? SecondPortal = null;
  19. /// <summary>
  20. /// Portals can't be placed on different grids?
  21. /// </summary>
  22. [DataField]
  23. public bool AllowPortalsOnDifferentGrids;
  24. [DataField("firstPortalPrototype", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
  25. public string FirstPortalPrototype = "PortalRed";
  26. [DataField("secondPortalPrototype", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
  27. public string SecondPortalPrototype = "PortalBlue";
  28. [DataField("newPortalSound")] public SoundSpecifier NewPortalSound =
  29. new SoundPathSpecifier("/Audio/Machines/high_tech_confirm.ogg")
  30. {
  31. Params = AudioParams.Default.WithVolume(-2f)
  32. };
  33. [DataField("clearPortalsSound")]
  34. public SoundSpecifier ClearPortalsSound = new SoundPathSpecifier("/Audio/Machines/button.ogg");
  35. /// <summary>
  36. /// Delay for creating the portals in seconds.
  37. /// </summary>
  38. [DataField("portalCreationDelay")]
  39. public float PortalCreationDelay = 1.0f;
  40. }
  41. [Serializable, NetSerializable]
  42. public sealed partial class TeleporterDoAfterEvent : SimpleDoAfterEvent
  43. {
  44. }