public static List <int>[] GetScreenContainTilesAndWalls() { List <int>[] result = { new List <int>(), new List <int>() }; int maxX = Main.screenWidth / tileSize; int maxY = Main.screenHeight / tileSize; Point pos = Main.sceneTilePos.ToTileCoordinates(); List <int> allTiles = TileUtils.GetAllTiles(); List <int> allWalls = WallUtils.GetAllWalls(); for (int x = pos.X; x < pos.X + maxX; x++) { for (int y = pos.Y; y < pos.Y + maxY; y++) { var tile = Main.tile[x, y]; var tileItemType = TileUtils.getKillDropItemType(tile); var wallItemType = WallUtils.getKillDropItemType(tile); if (allTiles.Contains(tileItemType) && !result[0].Contains(tileItemType)) { result[0].Add(tileItemType); } if (allWalls.Contains(wallItemType) && !result[1].Contains(wallItemType)) { result[1].Add(wallItemType); } } } return(result); }
public override void KillWall(int i, int j, int type, ref bool fail) { if (!fail) { fail = WallUtils.isProtected(i, j); } }
internal void UpdateGrid() { if (!updateNeeded) { return; } updateNeeded = false; Clear(); List <int> tiles; List <int> walls; if (btnFilterNear.GetValue <bool>()) { List <int>[] lists = ProtectToolsUtils.GetScreenContainTilesAndWalls(); tiles = lists[0]; walls = lists[1]; } else { tiles = TileUtils.GetAllTiles(); walls = WallUtils.GetAllWalls(); } if (showTiles) { foreach (var itemType in tiles) { Item item = new Item(); item.SetDefaults(itemType); var box = new UITileWallSlot(item); gridRight._items.Add(box); gridRight._innerList.Append(box); panelMain.AddDragTarget(box); } } if (showWalls) { foreach (var itemType in walls) { Item item = new Item(); item.SetDefaults(itemType); var box = new UITileWallSlot(item); gridRight._items.Add(box); gridRight._innerList.Append(box); panelMain.AddDragTarget(box); } } gridRight.UpdateOrder(); gridRight._innerList.Recalculate(); panelMain.caption = caption.Replace("??", $"{gridRight.Count}"); }
public override bool KillSound(int i, int j, int type) { return(!WallUtils.isProtected(i, j)); }
public override bool CreateDust(int i, int j, int type, ref int dustType) { return(!WallUtils.isProtected(i, j)); }