ToolSystem UseTool doesn't log missing components, slight cleanup for things using tools.

This commit is contained in:
Vera Aguilera Puerto
2021-10-07 23:08:16 +02:00
parent 6b73b89617
commit 0b57420d6e
4 changed files with 3 additions and 9 deletions

View File

@@ -41,7 +41,6 @@ namespace Content.Server.Power.Components
if (_cableDroppedOnCutPrototype == null) if (_cableDroppedOnCutPrototype == null)
return false; return false;
if (!eventArgs.Using.TryGetComponent<ToolComponent>(out var tool)) return false;
if (!await EntitySystem.Get<ToolSystem>().UseTool(eventArgs.Using.Uid, eventArgs.User.Uid, Owner.Uid, 0f, 0.25f, _cuttingQuality)) return false; if (!await EntitySystem.Get<ToolSystem>().UseTool(eventArgs.Using.Uid, eventArgs.User.Uid, Owner.Uid, 0f, 0.25f, _cuttingQuality)) return false;
Owner.Delete(); Owner.Delete();

View File

@@ -399,12 +399,6 @@ namespace Content.Server.Storage.Components
return false; return false;
} }
if (!eventArgs.Using.TryGetComponent(out WelderComponent? tool) || !tool.Lit)
{
_beingWelded = false;
return false;
}
if (_beingWelded) if (_beingWelded)
return false; return false;

View File

@@ -52,7 +52,7 @@ namespace Content.Server.Tools.Components
if (!tileDef.CanCrowbar) if (!tileDef.CanCrowbar)
return; return;
if (_toolComponentNeeded && !await EntitySystem.Get<ToolSystem>().UseTool(Owner.Uid, user.Uid, null, 0f, 0f, _qualityNeeded)) if (_toolComponentNeeded && !await EntitySystem.Get<ToolSystem>().UseTool(Owner.Uid, user.Uid, null, 0f, 0f, _qualityNeeded, toolComponent:tool))
return; return;
coordinates.PryTile(Owner.EntityManager, _mapManager); coordinates.PryTile(Owner.EntityManager, _mapManager);

View File

@@ -39,7 +39,8 @@ namespace Content.Server.Tools
float doAfterDelay, IEnumerable<string> toolQualitiesNeeded, Func<bool>? doAfterCheck = null, float doAfterDelay, IEnumerable<string> toolQualitiesNeeded, Func<bool>? doAfterCheck = null,
ToolComponent? toolComponent = null) ToolComponent? toolComponent = null)
{ {
if (!Resolve(tool, ref toolComponent)) // No logging here, after all that'd mean the caller would need to check if the component is there or not.
if (!Resolve(tool, ref toolComponent, false))
return false; return false;
if (!toolComponent.Qualities.ContainsAll(toolQualitiesNeeded) || !_actionBlockerSystem.CanInteract(user)) if (!toolComponent.Qualities.ContainsAll(toolQualitiesNeeded) || !_actionBlockerSystem.CanInteract(user))