Update ScatterBuilder.cs

This commit is contained in:
Peter-Mikhaël Richard 2025-07-31 06:21:48 +02:00 committed by GitHub
parent 3fbe752395
commit f7c9685457
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -83,7 +83,7 @@ namespace NewHorizons.Builder.Props
bool reasonableHeightConstraints = true;
if (!propInfo.preventOverlap && (heightMapTexture != null) && (propInfo.minHeight != null || propInfo.maxHeight != null)) // If caution is relevant
{
var maxHeight = (propInfo.minHeight != null ? Math.Min(propInfo.maxHeight, heightMap.maxHeight) : heightMap.maxHeight);
var maxHeight = (propInfo.maxHeight != null ? Math.Min(propInfo.maxHeight, heightMap.maxHeight) : heightMap.maxHeight);
var minHeight = (propInfo.minHeight != null ? Math.Max(propInfo.minHeight, heightMap.minHeight) : heightMap.minHeight);
if ((maxHeight - minHeight) / (heightMap.maxHeight - heightMap.minHeight) < 0.001) // If height roll has less than 0.1% chance of being valid
reasonableHeightConstraints = false; // Ignore propInfo.min/maxHeight to prevent infinite rerolls