Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix anchoring time increasing with each dangerous unwrench #3026

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Content.Shared/Construction/Components/AnchorableComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ public sealed partial class AnchorableComponent : Component
[ViewVariables(VVAccess.ReadWrite)]
[DataField]
public float Delay = 1f;

/// <summary>
/// Frontier: actual delay to use for anchoring.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField]
public float CurrentDelay = 1f;
}

[Flags]
Expand Down
6 changes: 3 additions & 3 deletions Content.Shared/Construction/EntitySystems/AnchorableSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private void TryUnAnchor(EntityUid uid, EntityUid userUid, EntityUid usingUid,
// Log unanchor attempt (server only)
_adminLogger.Add(LogType.Anchor, LogImpact.Low, $"{ToPrettyString(userUid):user} is trying to unanchor {ToPrettyString(uid):entity} from {transform.Coordinates:targetlocation}");

_tool.UseTool(usingUid, userUid, uid, anchorable.Delay, usingTool.Qualities, new TryUnanchorCompletedEvent());
_tool.UseTool(usingUid, userUid, uid, anchorable.CurrentDelay, usingTool.Qualities, new TryUnanchorCompletedEvent()); // Frontier: Delay<CurrentDelay
}

private void OnInteractUsing(EntityUid uid, AnchorableComponent anchorable, InteractUsingEvent args)
Expand Down Expand Up @@ -240,7 +240,7 @@ private void TryAnchor(EntityUid uid, EntityUid userUid, EntityUid usingUid,
return;
}

_tool.UseTool(usingUid, userUid, uid, anchorable.Delay, usingTool.Qualities, new TryAnchorCompletedEvent());
_tool.UseTool(usingUid, userUid, uid, anchorable.CurrentDelay, usingTool.Qualities, new TryAnchorCompletedEvent()); // Frontier: Delay<CurrentDelay
}

private bool Valid(
Expand Down Expand Up @@ -272,7 +272,7 @@ private bool Valid(
else
RaiseLocalEvent(uid, (UnanchorAttemptEvent) attempt);

anchorable.Delay += attempt.Delay;
anchorable.CurrentDelay = anchorable.Delay + attempt.Delay; // Frontier: assign delay from base value

return !attempt.Cancelled;
}
Expand Down
Loading