Make anchorable not spammable (#8202)

* weh

* Make anchorable not spammable
This commit is contained in:
metalgearsloth
2022-05-18 12:35:44 +10:00
committed by GitHub
parent 473ec2ec08
commit d09ea18de5
3 changed files with 134 additions and 67 deletions

View File

@@ -1,3 +1,4 @@
using System.Threading;
using Content.Shared.Construction.EntitySystems;
using Content.Shared.Tools;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
@@ -19,7 +20,9 @@ namespace Content.Shared.Construction.Components
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("delay")]
public float Delay = 0.5f;
public float Delay = 1f;
public CancellationTokenSource? CancelToken = null;
}
public abstract class BaseAnchoredAttemptEvent : CancellableEntityEventArgs

View File

@@ -15,7 +15,7 @@ public abstract class SharedAnchorableSystem : EntitySystem
SubscribeLocalEvent<AnchorableComponent, InteractUsingEvent>(OnInteractUsing, after: new[] { typeof(SharedConstructionSystem) });
}
private async void OnInteractUsing(EntityUid uid, AnchorableComponent anchorable, InteractUsingEvent args)
private void OnInteractUsing(EntityUid uid, AnchorableComponent anchorable, InteractUsingEvent args)
{
if (args.Handled)
return;
@@ -25,16 +25,16 @@ public abstract class SharedAnchorableSystem : EntitySystem
return;
args.Handled = true;
await TryToggleAnchor(uid, args.User, args.Used, anchorable, usingTool: usedTool);
TryToggleAnchor(uid, args.User, args.Used, anchorable, usingTool: usedTool);
}
public virtual async Task<bool> TryToggleAnchor(EntityUid uid, EntityUid userUid, EntityUid usingUid,
public virtual void TryToggleAnchor(EntityUid uid, EntityUid userUid, EntityUid usingUid,
AnchorableComponent? anchorable = null,
TransformComponent? transform = null,
SharedPullableComponent? pullable = null,
ToolComponent? usingTool = null)
{
// Thanks tool system.
return false;
return;
}
}