Fix welder interaction (#14704)

This commit is contained in:
08A
2023-03-23 18:08:46 +01:00
committed by GitHub
parent f919361ed5
commit 4290577d5d
4 changed files with 8 additions and 11 deletions

View File

@@ -23,7 +23,6 @@ public sealed class IgnitionSourceSystem : EntitySystem
private void OnIsHot(EntityUid uid, IgnitionSourceComponent component, IsHotEvent args) private void OnIsHot(EntityUid uid, IgnitionSourceComponent component, IsHotEvent args)
{ {
Logger.Debug(args.IsHot.ToString());
SetIgnited(uid,component,args.IsHot); SetIgnited(uid,component,args.IsHot);
} }

View File

@@ -15,7 +15,6 @@ using Content.Shared.Weapons.Melee.Events;
using Robust.Server.GameObjects; using Robust.Server.GameObjects;
using Robust.Shared.Audio; using Robust.Shared.Audio;
using Robust.Shared.GameStates; using Robust.Shared.GameStates;
using Robust.Shared.Player;
namespace Content.Server.Tools namespace Content.Server.Tools
{ {
@@ -302,6 +301,7 @@ namespace Content.Server.Tools
if (neededFuel > fuel) if (neededFuel > fuel)
{ {
_popupSystem.PopupEntity(Loc.GetString("welder-component-cannot-weld-message"), uid, args.User);
args.Cancel(); args.Cancel();
} }

View File

@@ -65,6 +65,7 @@ namespace Content.Shared.Tools.Components
public ToolUseFinishAttemptEvent(float fuel, EntityUid user) public ToolUseFinishAttemptEvent(float fuel, EntityUid user)
{ {
User = user;
Fuel = fuel; Fuel = fuel;
} }
} }

View File

@@ -35,7 +35,7 @@ public abstract class SharedToolSystem : EntitySystem
if (args.Handled || args.AdditionalData.Ev == null) if (args.Handled || args.AdditionalData.Ev == null)
return; return;
if (args.Cancelled) if (args.Cancelled || !ToolFinishUse(uid, args.Args.User, args.AdditionalData.Fuel))
{ {
if (args.AdditionalData.CancelledEv != null) if (args.AdditionalData.CancelledEv != null)
{ {
@@ -50,15 +50,12 @@ public abstract class SharedToolSystem : EntitySystem
return; return;
} }
if (ToolFinishUse(uid, args.Args.User, args.AdditionalData.Fuel)) if (args.AdditionalData.TargetEntity != null)
{ RaiseLocalEvent(args.AdditionalData.TargetEntity.Value, args.AdditionalData.Ev);
if (args.AdditionalData.TargetEntity != null) else
RaiseLocalEvent(args.AdditionalData.TargetEntity.Value, args.AdditionalData.Ev); RaiseLocalEvent(args.AdditionalData.Ev);
else
RaiseLocalEvent(args.AdditionalData.Ev);
args.Handled = true; args.Handled = true;
}
} }
public bool UseTool(EntityUid tool, EntityUid user, EntityUid? target, float doAfterDelay, IEnumerable<string> toolQualitiesNeeded, ToolEventData toolEventData, float fuel = 0f, ToolComponent? toolComponent = null, Func<bool>? doAfterCheck = null, CancellationTokenSource? cancelToken = null) public bool UseTool(EntityUid tool, EntityUid user, EntityUid? target, float doAfterDelay, IEnumerable<string> toolQualitiesNeeded, ToolEventData toolEventData, float fuel = 0f, ToolComponent? toolComponent = null, Func<bool>? doAfterCheck = null, CancellationTokenSource? cancelToken = null)