Allow do_afters to be spammed (#8074)

This commit is contained in:
metalgearsloth
2022-05-10 19:48:59 +10:00
committed by GitHub
parent 1ef2407d02
commit d7168fedd1
5 changed files with 17 additions and 10 deletions

View File

@@ -108,8 +108,6 @@ public sealed partial class ChemistrySystem
if (component.CancelToken != null)
{
component.CancelToken.Cancel();
component.CancelToken = null;
args.Handled = true;
return;
}

View File

@@ -92,7 +92,10 @@ public sealed class HealingSystem : EntitySystem
private bool TryHeal(EntityUid uid, EntityUid user, EntityUid target, HealingComponent component)
{
if (component.CancelToken != null) return false;
if (component.CancelToken != null)
{
return false;
}
if (TryComp<MobStateComponent>(target, out var state) && state.IsDead())
return false;

View File

@@ -194,8 +194,6 @@ namespace Content.Server.Nutrition.EntitySystems
// cannot stack do-afters
if (drink.CancelToken != null)
{
drink.CancelToken.Cancel();
drink.CancelToken = null;
return true;
}

View File

@@ -79,8 +79,6 @@ namespace Content.Server.Nutrition.EntitySystems
// if currently being used to feed, cancel that action.
if (food.CancelToken != null)
{
food.CancelToken.Cancel();
food.CancelToken = null;
return true;
}

View File

@@ -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
{
}
}