Files
tbd-station-14/Content.Server/Climbing/ClimbSystem.cs
metalgearsloth b2322864e9 Remove IActionBlocker.CanMove (#4449)
* Remove IActionBlocker.CanMove

Ported the remainders over to using MovementAttemptEvent which should also help make mob movement a bit faster.

* Make that check faster
2021-08-09 17:34:01 -07:00

47 lines
1.2 KiB
C#

using System.Collections.Generic;
using System.Linq;
using Content.Server.Climbing.Components;
using Content.Shared.Climbing;
using Content.Shared.GameTicking;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
namespace Content.Server.Climbing
{
[UsedImplicitly]
internal sealed class ClimbSystem : SharedClimbSystem
{
private readonly HashSet<ClimbingComponent> _activeClimbers = new();
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<RoundRestartCleanupEvent>(Reset);
}
public void AddActiveClimber(ClimbingComponent climbingComponent)
{
_activeClimbers.Add(climbingComponent);
}
public void RemoveActiveClimber(ClimbingComponent climbingComponent)
{
_activeClimbers.Remove(climbingComponent);
}
public override void Update(float frameTime)
{
foreach (var climber in _activeClimbers.ToArray())
{
climber.Update();
}
}
public void Reset(RoundRestartCleanupEvent ev)
{
_activeClimbers.Clear();
}
}
}