Omnitool fixes (#12476)
Fix https://github.com/space-wizards/space-station-14/issues/11203
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
using Content.Shared.Tools;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server.MachineLinking.Components
|
||||
{
|
||||
[RegisterComponent]
|
||||
@@ -8,5 +12,13 @@ namespace Content.Server.MachineLinking.Components
|
||||
|
||||
[ViewVariables]
|
||||
public EntityUid? SavedReceiver;
|
||||
|
||||
/// <summary>
|
||||
/// Optional tool quality required for linker to work.
|
||||
/// If linker entity doesn't have this quality it will ignore any interaction.
|
||||
/// </summary>
|
||||
[DataField("requiredQuality", customTypeSerializer: typeof(PrototypeIdSerializer<ToolQualityPrototype>))]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public string? RequiredQuality;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Server.MachineLinking.Components;
|
||||
using Content.Server.MachineLinking.Events;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.Tools;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.MachineLinking;
|
||||
using Content.Shared.Popups;
|
||||
@@ -19,6 +20,7 @@ namespace Content.Server.MachineLinking.System
|
||||
[Dependency] private readonly UserInterfaceSystem _userInterfaceSystem = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly IPrototypeManager _protoMan = default!;
|
||||
[Dependency] private readonly ToolSystem _tools = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -69,7 +71,8 @@ namespace Content.Server.MachineLinking.System
|
||||
if (!args.CanAccess || !args.CanInteract)
|
||||
return;
|
||||
|
||||
if (!TryComp(args.Using, out SignalLinkerComponent? linker))
|
||||
if (!TryComp(args.Using, out SignalLinkerComponent? linker) ||
|
||||
!IsLinkerInteractable(args.Using.Value, linker))
|
||||
return;
|
||||
|
||||
AlternativeVerb verb = new()
|
||||
@@ -100,7 +103,8 @@ namespace Content.Server.MachineLinking.System
|
||||
if (!args.CanAccess || !args.CanInteract)
|
||||
return;
|
||||
|
||||
if (!TryComp(args.Using, out SignalLinkerComponent? linker))
|
||||
if (!TryComp(args.Using, out SignalLinkerComponent? linker)
|
||||
|| !IsLinkerInteractable(args.Using.Value, linker))
|
||||
return;
|
||||
|
||||
AlternativeVerb verb = new()
|
||||
@@ -200,7 +204,7 @@ namespace Content.Server.MachineLinking.System
|
||||
{
|
||||
if (args.Handled) return;
|
||||
|
||||
if (!TryComp(args.Used, out SignalLinkerComponent? linker) ||
|
||||
if (!TryComp(args.Used, out SignalLinkerComponent? linker) || !IsLinkerInteractable(args.Used, linker) ||
|
||||
!TryComp(args.User, out ActorComponent? actor))
|
||||
return;
|
||||
|
||||
@@ -226,7 +230,7 @@ namespace Content.Server.MachineLinking.System
|
||||
{
|
||||
if (args.Handled) return;
|
||||
|
||||
if (!TryComp(args.Used, out SignalLinkerComponent? linker) ||
|
||||
if (!TryComp(args.Used, out SignalLinkerComponent? linker) || !IsLinkerInteractable(args.Used, linker) ||
|
||||
!TryComp(args.User, out ActorComponent? actor))
|
||||
return;
|
||||
|
||||
@@ -473,5 +477,11 @@ namespace Content.Server.MachineLinking.System
|
||||
return Comp<TransformComponent>(transmitterComponent.Owner).MapPosition.InRange(
|
||||
Comp<TransformComponent>(receiverComponent.Owner).MapPosition, transmitterComponent.TransmissionRange);
|
||||
}
|
||||
|
||||
private bool IsLinkerInteractable(EntityUid uid, SignalLinkerComponent linkerComponent)
|
||||
{
|
||||
var quality = linkerComponent.RequiredQuality;
|
||||
return quality == null || _tools.HasQuality(uid, quality);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,11 +317,17 @@
|
||||
size: 20
|
||||
- type: TilePrying
|
||||
- type: SignalLinker
|
||||
requiredQuality: Pulsing
|
||||
- type: UserInterface
|
||||
interfaces:
|
||||
- key: enum.SignalLinkerUiKey.Key
|
||||
type: SignalPortSelectorBoundUserInterface
|
||||
- type: Tool
|
||||
qualities:
|
||||
- Screwing
|
||||
speed: 1.2 # Kept for future adjustments. Currently 1.2x for balance
|
||||
useSound: /Audio/Items/drill_use.ogg
|
||||
- type: LatticeCutting
|
||||
- type: MultipleTool
|
||||
statusShowBehavior: true
|
||||
entries:
|
||||
|
||||
@@ -138,6 +138,12 @@
|
||||
permanentComponents:
|
||||
- type: TilePrying
|
||||
- type: SignalLinker
|
||||
requiredQuality: Pulsing
|
||||
- type: UserInterface
|
||||
interfaces:
|
||||
- key: enum.SignalLinkerUiKey.Key
|
||||
type: SignalPortSelectorBoundUserInterface
|
||||
- type: LatticeCutting
|
||||
- type: Tool
|
||||
qualities:
|
||||
- Screwing
|
||||
|
||||
Reference in New Issue
Block a user