Fix weather setup failing on missing clouds maximum percent

Morrowind.ini has no Clouds_Maximum_Percent for Ashstorm or Blight, so
esmfallbacks.lua passed 0 and the weather binding threw, aborting the
rest of generateDefaultWeathers. Clamp to a tiny positive value, which
keeps the old C++ behavior of swapping cloud textures immediately.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-10 14:12:45 -05:00
co-authored by Claude Opus 5.5
parent 158a3a1227
commit 9d846231bc
+4 -1
View File
@@ -279,7 +279,10 @@ local function generateDefaultWeathers()
rainThreshold = getFloat(('Weather_%s_Rain_Threshold'):format(recordId)),
rainMinHeight = getFloat(('Weather_%s_Rain_Height_Min'):format(recordId)),
rainMaxHeight = getFloat(('Weather_%s_Rain_Height_Max'):format(recordId)),
cloudsMaximumPercent = getFloat(('Weather_%s_Clouds_Maximum_Percent'):format(recordId)),
-- Morrowind.ini has no value for Ashstorm or Blight. The engine
-- requires (0, 1], so a tiny value keeps the old behavior of
-- swapping cloud textures as soon as the transition starts.
cloudsMaximumPercent = math.max(getFloat(('Weather_%s_Clouds_Maximum_Percent'):format(recordId)), 1e-6),
isStorm = windSpeed > fStromWindSpeed,
cloudTexture = getString(('Weather_%s_Cloud_Texture'):format(recordId)),
distantLandFogFactor = dlFactor,