diff --git a/VisualStudio/Properties/AssemblyInfo.cs b/VisualStudio/Properties/AssemblyInfo.cs index e3ae8ad..c633cc4 100644 --- a/VisualStudio/Properties/AssemblyInfo.cs +++ b/VisualStudio/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.1.0")] -[assembly: AssemblyFileVersion("2.1.0")] +[assembly: AssemblyVersion("2.1.1")] +[assembly: AssemblyFileVersion("2.1.1")] diff --git a/VisualStudio/src/BetterPlacing.cs b/VisualStudio/src/BetterPlacing.cs index 830e65c..7d40ff8 100644 --- a/VisualStudio/src/BetterPlacing.cs +++ b/VisualStudio/src/BetterPlacing.cs @@ -135,6 +135,16 @@ internal static void PrepareGearItems() RemovePickupHelper(Resources.Load("GEAR_PackMatches")); } + internal static GameObject getFurnitureRoot(GameObject gameObject) + { + if (gameObject.GetComponent() != null) + { + return gameObject; + } + + return getFurnitureRoot(gameObject.transform.parent.gameObject); + } + internal static void PreparePlacableFurniture(GameObject gameObject) { if (!gameObject.GetComponentInChildren().isPartOfStaticBatch) diff --git a/VisualStudio/src/Patches.cs b/VisualStudio/src/Patches.cs index 51fa824..97e78da 100644 --- a/VisualStudio/src/Patches.cs +++ b/VisualStudio/src/Patches.cs @@ -22,13 +22,15 @@ private static bool Prefix(BreakDown __instance, string text) return true; } + __instance.gameObject.SetActive(true); BetterPlacing.PreparePlacableFurniture(__instance.gameObject); - __instance.transform.parent.position = saveData.m_Position; - __instance.gameObject.SetActive(true); + GameObject root = BetterPlacing.getFurnitureRoot(__instance.gameObject); + + root.transform.position = saveData.m_Position; if (saveData.m_Rotation.x != 0 || saveData.m_Rotation.y != 0 || saveData.m_Rotation.z != 0) { - __instance.transform.parent.rotation = Quaternion.Euler(saveData.m_Rotation); + root.transform.rotation = Quaternion.Euler(saveData.m_Rotation); } return false; @@ -235,13 +237,8 @@ public static bool Prefix(PlayerManager __instance) { BetterPlacing.PreparePlacableFurniture(gameObject); - LODGroup lodGroup = gameObject.GetComponentInParent(); - if (lodGroup != null) - { - gameObject = lodGroup.gameObject; - } - - __instance.StartPlaceMesh(gameObject, 5f, false); + GameObject root = BetterPlacing.getFurnitureRoot(gameObject); + __instance.StartPlaceMesh(root, 5f, false); return false; }