diff --git a/Robust.Client/ClientIoC.cs b/Robust.Client/ClientIoC.cs index a0bc93c46..140ca2b3c 100644 --- a/Robust.Client/ClientIoC.cs +++ b/Robust.Client/ClientIoC.cs @@ -60,7 +60,7 @@ namespace Robust.Client deps.Register(); deps.Register(); deps.Register(); - deps.Register(); + deps.Register(); deps.Register(); deps.Register(); deps.Register(); diff --git a/Robust.Client/GameObjects/ClientComponentFactory.cs b/Robust.Client/GameObjects/ClientComponentFactory.cs deleted file mode 100644 index 5fd7f6745..000000000 --- a/Robust.Client/GameObjects/ClientComponentFactory.cs +++ /dev/null @@ -1,34 +0,0 @@ -using Robust.Client.ComponentTrees; -using Robust.Shared.Containers; -using Robust.Shared.GameObjects; -using Robust.Shared.IoC; -using Robust.Shared.Physics.Components; -using Robust.Shared.Reflection; - -namespace Robust.Client.GameObjects -{ - internal sealed class ClientComponentFactory : ComponentFactory - { - public ClientComponentFactory(IDynamicTypeFactoryInternal typeFactory, IReflectionManager reflectionManager) - : base(typeFactory, reflectionManager) - { - // Required for the engine to work - RegisterIgnore("KeyBindingInput"); - - RegisterClass(); - RegisterClass(); - RegisterClass(); - RegisterClass(); - RegisterClass(); - RegisterClass(); - RegisterClass(); - RegisterClass(); - RegisterClass(); - RegisterClass(); - RegisterClass(); - RegisterClass(); - RegisterClass(); - RegisterClass(); - } - } -} diff --git a/Robust.Client/GameObjects/Components/Animations/AnimationPlayerComponent.cs b/Robust.Client/GameObjects/Components/Animations/AnimationPlayerComponent.cs index a7445b52a..457030497 100644 --- a/Robust.Client/GameObjects/Components/Animations/AnimationPlayerComponent.cs +++ b/Robust.Client/GameObjects/Components/Animations/AnimationPlayerComponent.cs @@ -10,6 +10,7 @@ namespace Robust.Client.GameObjects /// /// Plays back s on entities. /// + [RegisterComponent] public sealed class AnimationPlayerComponent : Component { // TODO: Give this component a friend someday. Way too much content shit to change atm ._. diff --git a/Robust.Client/GameObjects/Components/Eye/EyeComponent.cs b/Robust.Client/GameObjects/Components/Eye/EyeComponent.cs index d6a923603..b072693e1 100644 --- a/Robust.Client/GameObjects/Components/Eye/EyeComponent.cs +++ b/Robust.Client/GameObjects/Components/Eye/EyeComponent.cs @@ -8,7 +8,7 @@ using Robust.Shared.ViewVariables; namespace Robust.Client.GameObjects { - [ComponentReference(typeof(SharedEyeComponent))] + [RegisterComponent, ComponentReference(typeof(SharedEyeComponent))] public sealed class EyeComponent : SharedEyeComponent { [Dependency] private readonly IEyeManager _eyeManager = default!; diff --git a/Robust.Client/GameObjects/Components/Input/InputComponent.cs b/Robust.Client/GameObjects/Components/Input/InputComponent.cs index 90133a5ab..358b03a79 100644 --- a/Robust.Client/GameObjects/Components/Input/InputComponent.cs +++ b/Robust.Client/GameObjects/Components/Input/InputComponent.cs @@ -8,6 +8,7 @@ namespace Robust.Client.GameObjects /// /// Defines data fields used in the . /// + [RegisterComponent] public sealed class InputComponent : Component { /// diff --git a/Robust.Client/GameObjects/Components/Renderable/SpriteComponent.cs b/Robust.Client/GameObjects/Components/Renderable/SpriteComponent.cs index eec493eaa..be8317695 100644 --- a/Robust.Client/GameObjects/Components/Renderable/SpriteComponent.cs +++ b/Robust.Client/GameObjects/Components/Renderable/SpriteComponent.cs @@ -30,7 +30,7 @@ using RSIDirection = Robust.Client.Graphics.RSI.State.Direction; namespace Robust.Client.GameObjects { [ComponentReference(typeof(SharedSpriteComponent))] - [ComponentReference(typeof(ISpriteComponent))] + [RegisterComponent, ComponentReference(typeof(ISpriteComponent))] public sealed class SpriteComponent : SharedSpriteComponent, ISpriteComponent, IComponentDebug, ISerializationHooks, IComponentTreeEntry { diff --git a/Robust.Client/GameObjects/Components/UserInterface/ClientUserInterfaceComponent.cs b/Robust.Client/GameObjects/Components/UserInterface/ClientUserInterfaceComponent.cs index 2e90d7afa..eb97d211e 100644 --- a/Robust.Client/GameObjects/Components/UserInterface/ClientUserInterfaceComponent.cs +++ b/Robust.Client/GameObjects/Components/UserInterface/ClientUserInterfaceComponent.cs @@ -9,7 +9,7 @@ using Robust.Shared.ViewVariables; namespace Robust.Client.GameObjects { - [ComponentReference(typeof(SharedUserInterfaceComponent))] + [RegisterComponent, ComponentReference(typeof(SharedUserInterfaceComponent))] public sealed class ClientUserInterfaceComponent : SharedUserInterfaceComponent, ISerializationHooks { [Dependency] private readonly IReflectionManager _reflectionManager = default!; diff --git a/Robust.Server/GameObjects/Components/Actor/ActorComponent.cs b/Robust.Server/GameObjects/Components/Actor/ActorComponent.cs index 652cfd460..2d6db5a1d 100644 --- a/Robust.Server/GameObjects/Components/Actor/ActorComponent.cs +++ b/Robust.Server/GameObjects/Components/Actor/ActorComponent.cs @@ -4,6 +4,7 @@ using Robust.Shared.ViewVariables; namespace Robust.Server.GameObjects { + [RegisterComponent] public sealed class ActorComponent : Component { [ViewVariables] diff --git a/Robust.Server/GameObjects/Components/Eye/EyeComponent.cs b/Robust.Server/GameObjects/Components/Eye/EyeComponent.cs index 21f222c78..d7c57350f 100644 --- a/Robust.Server/GameObjects/Components/Eye/EyeComponent.cs +++ b/Robust.Server/GameObjects/Components/Eye/EyeComponent.cs @@ -9,7 +9,7 @@ using Robust.Shared.ViewVariables; namespace Robust.Server.GameObjects { - [ComponentReference(typeof(SharedEyeComponent))] + [RegisterComponent, ComponentReference(typeof(SharedEyeComponent))] public sealed class EyeComponent : SharedEyeComponent { public const int DefaultVisibilityMask = 1; diff --git a/Robust.Server/GameObjects/Components/Renderable/SpriteComponent.cs b/Robust.Server/GameObjects/Components/Renderable/SpriteComponent.cs index 5949195e8..a6e464437 100644 --- a/Robust.Server/GameObjects/Components/Renderable/SpriteComponent.cs +++ b/Robust.Server/GameObjects/Components/Renderable/SpriteComponent.cs @@ -12,7 +12,7 @@ using DrawDepthTag = Robust.Shared.GameObjects.DrawDepth; namespace Robust.Server.GameObjects { - [ComponentReference(typeof(SharedSpriteComponent))] + [RegisterComponent, ComponentReference(typeof(SharedSpriteComponent))] [Obsolete("Use client-side systems, or appearance data & visualizers instead")] public sealed class SpriteComponent : SharedSpriteComponent, ISerializationHooks { diff --git a/Robust.Server/GameObjects/Components/UserInterface/ServerUserInterfaceComponent.cs b/Robust.Server/GameObjects/Components/UserInterface/ServerUserInterfaceComponent.cs index 8bca3f449..a7161aef8 100644 --- a/Robust.Server/GameObjects/Components/UserInterface/ServerUserInterfaceComponent.cs +++ b/Robust.Server/GameObjects/Components/UserInterface/ServerUserInterfaceComponent.cs @@ -15,7 +15,7 @@ namespace Robust.Server.GameObjects /// /// [PublicAPI] - [ComponentReference(typeof(SharedUserInterfaceComponent))] + [RegisterComponent, ComponentReference(typeof(SharedUserInterfaceComponent))] public sealed class ServerUserInterfaceComponent : SharedUserInterfaceComponent, ISerializationHooks { internal readonly Dictionary _interfaces = diff --git a/Robust.Server/GameObjects/MapSaveIdComponent.cs b/Robust.Server/GameObjects/MapSaveIdComponent.cs index 8ce86674c..103c8b955 100644 --- a/Robust.Server/GameObjects/MapSaveIdComponent.cs +++ b/Robust.Server/GameObjects/MapSaveIdComponent.cs @@ -9,6 +9,7 @@ namespace Robust.Server.GameObjects /// This component stores the previous map UID of entities from map load. /// This can then be used to re-serialize the entity with the same UID for the merge driver to recognize. /// + [RegisterComponent] public sealed class MapSaveIdComponent : Component { public int Uid { get; set; } diff --git a/Robust.Server/GameObjects/ServerComponentFactory.cs b/Robust.Server/GameObjects/ServerComponentFactory.cs index af597fcec..aea0c7cf5 100644 --- a/Robust.Server/GameObjects/ServerComponentFactory.cs +++ b/Robust.Server/GameObjects/ServerComponentFactory.cs @@ -1,34 +1,15 @@ -using Robust.Shared.Containers; using Robust.Shared.GameObjects; using Robust.Shared.IoC; -using Robust.Shared.Physics.Components; using Robust.Shared.Reflection; -namespace Robust.Server.GameObjects -{ - internal sealed class ServerComponentFactory : ComponentFactory - { - public ServerComponentFactory(IDynamicTypeFactoryInternal typeFactory, IReflectionManager reflectionManager) - : base(typeFactory, reflectionManager) - { - RegisterIgnore("Input"); - RegisterIgnore("AnimationPlayer"); - RegisterIgnore("GenericVisualizer"); +namespace Robust.Server.GameObjects; - RegisterClass(); - RegisterClass(); - RegisterClass(); - RegisterClass(); - RegisterClass(); - RegisterClass(); - RegisterClass(); - RegisterClass(); - RegisterClass(); - RegisterClass(); - RegisterClass(); - RegisterClass(); - RegisterClass(); - RegisterClass(); - } +internal sealed class ServerComponentFactory : ComponentFactory +{ + public ServerComponentFactory(IDynamicTypeFactoryInternal typeFactory, IReflectionManager reflectionManager) : base(typeFactory, reflectionManager) + { + RegisterIgnore("Input"); + RegisterIgnore("AnimationPlayer"); + RegisterIgnore("GenericVisualizer"); } } diff --git a/Robust.Shared/Containers/ContainerManagerComponent.cs b/Robust.Shared/Containers/ContainerManagerComponent.cs index 9a7e2dbd1..f721db816 100644 --- a/Robust.Shared/Containers/ContainerManagerComponent.cs +++ b/Robust.Shared/Containers/ContainerManagerComponent.cs @@ -18,7 +18,7 @@ namespace Robust.Shared.Containers /// [ComponentReference(typeof(IContainerManager))] [NetworkedComponent] - [ComponentProtoName("ContainerContainer")] + [RegisterComponent, ComponentProtoName("ContainerContainer")] public sealed class ContainerManagerComponent : Component, IContainerManager, ISerializationHooks { [Dependency] private readonly IDynamicTypeFactoryInternal _dynFactory = default!; diff --git a/Robust.Shared/GameObjects/Components/CollisionWakeComponent.cs b/Robust.Shared/GameObjects/Components/CollisionWakeComponent.cs index c46998806..3e21c5c58 100644 --- a/Robust.Shared/GameObjects/Components/CollisionWakeComponent.cs +++ b/Robust.Shared/GameObjects/Components/CollisionWakeComponent.cs @@ -9,7 +9,7 @@ namespace Robust.Shared.GameObjects /// /// An optimisation component for stuff that should be set as collidable when it's awake and non-collidable when asleep. /// - [NetworkedComponent()] + [RegisterComponent, NetworkedComponent()] [Access(typeof(CollisionWakeSystem))] public sealed class CollisionWakeComponent : Component { diff --git a/Robust.Shared/GameObjects/Components/DebugExceptionComponents.cs b/Robust.Shared/GameObjects/Components/DebugExceptionComponents.cs index 9c83fbf06..3280049d5 100644 --- a/Robust.Shared/GameObjects/Components/DebugExceptionComponents.cs +++ b/Robust.Shared/GameObjects/Components/DebugExceptionComponents.cs @@ -9,15 +9,18 @@ namespace Robust.Shared.GameObjects /// /// Throws an exception in . /// + [RegisterComponent] public sealed class DebugExceptionOnAddComponent : Component { } /// /// Throws an exception in . /// + [RegisterComponent] public sealed class DebugExceptionInitializeComponent : Component { } /// /// Throws an exception in . /// + [RegisterComponent] public sealed class DebugExceptionStartupComponent : Component { } } diff --git a/Robust.Shared/GameObjects/Components/MetaDataComponent.cs b/Robust.Shared/GameObjects/Components/MetaDataComponent.cs index 283f9f867..7e72c98dd 100644 --- a/Robust.Shared/GameObjects/Components/MetaDataComponent.cs +++ b/Robust.Shared/GameObjects/Components/MetaDataComponent.cs @@ -56,7 +56,7 @@ namespace Robust.Shared.GameObjects /// /// Contains meta data about this entity that isn't component specific. /// - [NetworkedComponent] + [RegisterComponent, NetworkedComponent] public sealed class MetaDataComponent : Component { [DataField("name")] internal string? _entityName; diff --git a/Robust.Shared/GameObjects/Components/Timers/TimerComponent.cs b/Robust.Shared/GameObjects/Components/Timers/TimerComponent.cs index 1bd3fb91d..9365ffffd 100644 --- a/Robust.Shared/GameObjects/Components/Timers/TimerComponent.cs +++ b/Robust.Shared/GameObjects/Components/Timers/TimerComponent.cs @@ -9,7 +9,7 @@ using Timer = Robust.Shared.Timing.Timer; namespace Robust.Shared.GameObjects { - [Obsolete("Use a system update loop instead")] + [RegisterComponent, Obsolete("Use a system update loop instead")] public sealed class TimerComponent : Component { [Dependency] private readonly IRuntimeLog _runtimeLog = default!; diff --git a/Robust.Shared/GameObjects/Components/Transform/TransformComponent.cs b/Robust.Shared/GameObjects/Components/Transform/TransformComponent.cs index 77fb6b997..be31d59eb 100644 --- a/Robust.Shared/GameObjects/Components/Transform/TransformComponent.cs +++ b/Robust.Shared/GameObjects/Components/Transform/TransformComponent.cs @@ -18,7 +18,7 @@ namespace Robust.Shared.GameObjects /// /// Stores the position and orientation of the entity. /// - [NetworkedComponent] + [RegisterComponent, NetworkedComponent] public sealed class TransformComponent : Component, IComponentDebug { [Dependency] private readonly IEntityManager _entMan = default!; diff --git a/Robust.Shared/Physics/Components/PhysicsComponent.Physics.cs b/Robust.Shared/Physics/Components/PhysicsComponent.Physics.cs index 5bc989f48..d9b909663 100644 --- a/Robust.Shared/Physics/Components/PhysicsComponent.Physics.cs +++ b/Robust.Shared/Physics/Components/PhysicsComponent.Physics.cs @@ -36,7 +36,7 @@ using Robust.Shared.ViewVariables; namespace Robust.Shared.Physics.Components { [ComponentReference(typeof(ILookupWorldBox2Component))] - [NetworkedComponent(), ComponentProtoName("Physics")] + [RegisterComponent, NetworkedComponent] public sealed class PhysicsComponent : Component, ILookupWorldBox2Component { [Dependency] private readonly IEntityManager _entMan = default!; diff --git a/Robust.UnitTesting/RobustUnitTest.cs b/Robust.UnitTesting/RobustUnitTest.cs index fea870a1f..996ae1a51 100644 --- a/Robust.UnitTesting/RobustUnitTest.cs +++ b/Robust.UnitTesting/RobustUnitTest.cs @@ -19,6 +19,7 @@ using Robust.Shared.IoC; using Robust.Shared.Map; using Robust.Shared.Map.Components; using Robust.Shared.Physics; +using Robust.Shared.Physics.Components; using Robust.Shared.Physics.Dynamics; using Robust.Shared.Physics.Systems; using Robust.Shared.Prototypes; @@ -134,11 +135,26 @@ namespace Robust.UnitTesting compFactory.RegisterClass(); } + if (!compFactory.AllRegisteredTypes.Contains(typeof(ContainerManagerComponent))) + { + compFactory.RegisterClass(); + } + if (!compFactory.AllRegisteredTypes.Contains(typeof(MetaDataComponent))) { compFactory.RegisterClass(); } + if (!compFactory.AllRegisteredTypes.Contains(typeof(TransformComponent))) + { + compFactory.RegisterClass(); + } + + if (!compFactory.AllRegisteredTypes.Contains(typeof(PhysicsComponent))) + { + compFactory.RegisterClass(); + } + if (!compFactory.AllRegisteredTypes.Contains(typeof(PhysicsMapComponent))) { compFactory.RegisterClass(); diff --git a/Robust.UnitTesting/Shared/Prototypes/PrototypeManager_Test.cs b/Robust.UnitTesting/Shared/Prototypes/PrototypeManager_Test.cs index a7b0c8ad7..bf1d97fce 100644 --- a/Robust.UnitTesting/Shared/Prototypes/PrototypeManager_Test.cs +++ b/Robust.UnitTesting/Shared/Prototypes/PrototypeManager_Test.cs @@ -25,6 +25,8 @@ namespace Robust.UnitTesting.Shared.Prototypes var factory = IoCManager.Resolve(); factory.RegisterClass(); factory.RegisterClass(); + // I'm so sorry + factory.RegisterClass(); IoCManager.Resolve().Initialize(); manager = IoCManager.Resolve();