From 6c04811e66e46ef637d02cf09a1d41adcdc0d440 Mon Sep 17 00:00:00 2001 From: Nemanja <98561806+EmoGarbage404@users.noreply.github.com> Date: Fri, 23 Dec 2022 23:55:31 -0500 Subject: [PATCH] remove a bunch of instances of component reference (#13164) --- Content.Client/Buckle/BuckleComponent.cs | 11 ---- Content.Client/Buckle/BuckleSystem.cs | 24 ++------ Content.Client/Buckle/Strap/StrapComponent.cs | 10 ---- .../CartridgeLoader/CartridgeLoaderSystem.cs | 7 --- .../UI/ConfigurationBoundUserInterface.cs | 2 +- .../Configurable/UI/ConfigurationMenu.cs | 2 +- .../Components/EnsnareableComponent.cs | 13 ----- .../Components/EnsnaringComponent.cs | 6 -- Content.Client/Ensnaring/EnsnareableSystem.cs | 2 +- .../Inventory/StrippableBoundUserInterface.cs | 2 +- .../Movement/Components/ClimbableComponent.cs | 9 --- .../Movement/Components/ClimbingComponent.cs | 9 --- .../Movement/Systems/ClimbSystem.cs | 5 +- .../Components/ContainmentFieldComponent.cs | 7 --- .../ContainmentFieldGeneratorComponent.cs | 6 -- .../Tests/Buckle/BuckleTest.cs | 2 +- .../Components/Movement/ClimbUnitTest.cs | 1 + .../Administration/Systems/AdminVerbSystem.cs | 3 +- Content.Server/Alert/Click/RemoveEnsnare.cs | 2 +- Content.Server/Bed/BedSystem.cs | 1 - .../Buckle/Components/BuckleComponent.cs | 38 ------------- .../Buckle/Components/StrapComponent.cs | 57 ------------------- .../Buckle/Systems/BuckleSystem.Buckle.cs | 2 - .../Buckle/Systems/BuckleSystem.Strap.cs | 1 - .../CartridgeLoaderComponent.cs | 18 ------ .../CartridgeLoader/CartridgeLoaderSystem.cs | 4 +- Content.Server/Climbing/ClimbSystem.cs | 12 ++-- .../Climbing/Components/ClimbableComponent.cs | 49 ---------------- .../Climbing/Components/ClimbingComponent.cs | 35 ------------ .../Configurable/ConfigurationComponent.cs | 16 ------ .../Configurable/ConfigurationSystem.cs | 3 +- .../Disease/Cures/DiseaseBedrestCure.cs | 2 +- .../Components/EnsnareableComponent.cs | 13 ----- .../Components/EnsnaringComponent.cs | 38 ------------- .../Ensnaring/EnsnareableSystem.Ensnaring.cs | 2 - Content.Server/Ensnaring/EnsnareableSystem.cs | 2 - Content.Server/Foldable/FoldableSystem.cs | 2 +- .../Systems/ShuttleSystem.FasterThanLight.cs | 3 +- .../ContainmentFieldGeneratorSystem.cs | 5 -- .../EntitySystems/ContainmentFieldSystem.cs | 4 +- Content.Server/Strip/StrippableSystem.cs | 3 +- Content.Server/Toilet/ToiletSystem.cs | 2 +- ...dBuckleComponent.cs => BuckleComponent.cs} | 39 +++++++++++-- ...redStrapComponent.cs => StrapComponent.cs} | 53 ++++++++++++++++- .../Buckle/SharedBuckleSystem.Buckle.cs | 28 ++++----- .../Buckle/SharedBuckleSystem.Strap.cs | 18 +++--- ...mponent.cs => CartridgeLoaderComponent.cs} | 15 ++++- .../SharedCartridgeLoaderSystem.cs | 20 +++---- Content.Shared/Climbing/ClimbableComponent.cs | 55 ++++++++++++++++++ ...mbingComponent.cs => ClimbingComponent.cs} | 11 ++-- Content.Shared/Climbing/SharedClimbSystem.cs | 10 ++-- .../Climbing/SharedClimbableComponent.cs | 12 ---- ...Component.cs => ConfigurationComponent.cs} | 13 ++++- ...leComponent.cs => EnsnareableComponent.cs} | 18 +++++- ...ringComponent.cs => EnsnaringComponent.cs} | 47 +++++++++++++-- .../Ensnaring/SharedEnsnareableSystem.cs | 26 ++++----- .../Interaction/RotateToFaceSystem.cs | 2 +- .../Systems/SharedPullingSystem.Actions.cs | 2 +- .../Components/ContainmentFieldComponent.cs | 9 ++- .../ContainmentFieldGeneratorComponent.cs | 39 +++++++++++-- .../SharedContainmentFieldComponent.cs | 2 - ...haredContainmentFieldGeneratorComponent.cs | 30 ---------- .../EntitySystems/SharedEventHorizonSystem.cs | 4 +- Content.Shared/Vehicle/SharedVehicleSystem.cs | 4 +- 64 files changed, 355 insertions(+), 537 deletions(-) delete mode 100644 Content.Client/Buckle/BuckleComponent.cs delete mode 100644 Content.Client/Buckle/Strap/StrapComponent.cs delete mode 100644 Content.Client/Ensnaring/Components/EnsnareableComponent.cs delete mode 100644 Content.Client/Movement/Components/ClimbableComponent.cs delete mode 100644 Content.Client/Movement/Components/ClimbingComponent.cs delete mode 100644 Content.Client/Singularity/Components/ContainmentFieldComponent.cs delete mode 100644 Content.Client/Singularity/Components/ContainmentFieldGeneratorComponent.cs delete mode 100644 Content.Server/Buckle/Components/BuckleComponent.cs delete mode 100644 Content.Server/Buckle/Components/StrapComponent.cs delete mode 100644 Content.Server/CartridgeLoader/CartridgeLoaderComponent.cs delete mode 100644 Content.Server/Climbing/Components/ClimbableComponent.cs delete mode 100644 Content.Server/Climbing/Components/ClimbingComponent.cs delete mode 100644 Content.Server/Configurable/ConfigurationComponent.cs delete mode 100644 Content.Server/Ensnaring/Components/EnsnareableComponent.cs rename Content.Shared/Buckle/Components/{SharedBuckleComponent.cs => BuckleComponent.cs} (52%) rename Content.Shared/Buckle/Components/{SharedStrapComponent.cs => StrapComponent.cs} (58%) rename Content.Shared/CartridgeLoader/{SharedCartridgeLoaderComponent.cs => CartridgeLoaderComponent.cs} (66%) create mode 100644 Content.Shared/Climbing/ClimbableComponent.cs rename Content.Shared/Climbing/{SharedClimbingComponent.cs => ClimbingComponent.cs} (76%) delete mode 100644 Content.Shared/Climbing/SharedClimbableComponent.cs rename Content.Shared/Configurable/{SharedConfigurationComponent.cs => ConfigurationComponent.cs} (75%) rename Content.Shared/Ensnaring/Components/{SharedEnsnareableComponent.cs => EnsnareableComponent.cs} (73%) rename Content.Shared/Ensnaring/Components/{SharedEnsnaringComponent.cs => EnsnaringComponent.cs} (58%) rename {Content.Server => Content.Shared}/Singularity/Components/ContainmentFieldComponent.cs (69%) rename {Content.Server => Content.Shared}/Singularity/Components/ContainmentFieldGeneratorComponent.cs (82%) delete mode 100644 Content.Shared/Singularity/Components/SharedContainmentFieldComponent.cs delete mode 100644 Content.Shared/Singularity/Components/SharedContainmentFieldGeneratorComponent.cs diff --git a/Content.Client/Buckle/BuckleComponent.cs b/Content.Client/Buckle/BuckleComponent.cs deleted file mode 100644 index 69ad94b7d0..0000000000 --- a/Content.Client/Buckle/BuckleComponent.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Content.Shared.Buckle.Components; - -namespace Content.Client.Buckle; - -[RegisterComponent] -[ComponentReference(typeof(SharedBuckleComponent))] -[Access(typeof(BuckleSystem))] -public sealed class BuckleComponent : SharedBuckleComponent -{ - public int? OriginalDrawDepth { get; set; } -} diff --git a/Content.Client/Buckle/BuckleSystem.cs b/Content.Client/Buckle/BuckleSystem.cs index 0279001d10..4b89d9b106 100644 --- a/Content.Client/Buckle/BuckleSystem.cs +++ b/Content.Client/Buckle/BuckleSystem.cs @@ -1,4 +1,3 @@ -using Content.Client.Buckle.Strap; using Content.Client.Rotation; using Content.Shared.ActionBlocker; using Content.Shared.Buckle; @@ -12,15 +11,14 @@ namespace Content.Client.Buckle internal sealed class BuckleSystem : SharedBuckleSystem { [Dependency] private readonly ActionBlockerSystem _actionBlocker = default!; - [Dependency] private readonly AppearanceSystem AppearanceSystem = default!; - [Dependency] private readonly RotationVisualizerSystem RotationVisualizerSystem = default!; + [Dependency] private readonly AppearanceSystem _appearanceSystem = default!; + [Dependency] private readonly RotationVisualizerSystem _rotationVisualizerSystem = default!; public override void Initialize() { base.Initialize(); SubscribeLocalEvent(OnBuckleHandleState); - SubscribeLocalEvent(OnStrapHandleState); SubscribeLocalEvent(OnAppearanceChange); } @@ -65,22 +63,10 @@ namespace Content.Client.Buckle } } - private void OnStrapHandleState(EntityUid uid, StrapComponent component, ref ComponentHandleState args) - { - if (args.Current is not StrapComponentState state) - return; - - component.Position = state.Position; - component.BuckleOffsetUnclamped = state.BuckleOffsetClamped; - component.BuckledEntities.Clear(); - component.BuckledEntities.UnionWith(state.BuckledEntities); - component.MaxBuckleDistance = state.MaxBuckleDistance; - } - private void OnAppearanceChange(EntityUid uid, BuckleComponent component, ref AppearanceChangeEvent args) { - if (!AppearanceSystem.TryGetData(uid, StrapVisuals.RotationAngle, out var angle, args.Component) || - !AppearanceSystem.TryGetData(uid, BuckleVisuals.Buckled, out var buckled, args.Component) || + if (!_appearanceSystem.TryGetData(uid, StrapVisuals.RotationAngle, out var angle, args.Component) || + !_appearanceSystem.TryGetData(uid, BuckleVisuals.Buckled, out var buckled, args.Component) || !buckled || args.Sprite == null) { @@ -88,7 +74,7 @@ namespace Content.Client.Buckle } // Animate strapping yourself to something at a given angle - RotationVisualizerSystem.AnimateSpriteRotation(args.Sprite, Angle.FromDegrees(angle), 0.125f); + _rotationVisualizerSystem.AnimateSpriteRotation(args.Sprite, Angle.FromDegrees(angle), 0.125f); } } } diff --git a/Content.Client/Buckle/Strap/StrapComponent.cs b/Content.Client/Buckle/Strap/StrapComponent.cs deleted file mode 100644 index 1168fff8ea..0000000000 --- a/Content.Client/Buckle/Strap/StrapComponent.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Content.Shared.Buckle.Components; - -namespace Content.Client.Buckle.Strap; - -[RegisterComponent] -[ComponentReference(typeof(SharedStrapComponent))] -[Access(typeof(BuckleSystem))] -public sealed class StrapComponent : SharedStrapComponent -{ -} diff --git a/Content.Client/CartridgeLoader/CartridgeLoaderSystem.cs b/Content.Client/CartridgeLoader/CartridgeLoaderSystem.cs index 46e28d9142..e06a547814 100644 --- a/Content.Client/CartridgeLoader/CartridgeLoaderSystem.cs +++ b/Content.Client/CartridgeLoader/CartridgeLoaderSystem.cs @@ -6,10 +6,3 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem { //Empty client system for component replication } - -[RegisterComponent] -[ComponentReference(typeof(SharedCartridgeLoaderComponent))] -public sealed class CartridgeLoaderComponent : SharedCartridgeLoaderComponent -{ - -} diff --git a/Content.Client/Configurable/UI/ConfigurationBoundUserInterface.cs b/Content.Client/Configurable/UI/ConfigurationBoundUserInterface.cs index 9ec62e01a0..f114f0cc11 100644 --- a/Content.Client/Configurable/UI/ConfigurationBoundUserInterface.cs +++ b/Content.Client/Configurable/UI/ConfigurationBoundUserInterface.cs @@ -2,7 +2,7 @@ using System.Text.RegularExpressions; using Robust.Client.GameObjects; using Robust.Shared.GameObjects; -using static Content.Shared.Configurable.SharedConfigurationComponent; +using static Content.Shared.Configurable.ConfigurationComponent; namespace Content.Client.Configurable.UI { diff --git a/Content.Client/Configurable/UI/ConfigurationMenu.cs b/Content.Client/Configurable/UI/ConfigurationMenu.cs index 4b94e3055e..dc1e939eba 100644 --- a/Content.Client/Configurable/UI/ConfigurationMenu.cs +++ b/Content.Client/Configurable/UI/ConfigurationMenu.cs @@ -4,7 +4,7 @@ using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.CustomControls; using Robust.Shared.Localization; using Robust.Shared.Maths; -using static Content.Shared.Configurable.SharedConfigurationComponent; +using static Content.Shared.Configurable.ConfigurationComponent; using static Robust.Client.UserInterface.Controls.BaseButton; using static Robust.Client.UserInterface.Controls.BoxContainer; diff --git a/Content.Client/Ensnaring/Components/EnsnareableComponent.cs b/Content.Client/Ensnaring/Components/EnsnareableComponent.cs deleted file mode 100644 index 7035dcfad8..0000000000 --- a/Content.Client/Ensnaring/Components/EnsnareableComponent.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Content.Shared.Ensnaring.Components; - -namespace Content.Client.Ensnaring.Components; -[RegisterComponent] -[ComponentReference(typeof(SharedEnsnareableComponent))] -public sealed class EnsnareableComponent : SharedEnsnareableComponent -{ - [DataField("sprite")] - public string? Sprite; - - [DataField("state")] - public string? State; -} diff --git a/Content.Client/Ensnaring/Components/EnsnaringComponent.cs b/Content.Client/Ensnaring/Components/EnsnaringComponent.cs index 83c7e1199d..63c8d0dfbe 100644 --- a/Content.Client/Ensnaring/Components/EnsnaringComponent.cs +++ b/Content.Client/Ensnaring/Components/EnsnaringComponent.cs @@ -1,9 +1,3 @@ using Content.Shared.Ensnaring.Components; -namespace Content.Client.Ensnaring.Components; -[RegisterComponent] -[ComponentReference(typeof(SharedEnsnaringComponent))] -public sealed class EnsnaringComponent : SharedEnsnaringComponent -{ -} diff --git a/Content.Client/Ensnaring/EnsnareableSystem.cs b/Content.Client/Ensnaring/EnsnareableSystem.cs index 9ccb5dcba5..dd4c76e6b1 100644 --- a/Content.Client/Ensnaring/EnsnareableSystem.cs +++ b/Content.Client/Ensnaring/EnsnareableSystem.cs @@ -1,5 +1,5 @@ -using Content.Client.Ensnaring.Components; using Content.Shared.Ensnaring; +using Content.Shared.Ensnaring.Components; using Robust.Client.GameObjects; namespace Content.Client.Ensnaring.Visualizers; diff --git a/Content.Client/Inventory/StrippableBoundUserInterface.cs b/Content.Client/Inventory/StrippableBoundUserInterface.cs index 1a971d4e3c..2d0f0ee554 100644 --- a/Content.Client/Inventory/StrippableBoundUserInterface.cs +++ b/Content.Client/Inventory/StrippableBoundUserInterface.cs @@ -120,7 +120,7 @@ namespace Content.Client.Inventory } // snare-removal button. This is just the old button before the change to item slots. It is pretty out of place. - if (_entMan.TryGetComponent(Owner.Owner, out SharedEnsnareableComponent? snare) && snare.IsEnsnared) + if (_entMan.TryGetComponent(Owner.Owner, out EnsnareableComponent? snare) && snare.IsEnsnared) { var button = new Button() { diff --git a/Content.Client/Movement/Components/ClimbableComponent.cs b/Content.Client/Movement/Components/ClimbableComponent.cs deleted file mode 100644 index 1c695ac792..0000000000 --- a/Content.Client/Movement/Components/ClimbableComponent.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Content.Client.Movement.Systems; -using Content.Shared.Climbing; - -namespace Content.Client.Movement.Components; - -[RegisterComponent] -[Access(typeof(ClimbSystem))] -[ComponentReference(typeof(SharedClimbableComponent))] -public sealed class ClimbableComponent : SharedClimbableComponent { } diff --git a/Content.Client/Movement/Components/ClimbingComponent.cs b/Content.Client/Movement/Components/ClimbingComponent.cs deleted file mode 100644 index ef5ada9529..0000000000 --- a/Content.Client/Movement/Components/ClimbingComponent.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Content.Client.Movement.Systems; -using Content.Shared.Climbing; - -namespace Content.Client.Movement.Components; - -[RegisterComponent] -[Access(typeof(ClimbSystem))] -[ComponentReference(typeof(SharedClimbingComponent))] -public sealed class ClimbingComponent : SharedClimbingComponent { } diff --git a/Content.Client/Movement/Systems/ClimbSystem.cs b/Content.Client/Movement/Systems/ClimbSystem.cs index 0354ee020e..1f7b757ba4 100644 --- a/Content.Client/Movement/Systems/ClimbSystem.cs +++ b/Content.Client/Movement/Systems/ClimbSystem.cs @@ -1,5 +1,4 @@ using Content.Client.Interactable; -using Content.Client.Movement.Components; using Content.Shared.Climbing; using Content.Shared.DragDrop; using Robust.Shared.GameStates; @@ -18,14 +17,14 @@ public sealed class ClimbSystem : SharedClimbSystem private static void OnClimbingState(EntityUid uid, ClimbingComponent component, ref ComponentHandleState args) { - if (args.Current is not SharedClimbingComponent.ClimbModeComponentState climbModeState) + if (args.Current is not ClimbingComponent.ClimbModeComponentState climbModeState) return; component.IsClimbing = climbModeState.Climbing; component.OwnerIsTransitioning = climbModeState.IsTransitioning; } - protected override void OnCanDragDropOn(EntityUid uid, SharedClimbableComponent component, CanDragDropOnEvent args) + protected override void OnCanDragDropOn(EntityUid uid, ClimbableComponent component, CanDragDropOnEvent args) { base.OnCanDragDropOn(uid, component, args); diff --git a/Content.Client/Singularity/Components/ContainmentFieldComponent.cs b/Content.Client/Singularity/Components/ContainmentFieldComponent.cs deleted file mode 100644 index e90c9ee598..0000000000 --- a/Content.Client/Singularity/Components/ContainmentFieldComponent.cs +++ /dev/null @@ -1,7 +0,0 @@ -using Content.Shared.Singularity.Components; - -namespace Content.Client.Singularity.Components; - -[RegisterComponent] -[ComponentReference(typeof(SharedContainmentFieldComponent))] -public sealed class ContainmentFieldComponent : SharedContainmentFieldComponent { } diff --git a/Content.Client/Singularity/Components/ContainmentFieldGeneratorComponent.cs b/Content.Client/Singularity/Components/ContainmentFieldGeneratorComponent.cs deleted file mode 100644 index ee30bafbac..0000000000 --- a/Content.Client/Singularity/Components/ContainmentFieldGeneratorComponent.cs +++ /dev/null @@ -1,6 +0,0 @@ -using Content.Shared.Singularity.Components; - -namespace Content.Client.Singularity.Components; -[RegisterComponent] -[ComponentReference(typeof(SharedContainmentFieldGeneratorComponent))] -public sealed class ContainmentFieldGeneratorComponent : SharedContainmentFieldGeneratorComponent { } diff --git a/Content.IntegrationTests/Tests/Buckle/BuckleTest.cs b/Content.IntegrationTests/Tests/Buckle/BuckleTest.cs index 7dce7b339c..28d15580d1 100644 --- a/Content.IntegrationTests/Tests/Buckle/BuckleTest.cs +++ b/Content.IntegrationTests/Tests/Buckle/BuckleTest.cs @@ -1,11 +1,11 @@ using System.Threading.Tasks; using Content.Server.Body.Systems; -using Content.Server.Buckle.Components; using Content.Server.Buckle.Systems; using Content.Server.Hands.Components; using Content.Shared.ActionBlocker; using Content.Shared.Body.Components; using Content.Shared.Body.Part; +using Content.Shared.Buckle.Components; using Content.Shared.Hands.EntitySystems; using Content.Shared.Standing; using NUnit.Framework; diff --git a/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs b/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs index 5033c50e31..3897a149a5 100644 --- a/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs +++ b/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs @@ -2,6 +2,7 @@ using System.Threading.Tasks; using Content.Server.Climbing.Components; +using Content.Shared.Climbing; using NUnit.Framework; using Robust.Shared.GameObjects; using Robust.Shared.IoC; diff --git a/Content.Server/Administration/Systems/AdminVerbSystem.cs b/Content.Server/Administration/Systems/AdminVerbSystem.cs index 6d36c52d1a..b920216b05 100644 --- a/Content.Server/Administration/Systems/AdminVerbSystem.cs +++ b/Content.Server/Administration/Systems/AdminVerbSystem.cs @@ -14,6 +14,7 @@ using Content.Server.Prayer; using Content.Server.Xenoarchaeology.XenoArtifacts; using Content.Server.Xenoarchaeology.XenoArtifacts.Triggers.Components; using Content.Shared.Administration; +using Content.Shared.Configurable; using Content.Shared.Database; using Content.Shared.GameTicking; using Content.Shared.Interaction.Helpers; @@ -27,7 +28,7 @@ using Robust.Shared.Console; using Robust.Shared.Map; using Robust.Shared.Prototypes; using Robust.Shared.Timing; -using static Content.Shared.Configurable.SharedConfigurationComponent; +using static Content.Shared.Configurable.ConfigurationComponent; namespace Content.Server.Administration.Systems { diff --git a/Content.Server/Alert/Click/RemoveEnsnare.cs b/Content.Server/Alert/Click/RemoveEnsnare.cs index bfac76c594..7d519a6b73 100644 --- a/Content.Server/Alert/Click/RemoveEnsnare.cs +++ b/Content.Server/Alert/Click/RemoveEnsnare.cs @@ -1,6 +1,6 @@ using Content.Server.Ensnaring; -using Content.Server.Ensnaring.Components; using Content.Shared.Alert; +using Content.Shared.Ensnaring.Components; using JetBrains.Annotations; namespace Content.Server.Alert.Click; diff --git a/Content.Server/Bed/BedSystem.cs b/Content.Server/Bed/BedSystem.cs index 027e6609ba..f33cd7b147 100644 --- a/Content.Server/Bed/BedSystem.cs +++ b/Content.Server/Bed/BedSystem.cs @@ -2,7 +2,6 @@ using Content.Server.Actions; using Content.Server.Bed.Components; using Content.Server.Bed.Sleep; using Content.Server.Body.Systems; -using Content.Server.Buckle.Components; using Content.Server.MobState; using Content.Server.Power.Components; using Content.Server.Power.EntitySystems; diff --git a/Content.Server/Buckle/Components/BuckleComponent.cs b/Content.Server/Buckle/Components/BuckleComponent.cs deleted file mode 100644 index 9f003f219d..0000000000 --- a/Content.Server/Buckle/Components/BuckleComponent.cs +++ /dev/null @@ -1,38 +0,0 @@ -using Content.Server.Buckle.Systems; -using Content.Shared.Buckle.Components; - -namespace Content.Server.Buckle.Components; - -/// -/// Component that handles sitting entities into s. -/// -[RegisterComponent] -[ComponentReference(typeof(SharedBuckleComponent))] -[Access(typeof(BuckleSystem))] -public sealed class BuckleComponent : SharedBuckleComponent -{ - /// - /// The amount of time that must pass for this entity to - /// be able to unbuckle after recently buckling. - /// - [DataField("delay")] - public TimeSpan UnbuckleDelay = TimeSpan.FromSeconds(0.25f); - - /// - /// The time that this entity buckled at. - /// - [ViewVariables] public TimeSpan BuckleTime; - - /// - /// The strap that this component is buckled to. - /// - [ViewVariables] - public StrapComponent? BuckledTo { get; set; } - - /// - /// The amount of space that this entity occupies in a - /// . - /// - [DataField("size")] - public int Size = 100; -} diff --git a/Content.Server/Buckle/Components/StrapComponent.cs b/Content.Server/Buckle/Components/StrapComponent.cs deleted file mode 100644 index e3b892bab4..0000000000 --- a/Content.Server/Buckle/Components/StrapComponent.cs +++ /dev/null @@ -1,57 +0,0 @@ -using Content.Server.Buckle.Systems; -using Content.Shared.Alert; -using Content.Shared.Buckle.Components; -using Robust.Shared.Audio; - -namespace Content.Server.Buckle.Components; - -[RegisterComponent] -[ComponentReference(typeof(SharedStrapComponent))] -[Access(typeof(BuckleSystem))] -public sealed class StrapComponent : SharedStrapComponent -{ - /// - /// The angle in degrees to rotate the player by when they get strapped - /// - [DataField("rotation")] - public int Rotation { get; set; } - - /// - /// The size of the strap which is compared against when buckling entities - /// - [DataField("size")] - public int Size { get; set; } = 100; - - /// - /// If disabled, nothing can be buckled on this object, and it will unbuckle anything that's already buckled - /// - public bool Enabled { get; set; } = true; - - /// - /// You can specify the offset the entity will have after unbuckling. - /// - [DataField("unbuckleOffset", required: false)] - public Vector2 UnbuckleOffset = Vector2.Zero; - /// - /// The sound to be played when a mob is buckled - /// - [DataField("buckleSound")] - public SoundSpecifier BuckleSound { get; } = new SoundPathSpecifier("/Audio/Effects/buckle.ogg"); - - /// - /// The sound to be played when a mob is unbuckled - /// - [DataField("unbuckleSound")] - public SoundSpecifier UnbuckleSound { get; } = new SoundPathSpecifier("/Audio/Effects/unbuckle.ogg"); - - /// - /// ID of the alert to show when buckled - /// - [DataField("buckledAlertType")] - public AlertType BuckledAlertType { get; } = AlertType.Buckled; - - /// - /// The sum of the sizes of all the buckled entities in this strap - /// - public int OccupiedSize { get; set; } -} diff --git a/Content.Server/Buckle/Systems/BuckleSystem.Buckle.cs b/Content.Server/Buckle/Systems/BuckleSystem.Buckle.cs index b63ca679bb..fc50dbff5a 100644 --- a/Content.Server/Buckle/Systems/BuckleSystem.Buckle.cs +++ b/Content.Server/Buckle/Systems/BuckleSystem.Buckle.cs @@ -1,5 +1,4 @@ using System.Diagnostics.CodeAnalysis; -using Content.Server.Buckle.Components; using Content.Server.Storage.Components; using Content.Shared.Alert; using Content.Shared.Bed.Sleep; @@ -14,7 +13,6 @@ using Content.Shared.Stunnable; using Content.Shared.Vehicle.Components; using Content.Shared.Verbs; using Robust.Shared.GameStates; -using Robust.Shared.Player; namespace Content.Server.Buckle.Systems; diff --git a/Content.Server/Buckle/Systems/BuckleSystem.Strap.cs b/Content.Server/Buckle/Systems/BuckleSystem.Strap.cs index e2e55d5ba7..65e15f0fc2 100644 --- a/Content.Server/Buckle/Systems/BuckleSystem.Strap.cs +++ b/Content.Server/Buckle/Systems/BuckleSystem.Strap.cs @@ -1,5 +1,4 @@ using System.Linq; -using Content.Server.Buckle.Components; using Content.Server.Construction.Completions; using Content.Shared.Buckle.Components; using Content.Shared.Destructible; diff --git a/Content.Server/CartridgeLoader/CartridgeLoaderComponent.cs b/Content.Server/CartridgeLoader/CartridgeLoaderComponent.cs deleted file mode 100644 index 1d6b4adc20..0000000000 --- a/Content.Server/CartridgeLoader/CartridgeLoaderComponent.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Content.Shared.CartridgeLoader; -using Robust.Shared.Serialization.TypeSerializers.Implementations; - -namespace Content.Server.CartridgeLoader; - -[RegisterComponent] -[ComponentReference(typeof(SharedCartridgeLoaderComponent))] -public sealed class CartridgeLoaderComponent : SharedCartridgeLoaderComponent -{ - /// - /// The maximum amount of programs that can be installed on the cartridge loader entity - /// - [DataField("diskSpace")] - public int DiskSpace = 5; - - [DataField("uiKey", readOnly: true, required: true, customTypeSerializer: typeof(EnumSerializer))] - public Enum UiKey = default!; -} diff --git a/Content.Server/CartridgeLoader/CartridgeLoaderSystem.cs b/Content.Server/CartridgeLoader/CartridgeLoaderSystem.cs index a524aaa8a2..f001a6b02d 100644 --- a/Content.Server/CartridgeLoader/CartridgeLoaderSystem.cs +++ b/Content.Server/CartridgeLoader/CartridgeLoaderSystem.cs @@ -241,13 +241,13 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem loader.BackgroundPrograms.Remove(cartridgeUid); } - protected override void OnItemInserted(EntityUid uid, SharedCartridgeLoaderComponent loader, EntInsertedIntoContainerMessage args) + protected override void OnItemInserted(EntityUid uid, Shared.CartridgeLoader.CartridgeLoaderComponent loader, EntInsertedIntoContainerMessage args) { RaiseLocalEvent(args.Entity, new CartridgeAddedEvent(uid)); base.OnItemInserted(uid, loader, args); } - protected override void OnItemRemoved(EntityUid uid, SharedCartridgeLoaderComponent loader, EntRemovedFromContainerMessage args) + protected override void OnItemRemoved(EntityUid uid, Shared.CartridgeLoader.CartridgeLoaderComponent loader, EntRemovedFromContainerMessage args) { var deactivate = loader.BackgroundPrograms.Remove(args.Entity); diff --git a/Content.Server/Climbing/ClimbSystem.cs b/Content.Server/Climbing/ClimbSystem.cs index 1534133b13..b8b0ac2628 100644 --- a/Content.Server/Climbing/ClimbSystem.cs +++ b/Content.Server/Climbing/ClimbSystem.cs @@ -66,7 +66,7 @@ public sealed class ClimbSystem : SharedClimbSystem SubscribeLocalEvent(OnGlassClimbed); } - protected override void OnCanDragDropOn(EntityUid uid, SharedClimbableComponent component, CanDragDropOnEvent args) + protected override void OnCanDragDropOn(EntityUid uid, ClimbableComponent component, CanDragDropOnEvent args) { base.OnCanDragDropOn(uid, component, args); @@ -166,6 +166,7 @@ public sealed class ClimbSystem : SharedClimbSystem return; climbing.IsClimbing = true; + Dirty(climbing); MoveEntityToward(uid, climbable, physics, climbing); // we may potentially need additional logic since we're forcing a player onto a climbable @@ -265,6 +266,7 @@ public sealed class ClimbSystem : SharedClimbSystem climbing.IsClimbing = false; climbing.OwnerIsTransitioning = false; + Dirty(climbing); } /// @@ -275,7 +277,7 @@ public sealed class ClimbSystem : SharedClimbSystem /// The object that is being vaulted /// The reason why it cant be dropped /// - private bool CanVault(SharedClimbableComponent component, EntityUid user, EntityUid target, out string reason) + private bool CanVault(ClimbableComponent component, EntityUid user, EntityUid target, out string reason) { if (!_actionBlockerSystem.CanInteract(user, target)) { @@ -311,7 +313,7 @@ public sealed class ClimbSystem : SharedClimbSystem /// The object that is being vaulted onto /// The reason why it cant be dropped /// - private bool CanVault(SharedClimbableComponent component, EntityUid user, EntityUid dragged, EntityUid target, + private bool CanVault(ClimbableComponent component, EntityUid user, EntityUid dragged, EntityUid target, out string reason) { if (!_actionBlockerSystem.CanInteract(user, dragged) || !_actionBlockerSystem.CanInteract(user, target)) @@ -353,7 +355,7 @@ public sealed class ClimbSystem : SharedClimbSystem private static void OnClimbingGetState(EntityUid uid, ClimbingComponent component, ref ComponentGetState args) { - args.State = new SharedClimbingComponent.ClimbModeComponentState(component.IsClimbing, component.OwnerIsTransitioning); + args.State = new ClimbingComponent.ClimbModeComponentState(component.IsClimbing, component.OwnerIsTransitioning); } private void OnGlassClimbed(EntityUid uid, GlassTableComponent component, ClimbedOnEvent args) @@ -401,7 +403,7 @@ public sealed class ClimbSystem : SharedClimbSystem _actionBlockerSystem.UpdateCanMove(uid); // Transition back to KinematicController after BufferTime - climbing.Owner.SpawnTimer((int) (SharedClimbingComponent.BufferTime * 1000), () => + climbing.Owner.SpawnTimer((int) (ClimbingComponent.BufferTime * 1000), () => { if (climbing.Deleted) return; physics.BodyType = BodyType.KinematicController; diff --git a/Content.Server/Climbing/Components/ClimbableComponent.cs b/Content.Server/Climbing/Components/ClimbableComponent.cs deleted file mode 100644 index 1655b4d225..0000000000 --- a/Content.Server/Climbing/Components/ClimbableComponent.cs +++ /dev/null @@ -1,49 +0,0 @@ -using Content.Shared.CCVar; -using Content.Shared.Climbing; -using Content.Shared.Damage; -using Robust.Shared.Audio; - -namespace Content.Server.Climbing.Components; - -[RegisterComponent] -[ComponentReference(typeof(SharedClimbableComponent))] -public sealed class ClimbableComponent : SharedClimbableComponent -{ - /// - /// The time it takes to climb onto the entity. - /// - [DataField("delay")] - public float ClimbDelay = 0.8f; - - /// - /// If set, people can bonk on this if is set or if they are clumsy. - /// - [DataField("bonk")] public bool Bonk = false; - - /// - /// Chance of bonk triggering if the user is clumsy. - /// - [DataField("bonkClumsyChance")] - public float BonkClumsyChance = 0.75f; - - /// - /// Sound to play when bonking. - /// - /// - [DataField("bonkSound")] - public SoundSpecifier? BonkSound; - - /// - /// How long to stun players on bonk, in seconds. - /// - /// - [DataField("bonkTime")] - public float BonkTime = 2; - - /// - /// How much damage to apply on bonk. - /// - /// - [DataField("bonkDamage")] - public DamageSpecifier? BonkDamage; -} diff --git a/Content.Server/Climbing/Components/ClimbingComponent.cs b/Content.Server/Climbing/Components/ClimbingComponent.cs deleted file mode 100644 index 5eab1b9672..0000000000 --- a/Content.Server/Climbing/Components/ClimbingComponent.cs +++ /dev/null @@ -1,35 +0,0 @@ -using Content.Shared.Climbing; - -namespace Content.Server.Climbing.Components; - -[RegisterComponent] -[ComponentReference(typeof(SharedClimbingComponent))] -[Access(typeof(ClimbSystem))] -public sealed class ClimbingComponent : SharedClimbingComponent -{ - [ViewVariables(VVAccess.ReadWrite)] - public override bool IsClimbing - { - get => base.IsClimbing; - set - { - if (base.IsClimbing == value) return; - base.IsClimbing = value; - Dirty(); - } - } - - public override bool OwnerIsTransitioning - { - get => base.OwnerIsTransitioning; - set - { - if (value == base.OwnerIsTransitioning) return; - base.OwnerIsTransitioning = value; - Dirty(); - } - } - - [ViewVariables] - public Dictionary DisabledFixtureMasks { get; } = new(); -} diff --git a/Content.Server/Configurable/ConfigurationComponent.cs b/Content.Server/Configurable/ConfigurationComponent.cs deleted file mode 100644 index 22d7a0dd0f..0000000000 --- a/Content.Server/Configurable/ConfigurationComponent.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Content.Shared.Configurable; -using Content.Shared.Tools; -using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; - -namespace Content.Server.Configurable; - -[RegisterComponent] -[ComponentReference(typeof(SharedConfigurationComponent))] -public sealed class ConfigurationComponent : SharedConfigurationComponent -{ - [DataField("config")] - public readonly Dictionary Config = new(); - - [DataField("qualityNeeded", customTypeSerializer: typeof(PrototypeIdSerializer))] - public string QualityNeeded = "Pulsing"; -} diff --git a/Content.Server/Configurable/ConfigurationSystem.cs b/Content.Server/Configurable/ConfigurationSystem.cs index 66a2a56b4a..9b43d0f65d 100644 --- a/Content.Server/Configurable/ConfigurationSystem.cs +++ b/Content.Server/Configurable/ConfigurationSystem.cs @@ -1,8 +1,9 @@ +using Content.Shared.Configurable; using Content.Shared.Interaction; using Content.Shared.Tools.Components; using Robust.Server.GameObjects; using Robust.Shared.Containers; -using static Content.Shared.Configurable.SharedConfigurationComponent; +using static Content.Shared.Configurable.ConfigurationComponent; namespace Content.Server.Configurable; diff --git a/Content.Server/Disease/Cures/DiseaseBedrestCure.cs b/Content.Server/Disease/Cures/DiseaseBedrestCure.cs index 2357a46fa0..e5abe041dc 100644 --- a/Content.Server/Disease/Cures/DiseaseBedrestCure.cs +++ b/Content.Server/Disease/Cures/DiseaseBedrestCure.cs @@ -1,6 +1,6 @@ using Content.Server.Bed.Components; -using Content.Server.Buckle.Components; using Content.Shared.Bed.Sleep; +using Content.Shared.Buckle.Components; using Content.Shared.Disease; namespace Content.Server.Disease.Cures diff --git a/Content.Server/Ensnaring/Components/EnsnareableComponent.cs b/Content.Server/Ensnaring/Components/EnsnareableComponent.cs deleted file mode 100644 index c5af4f58f5..0000000000 --- a/Content.Server/Ensnaring/Components/EnsnareableComponent.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Content.Shared.Ensnaring.Components; -using Robust.Shared.Containers; - -namespace Content.Server.Ensnaring.Components; -[RegisterComponent] -[ComponentReference(typeof(SharedEnsnareableComponent))] -public sealed class EnsnareableComponent : SharedEnsnareableComponent -{ - /// - /// The container where the entity will be stored - /// - public Container Container = default!; -} diff --git a/Content.Server/Ensnaring/Components/EnsnaringComponent.cs b/Content.Server/Ensnaring/Components/EnsnaringComponent.cs index 69fa9a241f..da9ad56c5e 100644 --- a/Content.Server/Ensnaring/Components/EnsnaringComponent.cs +++ b/Content.Server/Ensnaring/Components/EnsnaringComponent.cs @@ -1,43 +1,5 @@ using System.Threading; using Content.Shared.Ensnaring.Components; -namespace Content.Server.Ensnaring.Components; -[RegisterComponent] -[ComponentReference(typeof(SharedEnsnaringComponent))] -public sealed class EnsnaringComponent : SharedEnsnaringComponent -{ - /// - /// Should movement cancel breaking out? - /// - [ViewVariables(VVAccess.ReadWrite)] - [DataField("canMoveBreakout")] - public bool CanMoveBreakout; - public CancellationTokenSource? CancelToken; -} -/// -/// Used for the do after event to free the entity that owns the -/// -public sealed class FreeEnsnareDoAfterComplete : EntityEventArgs -{ - public readonly EntityUid EnsnaringEntity; - - public FreeEnsnareDoAfterComplete(EntityUid ensnaringEntity) - { - EnsnaringEntity = ensnaringEntity; - } -} - -/// -/// Used for the do after event when it fails to free the entity that owns the -/// -public sealed class FreeEnsnareDoAfterCancel : EntityEventArgs -{ - public readonly EntityUid EnsnaringEntity; - - public FreeEnsnareDoAfterCancel(EntityUid ensnaringEntity) - { - EnsnaringEntity = ensnaringEntity; - } -} diff --git a/Content.Server/Ensnaring/EnsnareableSystem.Ensnaring.cs b/Content.Server/Ensnaring/EnsnareableSystem.Ensnaring.cs index 3722324292..0bfde38c78 100644 --- a/Content.Server/Ensnaring/EnsnareableSystem.Ensnaring.cs +++ b/Content.Server/Ensnaring/EnsnareableSystem.Ensnaring.cs @@ -1,12 +1,10 @@ using System.Threading; using Content.Server.DoAfter; -using Content.Server.Ensnaring.Components; using Content.Shared.Alert; using Content.Shared.Ensnaring.Components; using Content.Shared.IdentityManagement; using Content.Shared.StepTrigger.Systems; using Content.Shared.Throwing; -using Robust.Shared.Player; namespace Content.Server.Ensnaring; diff --git a/Content.Server/Ensnaring/EnsnareableSystem.cs b/Content.Server/Ensnaring/EnsnareableSystem.cs index b10dca6709..cbb025459f 100644 --- a/Content.Server/Ensnaring/EnsnareableSystem.cs +++ b/Content.Server/Ensnaring/EnsnareableSystem.cs @@ -1,11 +1,9 @@ -using Content.Server.Ensnaring.Components; using Content.Server.Popups; using Content.Shared.Ensnaring; using Content.Shared.Ensnaring.Components; using Content.Shared.Popups; using Robust.Server.Containers; using Robust.Shared.Containers; -using Robust.Shared.Player; namespace Content.Server.Ensnaring; diff --git a/Content.Server/Foldable/FoldableSystem.cs b/Content.Server/Foldable/FoldableSystem.cs index 7b784bcf93..4b66d2aba0 100644 --- a/Content.Server/Foldable/FoldableSystem.cs +++ b/Content.Server/Foldable/FoldableSystem.cs @@ -1,7 +1,7 @@ using System.Linq; -using Content.Server.Buckle.Components; using Content.Server.Buckle.Systems; using Content.Server.Storage.Components; +using Content.Shared.Buckle.Components; using Content.Shared.Foldable; using Content.Shared.Verbs; using JetBrains.Annotations; diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs index 7e47f9a06b..7015e39cad 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs @@ -1,4 +1,3 @@ -using Content.Server.Buckle.Components; using Content.Server.Doors.Components; using Content.Server.Doors.Systems; using Content.Server.Shuttles.Components; @@ -14,7 +13,7 @@ using Robust.Shared.Player; using Robust.Shared.Utility; using System.Diagnostics.CodeAnalysis; using Content.Server.Shuttles.Events; -using Content.Server.Station.Components; +using Content.Shared.Buckle.Components; using Robust.Shared.Map.Components; using Robust.Shared.Physics.Components; diff --git a/Content.Server/Singularity/EntitySystems/ContainmentFieldGeneratorSystem.cs b/Content.Server/Singularity/EntitySystems/ContainmentFieldGeneratorSystem.cs index 94ac8e9e99..c69b730707 100644 --- a/Content.Server/Singularity/EntitySystems/ContainmentFieldGeneratorSystem.cs +++ b/Content.Server/Singularity/EntitySystems/ContainmentFieldGeneratorSystem.cs @@ -1,20 +1,15 @@ -using Content.Server.Singularity.Components; using Content.Server.Singularity.Events; using Content.Shared.Singularity.Components; using Content.Shared.Tag; using Robust.Server.GameObjects; using Robust.Shared.Physics; -using Robust.Shared.Physics.Dynamics; -using System.Linq; using Content.Server.Popups; using Content.Shared.Construction.Components; using Content.Shared.Examine; using Content.Shared.Interaction; using Content.Shared.Popups; -using Content.Shared.Throwing; using Robust.Shared.Physics.Components; using Robust.Shared.Physics.Events; -using Robust.Shared.Player; namespace Content.Server.Singularity.EntitySystems; diff --git a/Content.Server/Singularity/EntitySystems/ContainmentFieldSystem.cs b/Content.Server/Singularity/EntitySystems/ContainmentFieldSystem.cs index 13a82691d1..48487cbb94 100644 --- a/Content.Server/Singularity/EntitySystems/ContainmentFieldSystem.cs +++ b/Content.Server/Singularity/EntitySystems/ContainmentFieldSystem.cs @@ -1,13 +1,11 @@ using Content.Server.Popups; using Content.Server.Shuttles.Components; -using Content.Server.Singularity.Components; -using Content.Server.Singularity.EntitySystems; using Content.Server.Singularity.Events; using Content.Shared.Popups; +using Content.Shared.Singularity.Components; using Content.Shared.Throwing; using Robust.Shared.Physics.Components; using Robust.Shared.Physics.Events; -using Robust.Shared.Player; namespace Content.Server.Singularity.EntitySystems; diff --git a/Content.Server/Strip/StrippableSystem.cs b/Content.Server/Strip/StrippableSystem.cs index e14b85b22b..08c71c8fe7 100644 --- a/Content.Server/Strip/StrippableSystem.cs +++ b/Content.Server/Strip/StrippableSystem.cs @@ -1,7 +1,6 @@ using Content.Server.Cuffs.Components; using Content.Server.DoAfter; using Content.Server.Ensnaring; -using Content.Server.Ensnaring.Components; using Content.Server.Hands.Components; using Content.Shared.CombatMode; using Content.Shared.Hands.Components; @@ -13,10 +12,10 @@ using Content.Shared.Popups; using Content.Shared.Strip.Components; using Content.Shared.Verbs; using Robust.Server.GameObjects; -using Robust.Shared.Player; using System.Threading; using Content.Server.Administration.Logs; using Content.Shared.Database; +using Content.Shared.Ensnaring.Components; namespace Content.Server.Strip { diff --git a/Content.Server/Toilet/ToiletSystem.cs b/Content.Server/Toilet/ToiletSystem.cs index 1bb6de9e48..0bb8b3c7d2 100644 --- a/Content.Server/Toilet/ToiletSystem.cs +++ b/Content.Server/Toilet/ToiletSystem.cs @@ -1,5 +1,4 @@ using Content.Server.Body.Systems; -using Content.Server.Buckle.Components; using Content.Server.Buckle.Systems; using Content.Server.Popups; using Content.Server.Storage.Components; @@ -7,6 +6,7 @@ using Content.Server.Storage.EntitySystems; using Content.Server.Tools; using Content.Shared.Body.Components; using Content.Shared.Body.Part; +using Content.Shared.Buckle.Components; using Content.Shared.Examine; using Content.Shared.IdentityManagement; using Content.Shared.Interaction; diff --git a/Content.Shared/Buckle/Components/SharedBuckleComponent.cs b/Content.Shared/Buckle/Components/BuckleComponent.cs similarity index 52% rename from Content.Shared/Buckle/Components/SharedBuckleComponent.cs rename to Content.Shared/Buckle/Components/BuckleComponent.cs index 026a5b8794..3d7269ce96 100644 --- a/Content.Shared/Buckle/Components/SharedBuckleComponent.cs +++ b/Content.Shared/Buckle/Components/BuckleComponent.cs @@ -4,15 +4,14 @@ using Robust.Shared.Serialization; namespace Content.Shared.Buckle.Components; -[NetworkedComponent] -[Access(typeof(SharedBuckleSystem))] -public abstract class SharedBuckleComponent : Component +[RegisterComponent, NetworkedComponent] +public sealed class BuckleComponent : Component { /// - /// The range from which this entity can buckle to a . + /// The range from which this entity can buckle to a . /// [DataField("range")] - public float Range { get; protected set; } = SharedInteractionSystem.InteractionRange / 1.4f; + public float Range = SharedInteractionSystem.InteractionRange / 1.4f; /// /// True if the entity is buckled, false otherwise. @@ -22,6 +21,36 @@ public abstract class SharedBuckleComponent : Component public EntityUid? LastEntityBuckledTo { get; set; } public bool DontCollide { get; set; } + + /// + /// The amount of time that must pass for this entity to + /// be able to unbuckle after recently buckling. + /// + [DataField("delay")] + public TimeSpan UnbuckleDelay = TimeSpan.FromSeconds(0.25f); + + /// + /// The time that this entity buckled at. + /// + [ViewVariables] public TimeSpan BuckleTime; + + /// + /// The strap that this component is buckled to. + /// + [ViewVariables] + public StrapComponent? BuckledTo { get; set; } + + /// + /// The amount of space that this entity occupies in a + /// . + /// + [DataField("size")] + public int Size = 100; + + /// + /// Used for client rendering + /// + public int? OriginalDrawDepth { get; set; } } [Serializable, NetSerializable] diff --git a/Content.Shared/Buckle/Components/SharedStrapComponent.cs b/Content.Shared/Buckle/Components/StrapComponent.cs similarity index 58% rename from Content.Shared/Buckle/Components/SharedStrapComponent.cs rename to Content.Shared/Buckle/Components/StrapComponent.cs index b769929027..6d070a10af 100644 --- a/Content.Shared/Buckle/Components/SharedStrapComponent.cs +++ b/Content.Shared/Buckle/Components/StrapComponent.cs @@ -1,3 +1,5 @@ +using Content.Shared.Alert; +using Robust.Shared.Audio; using Robust.Shared.GameStates; using Robust.Shared.Serialization; @@ -21,9 +23,8 @@ public enum StrapPosition Down } -[NetworkedComponent] -[Access(typeof(SharedBuckleSystem))] -public abstract class SharedStrapComponent : Component +[RegisterComponent, NetworkedComponent] +public sealed class StrapComponent : Component { /// /// The change in position to the strapped mob @@ -58,6 +59,52 @@ public abstract class SharedStrapComponent : Component [DataField("buckleOffset", required: false)] [Access(Other = AccessPermissions.ReadWrite)] public Vector2 BuckleOffsetUnclamped = Vector2.Zero; + + + /// + /// The angle in degrees to rotate the player by when they get strapped + /// + [DataField("rotation")] + public int Rotation { get; set; } + + /// + /// The size of the strap which is compared against when buckling entities + /// + [DataField("size")] + public int Size { get; set; } = 100; + + /// + /// If disabled, nothing can be buckled on this object, and it will unbuckle anything that's already buckled + /// + public bool Enabled { get; set; } = true; + + /// + /// You can specify the offset the entity will have after unbuckling. + /// + [DataField("unbuckleOffset", required: false)] + public Vector2 UnbuckleOffset = Vector2.Zero; + /// + /// The sound to be played when a mob is buckled + /// + [DataField("buckleSound")] + public SoundSpecifier BuckleSound { get; } = new SoundPathSpecifier("/Audio/Effects/buckle.ogg"); + + /// + /// The sound to be played when a mob is unbuckled + /// + [DataField("unbuckleSound")] + public SoundSpecifier UnbuckleSound { get; } = new SoundPathSpecifier("/Audio/Effects/unbuckle.ogg"); + + /// + /// ID of the alert to show when buckled + /// + [DataField("buckledAlertType")] + public AlertType BuckledAlertType { get; } = AlertType.Buckled; + + /// + /// The sum of the sizes of all the buckled entities in this strap + /// + public int OccupiedSize { get; set; } } [Serializable, NetSerializable] diff --git a/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs b/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs index b136d7892b..972db5b7c9 100644 --- a/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs +++ b/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs @@ -13,15 +13,15 @@ public abstract partial class SharedBuckleSystem { private void InitializeBuckle() { - SubscribeLocalEvent(PreventCollision); - SubscribeLocalEvent(HandleDown); - SubscribeLocalEvent(HandleStand); - SubscribeLocalEvent(HandleThrowPushback); - SubscribeLocalEvent(HandleMove); - SubscribeLocalEvent(OnBuckleChangeDirectionAttempt); + SubscribeLocalEvent(PreventCollision); + SubscribeLocalEvent(HandleDown); + SubscribeLocalEvent(HandleStand); + SubscribeLocalEvent(HandleThrowPushback); + SubscribeLocalEvent(HandleMove); + SubscribeLocalEvent(OnBuckleChangeDirectionAttempt); } - private void PreventCollision(EntityUid uid, SharedBuckleComponent component, ref PreventCollideEvent args) + private void PreventCollision(EntityUid uid, BuckleComponent component, ref PreventCollideEvent args) { if (args.BodyB.Owner != component.LastEntityBuckledTo) return; @@ -30,25 +30,25 @@ public abstract partial class SharedBuckleSystem args.Cancelled = true; } - private void HandleDown(EntityUid uid, SharedBuckleComponent component, DownAttemptEvent args) + private void HandleDown(EntityUid uid, BuckleComponent component, DownAttemptEvent args) { if (component.Buckled) args.Cancel(); } - private void HandleStand(EntityUid uid, SharedBuckleComponent component, StandAttemptEvent args) + private void HandleStand(EntityUid uid, BuckleComponent component, StandAttemptEvent args) { if (component.Buckled) args.Cancel(); } - private void HandleThrowPushback(EntityUid uid, SharedBuckleComponent component, ThrowPushbackAttemptEvent args) + private void HandleThrowPushback(EntityUid uid, BuckleComponent component, ThrowPushbackAttemptEvent args) { if (component.Buckled) args.Cancel(); } - private void HandleMove(EntityUid uid, SharedBuckleComponent component, UpdateCanMoveEvent args) + private void HandleMove(EntityUid uid, BuckleComponent component, UpdateCanMoveEvent args) { if (component.LifeStage > ComponentLifeStage.Running) return; @@ -58,13 +58,13 @@ public abstract partial class SharedBuckleSystem args.Cancel(); } - private void OnBuckleChangeDirectionAttempt(EntityUid uid, SharedBuckleComponent component, ChangeDirectionAttemptEvent args) + private void OnBuckleChangeDirectionAttempt(EntityUid uid, BuckleComponent component, ChangeDirectionAttemptEvent args) { if (component.Buckled) args.Cancel(); } - public bool IsBuckled(EntityUid uid, SharedBuckleComponent? component = null) + public bool IsBuckled(EntityUid uid, BuckleComponent? component = null) { return Resolve(uid, ref component, false) && component.Buckled; } @@ -75,7 +75,7 @@ public abstract partial class SharedBuckleSystem /// The entity to reattach. /// The strap to reattach to. /// The buckle component of the entity to reattach. - public void ReAttach(EntityUid buckleId, SharedStrapComponent strap, SharedBuckleComponent? buckle = null) + public void ReAttach(EntityUid buckleId, StrapComponent strap, BuckleComponent? buckle = null) { if (!Resolve(buckleId, ref buckle, false)) return; diff --git a/Content.Shared/Buckle/SharedBuckleSystem.Strap.cs b/Content.Shared/Buckle/SharedBuckleSystem.Strap.cs index 58edb3f2d7..8e54bd384e 100644 --- a/Content.Shared/Buckle/SharedBuckleSystem.Strap.cs +++ b/Content.Shared/Buckle/SharedBuckleSystem.Strap.cs @@ -11,12 +11,12 @@ public abstract partial class SharedBuckleSystem private void InitializeStrap() { - SubscribeLocalEvent(OnStrapRotate); - SubscribeLocalEvent(OnStrapHandleState); - SubscribeLocalEvent(OnStrapCanDragDropOn); + SubscribeLocalEvent(OnStrapRotate); + SubscribeLocalEvent(OnStrapHandleState); + SubscribeLocalEvent(OnStrapCanDragDropOn); } - private void OnStrapHandleState(EntityUid uid, SharedStrapComponent component, ref ComponentHandleState args) + private void OnStrapHandleState(EntityUid uid, StrapComponent component, ref ComponentHandleState args) { if (args.Current is not StrapComponentState state) return; @@ -28,7 +28,7 @@ public abstract partial class SharedBuckleSystem component.MaxBuckleDistance = state.MaxBuckleDistance; } - private void OnStrapRotate(EntityUid uid, SharedStrapComponent component, ref MoveEvent args) + private void OnStrapRotate(EntityUid uid, StrapComponent component, ref MoveEvent args) { // TODO: This looks dirty af. // On rotation of a strap, reattach all buckled entities. @@ -50,7 +50,7 @@ public abstract partial class SharedBuckleSystem foreach (var buckledEntity in component.BuckledEntities) { - if (!EntityManager.TryGetComponent(buckledEntity, out SharedBuckleComponent? buckled)) + if (!EntityManager.TryGetComponent(buckledEntity, out BuckleComponent? buckled)) { continue; } @@ -71,8 +71,8 @@ public abstract partial class SharedBuckleSystem EntityUid user, EntityUid target, EntityUid buckleId, - SharedStrapComponent? strap = null, - SharedBuckleComponent? buckle = null) + StrapComponent? strap = null, + BuckleComponent? buckle = null) { if (!Resolve(strapId, ref strap, false) || !Resolve(buckleId, ref buckle, false)) @@ -85,7 +85,7 @@ public abstract partial class SharedBuckleSystem return _interactions.InRangeUnobstructed(target, buckleId, buckle.Range, predicate: Ignored); } - private void OnStrapCanDragDropOn(EntityUid uid, SharedStrapComponent strap, CanDragDropOnEvent args) + private void OnStrapCanDragDropOn(EntityUid uid, StrapComponent strap, CanDragDropOnEvent args) { args.CanDrop = StrapCanDragDropOn(args.Target, args.User, args.Target, args.Dragged, strap); args.Handled = true; diff --git a/Content.Shared/CartridgeLoader/SharedCartridgeLoaderComponent.cs b/Content.Shared/CartridgeLoader/CartridgeLoaderComponent.cs similarity index 66% rename from Content.Shared/CartridgeLoader/SharedCartridgeLoaderComponent.cs rename to Content.Shared/CartridgeLoader/CartridgeLoaderComponent.cs index b53045082a..0fa946b248 100644 --- a/Content.Shared/CartridgeLoader/SharedCartridgeLoaderComponent.cs +++ b/Content.Shared/CartridgeLoader/CartridgeLoaderComponent.cs @@ -1,9 +1,11 @@ using Content.Shared.Containers.ItemSlots; +using Robust.Shared.GameStates; +using Robust.Shared.Serialization.TypeSerializers.Implementations; namespace Content.Shared.CartridgeLoader; -[Access(typeof(SharedCartridgeLoaderSystem))] -public abstract class SharedCartridgeLoaderComponent : Component +[RegisterComponent, NetworkedComponent] +public sealed class CartridgeLoaderComponent : Component { public const string CartridgeSlotId = "Cartridge-Slot"; @@ -33,4 +35,13 @@ public abstract class SharedCartridgeLoaderComponent : Component /// [DataField("installedCartridges")] public List InstalledPrograms = new(); + + /// + /// The maximum amount of programs that can be installed on the cartridge loader entity + /// + [DataField("diskSpace")] + public int DiskSpace = 5; + + [DataField("uiKey", readOnly: true, required: true, customTypeSerializer: typeof(EnumSerializer))] + public Enum UiKey = default!; } diff --git a/Content.Shared/CartridgeLoader/SharedCartridgeLoaderSystem.cs b/Content.Shared/CartridgeLoader/SharedCartridgeLoaderSystem.cs index a5946de1ba..0bd7c5ec16 100644 --- a/Content.Shared/CartridgeLoader/SharedCartridgeLoaderSystem.cs +++ b/Content.Shared/CartridgeLoader/SharedCartridgeLoaderSystem.cs @@ -14,26 +14,26 @@ public abstract class SharedCartridgeLoaderSystem : EntitySystem { base.Initialize(); - SubscribeLocalEvent(OnComponentInit); - SubscribeLocalEvent(OnComponentRemove); + SubscribeLocalEvent(OnComponentInit); + SubscribeLocalEvent(OnComponentRemove); - SubscribeLocalEvent(OnItemInserted); - SubscribeLocalEvent(OnItemRemoved); + SubscribeLocalEvent(OnItemInserted); + SubscribeLocalEvent(OnItemRemoved); SubscribeLocalEvent(OnGetState); SubscribeLocalEvent(OnHandleState); } - private void OnComponentInit(EntityUid uid, SharedCartridgeLoaderComponent loader, ComponentInit args) + private void OnComponentInit(EntityUid uid, CartridgeLoaderComponent loader, ComponentInit args) { - _itemSlotsSystem.AddItemSlot(uid, SharedCartridgeLoaderComponent.CartridgeSlotId, loader.CartridgeSlot); + _itemSlotsSystem.AddItemSlot(uid, CartridgeLoaderComponent.CartridgeSlotId, loader.CartridgeSlot); } /// /// Marks installed program entities for deletion when the component gets removed /// - private void OnComponentRemove(EntityUid uid, SharedCartridgeLoaderComponent loader, ComponentRemove args) + private void OnComponentRemove(EntityUid uid, CartridgeLoaderComponent loader, ComponentRemove args) { _itemSlotsSystem.RemoveItemSlot(uid, loader.CartridgeSlot); @@ -43,12 +43,12 @@ public abstract class SharedCartridgeLoaderSystem : EntitySystem } } - protected virtual void OnItemInserted(EntityUid uid, SharedCartridgeLoaderComponent loader, EntInsertedIntoContainerMessage args) + protected virtual void OnItemInserted(EntityUid uid, CartridgeLoaderComponent loader, EntInsertedIntoContainerMessage args) { UpdateAppearanceData(uid, loader); } - protected virtual void OnItemRemoved(EntityUid uid, SharedCartridgeLoaderComponent loader, EntRemovedFromContainerMessage args) + protected virtual void OnItemRemoved(EntityUid uid, CartridgeLoaderComponent loader, EntRemovedFromContainerMessage args) { UpdateAppearanceData(uid, loader); } @@ -69,7 +69,7 @@ public abstract class SharedCartridgeLoaderSystem : EntitySystem component.InstallationStatus = state.InstallationStatus; } - private void UpdateAppearanceData(EntityUid uid, SharedCartridgeLoaderComponent loader) + private void UpdateAppearanceData(EntityUid uid, CartridgeLoaderComponent loader) { _appearanceSystem.SetData(uid, CartridgeLoaderVisuals.CartridgeInserted, loader.CartridgeSlot.HasItem); } diff --git a/Content.Shared/Climbing/ClimbableComponent.cs b/Content.Shared/Climbing/ClimbableComponent.cs new file mode 100644 index 0000000000..a185da1905 --- /dev/null +++ b/Content.Shared/Climbing/ClimbableComponent.cs @@ -0,0 +1,55 @@ +using Content.Shared.CCVar; +using Content.Shared.Damage; +using Content.Shared.Interaction; +using Robust.Shared.Audio; +using Robust.Shared.GameStates; + +namespace Content.Shared.Climbing +{ + [RegisterComponent, NetworkedComponent] + public sealed class ClimbableComponent : Component + { + /// + /// The range from which this entity can be climbed. + /// + [DataField("range")] public float Range = SharedInteractionSystem.InteractionRange / 1.4f; + + /// + /// The time it takes to climb onto the entity. + /// + [DataField("delay")] + public float ClimbDelay = 0.8f; + + /// + /// If set, people can bonk on this if is set or if they are clumsy. + /// + [DataField("bonk")] public bool Bonk = false; + + /// + /// Chance of bonk triggering if the user is clumsy. + /// + [DataField("bonkClumsyChance")] + public float BonkClumsyChance = 0.75f; + + /// + /// Sound to play when bonking. + /// + /// + [DataField("bonkSound")] + public SoundSpecifier? BonkSound; + + /// + /// How long to stun players on bonk, in seconds. + /// + /// + [DataField("bonkTime")] + public float BonkTime = 2; + + /// + /// How much damage to apply on bonk. + /// + /// + [DataField("bonkDamage")] + public DamageSpecifier? BonkDamage; + } +} diff --git a/Content.Shared/Climbing/SharedClimbingComponent.cs b/Content.Shared/Climbing/ClimbingComponent.cs similarity index 76% rename from Content.Shared/Climbing/SharedClimbingComponent.cs rename to Content.Shared/Climbing/ClimbingComponent.cs index 23db85df73..bf9745ebd6 100644 --- a/Content.Shared/Climbing/SharedClimbingComponent.cs +++ b/Content.Shared/Climbing/ClimbingComponent.cs @@ -3,26 +3,29 @@ using Robust.Shared.Serialization; namespace Content.Shared.Climbing; -[NetworkedComponent] -public abstract class SharedClimbingComponent : Component +[RegisterComponent, NetworkedComponent] +public sealed class ClimbingComponent : Component { /// /// Whether the owner is climbing on a climbable entity. /// [ViewVariables] - public virtual bool IsClimbing { get; set; } + public bool IsClimbing { get; set; } /// /// Whether the owner is being moved onto the climbed entity. /// [ViewVariables] - public virtual bool OwnerIsTransitioning { get; set; } + public bool OwnerIsTransitioning { get; set; } /// /// We'll launch the mob onto the table and give them at least this amount of time to be on it. /// public const float BufferTime = 0.3f; + [ViewVariables] + public Dictionary DisabledFixtureMasks { get; } = new(); + [Serializable, NetSerializable] public sealed class ClimbModeComponentState : ComponentState { diff --git a/Content.Shared/Climbing/SharedClimbSystem.cs b/Content.Shared/Climbing/SharedClimbSystem.cs index 53e20541f9..1d9ff5f606 100644 --- a/Content.Shared/Climbing/SharedClimbSystem.cs +++ b/Content.Shared/Climbing/SharedClimbSystem.cs @@ -9,11 +9,11 @@ public abstract class SharedClimbSystem : EntitySystem public override void Initialize() { base.Initialize(); - SubscribeLocalEvent(HandleMoveAttempt); - SubscribeLocalEvent(OnCanDragDropOn); + SubscribeLocalEvent(HandleMoveAttempt); + SubscribeLocalEvent(OnCanDragDropOn); } - private static void HandleMoveAttempt(EntityUid uid, SharedClimbingComponent component, UpdateCanMoveEvent args) + private static void HandleMoveAttempt(EntityUid uid, ClimbingComponent component, UpdateCanMoveEvent args) { if (component.LifeStage > ComponentLifeStage.Running) return; @@ -22,8 +22,8 @@ public abstract class SharedClimbSystem : EntitySystem args.Cancel(); } - protected virtual void OnCanDragDropOn(EntityUid uid, SharedClimbableComponent component, CanDragDropOnEvent args) + protected virtual void OnCanDragDropOn(EntityUid uid, ClimbableComponent component, CanDragDropOnEvent args) { - args.CanDrop = HasComp(args.Dragged); + args.CanDrop = HasComp(args.Dragged); } } diff --git a/Content.Shared/Climbing/SharedClimbableComponent.cs b/Content.Shared/Climbing/SharedClimbableComponent.cs deleted file mode 100644 index fee70cf1ce..0000000000 --- a/Content.Shared/Climbing/SharedClimbableComponent.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Content.Shared.Interaction; - -namespace Content.Shared.Climbing -{ - public abstract class SharedClimbableComponent : Component - { - /// - /// The range from which this entity can be climbed. - /// - [DataField("range")] public float Range = SharedInteractionSystem.InteractionRange / 1.4f; - } -} diff --git a/Content.Shared/Configurable/SharedConfigurationComponent.cs b/Content.Shared/Configurable/ConfigurationComponent.cs similarity index 75% rename from Content.Shared/Configurable/SharedConfigurationComponent.cs rename to Content.Shared/Configurable/ConfigurationComponent.cs index 965d7a9e5d..57809e5869 100644 --- a/Content.Shared/Configurable/SharedConfigurationComponent.cs +++ b/Content.Shared/Configurable/ConfigurationComponent.cs @@ -1,11 +1,20 @@ using System.Text.RegularExpressions; +using Content.Shared.Tools; +using Robust.Shared.GameStates; using Robust.Shared.Serialization; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; namespace Content.Shared.Configurable { - [Virtual] - public class SharedConfigurationComponent : Component + [RegisterComponent, NetworkedComponent] + public sealed class ConfigurationComponent : Component { + [DataField("config")] + public readonly Dictionary Config = new(); + + [DataField("qualityNeeded", customTypeSerializer: typeof(PrototypeIdSerializer))] + public string QualityNeeded = "Pulsing"; + [DataField("validation")] public readonly Regex Validation = new("^[a-zA-Z0-9 ]*$", RegexOptions.Compiled); diff --git a/Content.Shared/Ensnaring/Components/SharedEnsnareableComponent.cs b/Content.Shared/Ensnaring/Components/EnsnareableComponent.cs similarity index 73% rename from Content.Shared/Ensnaring/Components/SharedEnsnareableComponent.cs rename to Content.Shared/Ensnaring/Components/EnsnareableComponent.cs index c472fb8ecc..e0c3806996 100644 --- a/Content.Shared/Ensnaring/Components/SharedEnsnareableComponent.cs +++ b/Content.Shared/Ensnaring/Components/EnsnareableComponent.cs @@ -1,12 +1,13 @@ +using Robust.Shared.Containers; using Robust.Shared.GameStates; using Robust.Shared.Serialization; namespace Content.Shared.Ensnaring.Components; /// -/// Use this on an entity that you would like to be ensnared by anything that has the +/// Use this on an entity that you would like to be ensnared by anything that has the /// -[NetworkedComponent] -public abstract class SharedEnsnareableComponent : Component +[RegisterComponent, NetworkedComponent] +public sealed class EnsnareableComponent : Component { /// /// How much should this slow down the entities walk? @@ -28,6 +29,17 @@ public abstract class SharedEnsnareableComponent : Component [ViewVariables(VVAccess.ReadWrite)] [DataField("isEnsnared")] public bool IsEnsnared; + + /// + /// The container where the entity will be stored + /// + public Container Container = default!; + + [DataField("sprite")] + public string? Sprite; + + [DataField("state")] + public string? State; } [Serializable, NetSerializable] diff --git a/Content.Shared/Ensnaring/Components/SharedEnsnaringComponent.cs b/Content.Shared/Ensnaring/Components/EnsnaringComponent.cs similarity index 58% rename from Content.Shared/Ensnaring/Components/SharedEnsnaringComponent.cs rename to Content.Shared/Ensnaring/Components/EnsnaringComponent.cs index 8c68b4e6a0..1e69cdf263 100644 --- a/Content.Shared/Ensnaring/Components/SharedEnsnaringComponent.cs +++ b/Content.Shared/Ensnaring/Components/EnsnaringComponent.cs @@ -1,8 +1,12 @@ -namespace Content.Shared.Ensnaring.Components; +using System.Threading; +using Robust.Shared.GameStates; + +namespace Content.Shared.Ensnaring.Components; /// /// Use this on something you want to use to ensnare an entity with /// -public abstract class SharedEnsnaringComponent : Component +[RegisterComponent, NetworkedComponent] +public sealed class EnsnaringComponent : Component { /// /// How long it should take to free someone else. @@ -45,10 +49,19 @@ public abstract class SharedEnsnaringComponent : Component [ViewVariables(VVAccess.ReadWrite)] [DataField("ensnared")] public EntityUid? Ensnared; + + /// + /// Should movement cancel breaking out? + /// + [ViewVariables(VVAccess.ReadWrite)] + [DataField("canMoveBreakout")] + public bool CanMoveBreakout; + + public CancellationTokenSource? CancelToken; } /// -/// Used whenever you want to do something when someone becomes ensnared by the +/// Used whenever you want to do something when someone becomes ensnared by the /// public sealed class EnsnareEvent : EntityEventArgs { @@ -63,9 +76,35 @@ public sealed class EnsnareEvent : EntityEventArgs } /// -/// Used whenever you want to do something when someone is freed by the +/// Used whenever you want to do something when someone is freed by the /// public sealed class EnsnareRemoveEvent : CancellableEntityEventArgs { } + +/// +/// Used for the do after event to free the entity that owns the +/// +public sealed class FreeEnsnareDoAfterComplete : EntityEventArgs +{ + public readonly EntityUid EnsnaringEntity; + + public FreeEnsnareDoAfterComplete(EntityUid ensnaringEntity) + { + EnsnaringEntity = ensnaringEntity; + } +} + +/// +/// Used for the do after event when it fails to free the entity that owns the +/// +public sealed class FreeEnsnareDoAfterCancel : EntityEventArgs +{ + public readonly EntityUid EnsnaringEntity; + + public FreeEnsnareDoAfterCancel(EntityUid ensnaringEntity) + { + EnsnaringEntity = ensnaringEntity; + } +} diff --git a/Content.Shared/Ensnaring/SharedEnsnareableSystem.cs b/Content.Shared/Ensnaring/SharedEnsnareableSystem.cs index df47d41568..f7c4051814 100644 --- a/Content.Shared/Ensnaring/SharedEnsnareableSystem.cs +++ b/Content.Shared/Ensnaring/SharedEnsnareableSystem.cs @@ -13,15 +13,15 @@ public abstract class SharedEnsnareableSystem : EntitySystem { base.Initialize(); - SubscribeLocalEvent(MovementSpeedModify); - SubscribeLocalEvent(OnEnsnare); - SubscribeLocalEvent(OnEnsnareRemove); - SubscribeLocalEvent(OnEnsnareChange); - SubscribeLocalEvent(OnGetState); - SubscribeLocalEvent(OnHandleState); + SubscribeLocalEvent(MovementSpeedModify); + SubscribeLocalEvent(OnEnsnare); + SubscribeLocalEvent(OnEnsnareRemove); + SubscribeLocalEvent(OnEnsnareChange); + SubscribeLocalEvent(OnGetState); + SubscribeLocalEvent(OnHandleState); } - private void OnHandleState(EntityUid uid, SharedEnsnareableComponent component, ref ComponentHandleState args) + private void OnHandleState(EntityUid uid, EnsnareableComponent component, ref ComponentHandleState args) { if (args.Current is not EnsnareableComponentState state) return; @@ -33,12 +33,12 @@ public abstract class SharedEnsnareableSystem : EntitySystem RaiseLocalEvent(uid, new EnsnaredChangedEvent(component.IsEnsnared)); } - private void OnGetState(EntityUid uid, SharedEnsnareableComponent component, ref ComponentGetState args) + private void OnGetState(EntityUid uid, EnsnareableComponent component, ref ComponentGetState args) { args.State = new EnsnareableComponentState(component.IsEnsnared); } - private void OnEnsnare(EntityUid uid, SharedEnsnareableComponent component, EnsnareEvent args) + private void OnEnsnare(EntityUid uid, EnsnareableComponent component, EnsnareEvent args) { component.WalkSpeed = args.WalkSpeed; component.SprintSpeed = args.SprintSpeed; @@ -49,7 +49,7 @@ public abstract class SharedEnsnareableSystem : EntitySystem RaiseLocalEvent(uid, ev); } - private void OnEnsnareRemove(EntityUid uid, SharedEnsnareableComponent component, EnsnareRemoveEvent args) + private void OnEnsnareRemove(EntityUid uid, EnsnareableComponent component, EnsnareRemoveEvent args) { _speedModifier.RefreshMovementSpeedModifiers(uid); @@ -57,17 +57,17 @@ public abstract class SharedEnsnareableSystem : EntitySystem RaiseLocalEvent(uid, ev); } - private void OnEnsnareChange(EntityUid uid, SharedEnsnareableComponent component, EnsnaredChangedEvent args) + private void OnEnsnareChange(EntityUid uid, EnsnareableComponent component, EnsnaredChangedEvent args) { UpdateAppearance(uid, component); } - private void UpdateAppearance(EntityUid uid, SharedEnsnareableComponent component, AppearanceComponent? appearance = null) + private void UpdateAppearance(EntityUid uid, EnsnareableComponent component, AppearanceComponent? appearance = null) { Appearance.SetData(uid, EnsnareableVisuals.IsEnsnared, component.IsEnsnared, appearance); } - private void MovementSpeedModify(EntityUid uid, SharedEnsnareableComponent component, RefreshMovementSpeedModifiersEvent args) + private void MovementSpeedModify(EntityUid uid, EnsnareableComponent component, RefreshMovementSpeedModifiersEvent args) { if (!component.IsEnsnared) return; diff --git a/Content.Shared/Interaction/RotateToFaceSystem.cs b/Content.Shared/Interaction/RotateToFaceSystem.cs index b2e37a8a6b..2f0ae4a416 100644 --- a/Content.Shared/Interaction/RotateToFaceSystem.cs +++ b/Content.Shared/Interaction/RotateToFaceSystem.cs @@ -89,7 +89,7 @@ namespace Content.Shared.Interaction return true; } - if (EntityManager.TryGetComponent(user, out SharedBuckleComponent? buckle) && buckle.Buckled) + if (EntityManager.TryGetComponent(user, out BuckleComponent? buckle) && buckle.Buckled) { var suid = buckle.LastEntityBuckledTo; if (suid != null) diff --git a/Content.Shared/Pulling/Systems/SharedPullingSystem.Actions.cs b/Content.Shared/Pulling/Systems/SharedPullingSystem.Actions.cs index 9782c538ac..780bdc3263 100644 --- a/Content.Shared/Pulling/Systems/SharedPullingSystem.Actions.cs +++ b/Content.Shared/Pulling/Systems/SharedPullingSystem.Actions.cs @@ -59,7 +59,7 @@ namespace Content.Shared.Pulling return false; } - if (EntityManager.TryGetComponent(puller, out var buckle)) + if (EntityManager.TryGetComponent(puller, out var buckle)) { // Prevent people pulling the chair they're on, etc. if (buckle.Buckled && (buckle.LastEntityBuckledTo == pulled)) diff --git a/Content.Server/Singularity/Components/ContainmentFieldComponent.cs b/Content.Shared/Singularity/Components/ContainmentFieldComponent.cs similarity index 69% rename from Content.Server/Singularity/Components/ContainmentFieldComponent.cs rename to Content.Shared/Singularity/Components/ContainmentFieldComponent.cs index 68a4a82c0d..9e2409e890 100644 --- a/Content.Server/Singularity/Components/ContainmentFieldComponent.cs +++ b/Content.Shared/Singularity/Components/ContainmentFieldComponent.cs @@ -1,10 +1,9 @@ -using Content.Shared.Singularity.Components; +using Robust.Shared.GameStates; -namespace Content.Server.Singularity.Components; +namespace Content.Shared.Singularity.Components; -[RegisterComponent] -[ComponentReference(typeof(SharedContainmentFieldComponent))] -public sealed class ContainmentFieldComponent : SharedContainmentFieldComponent +[RegisterComponent, NetworkedComponent] +public sealed class ContainmentFieldComponent : Component { /// /// The throw force for the field if an entity collides with it diff --git a/Content.Server/Singularity/Components/ContainmentFieldGeneratorComponent.cs b/Content.Shared/Singularity/Components/ContainmentFieldGeneratorComponent.cs similarity index 82% rename from Content.Server/Singularity/Components/ContainmentFieldGeneratorComponent.cs rename to Content.Shared/Singularity/Components/ContainmentFieldGeneratorComponent.cs index efed3a9a97..0e2ba6da02 100644 --- a/Content.Server/Singularity/Components/ContainmentFieldGeneratorComponent.cs +++ b/Content.Shared/Singularity/Components/ContainmentFieldGeneratorComponent.cs @@ -1,15 +1,16 @@ using Content.Shared.Physics; -using Content.Shared.Singularity.Components; using Content.Shared.Tag; +using Robust.Shared.GameStates; using Robust.Shared.Prototypes; +using Robust.Shared.Serialization; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; -namespace Content.Server.Singularity.Components; -[RegisterComponent] -[ComponentReference(typeof(SharedContainmentFieldGeneratorComponent))] -public sealed class ContainmentFieldGeneratorComponent : SharedContainmentFieldGeneratorComponent +namespace Content.Shared.Singularity.Components; + +[RegisterComponent, NetworkedComponent] +public sealed class ContainmentFieldGeneratorComponent : Component { - private int _powerBuffer; + private int _powerBuffer; /// /// Store power with a cap. Decrease over time if not being powered from source. @@ -100,3 +101,29 @@ public sealed class ContainmentFieldGeneratorComponent : SharedContainmentFieldG [DataField("createdField", customTypeSerializer: typeof(PrototypeIdSerializer))] public string CreatedField = "ContainmentField"; } + +[Serializable, NetSerializable] +public enum ContainmentFieldGeneratorVisuals : byte +{ + PowerLight, + FieldLight, + OnLight, +} + +[Serializable, NetSerializable] +public enum PowerLevelVisuals : byte +{ + NoPower, + LowPower, + MediumPower, + HighPower, +} + +[Serializable, NetSerializable] +public enum FieldLevelVisuals : byte +{ + NoLevel, + On, + OneField, + MultipleFields, +} diff --git a/Content.Shared/Singularity/Components/SharedContainmentFieldComponent.cs b/Content.Shared/Singularity/Components/SharedContainmentFieldComponent.cs deleted file mode 100644 index 3bf970f501..0000000000 --- a/Content.Shared/Singularity/Components/SharedContainmentFieldComponent.cs +++ /dev/null @@ -1,2 +0,0 @@ -namespace Content.Shared.Singularity.Components; -public abstract class SharedContainmentFieldComponent : Component { } diff --git a/Content.Shared/Singularity/Components/SharedContainmentFieldGeneratorComponent.cs b/Content.Shared/Singularity/Components/SharedContainmentFieldGeneratorComponent.cs deleted file mode 100644 index 4a3aaab505..0000000000 --- a/Content.Shared/Singularity/Components/SharedContainmentFieldGeneratorComponent.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Robust.Shared.Serialization; - -namespace Content.Shared.Singularity.Components; -public abstract class SharedContainmentFieldGeneratorComponent : Component { } - -[Serializable, NetSerializable] -public enum ContainmentFieldGeneratorVisuals : byte -{ - PowerLight, - FieldLight, - OnLight, -} - -[Serializable, NetSerializable] -public enum PowerLevelVisuals : byte -{ - NoPower, - LowPower, - MediumPower, - HighPower, -} - -[Serializable, NetSerializable] -public enum FieldLevelVisuals : byte -{ - NoLevel, - On, - OneField, - MultipleFields, -} diff --git a/Content.Shared/Singularity/EntitySystems/SharedEventHorizonSystem.cs b/Content.Shared/Singularity/EntitySystems/SharedEventHorizonSystem.cs index 74e278a949..3cf3c5d67c 100644 --- a/Content.Shared/Singularity/EntitySystems/SharedEventHorizonSystem.cs +++ b/Content.Shared/Singularity/EntitySystems/SharedEventHorizonSystem.cs @@ -190,8 +190,8 @@ public abstract class SharedEventHorizonSystem : EntitySystem // If we can, breach containment // otherwise, check if it's containment and just keep the collision - if (EntityManager.HasComponent(otherUid) || - EntityManager.HasComponent(otherUid)) + if (EntityManager.HasComponent(otherUid) || + EntityManager.HasComponent(otherUid)) { if (comp.CanBreachContainment) args.Cancelled = true; diff --git a/Content.Shared/Vehicle/SharedVehicleSystem.cs b/Content.Shared/Vehicle/SharedVehicleSystem.cs index e47c768ec0..9e260a746d 100644 --- a/Content.Shared/Vehicle/SharedVehicleSystem.cs +++ b/Content.Shared/Vehicle/SharedVehicleSystem.cs @@ -118,7 +118,7 @@ public abstract partial class SharedVehicleSystem : EntitySystem UpdateDrawDepth(uid, 2); // This code should be purged anyway but with that being said this doesn't handle components being changed. - if (TryComp(uid, out var strap)) + if (TryComp(uid, out var strap)) { component.BaseBuckleOffset = strap.BuckleOffset; strap.BuckleOffsetUnclamped = Vector2.Zero; @@ -159,7 +159,7 @@ public abstract partial class SharedVehicleSystem : EntitySystem /// protected void UpdateBuckleOffset(TransformComponent xform, VehicleComponent component) { - if (!TryComp(component.Owner, out var strap)) + if (!TryComp(component.Owner, out var strap)) return; // TODO: Strap should handle this but buckle E/C moment.