Have medical scanners and cloning pods be 'climbed upon' on exit. (#5408)
This commit is contained in:
@@ -27,6 +27,14 @@ namespace Content.Server.Climbing
|
||||
SubscribeLocalEvent<ClimbableComponent, GetAlternativeVerbsEvent>(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())
|
||||
|
||||
@@ -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<ClimbSystem>().UnsetTransitionBoolAfterBufferTime(OwnerUid, this);
|
||||
}
|
||||
|
||||
public void Update()
|
||||
|
||||
@@ -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<ClimbSystem>().ForciblySetClimbing(entity.Uid);
|
||||
}
|
||||
|
||||
public void UpdateStatus(CloningPodStatus status)
|
||||
|
||||
@@ -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<ClimbSystem>().ForciblySetClimbing(containedEntity.Uid);
|
||||
}
|
||||
|
||||
public void Update(float frameTime)
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Content.Shared.Climbing
|
||||
/// <summary>
|
||||
/// We'll launch the mob onto the table and give them at least this amount of time to be on it.
|
||||
/// </summary>
|
||||
protected const float BufferTime = 0.3f;
|
||||
public const float BufferTime = 0.3f;
|
||||
|
||||
public virtual bool IsClimbing
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user