diff --git a/Content.Client/Hands/HandsComponent.cs b/Content.Client/Hands/HandsComponent.cs index 78d288ac24..5949b44316 100644 --- a/Content.Client/Hands/HandsComponent.cs +++ b/Content.Client/Hands/HandsComponent.cs @@ -1,13 +1,10 @@ -using System.Collections.Generic; using Content.Shared.Hands.Components; -using Content.Shared.Item; using Robust.Shared.Containers; using Robust.Shared.GameObjects; namespace Content.Client.Hands { [RegisterComponent] - [ComponentReference(typeof(ISharedHandsComponent))] [ComponentReference(typeof(SharedHandsComponent))] public class HandsComponent : SharedHandsComponent { diff --git a/Content.IntegrationTests/Tests/GameObjects/Components/ActionBlocking/HandCuffTest.cs b/Content.IntegrationTests/Tests/GameObjects/Components/ActionBlocking/HandCuffTest.cs index 4257ccb361..4801d20d4e 100644 --- a/Content.IntegrationTests/Tests/GameObjects/Components/ActionBlocking/HandCuffTest.cs +++ b/Content.IntegrationTests/Tests/GameObjects/Components/ActionBlocking/HandCuffTest.cs @@ -10,7 +10,6 @@ using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Map; using Robust.Shared.Maths; -using HandsComponent = Content.Client.Hands.HandsComponent; namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking { @@ -48,7 +47,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking IEntity cuffs; IEntity secondCuffs; CuffableComponent cuffed; - IHandsComponent hands; + HandsComponent hands; server.Assert(() => { diff --git a/Content.IntegrationTests/Tests/PDA/PDAExtensionsTests.cs b/Content.IntegrationTests/Tests/PDA/PDAExtensionsTests.cs index 6a5fb61252..1b686497b0 100644 --- a/Content.IntegrationTests/Tests/PDA/PDAExtensionsTests.cs +++ b/Content.IntegrationTests/Tests/PDA/PDAExtensionsTests.cs @@ -1,11 +1,11 @@ -using System.Linq; +using System.Linq; using System.Threading.Tasks; using Content.Server.Access.Components; -using Content.Shared.Containers.ItemSlots; using Content.Server.Hands.Components; using Content.Server.Inventory.Components; using Content.Server.Items; using Content.Server.PDA; +using Content.Shared.Containers.ItemSlots; using NUnit.Framework; using Robust.Server.Player; using Robust.Shared.GameObjects; @@ -72,7 +72,7 @@ namespace Content.IntegrationTests.Tests.PDA // Put PDA in hand var dummyPda = sEntityManager.SpawnEntity(PdaDummy, player.Transform.MapPosition); var pdaItemComponent = dummyPda.GetComponent(); - player.GetComponent().PutInHand(pdaItemComponent); + player.GetComponent().PutInHand(pdaItemComponent); var pdaComponent = dummyPda.GetComponent(); var pdaIdCard = sEntityManager.SpawnEntity(IdCardDummy, player.Transform.MapPosition); @@ -92,7 +92,7 @@ namespace Content.IntegrationTests.Tests.PDA // Put ID card in hand var idDummy = sEntityManager.SpawnEntity(IdCardDummy, player.Transform.MapPosition); var idItemComponent = idDummy.GetComponent(); - player.GetComponent().PutInHand(idItemComponent); + player.GetComponent().PutInHand(idItemComponent); var idCardComponent = idDummy.GetComponent(); @@ -120,7 +120,7 @@ namespace Content.IntegrationTests.Tests.PDA } } - var hands = player.GetComponent(); + var hands = player.GetComponent(); hands.Drop(dummyPda, false); hands.Drop(idDummy, false); diff --git a/Content.Server/AME/Components/AMEControllerComponent.cs b/Content.Server/AME/Components/AMEControllerComponent.cs index cfa3b84d5c..4f89c2b38e 100644 --- a/Content.Server/AME/Components/AMEControllerComponent.cs +++ b/Content.Server/AME/Components/AMEControllerComponent.cs @@ -124,7 +124,7 @@ namespace Content.Server.AME.Components return; } - if (!args.User.TryGetComponent(out IHandsComponent? hands)) + if (!args.User.TryGetComponent(out HandsComponent? hands)) { Owner.PopupMessage(args.User, Loc.GetString("ame-controller-component-interact-no-hands-text")); return; @@ -335,7 +335,7 @@ namespace Content.Server.AME.Components async Task IInteractUsing.InteractUsing(InteractUsingEventArgs args) { - if (!args.User.TryGetComponent(out IHandsComponent? hands)) + if (!args.User.TryGetComponent(out HandsComponent? hands)) { Owner.PopupMessage(args.User, Loc.GetString("ame-controller-component-interact-using-no-hands-text")); return true; diff --git a/Content.Server/AME/Components/AMEPartComponent.cs b/Content.Server/AME/Components/AMEPartComponent.cs index 6b9346aa46..e6e225be60 100644 --- a/Content.Server/AME/Components/AMEPartComponent.cs +++ b/Content.Server/AME/Components/AMEPartComponent.cs @@ -5,7 +5,6 @@ using Content.Server.Tools; using Content.Shared.Interaction; using Content.Shared.Popups; using Content.Shared.Sound; -using Content.Shared.Tools.Components; using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.GameObjects; @@ -36,7 +35,7 @@ namespace Content.Server.AME.Components async Task IInteractUsing.InteractUsing(InteractUsingEventArgs args) { - if (!args.User.TryGetComponent(out var hands)) + if (!args.User.HasComponent()) { Owner.PopupMessage(args.User, Loc.GetString("ame-part-component-interact-using-no-hands")); return false; diff --git a/Content.Server/Atmos/Components/GasAnalyzerComponent.cs b/Content.Server/Atmos/Components/GasAnalyzerComponent.cs index 702afa8d25..dd4114736e 100644 --- a/Content.Server/Atmos/Components/GasAnalyzerComponent.cs +++ b/Content.Server/Atmos/Components/GasAnalyzerComponent.cs @@ -5,7 +5,6 @@ using Content.Server.Hands.Components; using Content.Server.UserInterface; using Content.Shared.Atmos; using Content.Shared.Atmos.Components; -using Content.Shared.DragDrop; using Content.Shared.Interaction; using Content.Shared.Popups; using Robust.Server.GameObjects; @@ -161,7 +160,7 @@ namespace Content.Server.Atmos.Components if (session.AttachedEntity == null) return; - if (!session.AttachedEntity.TryGetComponent(out IHandsComponent? handsComponent)) + if (!session.AttachedEntity.TryGetComponent(out HandsComponent? handsComponent)) return; var activeHandEntity = handsComponent?.GetActiveHand?.Owner; @@ -226,7 +225,7 @@ namespace Content.Server.Atmos.Components return; } - if (!player.TryGetComponent(out IHandsComponent? handsComponent)) + if (!player.TryGetComponent(out HandsComponent? handsComponent)) { Owner.PopupMessage(player, Loc.GetString("gas-analyzer-component-player-has-no-hands-message")); return; diff --git a/Content.Server/Chemistry/Components/ChemMasterComponent.cs b/Content.Server/Chemistry/Components/ChemMasterComponent.cs index a29c665112..88613e74b0 100644 --- a/Content.Server/Chemistry/Components/ChemMasterComponent.cs +++ b/Content.Server/Chemistry/Components/ChemMasterComponent.cs @@ -9,7 +9,6 @@ using Content.Server.Power.Components; using Content.Server.UserInterface; using Content.Shared.ActionBlocker; using Content.Shared.Chemistry.Components; -using Content.Shared.Chemistry.Reagent; using Content.Shared.FixedPoint; using Content.Shared.Interaction; using Content.Shared.Popups; @@ -378,7 +377,7 @@ namespace Content.Server.Chemistry.Components return; } - if (!args.User.TryGetComponent(out IHandsComponent? hands)) + if (!args.User.TryGetComponent(out HandsComponent? hands)) { Owner.PopupMessage(args.User, Loc.GetString("chem-master-component-activate-no-hands")); return; @@ -400,7 +399,7 @@ namespace Content.Server.Chemistry.Components /// async Task IInteractUsing.InteractUsing(InteractUsingEventArgs args) { - if (!args.User.TryGetComponent(out IHandsComponent? hands)) + if (!args.User.TryGetComponent(out HandsComponent? hands)) { Owner.PopupMessage(args.User, Loc.GetString("chem-master-component-interact-using-no-hands")); return true; diff --git a/Content.Server/Chemistry/Components/ReagentDispenserComponent.cs b/Content.Server/Chemistry/Components/ReagentDispenserComponent.cs index e1fe379ce7..25cbc5017c 100644 --- a/Content.Server/Chemistry/Components/ReagentDispenserComponent.cs +++ b/Content.Server/Chemistry/Components/ReagentDispenserComponent.cs @@ -11,7 +11,6 @@ using Content.Server.UserInterface; using Content.Shared.ActionBlocker; using Content.Shared.Chemistry.Components; using Content.Shared.Chemistry.Dispenser; -using Content.Shared.Chemistry.Reagent; using Content.Shared.FixedPoint; using Content.Shared.Interaction; using Content.Shared.Popups; @@ -321,7 +320,7 @@ namespace Content.Server.Chemistry.Components return; } - if (!args.User.TryGetComponent(out IHandsComponent? hands)) + if (!args.User.TryGetComponent(out HandsComponent? hands)) { Owner.PopupMessage(args.User, Loc.GetString("reagent-dispenser-component-activate-no-hands")); return; @@ -343,7 +342,7 @@ namespace Content.Server.Chemistry.Components /// async Task IInteractUsing.InteractUsing(InteractUsingEventArgs args) { - if (!args.User.TryGetComponent(out IHandsComponent? hands)) + if (!args.User.TryGetComponent(out HandsComponent? hands)) { Owner.PopupMessage(args.User, Loc.GetString("reagent-dispenser-component-interact-using-no-hands")); return true; diff --git a/Content.Server/Disposal/Tube/Components/DisposalRouterComponent.cs b/Content.Server/Disposal/Tube/Components/DisposalRouterComponent.cs index 47b720a6d1..e65864cc40 100644 --- a/Content.Server/Disposal/Tube/Components/DisposalRouterComponent.cs +++ b/Content.Server/Disposal/Tube/Components/DisposalRouterComponent.cs @@ -8,7 +8,6 @@ using Content.Shared.ActionBlocker; using Content.Shared.Interaction; using Content.Shared.Popups; using Content.Shared.Sound; -using Content.Shared.Verbs; using Robust.Server.Console; using Robust.Server.GameObjects; using Robust.Server.Player; @@ -166,7 +165,7 @@ namespace Content.Server.Disposal.Tube.Components return; } - if (!args.User.TryGetComponent(out IHandsComponent? hands)) + if (!args.User.TryGetComponent(out HandsComponent? hands)) { Owner.PopupMessage(args.User, Loc.GetString("disposal-router-window-tag-input-activate-no-hands")); return; diff --git a/Content.Server/Disposal/Tube/Components/DisposalTaggerComponent.cs b/Content.Server/Disposal/Tube/Components/DisposalTaggerComponent.cs index eb44c289eb..101bc1b52a 100644 --- a/Content.Server/Disposal/Tube/Components/DisposalTaggerComponent.cs +++ b/Content.Server/Disposal/Tube/Components/DisposalTaggerComponent.cs @@ -5,7 +5,6 @@ using Content.Shared.ActionBlocker; using Content.Shared.Interaction; using Content.Shared.Popups; using Content.Shared.Sound; -using Content.Shared.Verbs; using Robust.Server.Console; using Robust.Server.GameObjects; using Robust.Server.Player; @@ -132,7 +131,7 @@ namespace Content.Server.Disposal.Tube.Components return; } - if (!args.User.TryGetComponent(out IHandsComponent? hands)) + if (!args.User.TryGetComponent(out HandsComponent? hands)) { Owner.PopupMessage(args.User, Loc.GetString("disposal-tagger-window-activate-no-hands")); return; diff --git a/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs b/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs index 561420b541..7e6b5cc54c 100644 --- a/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs +++ b/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs @@ -392,7 +392,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems } // This popup message doesn't appear on clicks, even when code was seperate. Unsure why. - if (!eventArgs.User.HasComponent()) + if (!eventArgs.User.HasComponent()) { eventArgs.Target.PopupMessage(eventArgs.User, Loc.GetString("ui-disposal-unit-is-valid-interaction-no-hands")); return false; diff --git a/Content.Server/Hands/Components/HandsComponent.cs b/Content.Server/Hands/Components/HandsComponent.cs index cbda6dfee9..84d7cea30d 100644 --- a/Content.Server/Hands/Components/HandsComponent.cs +++ b/Content.Server/Hands/Components/HandsComponent.cs @@ -25,11 +25,9 @@ using Robust.Shared.Serialization.Manager.Attributes; namespace Content.Server.Hands.Components { [RegisterComponent] - [ComponentReference(typeof(IHandsComponent))] - [ComponentReference(typeof(ISharedHandsComponent))] [ComponentReference(typeof(SharedHandsComponent))] #pragma warning disable 618 - public class HandsComponent : SharedHandsComponent, IHandsComponent, IBodyPartAdded, IBodyPartRemoved, IDisarmedAct + public class HandsComponent : SharedHandsComponent, IBodyPartAdded, IBodyPartRemoved, IDisarmedAct #pragma warning restore 618 { [Dependency] private readonly IEntitySystemManager _entitySystemManager = default!; diff --git a/Content.Server/Hands/Components/IHandsComponent.cs b/Content.Server/Hands/Components/IHandsComponent.cs deleted file mode 100644 index 68a9dac83d..0000000000 --- a/Content.Server/Hands/Components/IHandsComponent.cs +++ /dev/null @@ -1,194 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using Content.Server.Items; -using Content.Shared.ActionBlocker; -using Content.Shared.Hands.Components; -using Content.Shared.Item; -using Robust.Shared.Containers; -using Robust.Shared.GameObjects; -using Robust.Shared.Map; - -namespace Content.Server.Hands.Components -{ - public interface IHandsComponent : ISharedHandsComponent - { - /// - /// Invoked when the hand contents changes or when a hand is added/removed. - /// - event Action? OnItemChanged; - - /// - /// The hands in this component. - /// - IEnumerable HandNames { get; } - - /// - /// The hand name of the currently active hand. - /// - string? ActiveHand { get; set; } - - /// - /// Enumerates over every held item. - /// - IEnumerable GetAllHeldItems(); - - /// - /// Gets the item held by a hand. - /// - /// The name of the hand to get. - /// The item in the held, null if no item is held - ItemComponent? GetItem(string handName); - - /// - /// Attempts to get an item in a hand. - /// - /// The name of the hand to get. - /// The item in the held, null if no item is held - /// Whether it was holding an item - bool TryGetItem(string handName, [NotNullWhen(true)] out ItemComponent? item); - - /// - /// Gets item held by the current active hand - /// - ItemComponent? GetActiveHand { get; } - - /// - /// Puts an item into any empty hand, preferring the active hand. - /// - /// The item to put in a hand. - /// Whether to perform an ActionBlocker check to the entity. - /// True if the item was inserted, false otherwise. - bool PutInHand(SharedItemComponent item, bool mobCheck = true); - - /// - /// Checks to see if an item can be put in any hand. - /// - /// The item to check for. - /// Whether to perform an ActionBlocker check to the entity. - /// True if the item can be inserted, false otherwise. - bool CanPutInHand(ItemComponent item, bool mobCheck = true); - - /// - /// Drops the item contained in the slot to the same position as our entity. - /// - /// The slot of which to drop to drop the item. - /// Whether to check the for the mob or not.True on success, false if something blocked the drop. - bool Drop(string slot, bool mobChecks = true, bool intentional = true); - - /// - /// Drops an item held by one of our hand slots to the same position as our owning entity. - /// - /// The item to drop. - /// Whether to check the for the mob or not. - /// True on success, false if something blocked the drop. - /// - /// Thrown if is null. - /// - /// - /// Thrown if is not actually held in any hand. - /// - bool Drop(IEntity entity, bool mobChecks = true, bool intentional = true); - - /// - /// Drops the item in a slot. - /// - /// The slot to drop the item from. - /// - /// Whether to check the for the mob or not. - /// True if an item was dropped, false otherwise. - bool TryDropHand(string slot, EntityCoordinates coords, bool doMobChecks = true, bool intentional = true); - - /// - /// Drop the specified entity in our hands to a certain position. - /// - /// - /// There are no checks whether or not the user is within interaction range of the drop location - /// or whether the drop location is occupied. - /// - /// The entity to drop, must be held in one of the hands. - /// The coordinates to drop the entity at. - /// Whether to check the for the mob or not. - /// - /// True if the drop succeeded, - /// false if it failed (due to failing to eject from our hand slot, etc...) - /// - /// - /// Thrown if is null. - /// - /// - /// Thrown if is not actually held in any hand. - /// - bool TryDropEntity(IEntity entity, EntityCoordinates coords, bool doMobChecks = true, bool intentional = true); - - /// - /// Drop the item contained in a slot into another container. - /// - /// The slot of which to drop the entity. - /// The container to drop into. - /// Whether to check the for the mob or not. - /// True on success, false if something was blocked (insertion or removal). - /// - /// Thrown if dry-run checks reported OK to remove and insert, - /// but practical remove or insert returned false anyways. - /// This is an edge-case that is currently unhandled. - /// - bool TryPutHandIntoContainer(string slot, BaseContainer targetContainer, bool doMobChecks = true); - - /// - /// Drops an item in one of the hands into a container. - /// - /// The item to drop. - /// The container to drop into. - /// Whether to check the for the mob or not. - /// True on success, false if something was blocked (insertion or removal). - /// - /// Thrown if dry-run checks reported OK to remove and insert, - /// but practical remove or insert returned false anyways. - /// This is an edge-case that is currently unhandled. - /// - /// - /// Thrown if is null. - /// - /// - /// Thrown if is not actually held in any hand. - /// - bool Drop(IEntity entity, BaseContainer targetContainer, bool doMobChecks = true); - - /// - /// Checks whether the item in the specified hand can be dropped. - /// - /// The hand to check for. - /// Whether to perform an ActionBlocker check to the entity. - /// - /// True if the item can be dropped, false if the hand is empty or the item in the hand cannot be dropped. - /// - bool CanDrop(string name, bool mobCheck = true); - - /// - /// Adds a new hand to this hands component. - /// - /// The name of the hand to add. - /// - /// Thrown if a hand with specified name already exists. - /// - void AddHand(string name, HandLocation handLocation); - - /// - /// Removes a hand from this hands component. - /// - /// - /// If the hand contains an item, the item is dropped. - /// - /// The name of the hand to remove. - void RemoveHand(string name); - - /// - /// Checks whether a hand with the specified name exists. - /// - /// The hand name to check. - /// True if the hand exists, false otherwise. - bool HasHand(string name); - } -} diff --git a/Content.Server/Hands/Systems/HandsSystem.cs b/Content.Server/Hands/Systems/HandsSystem.cs index 74f963201c..47b7638f1c 100644 --- a/Content.Server/Hands/Systems/HandsSystem.cs +++ b/Content.Server/Hands/Systems/HandsSystem.cs @@ -170,11 +170,11 @@ namespace Content.Server.Hands.Systems { base.DropAllItemsInHands(entity, doMobChecks); - if (!entity.TryGetComponent(out IHandsComponent? hands)) return; + if (!entity.TryGetComponent(out HandsComponent? hands)) return; foreach (var heldItem in hands.GetAllHeldItems()) { - hands.Drop(heldItem.Owner, doMobChecks, intentional:false); + hands.Drop(heldItem.Owner, doMobChecks, false); } } diff --git a/Content.Server/Interaction/InteractionSystem.cs b/Content.Server/Interaction/InteractionSystem.cs index cc0408b129..e355d062ad 100644 --- a/Content.Server/Interaction/InteractionSystem.cs +++ b/Content.Server/Interaction/InteractionSystem.cs @@ -2,12 +2,10 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading.Tasks; -using Content.Server.Buckle.Components; using Content.Server.CombatMode; using Content.Server.Hands.Components; using Content.Server.Items; using Content.Server.Pulling; -using Content.Server.Verbs; using Content.Shared.ActionBlocker; using Content.Shared.DragDrop; using Content.Shared.Input; @@ -15,8 +13,6 @@ using Content.Shared.Interaction; using Content.Shared.Interaction.Helpers; using Content.Shared.Popups; using Content.Shared.Pulling.Components; -using Content.Shared.Rotatable; -using Content.Shared.Timing; using Content.Shared.Weapons.Melee; using JetBrains.Annotations; using Robust.Server.GameObjects; @@ -29,9 +25,7 @@ using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Log; using Robust.Shared.Map; -using Robust.Shared.Maths; using Robust.Shared.Players; -using Robust.Shared.Random; namespace Content.Server.Interaction { @@ -314,7 +308,7 @@ namespace Content.Server.Interaction } // Verify user has a hand, and find what object they are currently holding in their active hand - if (!user.TryGetComponent(out var hands)) + if (!user.TryGetComponent(out var hands)) return; var item = hands.GetActiveHand?.Owner; @@ -460,7 +454,7 @@ namespace Content.Server.Interaction } // Verify user has a hand, and find what object they are currently holding in their active hand - if (user.TryGetComponent(out var hands)) + if (user.TryGetComponent(out var hands)) { var item = hands.GetActiveHand?.Owner; diff --git a/Content.Server/Kitchen/EntitySystems/ReagentGrinderSystem.cs b/Content.Server/Kitchen/EntitySystems/ReagentGrinderSystem.cs index 21ed28daf0..4da12644d6 100644 --- a/Content.Server/Kitchen/EntitySystems/ReagentGrinderSystem.cs +++ b/Content.Server/Kitchen/EntitySystems/ReagentGrinderSystem.cs @@ -54,7 +54,7 @@ namespace Content.Server.Kitchen.EntitySystems { if (args.Handled) return; - if (!args.User.HasComponent()) + if (!args.User.HasComponent()) { component.Owner.PopupMessage(args.User, Loc.GetString("reagent-grinder-component-interact-using-no-hands")); @@ -229,7 +229,7 @@ namespace Content.Server.Kitchen.EntitySystems if (canJuice || !entity.TryGetComponent(out ExtractableComponent? component)) continue; canJuice = component.JuiceSolution != null; - canGrind = component.GrindableSolution != null + canGrind = component.GrindableSolution != null && _solutionsSystem.TryGetSolution(entity.Uid, component.GrindableSolution, out _); } } diff --git a/Content.Server/Morgue/Components/BodyBagEntityStorageComponent.cs b/Content.Server/Morgue/Components/BodyBagEntityStorageComponent.cs index 73b4586842..3f355d5eed 100644 --- a/Content.Server/Morgue/Components/BodyBagEntityStorageComponent.cs +++ b/Content.Server/Morgue/Components/BodyBagEntityStorageComponent.cs @@ -67,7 +67,7 @@ namespace Content.Server.Morgue.Components return false; } - var handsComponent = eventArgs.User.GetComponent(); + var handsComponent = eventArgs.User.GetComponent(); if (!handsComponent.Drop(eventArgs.Using, LabelContainer)) { return false; diff --git a/Content.Server/PDA/PDAExtensions.cs b/Content.Server/PDA/PDAExtensions.cs index 5a0cbe4262..a944d3a712 100644 --- a/Content.Server/PDA/PDAExtensions.cs +++ b/Content.Server/PDA/PDAExtensions.cs @@ -18,7 +18,7 @@ namespace Content.Server.PDA { IdCardComponent? firstIdInPda = null; - if (player.TryGetComponent(out IHandsComponent? hands)) + if (player.TryGetComponent(out HandsComponent? hands)) { foreach (var item in hands.GetAllHeldItems()) { diff --git a/Content.Server/Storage/Components/SecretStashComponent.cs b/Content.Server/Storage/Components/SecretStashComponent.cs index b1ef79b4f6..4b3c705755 100644 --- a/Content.Server/Storage/Components/SecretStashComponent.cs +++ b/Content.Server/Storage/Components/SecretStashComponent.cs @@ -59,7 +59,7 @@ namespace Content.Server.Storage.Components return false; } - if (!user.TryGetComponent(out IHandsComponent? hands)) + if (!user.TryGetComponent(out HandsComponent? hands)) return false; if (!hands.Drop(itemToHide, _itemContainer)) diff --git a/Content.Server/Storage/Components/ServerStorageComponent.cs b/Content.Server/Storage/Components/ServerStorageComponent.cs index d07866f856..8fe1a6d58d 100644 --- a/Content.Server/Storage/Components/ServerStorageComponent.cs +++ b/Content.Server/Storage/Components/ServerStorageComponent.cs @@ -219,7 +219,7 @@ namespace Content.Server.Storage.Components { EnsureInitialCalculated(); - if (!player.TryGetComponent(out IHandsComponent? hands) || + if (!player.TryGetComponent(out HandsComponent? hands) || hands.GetActiveHand == null) { return false; diff --git a/Content.Server/Traitor/Uplink/UplinkSystem.cs b/Content.Server/Traitor/Uplink/UplinkSystem.cs index 7aec424448..b7a31c95e5 100644 --- a/Content.Server/Traitor/Uplink/UplinkSystem.cs +++ b/Content.Server/Traitor/Uplink/UplinkSystem.cs @@ -1,11 +1,12 @@ +using System.Linq; using Content.Server.Hands.Components; using Content.Server.Inventory.Components; using Content.Server.Items; -using Content.Server.Mind.Components; using Content.Server.PDA; using Content.Server.Traitor.Uplink.Account; using Content.Server.Traitor.Uplink.Components; using Content.Server.UserInterface; +using Content.Shared.ActionBlocker; using Content.Shared.Hands.Components; using Content.Shared.Interaction; using Content.Shared.Traitor.Uplink; @@ -16,9 +17,6 @@ using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Log; using Robust.Shared.Player; -using System; -using System.Linq; -using Content.Shared.ActionBlocker; namespace Content.Server.Traitor.Uplink { @@ -218,7 +216,7 @@ namespace Content.Server.Traitor.Uplink } // Also check hands - if (user.TryGetComponent(out IHandsComponent? hands)) + if (user.TryGetComponent(out HandsComponent? hands)) { var heldItems = hands.GetAllHeldItems(); foreach (var item in heldItems) diff --git a/Content.Server/WireHacking/WiresComponent.cs b/Content.Server/WireHacking/WiresComponent.cs index 6fe8ebbacc..d3c7e2ca38 100644 --- a/Content.Server/WireHacking/WiresComponent.cs +++ b/Content.Server/WireHacking/WiresComponent.cs @@ -13,7 +13,6 @@ using Content.Shared.Interaction.Helpers; using Content.Shared.Popups; using Content.Shared.Sound; using Content.Shared.Tools; -using Content.Shared.Tools.Components; using Content.Shared.Wires; using JetBrains.Annotations; using Robust.Server.GameObjects; @@ -417,7 +416,7 @@ namespace Content.Server.WireHacking return; } - if (!player.TryGetComponent(out IHandsComponent? handsComponent)) + if (!player.TryGetComponent(out HandsComponent? handsComponent)) { Owner.PopupMessage(player, Loc.GetString("wires-component-ui-on-receive-message-no-hands")); return; diff --git a/Content.Shared/Hands/Components/ISharedHandsComponent.cs b/Content.Shared/Hands/Components/ISharedHandsComponent.cs deleted file mode 100644 index 0eac928ba8..0000000000 --- a/Content.Shared/Hands/Components/ISharedHandsComponent.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Robust.Shared.GameObjects; - -namespace Content.Shared.Hands.Components -{ - public interface ISharedHandsComponent : IComponent - { - } -} diff --git a/Content.Shared/Hands/Components/SharedHandsComponent.cs b/Content.Shared/Hands/Components/SharedHandsComponent.cs index 03c3867bde..3b7b82b6fe 100644 --- a/Content.Shared/Hands/Components/SharedHandsComponent.cs +++ b/Content.Shared/Hands/Components/SharedHandsComponent.cs @@ -19,8 +19,8 @@ using Robust.Shared.ViewVariables; namespace Content.Shared.Hands.Components { - [NetworkedComponent()] - public abstract class SharedHandsComponent : Component, ISharedHandsComponent + [NetworkedComponent] + public abstract class SharedHandsComponent : Component { public sealed override string Name => "Hands"; @@ -124,13 +124,12 @@ namespace Content.Shared.Hands.Components if (HasHand(handName)) return; - var container = ContainerHelpers.CreateContainer(Owner, handName); + var container = Owner.CreateContainer(handName); container.OccludesLight = false; Hands.Add(new Hand(handName, handLocation, container)); - if (ActiveHand == null) - ActiveHand = handName; + ActiveHand ??= handName; HandCountChanged(); @@ -353,7 +352,7 @@ namespace Content.Shared.Hands.Components } /// - /// Attempts to move a held item from a hand into a container that is not another hand, without dropping it on the floor inbetween. + /// Attempts to move a held item from a hand into a container that is not another hand, without dropping it on the floor in-between. /// public bool Drop(IEntity entity, BaseContainer targetContainer, bool checkActionBlocker = true) { @@ -391,8 +390,9 @@ namespace Content.Shared.Hands.Components /// /// Tries to remove the item in the active hand, without dropping it. - /// For transfering the held item to anothe rlocation, like an inventory slot, - /// which souldn't trigger the drop interaction + /// For transferring the held item to another location, like an inventory slot, + /// which shouldn't trigger the drop interaction + /// public bool TryDropNoInteraction() { if (!TryGetActiveHand(out var hand)) diff --git a/Content.Shared/Strip/Components/SharedStrippableComponent.cs b/Content.Shared/Strip/Components/SharedStrippableComponent.cs index bf211a76c0..ec781591fb 100644 --- a/Content.Shared/Strip/Components/SharedStrippableComponent.cs +++ b/Content.Shared/Strip/Components/SharedStrippableComponent.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using Content.Shared.ActionBlocker; using Content.Shared.DragDrop; using Content.Shared.Hands.Components; -using Content.Shared.Interaction.Events; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; using static Content.Shared.Inventory.EquipmentSlotDefines; @@ -17,7 +16,7 @@ namespace Content.Shared.Strip.Components public bool CanBeStripped(IEntity by) { return by != Owner - && by.HasComponent() + && by.HasComponent() && EntitySystem.Get().CanInteract(by); }