From 207c4cdce5d4966e80e07eee97482ae4a482a4ac Mon Sep 17 00:00:00 2001 From: "Nick J. Connors" Date: Thu, 30 Dec 2021 00:30:28 -0500 Subject: [PATCH] Fix GetFalloffExponent (maybe) --- NewHorizons/Utility/NewHorizonExtensions.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/NewHorizons/Utility/NewHorizonExtensions.cs b/NewHorizons/Utility/NewHorizonExtensions.cs index 7a2e4e27..ef01fa86 100644 --- a/NewHorizons/Utility/NewHorizonExtensions.cs +++ b/NewHorizons/Utility/NewHorizonExtensions.cs @@ -30,7 +30,10 @@ namespace NewHorizons.Utility public static float GetFalloffExponent(this GravityVolume gv) { if (gv == null) return 0; - return (float)typeof(GravityVolume).GetField("_falloffExponent", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(gv); + if (gv._falloffType == GravityVolume.FalloffType.linear) return 1; + if (gv._falloffType == GravityVolume.FalloffType.inverseSquared) return 2; + + return 0; } public static string ToCamelCase(this string str)