mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Use string.IsNullOrEmpty instead
This commit is contained in:
parent
addc0041ab
commit
782f344065
@ -23,23 +23,23 @@ namespace NewHorizons.Builder.Body
|
|||||||
Texture2D heightMap, textureMap, emissionMap;
|
Texture2D heightMap, textureMap, emissionMap;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (module.heightMap != null && !File.Exists(Path.Combine(mod.ModHelper.Manifest.ModFolderPath, module.heightMap)))
|
if (!string.IsNullOrEmpty(module.heightMap) && !File.Exists(Path.Combine(mod.ModHelper.Manifest.ModFolderPath, module.heightMap)))
|
||||||
{
|
{
|
||||||
Logger.LogError($"Bad path for {planetGO.name} heightMap: {module.heightMap} couldn't be found.");
|
Logger.LogError($"Bad path for {planetGO.name} heightMap: {module.heightMap} couldn't be found.");
|
||||||
module.heightMap = null;
|
module.heightMap = null;
|
||||||
}
|
}
|
||||||
if (module.textureMap != null && !File.Exists(Path.Combine(mod.ModHelper.Manifest.ModFolderPath, module.textureMap)))
|
if (!string.IsNullOrEmpty(module.textureMap) && !File.Exists(Path.Combine(mod.ModHelper.Manifest.ModFolderPath, module.textureMap)))
|
||||||
{
|
{
|
||||||
Logger.LogError($"Bad path for {planetGO.name} textureMap: {module.textureMap} couldn't be found.");
|
Logger.LogError($"Bad path for {planetGO.name} textureMap: {module.textureMap} couldn't be found.");
|
||||||
module.textureMap = null;
|
module.textureMap = null;
|
||||||
}
|
}
|
||||||
if (module.emissionMap != null && !File.Exists(Path.Combine(mod.ModHelper.Manifest.ModFolderPath, module.emissionMap)))
|
if (!string.IsNullOrEmpty(module.emissionMap) && !File.Exists(Path.Combine(mod.ModHelper.Manifest.ModFolderPath, module.emissionMap)))
|
||||||
{
|
{
|
||||||
Logger.LogError($"Bad path for {planetGO.name} emissionMap: {module.emissionMap} couldn't be found.");
|
Logger.LogError($"Bad path for {planetGO.name} emissionMap: {module.emissionMap} couldn't be found.");
|
||||||
module.emissionMap = null;
|
module.emissionMap = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (module.heightMap == null)
|
if (string.IsNullOrEmpty(module.heightMap))
|
||||||
{
|
{
|
||||||
heightMap = Texture2D.whiteTexture;
|
heightMap = Texture2D.whiteTexture;
|
||||||
}
|
}
|
||||||
@ -52,7 +52,7 @@ namespace NewHorizons.Builder.Body
|
|||||||
heightMap = ImageUtilities.GetTexture(mod, module.heightMap);
|
heightMap = ImageUtilities.GetTexture(mod, module.heightMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (module.textureMap == null)
|
if (string.IsNullOrEmpty(module.textureMap))
|
||||||
{
|
{
|
||||||
textureMap = Texture2D.whiteTexture;
|
textureMap = Texture2D.whiteTexture;
|
||||||
}
|
}
|
||||||
@ -61,7 +61,7 @@ namespace NewHorizons.Builder.Body
|
|||||||
textureMap = ImageUtilities.GetTexture(mod, module.textureMap);
|
textureMap = ImageUtilities.GetTexture(mod, module.textureMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (module.emissionMap == null)
|
if (string.IsNullOrEmpty(module.emissionMap))
|
||||||
{
|
{
|
||||||
emissionMap = Texture2D.blackTexture;
|
emissionMap = Texture2D.blackTexture;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,12 +40,15 @@ namespace NewHorizons.Builder.Props
|
|||||||
if (heightMap != null)
|
if (heightMap != null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(heightMap.heightMap))
|
||||||
{
|
{
|
||||||
// TODO copy what heightmap builder does eventually
|
// TODO copy what heightmap builder does eventually
|
||||||
heightMapTexture = ImageUtilities.GetTexture(mod, heightMap.heightMap);
|
heightMapTexture = ImageUtilities.GetTexture(mod, heightMap.heightMap);
|
||||||
// defer remove texture to next frame
|
// defer remove texture to next frame
|
||||||
Delay.FireOnNextUpdate(() => Object.Destroy(heightMapTexture));
|
Delay.FireOnNextUpdate(() => Object.Destroy(heightMapTexture));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (Exception) { }
|
catch (Exception) { }
|
||||||
if (heightMapTexture == null)
|
if (heightMapTexture == null)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user