diff --git a/Content.Server/Bed/Cryostorage/CryostorageSystem.cs b/Content.Server/Bed/Cryostorage/CryostorageSystem.cs index 7f1e1932b378..a3d52a76fdbd 100644 --- a/Content.Server/Bed/Cryostorage/CryostorageSystem.cs +++ b/Content.Server/Bed/Cryostorage/CryostorageSystem.cs @@ -59,6 +59,7 @@ public override void Initialize() SubscribeLocalEvent(OnBeforeUIOpened); SubscribeLocalEvent(OnRemoveItemBuiMessage); + SubscribeLocalEvent(OnCryopodLeaveAction); SubscribeLocalEvent(OnPlayerSpawned); SubscribeLocalEvent(OnMindRemoved); @@ -373,4 +374,11 @@ public override void Update(float frameTime) return null; } // end 220 cryo department record + // start 220 cryo action + public void OnCryopodLeaveAction(Entity ent, ref CryopodGhostActionEvent args) + { + if (TryComp(args.Performer, out var contained)) + contained.GracePeriodEndTime = Timing.CurTime; + } + // start 220 cryo action } diff --git a/Content.Server/SS220/TeleportAFKtoCryoSystem/TeleportAFKtoCryoSystem.cs b/Content.Server/SS220/TeleportAFKtoCryoSystem/TeleportAFKtoCryoSystem.cs index d15c4ac91c3b..e5f388d159d9 100644 --- a/Content.Server/SS220/TeleportAFKtoCryoSystem/TeleportAFKtoCryoSystem.cs +++ b/Content.Server/SS220/TeleportAFKtoCryoSystem/TeleportAFKtoCryoSystem.cs @@ -143,7 +143,7 @@ private bool TryTeleportToCryo(EntityUid target, EntityUid cryopodUid, string te if (TryComp(portal, out var ambientSoundComponent)) _audioSystem.PlayPvs(ambientSoundComponent.Sound, portal); - var doAfterArgs = new DoAfterArgs(EntityManager, target, TimeSpan.FromSeconds(4f), + var doAfterArgs = new DoAfterArgs(EntityManager, target, TimeSpan.FromSeconds(4), new TeleportToCryoFinished(GetNetEntity(portal)), cryopodUid) { BreakOnDamage = false, @@ -170,7 +170,7 @@ private void HandleTeleportFinished(Entity ent, ref Telepo } if (TryComp(args.User, out var contained)) - contained.GracePeriodEndTime = _gameTiming.CurTime + TimeSpan.FromSeconds(5f); + contained.GracePeriodEndTime = _gameTiming.CurTime + TimeSpan.FromSeconds(1); var portalEntity = GetEntity(args.PortalId); diff --git a/Content.Shared/Bed/Cryostorage/CryostorageComponent.cs b/Content.Shared/Bed/Cryostorage/CryostorageComponent.cs index c6d1d5cb7aa5..1d6276fce2a4 100644 --- a/Content.Shared/Bed/Cryostorage/CryostorageComponent.cs +++ b/Content.Shared/Bed/Cryostorage/CryostorageComponent.cs @@ -1,6 +1,7 @@ using Robust.Shared.Audio; using Robust.Shared.GameStates; using Robust.Shared.Serialization; +using Robust.Shared.Prototypes; namespace Content.Shared.Bed.Cryostorage; @@ -41,13 +42,24 @@ public sealed partial class CryostorageComponent : Component /// [DataField] public SoundSpecifier? RemoveSound = new SoundPathSpecifier("/Audio/Effects/teleport_departure.ogg"); - // start 220 teleport to cryo + + // start 220 cryo + /// - /// ID of teleport portal, that will spawn on TryTeleportToCryo + /// ProtoId of teleport portal, that will spawn on TryTeleportToCryo /// [DataField, ViewVariables(VVAccess.ReadWrite)] - public string TeleportPortralID = "CryoStoragePortal"; - // end 220 teleport to cryo + public EntProtoId TeleportPortralID = "CryoStoragePortal"; + + /// + /// ProtoId of ghost action + /// + [DataField] + public EntProtoId LeaveActionID = "ActionCryoGhost"; + + [DataField] + public EntityUid? LeaveActionUid; + // end 220 cryo } [Serializable, NetSerializable] diff --git a/Content.Shared/Bed/Cryostorage/SharedCryostorageSystem.cs b/Content.Shared/Bed/Cryostorage/SharedCryostorageSystem.cs index c3fa21e293e2..d952f7e130fb 100644 --- a/Content.Shared/Bed/Cryostorage/SharedCryostorageSystem.cs +++ b/Content.Shared/Bed/Cryostorage/SharedCryostorageSystem.cs @@ -9,6 +9,7 @@ using Robust.Shared.Containers; using Robust.Shared.Map; using Robust.Shared.Timing; +using Content.Shared.Actions; namespace Content.Shared.Bed.Cryostorage; @@ -24,6 +25,7 @@ public abstract class SharedCryostorageSystem : EntitySystem [Dependency] private readonly SharedAppearanceSystem _appearance = default!; [Dependency] protected readonly SharedMindSystem Mind = default!; [Dependency] private readonly MobStateSystem _mobState = default!; + [Dependency] private readonly SharedActionsSystem _actionsSystem = default!; protected EntityUid? PausedMap { get; private set; } @@ -53,7 +55,7 @@ private void OnCvarChanged(bool value) protected virtual void OnInsertedContainer(Entity ent, ref EntInsertedIntoContainerMessage args) { - var (_, comp) = ent; + var (uid, comp) = ent; if (args.Container.ID != comp.ContainerId) return; @@ -62,6 +64,7 @@ protected virtual void OnInsertedContainer(Entity ent, ref return; var containedComp = EnsureComp(args.Entity); + _actionsSystem.AddAction(args.Entity, ref comp.LeaveActionUid, comp.LeaveActionID, uid); // 220 cryo action var delay = Mind.TryGetMind(args.Entity, out _, out _) ? comp.GracePeriod : comp.NoMindGracePeriod; containedComp.GracePeriodEndTime = Timing.CurTime + delay; containedComp.Cryostorage = ent; @@ -73,7 +76,10 @@ private void OnRemovedContainer(Entity ent, ref EntRemoved var (_, comp) = ent; if (args.Container.ID != comp.ContainerId) return; - + // start 220 cryo action + if (comp.LeaveActionUid != null) + _actionsSystem.RemoveAction(args.Entity, comp.LeaveActionUid.Value); + // end 220 cryo action _appearance.SetData(ent, CryostorageVisuals.Full, args.Container.ContainedEntities.Count > 0); } @@ -178,3 +184,5 @@ public bool IsInPausedMap(Entity entity) return comp.MapUid != null && comp.MapUid == PausedMap; } } + + diff --git a/Content.Shared/SS220/Cryo/CryoAction.cs b/Content.Shared/SS220/Cryo/CryoAction.cs new file mode 100644 index 000000000000..2d1141265bb3 --- /dev/null +++ b/Content.Shared/SS220/Cryo/CryoAction.cs @@ -0,0 +1,5 @@ +using Content.Shared.Actions; + +public sealed partial class CryopodGhostActionEvent : InstantActionEvent +{ +} diff --git a/Resources/Locale/ru-RU/actions/actions/cryopodSSD.ftl b/Resources/Locale/ru-RU/actions/actions/cryopodSSD.ftl deleted file mode 100644 index a0f1feca9732..000000000000 --- a/Resources/Locale/ru-RU/actions/actions/cryopodSSD.ftl +++ /dev/null @@ -1,2 +0,0 @@ -action-name-cryopodSSDLeave = Уйти в крио хранилище -action-desc-cryopodSSDLeave = Вы переходите в наблюдатели без возможности вернуться к своему персонажу. \ No newline at end of file diff --git a/Resources/Locale/ru-RU/ss220/actions/cryopod.ftl b/Resources/Locale/ru-RU/ss220/actions/cryopod.ftl new file mode 100644 index 000000000000..57312ea2841c --- /dev/null +++ b/Resources/Locale/ru-RU/ss220/actions/cryopod.ftl @@ -0,0 +1,2 @@ +action-name-cryo-ghost = Уйти в крио хранилище +action-desc-cryo-ghost = Вы переходите в наблюдатели без возможности вернуться к своему персонажу. diff --git a/Resources/Prototypes/SS220/CryopodSSD/CryopodSSD.yml b/Resources/Prototypes/SS220/CryopodSSD/cryo.yml similarity index 69% rename from Resources/Prototypes/SS220/CryopodSSD/CryopodSSD.yml rename to Resources/Prototypes/SS220/CryopodSSD/cryo.yml index 9b4e6322e9f3..b1d9ca07b238 100644 --- a/Resources/Prototypes/SS220/CryopodSSD/CryopodSSD.yml +++ b/Resources/Prototypes/SS220/CryopodSSD/cryo.yml @@ -16,3 +16,13 @@ - type: AmbientSound enabled: false sound: /Audio/Effects/teleport_departure.ogg + +- type: entity + id: ActionCryoGhost + name: action-name-cryo-ghost + description: action-desc-cryo-ghost + noSpawn: true + components: + - type: InstantAction + checkCanInteract: false + event: !type:CryopodGhostActionEvent