// Token: 0x060030FD RID: 12541 RVA: 0x0012D4C0 File Offset: 0x0012B6C0 private static bool CreateGhost() { if (MultiplayerBuilder.ghostModel != null) { return(false); } Constructable component = MultiplayerBuilder.prefab.GetComponent <Constructable>(); MultiplayerBuilder.constructableTechType = component.techType; MultiplayerBuilder.placeMinDistance = component.placeMinDistance; MultiplayerBuilder.placeMaxDistance = component.placeMaxDistance; MultiplayerBuilder.placeDefaultDistance = component.placeDefaultDistance; MultiplayerBuilder.allowedSurfaceTypes = component.allowedSurfaceTypes; MultiplayerBuilder.forceUpright = component.forceUpright; MultiplayerBuilder.allowedInSub = component.allowedInSub; MultiplayerBuilder.allowedInBase = component.allowedInBase; MultiplayerBuilder.allowedOutside = component.allowedOutside; MultiplayerBuilder.allowedOnConstructables = component.allowedOnConstructables; MultiplayerBuilder.rotationEnabled = component.rotationEnabled; ConstructableBase component2 = MultiplayerBuilder.prefab.GetComponent <ConstructableBase>(); if (component2 != null) { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(MultiplayerBuilder.prefab); component2 = gameObject.GetComponent <ConstructableBase>(); MultiplayerBuilder.ghostModel = component2.model; BaseGhost component3 = MultiplayerBuilder.ghostModel.GetComponent <BaseGhost>(); component3.SetupGhost(); MultiplayerBuilder.ghostModelPosition = Vector3.zero; MultiplayerBuilder.ghostModelRotation = Quaternion.identity; MultiplayerBuilder.ghostModelScale = Vector3.one; MultiplayerBuilder.renderers = MaterialExtensions.AssignMaterial(MultiplayerBuilder.ghostModel, MultiplayerBuilder.ghostStructureMaterial); MaterialExtensions.SetLocalScale(MultiplayerBuilder.renderers); MultiplayerBuilder.InitBounds(MultiplayerBuilder.ghostModel); } else { MultiplayerBuilder.ghostModel = UnityEngine.Object.Instantiate <GameObject>(component.model); MultiplayerBuilder.ghostModel.SetActive(true); Transform component4 = component.GetComponent <Transform>(); Transform component5 = component.model.GetComponent <Transform>(); Quaternion quaternion = Quaternion.Inverse(component4.rotation); MultiplayerBuilder.ghostModelPosition = quaternion * (component5.position - component4.position); MultiplayerBuilder.ghostModelRotation = quaternion * component5.rotation; MultiplayerBuilder.ghostModelScale = component5.lossyScale; Collider[] componentsInChildren = MultiplayerBuilder.ghostModel.GetComponentsInChildren <Collider>(); for (int i = 0; i < componentsInChildren.Length; i++) { UnityEngine.Object.Destroy(componentsInChildren[i]); } MultiplayerBuilder.renderers = MaterialExtensions.AssignMaterial(MultiplayerBuilder.ghostModel, MultiplayerBuilder.ghostStructureMaterial); MaterialExtensions.SetLocalScale(MultiplayerBuilder.renderers); MultiplayerBuilder.SetupRenderers(MultiplayerBuilder.ghostModel, Player.main.IsInSub()); MultiplayerBuilder.CreatePowerPreview(MultiplayerBuilder.constructableTechType, MultiplayerBuilder.ghostModel); MultiplayerBuilder.InitBounds(MultiplayerBuilder.prefab); } return(true); }