diff --git a/NewHorizons/Assets/textures/CloudExit__PlayerShip_d.png b/NewHorizons/Assets/textures/CloudExit__PlayerShip_d.png new file mode 100644 index 00000000..5e83973d Binary files /dev/null and b/NewHorizons/Assets/textures/CloudExit__PlayerShip_d.png differ diff --git a/NewHorizons/Components/SplashColourizer.cs b/NewHorizons/Components/SplashColourizer.cs index 6cb1716f..0b38f44b 100644 --- a/NewHorizons/Components/SplashColourizer.cs +++ b/NewHorizons/Components/SplashColourizer.cs @@ -30,6 +30,8 @@ public class SplashColourizer : MonoBehaviour private bool _probeInsideVolume; + private List _customTextures = new(); + public void Awake() { var volume = new GameObject("Volume"); @@ -210,6 +212,12 @@ public class SplashColourizer : MonoBehaviour var meshRenderers = prefab.GetComponentsInChildren(true); foreach (var meshRenderer in meshRenderers) { + if (_customTextures.Contains(meshRenderer.material.mainTexture)) + { + // Might be some shared material stuff? This image is already tinted, so skip it + continue; + } + // Can't access the textures in memory so we need to have our own copies var texture = ImageUtilities.GetTexture(Main.Instance, $"Assets/textures/{meshRenderer.material.mainTexture.name}.png"); if (texture == null) @@ -218,6 +226,9 @@ public class SplashColourizer : MonoBehaviour GameObject.Destroy(prefab); flagError = true; } + + _customTextures.Add(texture); + meshRenderer.material = new(meshRenderer.material) { color = Color.white, @@ -251,6 +262,16 @@ public class SplashColourizer : MonoBehaviour } public void SetProbeSplashEffects(bool entering) + { + _probeInsideVolume = entering; + + if (_probeDetector != null) + { + SetSplashEffects(_probeDetector, entering); + } + } + + public void Update() { // Probe detector keeps being null, I hate my life if (_probeDetector == null) @@ -261,12 +282,5 @@ public class SplashColourizer : MonoBehaviour CachePrefabs(_probeDetector); } } - - _probeInsideVolume = entering; - - if (_probeDetector != null) - { - SetSplashEffects(_probeDetector, entering); - } } } diff --git a/NewHorizons/Utility/Files/ImageUtilities.cs b/NewHorizons/Utility/Files/ImageUtilities.cs index 742e5310..ff03f14b 100644 --- a/NewHorizons/Utility/Files/ImageUtilities.cs +++ b/NewHorizons/Utility/Files/ImageUtilities.cs @@ -39,7 +39,17 @@ namespace NewHorizons.Utility.Files return null; } // Copied from OWML but without the print statement lol - var path = Path.Combine(mod.ModHelper.Manifest.ModFolderPath, filename); + string path; + try + { + path = Path.Combine(mod.ModHelper.Manifest.ModFolderPath, filename); + } + catch (Exception e) + { + NHLogger.LogError($"Invalid path: Couldn't combine {mod.ModHelper.Manifest.ModFolderPath} {filename} - {e}"); + return null; + } + var key = GetKey(path); if (_textureCache.TryGetValue(key, out var existingTexture)) {