From 2af616284e4a421b171c0fc8b839210f6f04ad8d Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Sat, 23 Jan 2021 19:37:28 +0100 Subject: [PATCH] Log all broken reactions. --- Content.Shared/EntryPoint.cs | 52 ++++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 11 deletions(-) diff --git a/Content.Shared/EntryPoint.cs b/Content.Shared/EntryPoint.cs index 0f163e43c4..bbee9f5b2a 100644 --- a/Content.Shared/EntryPoint.cs +++ b/Content.Shared/EntryPoint.cs @@ -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()) + { + foreach (var reactant in reaction.Reactants.Keys) + { + if (!_prototypeManager.HasIndex(reactant)) + { + Logger.ErrorS( + "chem", "Reaction {reaction} has unknown reactant {reagent}.", + reaction.ID, reactant); + } + } + + foreach (var product in reaction.Products.Keys) + { + if (!_prototypeManager.HasIndex(product)) + { + Logger.ErrorS( + "chem", "Reaction {reaction} has unknown product {product}.", + reaction.ID, product); + } + } + } } private void _initTileDefinitions() @@ -55,6 +84,7 @@ { continue; } + prototypeList.Add(tileDef); }