// 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)); }
// Token: 0x06002BB4 RID: 11188 RVA: 0x00104DDC File Offset: 0x00102FDC 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; } }