move water thing outta for loop

This commit is contained in:
JohnCorby 2022-07-27 20:56:36 -07:00
parent 5be88e7bfa
commit 83dad8d68e

View File

@ -47,6 +47,10 @@ namespace NewHorizons.Builder.Props
{ {
Random.InitState(propInfo.seed); Random.InitState(propInfo.seed);
// By default don't put underwater more than a mater
// this is a backward compat thing lol
if (config.Water != null && propInfo.minHeight == null) propInfo.minHeight = config.Water.size - 1f;
GameObject prefab; GameObject prefab;
if (propInfo.assetBundle != null) prefab = AssetBundleUtilities.LoadPrefab(propInfo.assetBundle, propInfo.path, mod); if (propInfo.assetBundle != null) prefab = AssetBundleUtilities.LoadPrefab(propInfo.assetBundle, propInfo.path, mod);
else prefab = SearchUtilities.Find(propInfo.path); else prefab = SearchUtilities.Find(propInfo.path);
@ -76,9 +80,6 @@ namespace NewHorizons.Builder.Props
float relativeHeight = heightMapTexture.GetPixel((int)sampleX, (int)sampleY).r; float relativeHeight = heightMapTexture.GetPixel((int)sampleX, (int)sampleY).r;
height = (relativeHeight * (heightMap.maxHeight - heightMap.minHeight) + heightMap.minHeight); height = (relativeHeight * (heightMap.maxHeight - heightMap.minHeight) + heightMap.minHeight);
// By default don't put underwater more than a mater
if (config.Water != null && propInfo.minHeight == null) propInfo.minHeight = config.Water.size - 1f;
if ((propInfo.minHeight != null && height < propInfo.minHeight) || (propInfo.maxHeight != null && height > propInfo.maxHeight)) if ((propInfo.minHeight != null && height < propInfo.minHeight) || (propInfo.maxHeight != null && height > propInfo.maxHeight))
{ {
// Try this point again // Try this point again