예제 #1
0
        // 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));
        }