* Add nullable to some Content.Shared files. * Use [NotNullWhen(true)] * Undo adding now redundant !'s * Forgot one * Add a ton more nullable * You can guess * Fix some issues * It actually compiles now * Auto stash before merge of "null2" and "origin/master" * I lied * enable annotations -> enable * Revert ActionBlockerSystem.cs to original * Fix ActionBlockerSystem.cs * More nullable * Undo some added exclamation marks * Fix issues * Update Content.Shared/Maps/ContentTileDefinition.cs Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Resolve some issues * Remove unused method * Fix more issues * Fix more issues * Fix more issues * Fix more issues * Fix issue, rollback SharedGhostComponent.cs * Update submodule * Fix issue, invert some if-statements to reduce nesting * Revert RobustToolbox * FIx things broken by merge * Some fixes - Replaced with string.Empty - Remove some exclamation marks - Revert file * Some fixes * Trivial #nullable enable * Fix null ables Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
95 lines
2.8 KiB
C#
95 lines
2.8 KiB
C#
#nullable enable
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using Content.Shared.Chemistry;
|
|
using Content.Shared.Maps;
|
|
using Robust.Shared.ContentPack;
|
|
using Robust.Shared.IoC;
|
|
using Robust.Shared.Log;
|
|
using Robust.Shared.Map;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Shared
|
|
{
|
|
public class EntryPoint : GameShared
|
|
{
|
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
|
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
|
|
|
|
public override void PreInit()
|
|
{
|
|
IoCManager.InjectDependencies(this);
|
|
|
|
Localization.Init();
|
|
}
|
|
|
|
public override void Init()
|
|
{
|
|
}
|
|
|
|
public override void PostInit()
|
|
{
|
|
base.PostInit();
|
|
|
|
_initTileDefinitions();
|
|
CheckReactions();
|
|
}
|
|
|
|
private void CheckReactions()
|
|
{
|
|
foreach (var reaction in _prototypeManager.EnumeratePrototypes<ReactionPrototype>())
|
|
{
|
|
foreach (var reactant in reaction.Reactants.Keys)
|
|
{
|
|
if (!_prototypeManager.HasIndex<ReagentPrototype>(reactant))
|
|
{
|
|
Logger.ErrorS(
|
|
"chem", "Reaction {reaction} has unknown reactant {reagent}.",
|
|
reaction.ID, reactant);
|
|
}
|
|
}
|
|
|
|
foreach (var product in reaction.Products.Keys)
|
|
{
|
|
if (!_prototypeManager.HasIndex<ReagentPrototype>(product))
|
|
{
|
|
Logger.ErrorS(
|
|
"chem", "Reaction {reaction} has unknown product {product}.",
|
|
reaction.ID, product);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private void _initTileDefinitions()
|
|
{
|
|
// Register space first because I'm a hard coding hack.
|
|
var spaceDef = _prototypeManager.Index<ContentTileDefinition>("space");
|
|
|
|
_tileDefinitionManager.Register(spaceDef);
|
|
|
|
var prototypeList = new List<ContentTileDefinition>();
|
|
foreach (var tileDef in _prototypeManager.EnumeratePrototypes<ContentTileDefinition>())
|
|
{
|
|
if (tileDef.Name == "space")
|
|
{
|
|
continue;
|
|
}
|
|
|
|
prototypeList.Add(tileDef);
|
|
}
|
|
|
|
// Sort ordinal to ensure it's consistent client and server.
|
|
// So that tile IDs match up.
|
|
prototypeList.Sort((a, b) => string.Compare(a.Name, b.Name, StringComparison.Ordinal));
|
|
|
|
foreach (var tileDef in prototypeList)
|
|
{
|
|
_tileDefinitionManager.Register(tileDef);
|
|
}
|
|
|
|
_tileDefinitionManager.Initialize();
|
|
}
|
|
}
|
|
}
|