//////////////// public bool Check(int tileX, int tileY) { Tile tile = Main.tile[tileX, tileY]; if (this.IsWire != null) { if (TileHelpers.IsWire(tile) != this.IsWire) { return(false); } } if (this.IsSolid != null) { if (TileHelpers.IsSolid(tile, this.IsPlatformSolid, this.IsActuatedSolid) != this.IsSolid) { return(false); } } if (this.HasWall != null) { if ((tile.wall > 0) != this.HasWall) { return(false); } } if (this.HasLava != null) { if (tile.lava() != this.HasLava) { return(false); } } if (this.HasHoney != null) { if (tile.honey() != this.HasHoney) { return(false); } } if (this.HasWater != null) { if (tile.liquid > 0 != this.HasWater) { return(false); } } return(true); }
public static bool FindNearbyRandomAirTile(int tileX, int tileY, int radius, out int toX, out int toY) { Tile tile = null; int wtf = 0; bool isBlocked = false; toX = 0; toY = 0; if (tileX + radius <= 0 || tileX - radius >= Main.mapMaxX) { return(false); } if (tileY + radius <= 0 || tileY - radius >= Main.mapMaxY) { return(false); } do { do { toX = Main.rand.Next(-radius, radius) + tileX; }while(toX <= 0 || toX >= Main.mapMaxX); do { toY = Main.rand.Next(-radius, radius) + tileY; }while(toY <= 0 || toY >= Main.mapMaxY); //tile = Main.tile[toX, toY]; tile = Framing.GetTileSafely(toX, toY); if (wtf++ > 100) { return(false); } bool _; isBlocked = TileHelpers.IsSolid(tile, true, true) || TileWallHelpers.IsDungeon(tile, out _) || TileHelpers.IsWire(tile) || tile.lava(); } while(isBlocked && ((tile != null && tile.type != 0) || Lighting.Brightness(toX, toX) == 0)); return(true); }