Allow do_afters to be spammed (#8074)
This commit is contained in:
@@ -18,6 +18,12 @@ public sealed partial class ToolSystem
|
||||
{
|
||||
SubscribeLocalEvent<TilePryingComponent, AfterInteractEvent>(OnTilePryingAfterInteract);
|
||||
SubscribeLocalEvent<TilePryingComponent, TilePryingCompleteEvent>(OnTilePryComplete);
|
||||
SubscribeLocalEvent<TilePryingComponent, TilePryingCancelledEvent>(OnTilePryCancelled);
|
||||
}
|
||||
|
||||
private void OnTilePryCancelled(EntityUid uid, TilePryingComponent component, TilePryingCancelledEvent args)
|
||||
{
|
||||
component.CancelToken = null;
|
||||
}
|
||||
|
||||
private void OnTilePryComplete(EntityUid uid, TilePryingComponent component, TilePryingCompleteEvent args)
|
||||
@@ -38,9 +44,7 @@ public sealed partial class ToolSystem
|
||||
{
|
||||
if (component.CancelToken != null)
|
||||
{
|
||||
component.CancelToken.Cancel();
|
||||
component.CancelToken = null;
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!TryComp<ToolComponent?>(component.Owner, out var tool) && component.ToolComponentNeeded)
|
||||
@@ -75,6 +79,7 @@ public sealed partial class ToolSystem
|
||||
{
|
||||
Coordinates = clickLocation,
|
||||
},
|
||||
new TilePryingCancelledEvent(),
|
||||
toolComponent: tool,
|
||||
doAfterEventTarget: component.Owner,
|
||||
cancelToken: token.Token);
|
||||
@@ -86,4 +91,9 @@ public sealed partial class ToolSystem
|
||||
{
|
||||
public EntityCoordinates Coordinates { get; init; }
|
||||
}
|
||||
|
||||
private sealed class TilePryingCancelledEvent : EntityEventArgs
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user