wire panel now opens when a wire tool is used (#3200)

This commit is contained in:
tmtmtl30
2021-02-14 06:38:41 -08:00
committed by GitHub
parent 941f609417
commit 137b99a543
2 changed files with 28 additions and 10 deletions

View File

@@ -397,7 +397,7 @@ namespace Content.Server.GameObjects.Components.Doors
}
}
if (args.Action == Mend)
else if (args.Action == Mend)
{
switch (args.Identifier)
{
@@ -420,7 +420,7 @@ namespace Content.Server.GameObjects.Components.Doors
}
}
if (args.Action == Cut)
else if (args.Action == Cut)
{
switch (args.Identifier)
{

View File

@@ -1,4 +1,4 @@
#nullable enable
#nullable enable
using System;
using System.Collections.Generic;
using System.Linq;
@@ -482,15 +482,33 @@ namespace Content.Server.GameObjects.Components
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
{
if (!eventArgs.Using.TryGetComponent<ToolComponent>(out var tool))
{
return false;
if (!await tool.UseTool(eventArgs.User, Owner, 0.5f, ToolQuality.Screwing))
return false;
}
IsPanelOpen = !IsPanelOpen;
EntitySystem.Get<AudioSystem>()
.PlayFromEntity(IsPanelOpen ? "/Audio/Machines/screwdriveropen.ogg" : "/Audio/Machines/screwdriverclose.ogg",
Owner);
return true;
// opens the wires ui if using a tool with cutting or multitool quality on it
if (IsPanelOpen &&
(tool.HasQuality(ToolQuality.Cutting) ||
tool.HasQuality(ToolQuality.Multitool)))
{
if (eventArgs.User.TryGetComponent(out IActorComponent? actor))
{
OpenInterface(actor.playerSession);
return true;
}
}
// screws the panel open if the tool can do so
else if (await tool.UseTool(eventArgs.User, Owner, 0.5f, ToolQuality.Screwing))
{
IsPanelOpen = !IsPanelOpen;
EntitySystem.Get<AudioSystem>()
.PlayFromEntity(IsPanelOpen ? "/Audio/Machines/screwdriveropen.ogg" : "/Audio/Machines/screwdriverclose.ogg",
Owner);
return true;
}
return false;
}
void IExamine.Examine(FormattedMessage message, bool inDetailsRange)