From 0b419b66c4d8c56ad1197505920bf0043fe25941 Mon Sep 17 00:00:00 2001 From: xen-42 <22628069+xen-42@users.noreply.github.com> Date: Mon, 4 Aug 2025 21:50:11 -0400 Subject: [PATCH] Revert "Add a security check to ScatterBuilder (#1109)" This reverts commit ced49c6606e88fb7a40b8cecb8fb7c753cd24214, reversing changes made to 4c3d92a4a3f90c981420eacac1d048a0f44da303. --- NewHorizons/Builder/Props/ScatterBuilder.cs | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/NewHorizons/Builder/Props/ScatterBuilder.cs b/NewHorizons/Builder/Props/ScatterBuilder.cs index 0df720d6..862f0629 100644 --- a/NewHorizons/Builder/Props/ScatterBuilder.cs +++ b/NewHorizons/Builder/Props/ScatterBuilder.cs @@ -80,18 +80,6 @@ namespace NewHorizons.Builder.Props }; var scatterPrefab = DetailBuilder.Make(go, sector, mod, prefab, detailInfo); - bool reasonableHeightConstraints = true; - if (!propInfo.preventOverlap && (heightMapTexture != null) && (propInfo.minHeight != null || propInfo.maxHeight != null)) // If caution is relevant - { - 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 - { - NHLogger.LogError($"Ignoring minHeight/maxHeight for scatter of [{scatterPrefab.name}] to prevent infinite rerolls from too much constraint on height."); - reasonableHeightConstraints = false; // Ignore propInfo.min/maxHeight to prevent infinite rerolls - } - // That way, even if often not valid, it still won't loop much more than propInfo.count * 1000 per prop - } for (int i = 0; i < propInfo.count; i++) { Vector3 point; @@ -125,7 +113,7 @@ namespace NewHorizons.Builder.Props float relativeHeight = heightMapTexture.GetPixel((int)sampleX, (int)sampleY).r; height = (relativeHeight * (heightMap.maxHeight - heightMap.minHeight) + heightMap.minHeight); - if (reasonableHeightConstraints && ((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 i--;