Skip to content

Commit f6669bf

Browse files
committed
Set modded physics and reload earlier
Do it in post patch, this allows the part loader to pick up changes (e.g. rigidbody min mass)
1 parent 0261dc6 commit f6669bf

2 files changed

Lines changed: 20 additions & 10 deletions

File tree

ModuleManager/CustomConfigsManager.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,6 @@ internal void Start()
1616
Log("Setting modded tech tree as the active one");
1717
HighLogic.CurrentGame.Parameters.Career.TechTreeUrl = techTreeFile;
1818
}
19-
20-
if (PhysicsGlobals.PhysicsDatabaseFilename != physicsFile && File.Exists(physicsPath))
21-
{
22-
Log("Setting modded physics as the active one");
23-
24-
PhysicsGlobals.PhysicsDatabaseFilename = physicsFile;
25-
26-
if (!PhysicsGlobals.Instance.LoadDatabase())
27-
Log("Something went wrong while setting the active physics config.");
28-
}
2919
}
3020

3121
public static void Log(String s)

ModuleManager/PostPatchLoader.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ private IEnumerator Run()
130130
logger.Info("Reloading Part Upgrades");
131131
PartUpgradeManager.Handler.FillUpgrades();
132132

133+
LoadModdedPhysics();
134+
133135
yield return null;
134136

135137
progressTitle = "ModuleManager: Running post patch callbacks";
@@ -209,5 +211,23 @@ private IEnumerator Run()
209211

210212
ready = true;
211213
}
214+
215+
private void LoadModdedPhysics()
216+
{
217+
if (PhysicsGlobals.PhysicsDatabaseFilename == physicsFile) return;
218+
219+
if (!File.Exists(physicsPath))
220+
{
221+
logger.Error("Physics file not found");
222+
return;
223+
}
224+
225+
logger.Info("Setting modded physics as the active one");
226+
227+
PhysicsGlobals.PhysicsDatabaseFilename = physicsFile;
228+
229+
if (!PhysicsGlobals.Instance.LoadDatabase())
230+
logger.Error("Something went wrong while setting the active physics config.");
231+
}
212232
}
213233
}

0 commit comments

Comments
 (0)