mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Merge branch 'dev' into sandEffectRuleset
This commit is contained in:
commit
54165a8d5e
@ -100,8 +100,6 @@ namespace NewHorizons.Builder.Props.Audio
|
|||||||
var freq = CollectionUtilities.KeyByValue(_customFrequencyNames, str);
|
var freq = CollectionUtilities.KeyByValue(_customFrequencyNames, str);
|
||||||
if (freq != default) return freq;
|
if (freq != default) return freq;
|
||||||
|
|
||||||
NHLogger.Log($"Registering new frequency name [{str}]");
|
|
||||||
|
|
||||||
if (NumberOfFrequencies == 31)
|
if (NumberOfFrequencies == 31)
|
||||||
{
|
{
|
||||||
NHLogger.LogWarning($"Can't store any more frequencies, skipping [{str}]");
|
NHLogger.LogWarning($"Can't store any more frequencies, skipping [{str}]");
|
||||||
@ -111,10 +109,9 @@ namespace NewHorizons.Builder.Props.Audio
|
|||||||
freq = EnumUtilities.Create<SignalFrequency>(str);
|
freq = EnumUtilities.Create<SignalFrequency>(str);
|
||||||
_customFrequencyNames.Add(freq, str);
|
_customFrequencyNames.Add(freq, str);
|
||||||
|
|
||||||
NumberOfFrequencies = EnumUtils.GetValues<SignalFrequency>().Length;
|
NHLogger.Log($"Registered new frequency name [{str}] with value [{(int)freq}] and index [{AudioSignal.FrequencyToIndex(freq)}]");
|
||||||
|
|
||||||
// This stuff happens after the signalscope is Awake so we have to change the number of frequencies now
|
NumberOfFrequencies = EnumUtils.GetValues<SignalFrequency>().Length;
|
||||||
GameObject.FindObjectOfType<Signalscope>()._strongestSignals = new AudioSignal[NumberOfFrequencies + 1];
|
|
||||||
|
|
||||||
return freq;
|
return freq;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -80,18 +80,6 @@ namespace NewHorizons.Builder.Props
|
|||||||
};
|
};
|
||||||
var scatterPrefab = DetailBuilder.Make(go, sector, mod, prefab, detailInfo);
|
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++)
|
for (int i = 0; i < propInfo.count; i++)
|
||||||
{
|
{
|
||||||
Vector3 point;
|
Vector3 point;
|
||||||
@ -125,7 +113,7 @@ 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);
|
||||||
|
|
||||||
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
|
// Try this point again
|
||||||
i--;
|
i--;
|
||||||
|
|||||||
@ -45,7 +45,9 @@ namespace NewHorizons.Patches.SignalPatches
|
|||||||
SignalFrequency.HideAndSeek => 5,
|
SignalFrequency.HideAndSeek => 5,
|
||||||
SignalFrequency.Radio => 6,
|
SignalFrequency.Radio => 6,
|
||||||
SignalFrequency.Statue => 7,
|
SignalFrequency.Statue => 7,
|
||||||
_ => (int)(Mathf.Log((float)frequency) / Mathf.Log(2f)),// Frequencies are in powers of 2
|
// Can't cast to int because floating point error, it was doing 12.9999999 -> 12
|
||||||
|
// Frequencies are in powers of 2
|
||||||
|
_ => Mathf.RoundToInt(Mathf.Log((float)frequency) / Mathf.Log(2f)),
|
||||||
};
|
};
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ namespace NewHorizons.Patches.SignalPatches
|
|||||||
[HarmonyPatch(nameof(Signalscope.Awake))]
|
[HarmonyPatch(nameof(Signalscope.Awake))]
|
||||||
public static void Signalscope_Awake(Signalscope __instance)
|
public static void Signalscope_Awake(Signalscope __instance)
|
||||||
{
|
{
|
||||||
__instance._strongestSignals = new AudioSignal[8];
|
__instance._strongestSignals = new AudioSignal[32];
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
"author": "xen, Bwc9876, JohnCorby, MegaPiggy, and friends",
|
"author": "xen, Bwc9876, JohnCorby, MegaPiggy, and friends",
|
||||||
"name": "New Horizons",
|
"name": "New Horizons",
|
||||||
"uniqueName": "xen.NewHorizons",
|
"uniqueName": "xen.NewHorizons",
|
||||||
"version": "1.28.5",
|
"version": "1.28.6",
|
||||||
"owmlVersion": "2.12.1",
|
"owmlVersion": "2.12.1",
|
||||||
"dependencies": [ "JohnCorby.VanillaFix", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ],
|
"dependencies": [ "JohnCorby.VanillaFix", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ],
|
||||||
"conflicts": [ "PacificEngine.OW_CommonResources" ],
|
"conflicts": [ "PacificEngine.OW_CommonResources" ],
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user