Reimplement anchor/unanchor delay (#11128)

This commit is contained in:
theashtronaut
2022-09-11 06:30:10 +00:00
committed by GitHub
parent b3c1a1aa19
commit 6f9065a1de
2 changed files with 22 additions and 17 deletions

View File

@@ -20,8 +20,8 @@ namespace Content.Server.Construction
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly ToolSystem _toolSystem = default!;
[Dependency] private readonly PullingSystem _pullingSystem = default!;
[Dependency] private readonly ToolSystem _tool = default!;
[Dependency] private readonly PullingSystem _pulling = default!;
public override void Initialize()
{
@@ -85,7 +85,7 @@ namespace Content.Server.Construction
if (TryComp<SharedPullableComponent>(uid, out var pullable) && pullable.Puller != null)
{
_pullingSystem.TryStopPull(pullable);
_pulling.TryStopPull(pullable);
}
// TODO: Anchoring snaps rn anyway!
@@ -155,6 +155,8 @@ namespace Content.Server.Construction
else
RaiseLocalEvent(uid, (UnanchorAttemptEvent) attempt, false);
anchorable.Delay += attempt.Delay;
if (attempt.Cancelled)
return false;
@@ -192,7 +194,7 @@ namespace Content.Server.Construction
anchorable.CancelToken = new CancellationTokenSource();
_toolSystem.UseTool(usingUid, userUid, uid, 0f, anchorable.Delay, usingTool.Qualities,
_tool.UseTool(usingUid, userUid, uid, 0f, anchorable.Delay, usingTool.Qualities,
new TryAnchorCompletedEvent(), new TryAnchorCancelledEvent(), uid, cancelToken: anchorable.CancelToken.Token);
}
@@ -215,7 +217,7 @@ namespace Content.Server.Construction
anchorable.CancelToken = new CancellationTokenSource();
_toolSystem.UseTool(usingUid, userUid, uid, 0f, anchorable.Delay, usingTool.Qualities,
_tool.UseTool(usingUid, userUid, uid, 0f, anchorable.Delay, usingTool.Qualities,
new TryUnanchorCompletedEvent(), new TryUnanchorCancelledEvent(), uid, cancelToken: anchorable.CancelToken.Token);
}