diff --git a/Content.Server/Climbing/ClimbSystem.cs b/Content.Server/Climbing/ClimbSystem.cs index 27f4291afe..214eb3b3a0 100644 --- a/Content.Server/Climbing/ClimbSystem.cs +++ b/Content.Server/Climbing/ClimbSystem.cs @@ -27,6 +27,14 @@ namespace Content.Server.Climbing SubscribeLocalEvent(AddClimbVerb); } + public void ForciblySetClimbing(EntityUid uid, ClimbingComponent? component = null) + { + if (!Resolve(uid, ref component, false)) + return; + component.IsClimbing = true; + UnsetTransitionBoolAfterBufferTime(uid, component); + } + private void AddClimbVerb(EntityUid uid, ClimbableComponent component, GetAlternativeVerbsEvent args) { if (!args.CanAccess || !args.CanInteract || !_actionBlockerSystem.CanMove(args.User.Uid)) @@ -55,6 +63,17 @@ namespace Content.Server.Climbing _activeClimbers.Remove(climbingComponent); } + public void UnsetTransitionBoolAfterBufferTime(EntityUid uid, ClimbingComponent? component = null) + { + if (!Resolve(uid, ref component, false)) + return; + component.Owner.SpawnTimer((int) (SharedClimbingComponent.BufferTime * 1000), () => + { + if (component.Deleted) return; + component.OwnerIsTransitioning = false; + }); + } + public override void Update(float frameTime) { foreach (var climber in _activeClimbers.ToArray()) diff --git a/Content.Server/Climbing/Components/ClimbingComponent.cs b/Content.Server/Climbing/Components/ClimbingComponent.cs index aab3e2f2c4..f1d43125e9 100644 --- a/Content.Server/Climbing/Components/ClimbingComponent.cs +++ b/Content.Server/Climbing/Components/ClimbingComponent.cs @@ -85,11 +85,7 @@ namespace Content.Server.Climbing.Components Body.ApplyLinearImpulse((to - from).Normalized * velocity * Body.Mass * 5); OwnerIsTransitioning = true; - Owner.SpawnTimer((int) (BufferTime * 1000), () => - { - if (Deleted) return; - OwnerIsTransitioning = false; - }); + EntitySystem.Get().UnsetTransitionBoolAfterBufferTime(OwnerUid, this); } public void Update() diff --git a/Content.Server/Cloning/Components/CloningPodComponent.cs b/Content.Server/Cloning/Components/CloningPodComponent.cs index 0d89351f86..d9faa3d082 100644 --- a/Content.Server/Cloning/Components/CloningPodComponent.cs +++ b/Content.Server/Cloning/Components/CloningPodComponent.cs @@ -1,5 +1,6 @@ using System; using Content.Server.EUI; +using Content.Server.Climbing; using Content.Server.Mind.Components; using Content.Server.Power.Components; using Content.Server.UserInterface; @@ -175,6 +176,7 @@ namespace Content.Server.Cloning.Components CapturedMind = null; CloningProgress = 0f; UpdateStatus(CloningPodStatus.Idle); + EntitySystem.Get().ForciblySetClimbing(entity.Uid); } public void UpdateStatus(CloningPodStatus status) diff --git a/Content.Server/Medical/Components/MedicalScannerComponent.cs b/Content.Server/Medical/Components/MedicalScannerComponent.cs index c3671a565e..413dca3fb8 100644 --- a/Content.Server/Medical/Components/MedicalScannerComponent.cs +++ b/Content.Server/Medical/Components/MedicalScannerComponent.cs @@ -1,4 +1,5 @@ using System; +using Content.Server.Climbing; using Content.Server.Cloning; using Content.Server.Mind.Components; using Content.Server.Power.Components; @@ -34,7 +35,6 @@ namespace Content.Server.Medical.Components public TimeSpan LastInternalOpenAttempt; private ContainerSlot _bodyContainer = default!; - private readonly Vector2 _ejectOffset = new(0f, 0f); [ViewVariables] private bool Powered => !Owner.TryGetComponent(out ApcPowerReceiverComponent? receiver) || receiver.Powered; @@ -177,9 +177,9 @@ namespace Content.Server.Medical.Components var containedEntity = _bodyContainer.ContainedEntity; if (containedEntity == null) return; _bodyContainer.Remove(containedEntity); - containedEntity.Transform.WorldPosition += _ejectOffset; UpdateUserInterface(); UpdateAppearance(); + EntitySystem.Get().ForciblySetClimbing(containedEntity.Uid); } public void Update(float frameTime) diff --git a/Content.Shared/Climbing/SharedClimbingComponent.cs b/Content.Shared/Climbing/SharedClimbingComponent.cs index b799fd7e7c..a9e8458e43 100644 --- a/Content.Shared/Climbing/SharedClimbingComponent.cs +++ b/Content.Shared/Climbing/SharedClimbingComponent.cs @@ -58,7 +58,7 @@ namespace Content.Shared.Climbing /// /// We'll launch the mob onto the table and give them at least this amount of time to be on it. /// - protected const float BufferTime = 0.3f; + public const float BufferTime = 0.3f; public virtual bool IsClimbing { diff --git a/Resources/Prototypes/Entities/Structures/Machines/medical_scanner.yml b/Resources/Prototypes/Entities/Structures/Machines/medical_scanner.yml index facc87125d..ad8e4d966c 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/medical_scanner.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/medical_scanner.yml @@ -14,6 +14,18 @@ map: ["enum.MedicalScannerVisualLayers.Machine"] - state: idle_unlit map: ["enum.MedicalScannerVisualLayers.Terminal"] + - type: Physics + bodyType: Static + fixtures: + - shape: + !type:PhysShapeAabb + bounds: "-0.25,-0.5,0.25,0.5" + mass: 25 + layer: + - SmallImpassable + - Opaque + mask: + - MobMask - type: Construction graph: machine node: machine