diff --git a/Content.Client/Construction/ConstructionMenuPresenter.cs b/Content.Client/Construction/ConstructionMenuPresenter.cs index 319e6eac62..14ba7ca187 100644 --- a/Content.Client/Construction/ConstructionMenuPresenter.cs +++ b/Content.Client/Construction/ConstructionMenuPresenter.cs @@ -71,7 +71,7 @@ namespace Content.Client.Construction _constructionView.Close(); } } - + /// /// Constructs a new instance of . /// @@ -216,7 +216,7 @@ namespace Content.Client.Construction private void GenerateStepList(ConstructionPrototype prototype, ItemList stepList) { - if (!_prototypeManager.TryIndex(prototype.Graph, out ConstructionGraphPrototype graph)) + if (!_prototypeManager.TryIndex(prototype.Graph, out ConstructionGraphPrototype? graph)) return; var startNode = graph.Nodes[prototype.StartNode]; @@ -430,7 +430,7 @@ namespace Content.Client.Construction _constructionView.BuildButtonPressed = true; } - + private void OnSystemLoaded(object? sender, SystemChangedArgs args) { if (args.System is ConstructionSystem system) SystemBindingChanged(system); diff --git a/Content.Client/EntryPoint.cs b/Content.Client/EntryPoint.cs index c51d82087f..0fbccc8342 100644 --- a/Content.Client/EntryPoint.cs +++ b/Content.Client/EntryPoint.cs @@ -61,17 +61,17 @@ namespace Content.Client factory.RegisterIgnore(ignoreName); } - factory.Register(); - factory.Register(); - factory.Register(); - factory.Register(); - factory.Register(); - factory.Register(); - factory.Register(); - factory.Register(); - factory.Register(); - factory.Register(); - factory.Register(); + factory.RegisterClass(); + factory.RegisterClass(); + factory.RegisterClass(); + factory.RegisterClass(); + factory.RegisterClass(); + factory.RegisterClass(); + factory.RegisterClass(); + factory.RegisterClass(); + factory.RegisterClass(); + factory.RegisterClass(); + factory.RegisterClass(); prototypes.RegisterIgnore("material"); prototypes.RegisterIgnore("reaction"); //Chemical reactions only needed by server. Reactions checks are server-side. diff --git a/Content.IntegrationTests/Tests/Destructible/DestructibleDamageClassTest.cs b/Content.IntegrationTests/Tests/Destructible/DestructibleDamageClassTest.cs index 87db264268..02ec1a48cb 100644 --- a/Content.IntegrationTests/Tests/Destructible/DestructibleDamageClassTest.cs +++ b/Content.IntegrationTests/Tests/Destructible/DestructibleDamageClassTest.cs @@ -23,7 +23,7 @@ namespace Content.IntegrationTests.Tests.Destructible ExtraPrototypes = Prototypes, ContentBeforeIoC = () => { - IoCManager.Resolve().Register(); + IoCManager.Resolve().RegisterClass(); } }); diff --git a/Content.IntegrationTests/Tests/Destructible/DestructibleDamageTypeTest.cs b/Content.IntegrationTests/Tests/Destructible/DestructibleDamageTypeTest.cs index caadda8c5f..fe8b900752 100644 --- a/Content.IntegrationTests/Tests/Destructible/DestructibleDamageTypeTest.cs +++ b/Content.IntegrationTests/Tests/Destructible/DestructibleDamageTypeTest.cs @@ -23,7 +23,7 @@ namespace Content.IntegrationTests.Tests.Destructible ExtraPrototypes = Prototypes, ContentBeforeIoC = () => { - IoCManager.Resolve().Register(); + IoCManager.Resolve().RegisterClass(); } }); diff --git a/Content.IntegrationTests/Tests/Destructible/DestructibleDestructionTest.cs b/Content.IntegrationTests/Tests/Destructible/DestructibleDestructionTest.cs index 81674edbf0..96dfdfe0a4 100644 --- a/Content.IntegrationTests/Tests/Destructible/DestructibleDestructionTest.cs +++ b/Content.IntegrationTests/Tests/Destructible/DestructibleDestructionTest.cs @@ -22,7 +22,7 @@ namespace Content.IntegrationTests.Tests.Destructible ExtraPrototypes = Prototypes, ContentBeforeIoC = () => { - IoCManager.Resolve().Register(); + IoCManager.Resolve().RegisterClass(); } }); diff --git a/Content.IntegrationTests/Tests/Destructible/DestructibleThresholdActivationTest.cs b/Content.IntegrationTests/Tests/Destructible/DestructibleThresholdActivationTest.cs index 8a8a57ce3f..1f4dd39894 100644 --- a/Content.IntegrationTests/Tests/Destructible/DestructibleThresholdActivationTest.cs +++ b/Content.IntegrationTests/Tests/Destructible/DestructibleThresholdActivationTest.cs @@ -27,7 +27,7 @@ namespace Content.IntegrationTests.Tests.Destructible ExtraPrototypes = Prototypes, ContentBeforeIoC = () => { - IoCManager.Resolve().Register(); + IoCManager.Resolve().RegisterClass(); } }); diff --git a/Content.IntegrationTests/Tests/Networking/SimplePredictReconcileTest.cs b/Content.IntegrationTests/Tests/Networking/SimplePredictReconcileTest.cs index 4eb8c427e2..7219ef5524 100644 --- a/Content.IntegrationTests/Tests/Networking/SimplePredictReconcileTest.cs +++ b/Content.IntegrationTests/Tests/Networking/SimplePredictReconcileTest.cs @@ -47,7 +47,7 @@ namespace Content.IntegrationTests.Tests.Networking ContentBeforeIoC = () => { IoCManager.Resolve().LoadExtraSystemType(); - IoCManager.Resolve().Register(); + IoCManager.Resolve().RegisterClass(); } }, new ServerContentIntegrationOption @@ -55,7 +55,7 @@ namespace Content.IntegrationTests.Tests.Networking ContentBeforeIoC = () => { IoCManager.Resolve().LoadExtraSystemType(); - IoCManager.Resolve().Register(); + IoCManager.Resolve().RegisterClass(); } }); diff --git a/Content.Server/Commands/RemoveExtraComponents.cs b/Content.Server/Commands/RemoveExtraComponents.cs index c2ea1b9dc7..24d4958b25 100644 --- a/Content.Server/Commands/RemoveExtraComponents.cs +++ b/Content.Server/Commands/RemoveExtraComponents.cs @@ -28,7 +28,7 @@ namespace Content.Server.Commands } else { - if (!prototypeManager.TryIndex(id, out EntityPrototype prototype)) + if (!prototypeManager.TryIndex(id, out EntityPrototype? prototype)) { shell.WriteLine($"No entity prototype found with id {id}."); return; diff --git a/Content.Server/GameObjects/Components/BarSign/BarSignComponent.cs b/Content.Server/GameObjects/Components/BarSign/BarSignComponent.cs index 5c4f2c1161..cbf0df733e 100644 --- a/Content.Server/GameObjects/Components/BarSign/BarSignComponent.cs +++ b/Content.Server/GameObjects/Components/BarSign/BarSignComponent.cs @@ -43,7 +43,7 @@ namespace Content.Server.GameObjects.Components.BarSign return; } - if (!_prototypeManager.TryIndex(_currentSign, out BarSignPrototype prototype)) + if (!_prototypeManager.TryIndex(_currentSign, out BarSignPrototype? prototype)) { Logger.ErrorS("barSign", $"Invalid bar sign prototype: \"{_currentSign}\""); return; diff --git a/Content.Server/GameObjects/Components/Cargo/CargoConsoleComponent.cs b/Content.Server/GameObjects/Components/Cargo/CargoConsoleComponent.cs index b23c650ac1..03c4b88717 100644 --- a/Content.Server/GameObjects/Components/Cargo/CargoConsoleComponent.cs +++ b/Content.Server/GameObjects/Components/Cargo/CargoConsoleComponent.cs @@ -136,7 +136,7 @@ namespace Content.Server.GameObjects.Components.Cargo break; } - PrototypeManager.TryIndex(order.ProductId, out CargoProductPrototype product); + PrototypeManager.TryIndex(order.ProductId, out CargoProductPrototype? product); if (product == null!) break; var capacity = _cargoConsoleSystem.GetCapacity(orders.Database.Id); @@ -184,7 +184,7 @@ namespace Content.Server.GameObjects.Components.Cargo orders.Database.ClearOrderCapacity(); foreach (var order in approvedOrders) { - if (!PrototypeManager.TryIndex(order.ProductId, out CargoProductPrototype product)) + if (!PrototypeManager.TryIndex(order.ProductId, out CargoProductPrototype? product)) continue; for (var i = 0; i < order.Amount; i++) { diff --git a/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs b/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs index 1a01f740ab..4c58b7b242 100644 --- a/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs +++ b/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs @@ -103,7 +103,7 @@ namespace Content.Server.GameObjects.Components.Chemistry { if (string.IsNullOrEmpty(_packPrototypeId)) return; - if (!_prototypeManager.TryIndex(_packPrototypeId, out ReagentDispenserInventoryPrototype packPrototype)) + if (!_prototypeManager.TryIndex(_packPrototypeId, out ReagentDispenserInventoryPrototype? packPrototype)) { return; } diff --git a/Content.Server/GameObjects/Components/Chemistry/TransformableContainerComponent.cs b/Content.Server/GameObjects/Components/Chemistry/TransformableContainerComponent.cs index 5fad172db7..aebb426632 100644 --- a/Content.Server/GameObjects/Components/Chemistry/TransformableContainerComponent.cs +++ b/Content.Server/GameObjects/Components/Chemistry/TransformableContainerComponent.cs @@ -81,7 +81,7 @@ namespace Content.Server.GameObjects.Components.Chemistry //Only reagents with spritePath property can change appearance of transformable containers! if (!string.IsNullOrWhiteSpace(reagentId) && - _prototypeManager.TryIndex(reagentId, out ReagentPrototype proto) && + _prototypeManager.TryIndex(reagentId, out ReagentPrototype? proto) && !string.IsNullOrWhiteSpace(proto.SpriteReplacementPath)) { var spriteSpec = new SpriteSpecifier.Rsi(new ResourcePath("Objects/Consumable/Drinks/" + proto.SpriteReplacementPath),"icon"); diff --git a/Content.Server/GameObjects/Components/Construction/ConstructionComponent.cs b/Content.Server/GameObjects/Components/Construction/ConstructionComponent.cs index 4bf6cbbfc7..5d4468caef 100644 --- a/Content.Server/GameObjects/Components/Construction/ConstructionComponent.cs +++ b/Content.Server/GameObjects/Components/Construction/ConstructionComponent.cs @@ -480,7 +480,7 @@ namespace Content.Server.GameObjects.Components.Construction return; } - if (_prototypeManager.TryIndex(_graphIdentifier, out ConstructionGraphPrototype graph)) + if (_prototypeManager.TryIndex(_graphIdentifier, out ConstructionGraphPrototype? graph)) { GraphPrototype = graph; diff --git a/Content.Server/GameObjects/Components/Metabolism/MetabolismComponent.cs b/Content.Server/GameObjects/Components/Metabolism/MetabolismComponent.cs index d7a292b0cb..959f55b810 100644 --- a/Content.Server/GameObjects/Components/Metabolism/MetabolismComponent.cs +++ b/Content.Server/GameObjects/Components/Metabolism/MetabolismComponent.cs @@ -337,7 +337,7 @@ namespace Content.Server.GameObjects.Components.Metabolism // Using ToList here lets us edit reagents while iterating foreach (var reagent in bloodstream.Solution.ReagentList.ToList()) { - if (!_prototypeManager.TryIndex(reagent.ReagentId, out ReagentPrototype prototype)) + if (!_prototypeManager.TryIndex(reagent.ReagentId, out ReagentPrototype? prototype)) { continue; } diff --git a/Content.Server/GameObjects/Components/Research/LatheComponent.cs b/Content.Server/GameObjects/Components/Research/LatheComponent.cs index d8b01907ad..f834a726e5 100644 --- a/Content.Server/GameObjects/Components/Research/LatheComponent.cs +++ b/Content.Server/GameObjects/Components/Research/LatheComponent.cs @@ -65,7 +65,7 @@ namespace Content.Server.GameObjects.Components.Research switch (message.Message) { case LatheQueueRecipeMessage msg: - PrototypeManager.TryIndex(msg.ID, out LatheRecipePrototype recipe); + PrototypeManager.TryIndex(msg.ID, out LatheRecipePrototype? recipe); if (recipe != null!) for (var i = 0; i < msg.Quantity; i++) { diff --git a/Content.Server/GameObjects/Components/Research/ResearchConsoleComponent.cs b/Content.Server/GameObjects/Components/Research/ResearchConsoleComponent.cs index dcea97a0a5..0d3d91bd8c 100644 --- a/Content.Server/GameObjects/Components/Research/ResearchConsoleComponent.cs +++ b/Content.Server/GameObjects/Components/Research/ResearchConsoleComponent.cs @@ -55,7 +55,7 @@ namespace Content.Server.GameObjects.Components.Research switch (message.Message) { case ConsoleUnlockTechnologyMessage msg: - if (!_prototypeManager.TryIndex(msg.Id, out TechnologyPrototype tech)) break; + if (!_prototypeManager.TryIndex(msg.Id, out TechnologyPrototype? tech)) break; if (client.Server == null) break; if (!client.Server.CanUnlockTechnology(tech)) break; if (client.Server.UnlockTechnology(tech)) diff --git a/Content.Server/GameObjects/Components/VendingMachines/VendingMachineComponent.cs b/Content.Server/GameObjects/Components/VendingMachines/VendingMachineComponent.cs index 07c9400021..ce7ce5d482 100644 --- a/Content.Server/GameObjects/Components/VendingMachines/VendingMachineComponent.cs +++ b/Content.Server/GameObjects/Components/VendingMachines/VendingMachineComponent.cs @@ -77,7 +77,7 @@ namespace Content.Server.GameObjects.Components.VendingMachines private void InitializeFromPrototype() { if (string.IsNullOrEmpty(_packPrototypeId)) { return; } - if (!_prototypeManager.TryIndex(_packPrototypeId, out VendingMachineInventoryPrototype packPrototype)) + if (!_prototypeManager.TryIndex(_packPrototypeId, out VendingMachineInventoryPrototype? packPrototype)) { return; } diff --git a/Content.Server/GameObjects/EntitySystems/ConstructionSystem.cs b/Content.Server/GameObjects/EntitySystems/ConstructionSystem.cs index f290f9f4df..2d6d8d358d 100644 --- a/Content.Server/GameObjects/EntitySystems/ConstructionSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/ConstructionSystem.cs @@ -304,13 +304,13 @@ namespace Content.Server.GameObjects.EntitySystems private async void HandleStartItemConstruction(TryStartItemConstructionMessage ev, EntitySessionEventArgs args) { - if (!_prototypeManager.TryIndex(ev.PrototypeName, out ConstructionPrototype constructionPrototype)) + if (!_prototypeManager.TryIndex(ev.PrototypeName, out ConstructionPrototype? constructionPrototype)) { Logger.Error($"Tried to start construction of invalid recipe '{ev.PrototypeName}'!"); return; } - if (!_prototypeManager.TryIndex(constructionPrototype.Graph, out ConstructionGraphPrototype constructionGraph)) + if (!_prototypeManager.TryIndex(constructionPrototype.Graph, out ConstructionGraphPrototype? constructionGraph)) { Logger.Error($"Invalid construction graph '{constructionPrototype.Graph}' in recipe '{ev.PrototypeName}'!"); return; @@ -360,14 +360,14 @@ namespace Content.Server.GameObjects.EntitySystems private async void HandleStartStructureConstruction(TryStartStructureConstructionMessage ev, EntitySessionEventArgs args) { - if (!_prototypeManager.TryIndex(ev.PrototypeName, out ConstructionPrototype constructionPrototype)) + if (!_prototypeManager.TryIndex(ev.PrototypeName, out ConstructionPrototype? constructionPrototype)) { Logger.Error($"Tried to start construction of invalid recipe '{ev.PrototypeName}'!"); RaiseNetworkEvent(new AckStructureConstructionMessage(ev.Ack)); return; } - if (!_prototypeManager.TryIndex(constructionPrototype.Graph, out ConstructionGraphPrototype constructionGraph)) + if (!_prototypeManager.TryIndex(constructionPrototype.Graph, out ConstructionGraphPrototype? constructionGraph)) { Logger.Error($"Invalid construction graph '{constructionPrototype.Graph}' in recipe '{ev.PrototypeName}'!"); RaiseNetworkEvent(new AckStructureConstructionMessage(ev.Ack)); diff --git a/Content.Shared/EntryPoint.cs b/Content.Shared/EntryPoint.cs index c99665d271..8c30888807 100644 --- a/Content.Shared/EntryPoint.cs +++ b/Content.Shared/EntryPoint.cs @@ -1,11 +1,9 @@ using System; using System.Collections.Generic; -using System.Globalization; using Content.Shared.Chemistry; using Content.Shared.Maps; using Robust.Shared.ContentPack; using Robust.Shared.IoC; -using Robust.Shared.Localization; using Robust.Shared.Log; using Robust.Shared.Map; using Robust.Shared.Prototypes; @@ -16,7 +14,6 @@ namespace Content.Shared { [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!; - [Dependency] private readonly IResourceManager _resourceManager = default!; public override void PreInit() { diff --git a/Content.Shared/GameObjects/Components/Chemistry/SharedSolutionContainerComponent.cs b/Content.Shared/GameObjects/Components/Chemistry/SharedSolutionContainerComponent.cs index 4cc238cb66..6bd6a1315a 100644 --- a/Content.Shared/GameObjects/Components/Chemistry/SharedSolutionContainerComponent.cs +++ b/Content.Shared/GameObjects/Components/Chemistry/SharedSolutionContainerComponent.cs @@ -199,7 +199,7 @@ namespace Content.Shared.GameObjects.Components.Chemistry } var primaryReagent = Solution.GetPrimaryReagentId(); - if (!prototypeManager.TryIndex(primaryReagent, out ReagentPrototype proto)) + if (!prototypeManager.TryIndex(primaryReagent, out ReagentPrototype? proto)) { Logger.Error($"{nameof(SharedSolutionContainerComponent)} could not find the prototype associated with {primaryReagent}."); return; diff --git a/Content.Shared/Localization.cs b/Content.Shared/Localization.cs index 290ef13ed7..72dcf9cd15 100644 --- a/Content.Shared/Localization.cs +++ b/Content.Shared/Localization.cs @@ -18,7 +18,7 @@ namespace Content.Shared var culture = new CultureInfo(Culture); - loc.LoadCulture(res, culture); + loc.LoadCulture(culture); loc.AddFunction(culture, "PRESSURE", FormatPressure); loc.AddFunction(culture, "TOSTRING", args => FormatToString(culture, args)); } diff --git a/Content.Shared/Utility/EntityPrototypeHelpers.cs b/Content.Shared/Utility/EntityPrototypeHelpers.cs index 0fa03a531a..5982788e73 100644 --- a/Content.Shared/Utility/EntityPrototypeHelpers.cs +++ b/Content.Shared/Utility/EntityPrototypeHelpers.cs @@ -33,7 +33,7 @@ namespace Content.Shared.Utility { prototypeManager ??= IoCManager.Resolve(); - return prototypeManager.TryIndex(prototype, out EntityPrototype proto) && proto.HasComponent(component, componentFactory); + return prototypeManager.TryIndex(prototype, out EntityPrototype? proto) && proto.HasComponent(component, componentFactory); } } } diff --git a/Content.Tests/Server/GameObjects/Components/Mobs/ServerAlertsComponentTests.cs b/Content.Tests/Server/GameObjects/Components/Mobs/ServerAlertsComponentTests.cs index 42cf459a1b..195cfaf29b 100644 --- a/Content.Tests/Server/GameObjects/Components/Mobs/ServerAlertsComponentTests.cs +++ b/Content.Tests/Server/GameObjects/Components/Mobs/ServerAlertsComponentTests.cs @@ -36,7 +36,7 @@ namespace Content.Tests.Server.GameObjects.Components.Mobs var prototypeManager = IoCManager.Resolve(); var factory = IoCManager.Resolve(); - factory.Register(); + factory.RegisterClass(); prototypeManager.LoadFromStream(new StringReader(PROTOTYPES)); prototypeManager.Resync(); var alertManager = IoCManager.Resolve(); diff --git a/RobustToolbox b/RobustToolbox index cecc4dfcf2..6d41958853 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit cecc4dfcf233bb659c549e33e8bfc87328fb1147 +Subproject commit 6d41958853b88b6b68f404ab34fba2aec437a026