// Token: 0x06003115 RID: 12565 RVA: 0x0012E290 File Offset: 0x0012C490
        private static void SetDefaultPlaceTransform(ref Vector3 position, ref Quaternion rotation)
        {
            Transform aimTransform = MultiplayerBuilder.GetAimTransform();

            position = aimTransform.position + aimTransform.forward * MultiplayerBuilder.placeDefaultDistance;
            Vector3 forward;
            Vector3 up;

            if (MultiplayerBuilder.forceUpright)
            {
                forward   = -aimTransform.forward;
                forward.y = 0f;
                forward.Normalize();
                up = Vector3.up;
            }
            else
            {
                forward = -aimTransform.forward;
                up      = aimTransform.up;
            }
            rotation = Quaternion.LookRotation(forward, up);
            if (MultiplayerBuilder.rotationEnabled)
            {
                rotation = Quaternion.AngleAxis(MultiplayerBuilder.additiveRotation, up) * rotation;
            }
        }
        // Token: 0x06003113 RID: 12563 RVA: 0x0012E260 File Offset: 0x0012C460
        private static bool CheckDistance(Vector3 worldPosition, float minDistance)
        {
            Transform aimTransform = MultiplayerBuilder.GetAimTransform();
            float     magnitude    = (worldPosition - aimTransform.position).magnitude;

            return(magnitude >= minDistance);
        }
        // Token: 0x060030FE RID: 12542 RVA: 0x0012D6FC File Offset: 0x0012B8FC
        private static bool UpdateAllowed()
        {
            MultiplayerBuilder.SetDefaultPlaceTransform(ref MultiplayerBuilder.placePosition, ref MultiplayerBuilder.placeRotation);
            bool flag = false;
            ConstructableBase componentInParent = MultiplayerBuilder.ghostModel.GetComponentInParent <ConstructableBase>();
            bool flag2;

            if (componentInParent != null)
            {
                Transform transform = componentInParent.transform;
                transform.position = MultiplayerBuilder.placePosition;
                transform.rotation = MultiplayerBuilder.placeRotation;
                flag2 = componentInParent.UpdateGhostModel(MultiplayerBuilder.GetAimTransform(), MultiplayerBuilder.ghostModel, default(RaycastHit), out flag);
                MultiplayerBuilder.placePosition = transform.position;
                MultiplayerBuilder.placeRotation = transform.rotation;
                if (flag)
                {
                    MultiplayerBuilder.renderers = MaterialExtensions.AssignMaterial(MultiplayerBuilder.ghostModel, MultiplayerBuilder.ghostStructureMaterial);
                    MultiplayerBuilder.InitBounds(MultiplayerBuilder.ghostModel);
                }
            }
            else
            {
                flag2 = MultiplayerBuilder.CheckAsSubModule();
            }
            if (flag2)
            {
                List <GameObject> list = new List <GameObject>();
                MultiplayerBuilder.GetObstacles(MultiplayerBuilder.placePosition, MultiplayerBuilder.placeRotation, MultiplayerBuilder.bounds, list);
                flag2 = (list.Count == 0);
                list.Clear();
            }
            return(flag2);
        }
        // Token: 0x06003116 RID: 12566 RVA: 0x0012E340 File Offset: 0x0012C540
        private static void SetPlaceOnSurface(RaycastHit hit, ref Vector3 position, ref Quaternion rotation)
        {
            Transform aimTransform = MultiplayerBuilder.GetAimTransform();
            Vector3   vector       = Vector3.forward;
            Vector3   vector2      = Vector3.up;

            if (MultiplayerBuilder.forceUpright)
            {
                vector   = -aimTransform.forward;
                vector.y = 0f;
                vector.Normalize();
                vector2 = Vector3.up;
            }
            else
            {
                SurfaceType surfaceType = MultiplayerBuilder.GetSurfaceType(hit.normal);
                if (surfaceType != SurfaceType.Wall)
                {
                    if (surfaceType != SurfaceType.Ceiling)
                    {
                        if (surfaceType == SurfaceType.Ground)
                        {
                            vector2   = hit.normal;
                            vector    = -aimTransform.forward;
                            vector.y -= Vector3.Dot(vector, vector2);
                            vector.Normalize();
                        }
                    }
                    else
                    {
                        vector     = hit.normal;
                        vector2    = -aimTransform.forward;
                        vector2.y -= Vector3.Dot(vector2, vector);
                        vector2.Normalize();
                    }
                }
                else
                {
                    vector  = hit.normal;
                    vector2 = Vector3.up;
                }
            }
            position = hit.point;
            rotation = Quaternion.LookRotation(vector, vector2);
            if (MultiplayerBuilder.rotationEnabled)
            {
                rotation = Quaternion.AngleAxis(MultiplayerBuilder.additiveRotation, vector2) * rotation;
            }
        }
        // Token: 0x0600310F RID: 12559 RVA: 0x0012E0D0 File Offset: 0x0012C2D0
        private static bool CheckAsSubModule()
        {
            if (!Constructable.CheckFlags(MultiplayerBuilder.allowedInBase, MultiplayerBuilder.allowedInSub, MultiplayerBuilder.allowedOutside))
            {
                return(false);
            }
            Transform aimTransform = MultiplayerBuilder.GetAimTransform();

            MultiplayerBuilder.placementTarget = null;
            RaycastHit hit;

            if (!Physics.Raycast(aimTransform.position, aimTransform.forward, out hit, MultiplayerBuilder.placeMaxDistance, MultiplayerBuilder.placeLayerMask.value, QueryTriggerInteraction.Ignore))
            {
                return(false);
            }
            MultiplayerBuilder.placementTarget = hit.collider.gameObject;
            MultiplayerBuilder.SetPlaceOnSurface(hit, ref MultiplayerBuilder.placePosition, ref MultiplayerBuilder.placeRotation);
            if (!MultiplayerBuilder.CheckTag(hit.collider))
            {
                return(false);
            }
            if (!MultiplayerBuilder.CheckSurfaceType(MultiplayerBuilder.GetSurfaceType(hit.normal)))
            {
                return(false);
            }
            if (!MultiplayerBuilder.CheckDistance(hit.point, MultiplayerBuilder.placeMinDistance))
            {
                return(false);
            }
            if (!MultiplayerBuilder.allowedOnConstructables && MultiplayerBuilder.HasComponent <Constructable>(hit.collider.gameObject))
            {
                return(false);
            }
            if (!Player.main.IsInSub())
            {
                GameObject entityRoot = UWE.Utils.GetEntityRoot(MultiplayerBuilder.placementTarget);
                if (!entityRoot)
                {
                    entityRoot = MultiplayerBuilder.placementTarget;
                }
                if (!MultiplayerBuilder.ValidateOutdoor(entityRoot))
                {
                    return(false);
                }
            }
            return(MultiplayerBuilder.CheckSpace(MultiplayerBuilder.placePosition, MultiplayerBuilder.placeRotation, MultiplayerBuilder.bounds, MultiplayerBuilder.placeLayerMask.value, hit.collider));
        }