If texture/heightmap files don't exist, do error

This commit is contained in:
Nick 2022-07-27 22:12:57 -04:00
parent 86069d54ca
commit 7c5511d5f9

View File

@ -5,6 +5,7 @@ using NewHorizons.Handlers;
using NewHorizons.Utility; using NewHorizons.Utility;
using OWML.Common; using OWML.Common;
using System; using System;
using System.IO;
using UnityEngine; using UnityEngine;
using Logger = NewHorizons.Utility.Logger; using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.Body namespace NewHorizons.Builder.Body
@ -20,6 +21,17 @@ namespace NewHorizons.Builder.Body
Texture2D heightMap, textureMap; Texture2D heightMap, textureMap;
try 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) if (module.heightMap == null)
{ {
heightMap = Texture2D.whiteTexture; heightMap = Texture2D.whiteTexture;