diff --git a/CyclopsDockingMod/BaseItem.cs b/CyclopsDockingMod/BaseItem.cs index b712be3..aeb4c67 100644 --- a/CyclopsDockingMod/BaseItem.cs +++ b/CyclopsDockingMod/BaseItem.cs @@ -20,7 +20,7 @@ public BaseItem(string classID, string name, string desc, string icon) : this(Pr } [SetsRequiredMembers] - public BaseItem(string classID, string name, string desc, Atlas.Sprite icon) : this(PrefabInfo.WithTechType(classID, name, desc, unlockAtStart: true).WithFileName(DefaultResourcePath + classID).WithIcon(icon)) + public BaseItem(string classID, string name, string desc, Sprite icon) : this(PrefabInfo.WithTechType(classID, name, desc, unlockAtStart: true).WithFileName(DefaultResourcePath + classID).WithIcon(icon)) { } diff --git a/CyclopsDockingMod/CyclopsDockingMod.csproj b/CyclopsDockingMod/CyclopsDockingMod.csproj index 43bbc45..989bc9a 100644 --- a/CyclopsDockingMod/CyclopsDockingMod.csproj +++ b/CyclopsDockingMod/CyclopsDockingMod.csproj @@ -86,23 +86,6 @@ $(SubnauticaDir)\Subnautica_Data\Managed - - $(SubnauticaDir)\BepInEx\core\BepInEx.dll - - - $(SubnauticaDir)\BepInEx\core\0Harmony.dll - - - $(Dependencies)\publicized_assemblies\Assembly-CSharp_publicized.dll - - - - $(Dependencies)\publicized_assemblies\Assembly-CSharp-firstpass_publicized.dll - - - - $(SubnauticaDir)\BepInEx\plugins\Modding Helper\SMLHelper.dll - $(SubnauticaDir)\BepInEx\plugins\Nautilus\Nautilus.dll @@ -110,45 +93,6 @@ False $(Dependencies)\Unity.Addressables.dll - - $(Dependencies)\UnityEngine.dll - - - False - $(Dependencies)\UnityEngine.AnimationModule.dll - - - $(Dependencies)\UnityEngine.AssetBundleModule.dll - - - $(Dependencies)\UnityEngine.CoreModule.dll - - - $(Dependencies)\UnityEngine.InputLegacyModule.dll - - - $(Dependencies)\UnityEngine.PhysicsModule.dll - - - False - $(Dependencies)\UnityEngine.TextRenderingModule.dll - - - False - $(Dependencies)\Unity.TextMeshPro.dll - - - False - $(Dependencies)\UnityEngine.UI.dll - - - False - $(Dependencies)\Unity.ResourceManager.dll - - - False - $(Dependencies)\UnityEngine.IMGUIModule.dll - @@ -180,8 +124,6 @@ - - @@ -198,6 +140,20 @@ + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + diff --git a/CyclopsDockingMod/CyclopsHatchConnector.cs b/CyclopsDockingMod/CyclopsHatchConnector.cs index a0829c6..704f2f5 100644 --- a/CyclopsDockingMod/CyclopsHatchConnector.cs +++ b/CyclopsDockingMod/CyclopsHatchConnector.cs @@ -8,12 +8,11 @@ using SMLHelper.V2.Crafting; using SMLHelper.V2.Handlers; #endif -using Ingredient = CraftData.Ingredient; using UnityEngine; namespace CyclopsDockingMod { - public class CyclopsHatchConnector : BaseItem + public class CyclopsHatchConnector : BaseItem { public static List ResourceMap = new List(new TechType[] { @@ -38,7 +37,7 @@ public class CyclopsHatchConnector : BaseItem private static Texture _normal1 = null; - private static Texture _illum1 = null; + private static Texture _illum1 = null; public enum CyclopsDockingAnim { @@ -65,161 +64,161 @@ public CyclopsHatchConnector() base.GameObject = new GameObject(base.ClassID); base.TechType = TechTypeHandler.AddTechType(base.ClassID, CyclopsHatchConnector.CyclopsHatchConnectorName, CyclopsHatchConnector.CyclopsHatchConnectorDescription, true); #endif - CyclopsDockingMod.CyclopsHatchConnector = base.TechType; - this.IsHabitatBuilder = true; + CyclopsDockingMod.CyclopsHatchConnector = base.TechType; + this.IsHabitatBuilder = true; #if SUBNAUTICA_NAUTI base.Recipe = new RecipeData #else base.Recipe = new TechData #endif - { - craftAmount = 1, - Ingredients = this.SortIngredients() - }; - } - - private List SortIngredients() - { - Dictionary dictionary = new Dictionary(); - foreach (TechType techType in CyclopsHatchConnector.ResourceMap) - { - if (dictionary.ContainsKey(techType)) - { - Dictionary dictionary2 = dictionary; - TechType techType2 = techType; - int num = dictionary2[techType2]; - dictionary2[techType2] = num + 1; - } - else - dictionary.Add(techType, 1); - } - List list = new List(); - foreach (KeyValuePair keyValuePair in dictionary) - list.Add(new Ingredient(keyValuePair.Key, keyValuePair.Value)); - return list; - } - - public override void RegisterItem() - { - if (!this.IsRegistered) - { + { + craftAmount = 1, + Ingredients = this.SortIngredients() + }; + } + + private List SortIngredients() + { + Dictionary dictionary = new Dictionary(); + foreach (TechType techType in CyclopsHatchConnector.ResourceMap) + { + if (dictionary.ContainsKey(techType)) + { + Dictionary dictionary2 = dictionary; + TechType techType2 = techType; + int num = dictionary2[techType2]; + dictionary2[techType2] = num + 1; + } + else + dictionary.Add(techType, 1); + } + List list = new List(); + foreach (KeyValuePair keyValuePair in dictionary) + list.Add(new Ingredient(keyValuePair.Key, keyValuePair.Value)); + return list; + } + + public override void RegisterItem() + { + if (!this.IsRegistered) + { #if SUBNAUTICA_NAUTI - CraftDataHandler.SetRecipeData(TechType, Recipe); + CraftDataHandler.SetRecipeData(TechType, Recipe); #else CraftDataHandler.SetTechData(base.TechType, base.Recipe); #endif - CraftDataHandler.AddBuildable(base.TechType); - CraftDataHandler.AddToGroup(TechGroup.BasePieces, TechCategory.BasePiece, base.TechType); + CraftDataHandler.AddBuildable(base.TechType); + CraftDataHandler.AddToGroup(TechGroup.BasePieces, TechCategory.BasePiece, base.TechType); #if SUBNAUTICA_NAUTI - this.Register(); + this.Register(); #else PrefabHandler.RegisterPrefab(this); #endif - SpriteHandler.RegisterSprite(base.TechType, AssetsHelper.Assets.LoadAsset("CyclopsDockingHatchIconG")); - - this.IsRegistered = true; - } - } - - public override GameObject GetGameObject() - { - if (GameObject == null) - GameObject = new GameObject(ClassID); - GameObject gameObject = Object.Instantiate(GameObject); - gameObject.name = ClassID; - gameObject.AddComponent().ClassId = ClassID; - gameObject.AddComponent().type = TechType; - Constructable constructable = gameObject.AddComponent(); - constructable.allowedInBase = true; - constructable.allowedInSub = true; - constructable.allowedOutside = true; - constructable.allowedOnCeiling = false; - constructable.allowedOnGround = true; - constructable.allowedOnConstructables = true; - constructable.allowedUnderwater = true; - constructable.attachedToBase = true; - constructable.deconstructionAllowed = true; - constructable.rotationEnabled = false; - constructable.model = gameObject; - constructable.techType = TechType; - constructable.surfaceType = VFXSurfaceTypes.metal; - constructable.placeMinDistance = 0.6f; - constructable.enabled = true; - return gameObject; - } - - public static void PlayDockingAnim(GameObject go, CyclopsHatchConnector.CyclopsDockingAnim toPlay) - { - string text; - if (toPlay == CyclopsHatchConnector.CyclopsDockingAnim.CONSTRUCT) - text = "construct_"; - else if (toPlay == CyclopsHatchConnector.CyclopsDockingAnim.DOCKING) - text = ""; - else if (toPlay == CyclopsHatchConnector.CyclopsDockingAnim.DOCKED) - text = "docked_"; - else if (toPlay == CyclopsHatchConnector.CyclopsDockingAnim.UNDOCKING) - text = "undock_"; - else - { - if (toPlay != CyclopsHatchConnector.CyclopsDockingAnim.UNDOCKED) - return; - text = null; - } - go.GetComponent().CrossFadeInFixedTime((text == null) ? "NoAnim" : (text + "armsrotation"), 0.5f); - foreach (object obj in go.transform) - { - Transform transform = (Transform)obj; - if (transform.name == "SmallBaseTube") - transform.GetComponent().CrossFadeInFixedTime((text == null) ? "NoAnim" : (text + "smallbasetube"), 0.5f); - else if (transform.name == "arms") - { - foreach (object obj2 in transform) - { - Transform transform2 = (Transform)obj2; - if (transform2.name == "arm_up" || transform2.name == "arm_down" || transform2.name == "arm_up_bis" || transform2.name == "arm_down_bis") - transform2.GetComponent().CrossFadeInFixedTime((text == null) ? "NoAnim" : (text + transform2.name), 0.5f); - } - } - } - if (toPlay == CyclopsHatchConnector.CyclopsDockingAnim.DOCKED) - StabilizerFixer.RefreshStabilizers(); - } - - public static GameObject InstantiateCyclopsDocking(CyclopsHatchConnector.CyclopsDockingAnim toPlay) - { - if (CyclopsHatchConnector._cyclopsDockingHatch == null) - { - CyclopsHatchConnector._cyclopsDockingHatch = AssetsHelper.Assets.LoadAsset("CyclopsDockingHatchClean"); - CyclopsHatchConnector._normal1 = AssetsHelper.Assets.LoadAsset("submarine_launch_bay_01_02_normal_207"); - CyclopsHatchConnector._illum1 = AssetsHelper.Assets.LoadAsset("submarine_launch_bay_01_02_241_illumb"); - } - GameObject gameObject = Object.Instantiate(CyclopsHatchConnector._cyclopsDockingHatch); - Renderer[] componentsInChildren = gameObject.GetComponentsInChildren(); - Shader shader = Shader.Find("MarmosetUBER"); - if (componentsInChildren != null) - { - foreach (Renderer renderer in componentsInChildren) - { - if (renderer.materials != null) - { - foreach (Material material in renderer.materials) - { - material.shader = shader; - if (material.name.StartsWith("submarine_launch_bay_01_02_101")) - { - material.SetTexture("_BumpMap", CyclopsHatchConnector._normal1); - material.SetTexture("_Illum", CyclopsHatchConnector._illum1); - material.SetFloat("_EmissionLM", 1f); - material.EnableKeyword("MARMO_NORMALMAP"); - material.EnableKeyword("MARMO_EMISSION"); - material.EnableKeyword("_ZWRITE_ON"); - } - } - } - } - } - CyclopsHatchConnector.PlayDockingAnim(gameObject, toPlay); - return gameObject; - } - } + SpriteHandler.RegisterSprite(base.TechType, AssetsHelper.Assets.LoadAsset("CyclopsDockingHatchIconG")); + + this.IsRegistered = true; + } + } + + public override GameObject GetGameObject() + { + if (GameObject == null) + GameObject = new GameObject(ClassID); + GameObject gameObject = Object.Instantiate(GameObject); + gameObject.name = ClassID; + gameObject.AddComponent().ClassId = ClassID; + gameObject.AddComponent().type = TechType; + Constructable constructable = gameObject.AddComponent(); + constructable.allowedInBase = true; + constructable.allowedInSub = true; + constructable.allowedOutside = true; + constructable.allowedOnCeiling = false; + constructable.allowedOnGround = true; + constructable.allowedOnConstructables = true; + constructable.allowedUnderwater = true; + constructable.attachedToBase = true; + constructable.deconstructionAllowed = true; + constructable.rotationEnabled = false; + constructable.model = gameObject; + constructable.techType = TechType; + constructable.surfaceType = VFXSurfaceTypes.metal; + constructable.placeMinDistance = 0.6f; + constructable.enabled = true; + return gameObject; + } + + public static void PlayDockingAnim(GameObject go, CyclopsHatchConnector.CyclopsDockingAnim toPlay) + { + string text; + if (toPlay == CyclopsHatchConnector.CyclopsDockingAnim.CONSTRUCT) + text = "construct_"; + else if (toPlay == CyclopsHatchConnector.CyclopsDockingAnim.DOCKING) + text = ""; + else if (toPlay == CyclopsHatchConnector.CyclopsDockingAnim.DOCKED) + text = "docked_"; + else if (toPlay == CyclopsHatchConnector.CyclopsDockingAnim.UNDOCKING) + text = "undock_"; + else + { + if (toPlay != CyclopsHatchConnector.CyclopsDockingAnim.UNDOCKED) + return; + text = null; + } + go.GetComponent().CrossFadeInFixedTime((text == null) ? "NoAnim" : (text + "armsrotation"), 0.5f); + foreach (object obj in go.transform) + { + Transform transform = (Transform)obj; + if (transform.name == "SmallBaseTube") + transform.GetComponent().CrossFadeInFixedTime((text == null) ? "NoAnim" : (text + "smallbasetube"), 0.5f); + else if (transform.name == "arms") + { + foreach (object obj2 in transform) + { + Transform transform2 = (Transform)obj2; + if (transform2.name == "arm_up" || transform2.name == "arm_down" || transform2.name == "arm_up_bis" || transform2.name == "arm_down_bis") + transform2.GetComponent().CrossFadeInFixedTime((text == null) ? "NoAnim" : (text + transform2.name), 0.5f); + } + } + } + if (toPlay == CyclopsHatchConnector.CyclopsDockingAnim.DOCKED) + StabilizerFixer.RefreshStabilizers(); + } + + public static GameObject InstantiateCyclopsDocking(CyclopsHatchConnector.CyclopsDockingAnim toPlay) + { + if (CyclopsHatchConnector._cyclopsDockingHatch == null) + { + CyclopsHatchConnector._cyclopsDockingHatch = AssetsHelper.Assets.LoadAsset("CyclopsDockingHatchClean"); + CyclopsHatchConnector._normal1 = AssetsHelper.Assets.LoadAsset("submarine_launch_bay_01_02_normal_207"); + CyclopsHatchConnector._illum1 = AssetsHelper.Assets.LoadAsset("submarine_launch_bay_01_02_241_illumb"); + } + GameObject gameObject = Object.Instantiate(CyclopsHatchConnector._cyclopsDockingHatch); + Renderer[] componentsInChildren = gameObject.GetComponentsInChildren(); + Shader shader = Shader.Find("MarmosetUBER"); + if (componentsInChildren != null) + { + foreach (Renderer renderer in componentsInChildren) + { + if (renderer.materials != null) + { + foreach (Material material in renderer.materials) + { + material.shader = shader; + if (material.name.StartsWith("submarine_launch_bay_01_02_101")) + { + material.SetTexture("_BumpMap", CyclopsHatchConnector._normal1); + material.SetTexture("_Illum", CyclopsHatchConnector._illum1); + material.SetFloat("_EmissionLM", 1f); + material.EnableKeyword("MARMO_NORMALMAP"); + material.EnableKeyword("MARMO_EMISSION"); + material.EnableKeyword("_ZWRITE_ON"); + } + } + } + } + } + CyclopsHatchConnector.PlayDockingAnim(gameObject, toPlay); + return gameObject; + } + } } diff --git a/CyclopsDockingMod/Fixers/BuilderFixer.cs b/CyclopsDockingMod/Fixers/BuilderFixer.cs index b5ab8b2..8bc75f8 100644 --- a/CyclopsDockingMod/Fixers/BuilderFixer.cs +++ b/CyclopsDockingMod/Fixers/BuilderFixer.cs @@ -5,7 +5,7 @@ namespace CyclopsDockingMod.Fixers { - public static class BuilderFixer + public static class BuilderFixer { public const string BaseConnectorL = "BaseConnectorLc"; @@ -60,79 +60,79 @@ public static class BuilderFixer private static readonly MethodInfo _CreatePowerPreviewAsync = typeof(Builder).GetMethod("CreatePowerPreviewAsync", BindingFlags.Static | BindingFlags.NonPublic); public static bool CreateGhost_Prefix(ref bool __result) - { - if (BuilderFixer._ghostModel.GetValue(null) != null || !uGUI_BuilderMenuFixer.SelectedDocking) - return true; - BuilderFixer.BaseConnector = true; - GameObject gameObject = (GameObject)BuilderFixer._prefab.GetValue(null); - Constructable component = gameObject.GetComponent(); - ConstructableBase component2 = gameObject.GetComponent(); - BuilderFixer._constructableTechType.SetValue(null, component.techType); - BuilderFixer._placeMinDistance.SetValue(null, component.placeMinDistance); - BuilderFixer._placeMaxDistance.SetValue(null, component.placeMaxDistance); - BuilderFixer._placeDefaultDistance.SetValue(null, component.placeDefaultDistance); - BuilderFixer._allowedSurfaceTypes.SetValue(null, component.allowedSurfaceTypes); - BuilderFixer._forceUpright.SetValue(null, component.forceUpright); - BuilderFixer._allowedInSub.SetValue(null, component.allowedInSub); - BuilderFixer._allowedInBase.SetValue(null, component.allowedInBase); - BuilderFixer._allowedOutside.SetValue(null, component.allowedOutside); - BuilderFixer._allowedOnConstructables.SetValue(null, component.allowedOnConstructables); - BuilderFixer._allowedUnderwater.SetValue(null, component.allowedUnderwater); - BuilderFixer._rotationEnabled.SetValue(null, component.rotationEnabled); - BuilderFixer._rotatableBasePiece.SetValue(null, component2 != null && component2.rotatableBasePiece); - BuilderFixer._alignWithSurface.SetValue(null, component.alignWithSurface); - BuilderFixer._attachedToBase.SetValue(null, component.attachedToBase); - if (component2 != null) - { - GameObject model = UnityEngine.Object.Instantiate(gameObject).GetComponent().model; - uGUI_BuilderMenuFixer.SelectedDocking = false; - GameObject gameObject2 = new GameObject("BaseConnectorLc"); - gameObject2.transform.parent = model.transform; - gameObject2.transform.localPosition = Vector3.zero; - gameObject2.transform.localRotation = Quaternion.identity; - gameObject2.transform.localScale = Vector3.one; - BaseFixer.SetupCyclopsDockingHatchModel(model.transform, CyclopsHatchConnector.CyclopsDockingAnim.NONE); - BuilderFixer._ghostModel.SetValue(null, model); - ((GameObject)BuilderFixer._ghostModel.GetValue(null)).GetComponent().SetupGhost(); - BuilderFixer._ghostModelPosition.SetValue(null, Vector3.zero); - BuilderFixer._ghostModelRotation.SetValue(null, Quaternion.identity); - BuilderFixer._ghostModelScale.SetValue(null, Vector3.one); - BuilderFixer._renderers.SetValue(null, MaterialExtensions.AssignMaterial((GameObject)BuilderFixer._ghostModel.GetValue(null), (Material)BuilderFixer._ghostStructureMaterial.GetValue(null), true)); - BuilderFixer._InitBounds.Invoke(null, new object[] { (GameObject)BuilderFixer._ghostModel.GetValue(null) }); - } - else - { - BuilderFixer._ghostModel.SetValue(null, UnityEngine.Object.Instantiate(component.model)); - ((GameObject)BuilderFixer._ghostModel.GetValue(null)).SetActive(true); - Transform component3 = component.GetComponent(); - Transform component4 = component.model.GetComponent(); - Quaternion quaternion = Quaternion.Inverse(component3.rotation); - BuilderFixer._ghostModelPosition.SetValue(null, quaternion * (component4.position - component3.position)); - BuilderFixer._ghostModelRotation.SetValue(null, quaternion * component4.rotation); - BuilderFixer._ghostModelScale.SetValue(null, component4.lossyScale); - Collider[] componentsInChildren = ((GameObject)BuilderFixer._ghostModel.GetValue(null)).GetComponentsInChildren(); - for (int i = 0; i < componentsInChildren.Length; i++) - UnityEngine.Object.Destroy(componentsInChildren[i]); - BuilderFixer._renderers.SetValue(null, MaterialExtensions.AssignMaterial((GameObject)BuilderFixer._ghostModel.GetValue(null), (Material)BuilderFixer._ghostStructureMaterial.GetValue(null), true)); - string poweredPrefabName = CraftData.GetPoweredPrefabName((TechType)BuilderFixer._constructableTechType.GetValue(null)); - if (!string.IsNullOrEmpty(poweredPrefabName)) - { - CoroutineHost.StartCoroutine((IEnumerator)BuilderFixer._CreatePowerPreviewAsync.Invoke(null, new object[] - { - (GameObject)BuilderFixer._ghostModel.GetValue(null), - poweredPrefabName - })); - } - BuilderFixer._InitBounds.Invoke(null, new object[] { (GameObject)BuilderFixer._prefab.GetValue(null) }); - } - __result = true; - return false; - } - - public static void End_Postfix() - { - if (BuilderFixer.BaseConnector) - BuilderFixer.BaseConnector = false; - } - } + { + if (BuilderFixer._ghostModel.GetValue(null) != null || !uGUI_BuilderMenuFixer.SelectedDocking) + return true; + BuilderFixer.BaseConnector = true; + GameObject gameObject = (GameObject)BuilderFixer._prefab.GetValue(null); + Constructable component = gameObject.GetComponent(); + ConstructableBase component2 = gameObject.GetComponent(); + BuilderFixer._constructableTechType.SetValue(null, component.techType); + BuilderFixer._placeMinDistance.SetValue(null, component.placeMinDistance); + BuilderFixer._placeMaxDistance.SetValue(null, component.placeMaxDistance); + BuilderFixer._placeDefaultDistance.SetValue(null, component.placeDefaultDistance); + BuilderFixer._allowedSurfaceTypes.SetValue(null, component.allowedSurfaceTypes); + BuilderFixer._forceUpright.SetValue(null, component.forceUpright); + BuilderFixer._allowedInSub.SetValue(null, component.allowedInSub); + BuilderFixer._allowedInBase.SetValue(null, component.allowedInBase); + BuilderFixer._allowedOutside.SetValue(null, component.allowedOutside); + BuilderFixer._allowedOnConstructables.SetValue(null, component.allowedOnConstructables); + BuilderFixer._allowedUnderwater.SetValue(null, component.allowedUnderwater); + BuilderFixer._rotationEnabled.SetValue(null, component.rotationEnabled); + BuilderFixer._rotatableBasePiece.SetValue(null, component2 != null && component2.rotatableBasePiece); + BuilderFixer._alignWithSurface.SetValue(null, component.alignWithSurface); + BuilderFixer._attachedToBase.SetValue(null, component.attachedToBase); + if (component2 != null) + { + GameObject model = UnityEngine.Object.Instantiate(gameObject).GetComponent().model; + uGUI_BuilderMenuFixer.SelectedDocking = false; + GameObject gameObject2 = new GameObject("BaseConnectorLc"); + gameObject2.transform.parent = model.transform; + gameObject2.transform.localPosition = Vector3.zero; + gameObject2.transform.localRotation = Quaternion.identity; + gameObject2.transform.localScale = Vector3.one; + BaseFixer.SetupCyclopsDockingHatchModel(model.transform, CyclopsHatchConnector.CyclopsDockingAnim.NONE); + BuilderFixer._ghostModel.SetValue(null, model); + ((GameObject)BuilderFixer._ghostModel.GetValue(null)).GetComponent().SetupGhost(); + BuilderFixer._ghostModelPosition.SetValue(null, Vector3.zero); + BuilderFixer._ghostModelRotation.SetValue(null, Quaternion.identity); + BuilderFixer._ghostModelScale.SetValue(null, Vector3.one); + BuilderFixer._renderers.SetValue(null, MaterialExtensions.AssignMaterial((GameObject)BuilderFixer._ghostModel.GetValue(null), (Material)BuilderFixer._ghostStructureMaterial.GetValue(null), true)); + BuilderFixer._InitBounds.Invoke(null, new object[] { (GameObject)BuilderFixer._ghostModel.GetValue(null) }); + } + else + { + BuilderFixer._ghostModel.SetValue(null, UnityEngine.Object.Instantiate(component.model)); + ((GameObject)BuilderFixer._ghostModel.GetValue(null)).SetActive(true); + Transform component3 = component.GetComponent(); + Transform component4 = component.model.GetComponent(); + Quaternion quaternion = Quaternion.Inverse(component3.rotation); + BuilderFixer._ghostModelPosition.SetValue(null, quaternion * (component4.position - component3.position)); + BuilderFixer._ghostModelRotation.SetValue(null, quaternion * component4.rotation); + BuilderFixer._ghostModelScale.SetValue(null, component4.lossyScale); + Collider[] componentsInChildren = ((GameObject)BuilderFixer._ghostModel.GetValue(null)).GetComponentsInChildren(); + for (int i = 0; i < componentsInChildren.Length; i++) + UnityEngine.Object.Destroy(componentsInChildren[i]); + BuilderFixer._renderers.SetValue(null, MaterialExtensions.AssignMaterial((GameObject)BuilderFixer._ghostModel.GetValue(null), (Material)BuilderFixer._ghostStructureMaterial.GetValue(null), true)); + string poweredPrefabName = TechData.GetPoweredPrefabName((TechType)BuilderFixer._constructableTechType.GetValue(null)); + if (!string.IsNullOrEmpty(poweredPrefabName)) + { + CoroutineHost.StartCoroutine((IEnumerator)BuilderFixer._CreatePowerPreviewAsync.Invoke(null, new object[] + { + (GameObject)BuilderFixer._ghostModel.GetValue(null), + poweredPrefabName + })); + } + BuilderFixer._InitBounds.Invoke(null, new object[] { (GameObject)BuilderFixer._prefab.GetValue(null) }); + } + __result = true; + return false; + } + + public static void End_Postfix() + { + if (BuilderFixer.BaseConnector) + BuilderFixer.BaseConnector = false; + } + } }