Have medical scanners and cloning pods be 'climbed upon' on exit. (#5408)

This commit is contained in:
20kdc
2021-11-20 01:03:09 +00:00
committed by GitHub
parent 78dde11bf8
commit 73ca553ad4
6 changed files with 37 additions and 8 deletions

View File

@@ -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())