Allow do_afters to be spammed (#8074)
This commit is contained in:
@@ -108,8 +108,6 @@ public sealed partial class ChemistrySystem
|
|||||||
|
|
||||||
if (component.CancelToken != null)
|
if (component.CancelToken != null)
|
||||||
{
|
{
|
||||||
component.CancelToken.Cancel();
|
|
||||||
component.CancelToken = null;
|
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,7 +92,10 @@ public sealed class HealingSystem : EntitySystem
|
|||||||
|
|
||||||
private bool TryHeal(EntityUid uid, EntityUid user, EntityUid target, HealingComponent component)
|
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())
|
if (TryComp<MobStateComponent>(target, out var state) && state.IsDead())
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -194,8 +194,6 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
// cannot stack do-afters
|
// cannot stack do-afters
|
||||||
if (drink.CancelToken != null)
|
if (drink.CancelToken != null)
|
||||||
{
|
{
|
||||||
drink.CancelToken.Cancel();
|
|
||||||
drink.CancelToken = null;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -79,8 +79,6 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
// if currently being used to feed, cancel that action.
|
// if currently being used to feed, cancel that action.
|
||||||
if (food.CancelToken != null)
|
if (food.CancelToken != null)
|
||||||
{
|
{
|
||||||
food.CancelToken.Cancel();
|
|
||||||
food.CancelToken = null;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,12 @@ public sealed partial class ToolSystem
|
|||||||
{
|
{
|
||||||
SubscribeLocalEvent<TilePryingComponent, AfterInteractEvent>(OnTilePryingAfterInteract);
|
SubscribeLocalEvent<TilePryingComponent, AfterInteractEvent>(OnTilePryingAfterInteract);
|
||||||
SubscribeLocalEvent<TilePryingComponent, TilePryingCompleteEvent>(OnTilePryComplete);
|
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)
|
private void OnTilePryComplete(EntityUid uid, TilePryingComponent component, TilePryingCompleteEvent args)
|
||||||
@@ -38,9 +44,7 @@ public sealed partial class ToolSystem
|
|||||||
{
|
{
|
||||||
if (component.CancelToken != null)
|
if (component.CancelToken != null)
|
||||||
{
|
{
|
||||||
component.CancelToken.Cancel();
|
return true;
|
||||||
component.CancelToken = null;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TryComp<ToolComponent?>(component.Owner, out var tool) && component.ToolComponentNeeded)
|
if (!TryComp<ToolComponent?>(component.Owner, out var tool) && component.ToolComponentNeeded)
|
||||||
@@ -75,6 +79,7 @@ public sealed partial class ToolSystem
|
|||||||
{
|
{
|
||||||
Coordinates = clickLocation,
|
Coordinates = clickLocation,
|
||||||
},
|
},
|
||||||
|
new TilePryingCancelledEvent(),
|
||||||
toolComponent: tool,
|
toolComponent: tool,
|
||||||
doAfterEventTarget: component.Owner,
|
doAfterEventTarget: component.Owner,
|
||||||
cancelToken: token.Token);
|
cancelToken: token.Token);
|
||||||
@@ -86,4 +91,9 @@ public sealed partial class ToolSystem
|
|||||||
{
|
{
|
||||||
public EntityCoordinates Coordinates { get; init; }
|
public EntityCoordinates Coordinates { get; init; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private sealed class TilePryingCancelledEvent : EntityEventArgs
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user