diff --git a/Content.Server/MachineLinking/Components/SignalLinkerComponent.cs b/Content.Server/MachineLinking/Components/SignalLinkerComponent.cs index 6af33f2259..b87a6970fb 100644 --- a/Content.Server/MachineLinking/Components/SignalLinkerComponent.cs +++ b/Content.Server/MachineLinking/Components/SignalLinkerComponent.cs @@ -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; + + /// + /// Optional tool quality required for linker to work. + /// If linker entity doesn't have this quality it will ignore any interaction. + /// + [DataField("requiredQuality", customTypeSerializer: typeof(PrototypeIdSerializer))] + [ViewVariables(VVAccess.ReadWrite)] + public string? RequiredQuality; } } diff --git a/Content.Server/MachineLinking/System/SignalLinkerSystem.cs b/Content.Server/MachineLinking/System/SignalLinkerSystem.cs index edc7ab9c78..b6a5c2b9b9 100644 --- a/Content.Server/MachineLinking/System/SignalLinkerSystem.cs +++ b/Content.Server/MachineLinking/System/SignalLinkerSystem.cs @@ -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(transmitterComponent.Owner).MapPosition.InRange( Comp(receiverComponent.Owner).MapPosition, transmitterComponent.TransmissionRange); } + + private bool IsLinkerInteractable(EntityUid uid, SignalLinkerComponent linkerComponent) + { + var quality = linkerComponent.RequiredQuality; + return quality == null || _tools.HasQuality(uid, quality); + } } } diff --git a/Resources/Prototypes/Entities/Objects/Tools/tools.yml b/Resources/Prototypes/Entities/Objects/Tools/tools.yml index 621aad3bb2..46e62deac9 100644 --- a/Resources/Prototypes/Entities/Objects/Tools/tools.yml +++ b/Resources/Prototypes/Entities/Objects/Tools/tools.yml @@ -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: diff --git a/Resources/Prototypes/XenoArch/Effects/utility_effects.yml b/Resources/Prototypes/XenoArch/Effects/utility_effects.yml index ea9c72ec2b..7582f37a85 100644 --- a/Resources/Prototypes/XenoArch/Effects/utility_effects.yml +++ b/Resources/Prototypes/XenoArch/Effects/utility_effects.yml @@ -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