From 7c5511d5f90cb7c346ee0193316f236e577fc854 Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 27 Jul 2022 22:12:57 -0400 Subject: [PATCH] If texture/heightmap files don't exist, do error --- NewHorizons/Builder/Body/HeightMapBuilder.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/NewHorizons/Builder/Body/HeightMapBuilder.cs b/NewHorizons/Builder/Body/HeightMapBuilder.cs index ffa6e87c..6be4d83f 100644 --- a/NewHorizons/Builder/Body/HeightMapBuilder.cs +++ b/NewHorizons/Builder/Body/HeightMapBuilder.cs @@ -5,6 +5,7 @@ using NewHorizons.Handlers; using NewHorizons.Utility; using OWML.Common; using System; +using System.IO; using UnityEngine; using Logger = NewHorizons.Utility.Logger; namespace NewHorizons.Builder.Body @@ -20,6 +21,17 @@ namespace NewHorizons.Builder.Body Texture2D heightMap, textureMap; try { + if (!File.Exists(Path.Combine(mod.ModHelper.Manifest.ModFolderPath, module.heightMap ?? ""))) + { + Logger.LogError($"Bad path for {planetGO.name} heightMap: {module.heightMap} couldn't be found."); + module.heightMap = null; + } + if (!File.Exists(Path.Combine(mod.ModHelper.Manifest.ModFolderPath, module.textureMap ?? ""))) + { + Logger.LogError($"Bad path for {planetGO.name} textureMap: {module.textureMap} couldn't be found."); + module.textureMap = null; + } + if (module.heightMap == null) { heightMap = Texture2D.whiteTexture;