//// /// <summary> /// Indicates if the given position is at a beach/ocean area. /// </summary> /// <param name="worldPos"></param> /// <returns></returns> public static bool IsBeach(Vector2 worldPos) { if (!WorldHelpers.IsOverworld(worldPos)) { return(false); } return(IsBeachRegion(worldPos)); }
//////////////// /// <summary> /// Drops from a given point to the ground. /// </summary> /// <param name="worldPos"></param> /// <param name="invertGravity"></param> /// <param name="ground">Tile pattern checker to define 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, TilePattern ground, out Vector2 groundPos) { int furthestTileY = invertGravity ? 42 : Main.maxTilesY - 42; return(WorldHelpers.DropToGround(worldPos, invertGravity, ground, furthestTileY, out groundPos)); }
//////////////// /// <summary> /// Gets the identifiable region of a given point in the world. /// </summary> /// <param name="worldPos"></param> /// <returns></returns> public static WorldRegionFlags GetRegion(Vector2 worldPos) { WorldRegionFlags where = 0; if (WorldHelpers.IsSky(worldPos)) { where |= WorldRegionFlags.Sky; } else if (WorldHelpers.IsWithinUnderworld(worldPos)) { where |= WorldRegionFlags.Hell; } else if (WorldHelpers.IsAboveWorldSurface(worldPos)) { where |= WorldRegionFlags.Overworld; if (WorldHelpers.BeachEastTileX < (worldPos.Y / 16)) { where |= WorldRegionFlags.OceanEast; } else if (WorldHelpers.BeachWestTileX > (worldPos.Y / 16)) { where |= WorldRegionFlags.OceanWest; } } else { if (WorldHelpers.IsDirtLayer(worldPos)) { where |= WorldRegionFlags.CaveDirt; } else { if (WorldHelpers.IsPreRockLayer(worldPos)) { where |= WorldRegionFlags.CavePreRock; } if (WorldHelpers.IsRockLayer(worldPos)) { where |= WorldRegionFlags.CaveRock; if (WorldHelpers.IsLavaLayer(worldPos)) { where |= WorldRegionFlags.CaveLava; } } } } return(where); }