mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
Bugfix: Only raise ToolRefineAttemptEvent if used item has needed tool qualities (#44441)
ToolRefinableSystem: check used tool before evt
This commit is contained in:
parent
6f8832efd1
commit
0c7d9cd2ba
1 changed files with 11 additions and 8 deletions
|
|
@ -47,7 +47,7 @@ public sealed partial class ToolRefinablSystem : EntitySystem
|
|||
/// <summary> Normal interactions. </summary>
|
||||
private void OnInteractUsing(Entity<ToolRefinableComponent> ent, ref InteractUsingEvent args)
|
||||
{
|
||||
if (args.Handled)
|
||||
if (args.Handled || !_toolSystem.HasQuality(args.Used, ent.Comp.QualityNeeded))
|
||||
return;
|
||||
|
||||
var component = ent.Comp;
|
||||
|
|
@ -86,14 +86,17 @@ public sealed partial class ToolRefinablSystem : EntitySystem
|
|||
? null
|
||||
: Loc.GetString(ent.Comp.ToolMissingQualityTooltip, ("target", ent.Owner));
|
||||
}
|
||||
// make an attempt to ensure refinement is not blocked.
|
||||
var attemptEvent = new AttemptToolRefineEvent(tool);
|
||||
RaiseLocalEvent(args.Target, ref attemptEvent);
|
||||
|
||||
if (attemptEvent.IsCancelled)
|
||||
else
|
||||
{
|
||||
verbDisabled = true;
|
||||
verbMessage = attemptEvent.BlockCause;
|
||||
// We have the necessary tool, make an attempt to ensure refinement is not blocked.
|
||||
var attemptEvent = new AttemptToolRefineEvent(tool);
|
||||
RaiseLocalEvent(args.Target, ref attemptEvent);
|
||||
|
||||
if (attemptEvent.IsCancelled)
|
||||
{
|
||||
verbDisabled = true;
|
||||
verbMessage = attemptEvent.BlockCause;
|
||||
}
|
||||
}
|
||||
|
||||
verbMessage ??= component.VerbDefaultTooltip == null
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue