Update submodule, fix a bunch of warnings.

This commit is contained in:
Pieter-Jan Briers
2021-02-23 22:26:59 +01:00
parent ade8c6115b
commit 5a7658a13b
24 changed files with 40 additions and 43 deletions

View File

@@ -71,7 +71,7 @@ namespace Content.Client.Construction
_constructionView.Close(); _constructionView.Close();
} }
} }
/// <summary> /// <summary>
/// Constructs a new instance of <see cref="ConstructionMenuPresenter" />. /// Constructs a new instance of <see cref="ConstructionMenuPresenter" />.
/// </summary> /// </summary>
@@ -216,7 +216,7 @@ namespace Content.Client.Construction
private void GenerateStepList(ConstructionPrototype prototype, ItemList stepList) private void GenerateStepList(ConstructionPrototype prototype, ItemList stepList)
{ {
if (!_prototypeManager.TryIndex(prototype.Graph, out ConstructionGraphPrototype graph)) if (!_prototypeManager.TryIndex(prototype.Graph, out ConstructionGraphPrototype? graph))
return; return;
var startNode = graph.Nodes[prototype.StartNode]; var startNode = graph.Nodes[prototype.StartNode];
@@ -430,7 +430,7 @@ namespace Content.Client.Construction
_constructionView.BuildButtonPressed = true; _constructionView.BuildButtonPressed = true;
} }
private void OnSystemLoaded(object? sender, SystemChangedArgs args) private void OnSystemLoaded(object? sender, SystemChangedArgs args)
{ {
if (args.System is ConstructionSystem system) SystemBindingChanged(system); if (args.System is ConstructionSystem system) SystemBindingChanged(system);

View File

@@ -61,17 +61,17 @@ namespace Content.Client
factory.RegisterIgnore(ignoreName); factory.RegisterIgnore(ignoreName);
} }
factory.Register<SharedResearchConsoleComponent>(); factory.RegisterClass<SharedResearchConsoleComponent>();
factory.Register<SharedLatheComponent>(); factory.RegisterClass<SharedLatheComponent>();
factory.Register<SharedSpawnPointComponent>(); factory.RegisterClass<SharedSpawnPointComponent>();
factory.Register<SharedVendingMachineComponent>(); factory.RegisterClass<SharedVendingMachineComponent>();
factory.Register<SharedWiresComponent>(); factory.RegisterClass<SharedWiresComponent>();
factory.Register<SharedCargoConsoleComponent>(); factory.RegisterClass<SharedCargoConsoleComponent>();
factory.Register<SharedReagentDispenserComponent>(); factory.RegisterClass<SharedReagentDispenserComponent>();
factory.Register<SharedChemMasterComponent>(); factory.RegisterClass<SharedChemMasterComponent>();
factory.Register<SharedMicrowaveComponent>(); factory.RegisterClass<SharedMicrowaveComponent>();
factory.Register<SharedGravityGeneratorComponent>(); factory.RegisterClass<SharedGravityGeneratorComponent>();
factory.Register<SharedAMEControllerComponent>(); factory.RegisterClass<SharedAMEControllerComponent>();
prototypes.RegisterIgnore("material"); prototypes.RegisterIgnore("material");
prototypes.RegisterIgnore("reaction"); //Chemical reactions only needed by server. Reactions checks are server-side. prototypes.RegisterIgnore("reaction"); //Chemical reactions only needed by server. Reactions checks are server-side.

View File

@@ -23,7 +23,7 @@ namespace Content.IntegrationTests.Tests.Destructible
ExtraPrototypes = Prototypes, ExtraPrototypes = Prototypes,
ContentBeforeIoC = () => ContentBeforeIoC = () =>
{ {
IoCManager.Resolve<IComponentFactory>().Register<TestThresholdListenerComponent>(); IoCManager.Resolve<IComponentFactory>().RegisterClass<TestThresholdListenerComponent>();
} }
}); });

View File

@@ -23,7 +23,7 @@ namespace Content.IntegrationTests.Tests.Destructible
ExtraPrototypes = Prototypes, ExtraPrototypes = Prototypes,
ContentBeforeIoC = () => ContentBeforeIoC = () =>
{ {
IoCManager.Resolve<IComponentFactory>().Register<TestThresholdListenerComponent>(); IoCManager.Resolve<IComponentFactory>().RegisterClass<TestThresholdListenerComponent>();
} }
}); });

View File

@@ -22,7 +22,7 @@ namespace Content.IntegrationTests.Tests.Destructible
ExtraPrototypes = Prototypes, ExtraPrototypes = Prototypes,
ContentBeforeIoC = () => ContentBeforeIoC = () =>
{ {
IoCManager.Resolve<IComponentFactory>().Register<TestThresholdListenerComponent>(); IoCManager.Resolve<IComponentFactory>().RegisterClass<TestThresholdListenerComponent>();
} }
}); });

View File

@@ -27,7 +27,7 @@ namespace Content.IntegrationTests.Tests.Destructible
ExtraPrototypes = Prototypes, ExtraPrototypes = Prototypes,
ContentBeforeIoC = () => ContentBeforeIoC = () =>
{ {
IoCManager.Resolve<IComponentFactory>().Register<TestThresholdListenerComponent>(); IoCManager.Resolve<IComponentFactory>().RegisterClass<TestThresholdListenerComponent>();
} }
}); });

View File

@@ -47,7 +47,7 @@ namespace Content.IntegrationTests.Tests.Networking
ContentBeforeIoC = () => ContentBeforeIoC = () =>
{ {
IoCManager.Resolve<IEntitySystemManager>().LoadExtraSystemType<PredictionTestEntitySystem>(); IoCManager.Resolve<IEntitySystemManager>().LoadExtraSystemType<PredictionTestEntitySystem>();
IoCManager.Resolve<IComponentFactory>().Register<PredictionTestComponent>(); IoCManager.Resolve<IComponentFactory>().RegisterClass<PredictionTestComponent>();
} }
}, },
new ServerContentIntegrationOption new ServerContentIntegrationOption
@@ -55,7 +55,7 @@ namespace Content.IntegrationTests.Tests.Networking
ContentBeforeIoC = () => ContentBeforeIoC = () =>
{ {
IoCManager.Resolve<IEntitySystemManager>().LoadExtraSystemType<PredictionTestEntitySystem>(); IoCManager.Resolve<IEntitySystemManager>().LoadExtraSystemType<PredictionTestEntitySystem>();
IoCManager.Resolve<IComponentFactory>().Register<PredictionTestComponent>(); IoCManager.Resolve<IComponentFactory>().RegisterClass<PredictionTestComponent>();
} }
}); });

View File

@@ -28,7 +28,7 @@ namespace Content.Server.Commands
} }
else else
{ {
if (!prototypeManager.TryIndex(id, out EntityPrototype prototype)) if (!prototypeManager.TryIndex(id, out EntityPrototype? prototype))
{ {
shell.WriteLine($"No entity prototype found with id {id}."); shell.WriteLine($"No entity prototype found with id {id}.");
return; return;

View File

@@ -43,7 +43,7 @@ namespace Content.Server.GameObjects.Components.BarSign
return; return;
} }
if (!_prototypeManager.TryIndex(_currentSign, out BarSignPrototype prototype)) if (!_prototypeManager.TryIndex(_currentSign, out BarSignPrototype? prototype))
{ {
Logger.ErrorS("barSign", $"Invalid bar sign prototype: \"{_currentSign}\""); Logger.ErrorS("barSign", $"Invalid bar sign prototype: \"{_currentSign}\"");
return; return;

View File

@@ -136,7 +136,7 @@ namespace Content.Server.GameObjects.Components.Cargo
break; break;
} }
PrototypeManager.TryIndex(order.ProductId, out CargoProductPrototype product); PrototypeManager.TryIndex(order.ProductId, out CargoProductPrototype? product);
if (product == null!) if (product == null!)
break; break;
var capacity = _cargoConsoleSystem.GetCapacity(orders.Database.Id); var capacity = _cargoConsoleSystem.GetCapacity(orders.Database.Id);
@@ -184,7 +184,7 @@ namespace Content.Server.GameObjects.Components.Cargo
orders.Database.ClearOrderCapacity(); orders.Database.ClearOrderCapacity();
foreach (var order in approvedOrders) foreach (var order in approvedOrders)
{ {
if (!PrototypeManager.TryIndex(order.ProductId, out CargoProductPrototype product)) if (!PrototypeManager.TryIndex(order.ProductId, out CargoProductPrototype? product))
continue; continue;
for (var i = 0; i < order.Amount; i++) for (var i = 0; i < order.Amount; i++)
{ {

View File

@@ -103,7 +103,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
{ {
if (string.IsNullOrEmpty(_packPrototypeId)) return; if (string.IsNullOrEmpty(_packPrototypeId)) return;
if (!_prototypeManager.TryIndex(_packPrototypeId, out ReagentDispenserInventoryPrototype packPrototype)) if (!_prototypeManager.TryIndex(_packPrototypeId, out ReagentDispenserInventoryPrototype? packPrototype))
{ {
return; return;
} }

View File

@@ -81,7 +81,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
//Only reagents with spritePath property can change appearance of transformable containers! //Only reagents with spritePath property can change appearance of transformable containers!
if (!string.IsNullOrWhiteSpace(reagentId) && if (!string.IsNullOrWhiteSpace(reagentId) &&
_prototypeManager.TryIndex(reagentId, out ReagentPrototype proto) && _prototypeManager.TryIndex(reagentId, out ReagentPrototype? proto) &&
!string.IsNullOrWhiteSpace(proto.SpriteReplacementPath)) !string.IsNullOrWhiteSpace(proto.SpriteReplacementPath))
{ {
var spriteSpec = new SpriteSpecifier.Rsi(new ResourcePath("Objects/Consumable/Drinks/" + proto.SpriteReplacementPath),"icon"); var spriteSpec = new SpriteSpecifier.Rsi(new ResourcePath("Objects/Consumable/Drinks/" + proto.SpriteReplacementPath),"icon");

View File

@@ -480,7 +480,7 @@ namespace Content.Server.GameObjects.Components.Construction
return; return;
} }
if (_prototypeManager.TryIndex(_graphIdentifier, out ConstructionGraphPrototype graph)) if (_prototypeManager.TryIndex(_graphIdentifier, out ConstructionGraphPrototype? graph))
{ {
GraphPrototype = graph; GraphPrototype = graph;

View File

@@ -337,7 +337,7 @@ namespace Content.Server.GameObjects.Components.Metabolism
// Using ToList here lets us edit reagents while iterating // Using ToList here lets us edit reagents while iterating
foreach (var reagent in bloodstream.Solution.ReagentList.ToList()) 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; continue;
} }

View File

@@ -65,7 +65,7 @@ namespace Content.Server.GameObjects.Components.Research
switch (message.Message) switch (message.Message)
{ {
case LatheQueueRecipeMessage msg: case LatheQueueRecipeMessage msg:
PrototypeManager.TryIndex(msg.ID, out LatheRecipePrototype recipe); PrototypeManager.TryIndex(msg.ID, out LatheRecipePrototype? recipe);
if (recipe != null!) if (recipe != null!)
for (var i = 0; i < msg.Quantity; i++) for (var i = 0; i < msg.Quantity; i++)
{ {

View File

@@ -55,7 +55,7 @@ namespace Content.Server.GameObjects.Components.Research
switch (message.Message) switch (message.Message)
{ {
case ConsoleUnlockTechnologyMessage msg: 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 == null) break;
if (!client.Server.CanUnlockTechnology(tech)) break; if (!client.Server.CanUnlockTechnology(tech)) break;
if (client.Server.UnlockTechnology(tech)) if (client.Server.UnlockTechnology(tech))

View File

@@ -77,7 +77,7 @@ namespace Content.Server.GameObjects.Components.VendingMachines
private void InitializeFromPrototype() private void InitializeFromPrototype()
{ {
if (string.IsNullOrEmpty(_packPrototypeId)) { return; } if (string.IsNullOrEmpty(_packPrototypeId)) { return; }
if (!_prototypeManager.TryIndex(_packPrototypeId, out VendingMachineInventoryPrototype packPrototype)) if (!_prototypeManager.TryIndex(_packPrototypeId, out VendingMachineInventoryPrototype? packPrototype))
{ {
return; return;
} }

View File

@@ -304,13 +304,13 @@ namespace Content.Server.GameObjects.EntitySystems
private async void HandleStartItemConstruction(TryStartItemConstructionMessage ev, EntitySessionEventArgs args) 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}'!"); Logger.Error($"Tried to start construction of invalid recipe '{ev.PrototypeName}'!");
return; 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}'!"); Logger.Error($"Invalid construction graph '{constructionPrototype.Graph}' in recipe '{ev.PrototypeName}'!");
return; return;
@@ -360,14 +360,14 @@ namespace Content.Server.GameObjects.EntitySystems
private async void HandleStartStructureConstruction(TryStartStructureConstructionMessage ev, EntitySessionEventArgs args) 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}'!"); Logger.Error($"Tried to start construction of invalid recipe '{ev.PrototypeName}'!");
RaiseNetworkEvent(new AckStructureConstructionMessage(ev.Ack)); RaiseNetworkEvent(new AckStructureConstructionMessage(ev.Ack));
return; 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}'!"); Logger.Error($"Invalid construction graph '{constructionPrototype.Graph}' in recipe '{ev.PrototypeName}'!");
RaiseNetworkEvent(new AckStructureConstructionMessage(ev.Ack)); RaiseNetworkEvent(new AckStructureConstructionMessage(ev.Ack));

View File

@@ -1,11 +1,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using Content.Shared.Chemistry; using Content.Shared.Chemistry;
using Content.Shared.Maps; using Content.Shared.Maps;
using Robust.Shared.ContentPack; using Robust.Shared.ContentPack;
using Robust.Shared.IoC; using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Log; using Robust.Shared.Log;
using Robust.Shared.Map; using Robust.Shared.Map;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
@@ -16,7 +14,6 @@ namespace Content.Shared
{ {
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!; [Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
[Dependency] private readonly IResourceManager _resourceManager = default!;
public override void PreInit() public override void PreInit()
{ {

View File

@@ -199,7 +199,7 @@ namespace Content.Shared.GameObjects.Components.Chemistry
} }
var primaryReagent = Solution.GetPrimaryReagentId(); 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}."); Logger.Error($"{nameof(SharedSolutionContainerComponent)} could not find the prototype associated with {primaryReagent}.");
return; return;

View File

@@ -18,7 +18,7 @@ namespace Content.Shared
var culture = new CultureInfo(Culture); var culture = new CultureInfo(Culture);
loc.LoadCulture(res, culture); loc.LoadCulture(culture);
loc.AddFunction(culture, "PRESSURE", FormatPressure); loc.AddFunction(culture, "PRESSURE", FormatPressure);
loc.AddFunction(culture, "TOSTRING", args => FormatToString(culture, args)); loc.AddFunction(culture, "TOSTRING", args => FormatToString(culture, args));
} }

View File

@@ -33,7 +33,7 @@ namespace Content.Shared.Utility
{ {
prototypeManager ??= IoCManager.Resolve<IPrototypeManager>(); prototypeManager ??= IoCManager.Resolve<IPrototypeManager>();
return prototypeManager.TryIndex(prototype, out EntityPrototype proto) && proto.HasComponent(component, componentFactory); return prototypeManager.TryIndex(prototype, out EntityPrototype? proto) && proto.HasComponent(component, componentFactory);
} }
} }
} }

View File

@@ -36,7 +36,7 @@ namespace Content.Tests.Server.GameObjects.Components.Mobs
var prototypeManager = IoCManager.Resolve<IPrototypeManager>(); var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
var factory = IoCManager.Resolve<IComponentFactory>(); var factory = IoCManager.Resolve<IComponentFactory>();
factory.Register<ServerAlertsComponent>(); factory.RegisterClass<ServerAlertsComponent>();
prototypeManager.LoadFromStream(new StringReader(PROTOTYPES)); prototypeManager.LoadFromStream(new StringReader(PROTOTYPES));
prototypeManager.Resync(); prototypeManager.Resync();
var alertManager = IoCManager.Resolve<AlertManager>(); var alertManager = IoCManager.Resolve<AlertManager>();