Beispiel #1
0
        // Token: 0x06002BAD RID: 11181 RVA: 0x00104B6C File Offset: 0x00102D6C
        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));
        }