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();
}
}
/// <summary>
/// Constructs a new instance of <see cref="ConstructionMenuPresenter" />.
/// </summary>
@@ -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);

View File

@@ -61,17 +61,17 @@ namespace Content.Client
factory.RegisterIgnore(ignoreName);
}
factory.Register<SharedResearchConsoleComponent>();
factory.Register<SharedLatheComponent>();
factory.Register<SharedSpawnPointComponent>();
factory.Register<SharedVendingMachineComponent>();
factory.Register<SharedWiresComponent>();
factory.Register<SharedCargoConsoleComponent>();
factory.Register<SharedReagentDispenserComponent>();
factory.Register<SharedChemMasterComponent>();
factory.Register<SharedMicrowaveComponent>();
factory.Register<SharedGravityGeneratorComponent>();
factory.Register<SharedAMEControllerComponent>();
factory.RegisterClass<SharedResearchConsoleComponent>();
factory.RegisterClass<SharedLatheComponent>();
factory.RegisterClass<SharedSpawnPointComponent>();
factory.RegisterClass<SharedVendingMachineComponent>();
factory.RegisterClass<SharedWiresComponent>();
factory.RegisterClass<SharedCargoConsoleComponent>();
factory.RegisterClass<SharedReagentDispenserComponent>();
factory.RegisterClass<SharedChemMasterComponent>();
factory.RegisterClass<SharedMicrowaveComponent>();
factory.RegisterClass<SharedGravityGeneratorComponent>();
factory.RegisterClass<SharedAMEControllerComponent>();
prototypes.RegisterIgnore("material");
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,
ContentBeforeIoC = () =>
{
IoCManager.Resolve<IComponentFactory>().Register<TestThresholdListenerComponent>();
IoCManager.Resolve<IComponentFactory>().RegisterClass<TestThresholdListenerComponent>();
}
});

View File

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

View File

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

View File

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

View File

@@ -47,7 +47,7 @@ namespace Content.IntegrationTests.Tests.Networking
ContentBeforeIoC = () =>
{
IoCManager.Resolve<IEntitySystemManager>().LoadExtraSystemType<PredictionTestEntitySystem>();
IoCManager.Resolve<IComponentFactory>().Register<PredictionTestComponent>();
IoCManager.Resolve<IComponentFactory>().RegisterClass<PredictionTestComponent>();
}
},
new ServerContentIntegrationOption
@@ -55,7 +55,7 @@ namespace Content.IntegrationTests.Tests.Networking
ContentBeforeIoC = () =>
{
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
{
if (!prototypeManager.TryIndex(id, out EntityPrototype prototype))
if (!prototypeManager.TryIndex(id, out EntityPrototype? prototype))
{
shell.WriteLine($"No entity prototype found with id {id}.");
return;

View File

@@ -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;

View File

@@ -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++)
{

View File

@@ -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;
}

View File

@@ -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");

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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++)
{

View File

@@ -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))

View File

@@ -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;
}

View File

@@ -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));

View File

@@ -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()
{

View File

@@ -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;

View File

@@ -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));
}

View File

@@ -33,7 +33,7 @@ namespace Content.Shared.Utility
{
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 factory = IoCManager.Resolve<IComponentFactory>();
factory.Register<ServerAlertsComponent>();
factory.RegisterClass<ServerAlertsComponent>();
prototypeManager.LoadFromStream(new StringReader(PROTOTYPES));
prototypeManager.Resync();
var alertManager = IoCManager.Resolve<AlertManager>();