/// <summary> /// Requests all tile chunks (200x150 tile 'sections') from the server within a given tile range. /// </summary> /// <param name="tileRange"></param> /// <param name="leftPadding">In chunks.</param> /// <param name="topPadding">In chunks.</param> /// <param name="rightPadding">In chunks.</param> /// <param name="bottomPadding">In chunks.</param> public static void RequestChunksFromServer( Rectangle tileRange, int leftPadding = 0, int topPadding = 0, int rightPadding = 0, int bottomPadding = 0) { int sectX = 200; int sectY = 150; int minX = Math.Max((tileRange.X / sectX) - leftPadding, 0); minX *= sectX; int minY = Math.Max((tileRange.Y / sectY) - topPadding, 0); minY *= sectY; int maxX = tileRange.X + tileRange.Width; maxX += rightPadding * sectX; maxX = Math.Min(maxX, Main.maxTilesX - 1); int maxY = tileRange.Y + tileRange.Height; maxY += bottomPadding * sectY; maxY = Math.Min(maxY, Main.maxTilesY - 1); for (int x = minX; x < maxX; x += sectX) { for (int y = minY; y < maxY; y += sectY) { TileWorldLibraries.RequestChunkFromServer(Netplay.GetSectionX(x), Netplay.GetSectionY(y)); } } }
//////////////// /// <summary> /// Drops from a given point to the ground. /// </summary> /// <param name="worldPos"></param> /// <param name="invertGravity"></param> /// <param name="isGround">Defines what "ground" is.</param> /// <param name="groundPos"></param> /// <returns>`true` if a ground point was found within world boundaries.</returns> public static bool DropToGround(Vector2 worldPos, bool invertGravity, IsGround isGround, out Vector2 groundPos) { int furthestTileY = invertGravity ? 42 : Main.maxTilesY - 42; return(TileWorldLibraries.DropToGround(worldPos, invertGravity, isGround, furthestTileY, out groundPos)); }