Log all broken reactions.

This commit is contained in:
Pieter-Jan Briers
2021-01-23 19:37:28 +01:00
parent 8b2f28f155
commit 2af616284e

View File

@@ -1,15 +1,17 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using Content.Shared.Maps;
using Robust.Shared.ContentPack;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Localization.Macros;
using Robust.Shared.Prototypes;
using System;
using System.Collections.Generic;
using System.Globalization;
using Content.Shared.Chemistry;
using Content.Shared.Maps;
using Robust.Shared.ContentPack;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Localization.Macros;
using Robust.Shared.Log;
using Robust.Shared.Prototypes;
namespace Content.Shared
namespace Content.Shared
{
public class EntryPoint : GameShared
{
@@ -39,6 +41,33 @@
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()
@@ -55,6 +84,7 @@
{
continue;
}
prototypeList.Add(tileDef);
}