Exemple #1
0
        public override void mine(World world, int x, int y, int data, ItemPick pick, World.TileDepth tileDepth)
        {
            int k = 1;

            int  ii = 0;
            int  jj = 0;
            bool kk = false;

            for (int i = 0; i < size.X; i++)
            {
                for (int j = size.Y - 1; j >= 0; j--)
                {
                    if (k == data || k == -data)
                    {
                        ii = i;
                        jj = j;
                        kk = true;
                        break;
                    }
                    k++;
                }
                if (kk)
                {
                    break;
                }
            }

            for (int i = 0; i < size.X; i++)
            {
                for (int j = size.Y - 1; j >= 0; j--)
                {
                    world.setTileWithUpdate(x + i - ii, y + j - jj, Tile.TileAir.index, tileDepth);
                }
            }
        }
Exemple #2
0
 public override void mine(World world, int x, int y, int data, ItemPick pick, World.TileDepth tileDepth)
 {
     if (world.isTileSolid(x, y + 1, tileDepth)) {
         if (world.getTileIndex(x + 1, y, tileDepth) == index) {
             world.mineTile(x + 1, y, pick, tileDepth);
         }
         if (world.getTileIndex(x - 1, y, tileDepth) == index) {
             world.mineTile(x - 1, y, pick, tileDepth);
         }
     }
 }
Exemple #3
0
 public override void mine(World world, int x, int y, int data, ItemPick pick, World.TileDepth tileDepth)
 {
     if (world.isTileSolid(x, y + 1, tileDepth))
     {
         if (world.getTileIndex(x + 1, y, tileDepth) == index)
         {
             world.mineTile(x + 1, y, pick, tileDepth);
         }
         if (world.getTileIndex(x - 1, y, tileDepth) == index)
         {
             world.mineTile(x - 1, y, pick, tileDepth);
         }
     }
 }
Exemple #4
0
        public bool mineTileNoNearUpdate(int x, int y, ItemPick pick, World.TileDepth tileDepth)
        {
            Tile tile = getTileObject(x, y, tileDepth);
            int  data = getTileDataNoCheck(x, y, tileDepth);

            if (setTile(x, y, Tile.TileAir.index, tileDepth))
            {
                Entity e = new EntityItem(new Vector2((x) * World.tileSizeInPixels, (y) * World.tileSizeInPixels), tile.dropStack(this, pick, Game.rand, x, y, tileDepth));
                tile.mine(this, x, y, data, pick, tileDepth);
                EntityAddingList.Add(e);
                return(true);
            }
            return(false);
        }
Exemple #5
0
 public bool mineTile(int x, int y, ItemPick pick, World.TileDepth tileDepth)
 {
     if (!getTileObject(x, y, tileDepth).canBeDestroyed(this, x, y, tileDepth))
     {
         return(false);
     }
     if (mineTileNoNearUpdate(x, y, pick, tileDepth))
     {
         setTileForUpdate(x - 1, y, tileDepth);
         setTileForUpdate(x + 1, y, tileDepth);
         setTileForUpdate(x, y - 1, tileDepth);
         setTileForUpdate(x, y + 1, tileDepth);
         return(true);
     }
     return(false);
 }
Exemple #6
0
        public string getDisplayName(bool extended)
        {
            string s = item.getDisplayName(count, data);

            if (extended)
            {
                s += "\n  Reach: " + (item.reach / World.tileSizeInPixels);
                if (item is ItemTile)
                {
                    s += "\n  Placeable";
                    Tile tile = Tile.getTileObject(data);
                    if (tile is TileDoor)
                    {
                        s += "\n  Size: 1x3";
                    }
                    else if (tile is TileFurniture)
                    {
                        TileFurniture furniture = (TileFurniture)tile;
                        s += "\n  Size: " + furniture.size.X + "x" + furniture.size.Y;
                    }
                }
                else if (item is ItemPick)
                {
                    ItemPick pick = (ItemPick)item;
                    int      p;
                    p = pick.getPower(Tile.Material.stone); if (p > 0)
                    {
                        s += "\n  Rock Power: " + Math.Ceiling(((p / 256.0) * 100)) + "%";
                    }
                    p = pick.getPower(Tile.Material.dirt); if (p > 0)
                    {
                        s += "\n  Soil Power: " + Math.Ceiling(((p / 256.0) * 100)) + "%";
                    }
                    p = pick.getPower(Tile.Material.wood); if (p > 0)
                    {
                        s += "\n  Wood Power: " + Math.Ceiling(((p / 256.0) * 100)) + "%";
                    }
                    s += "\n  Speed: " + Math.Max((20 - pick.getDelay()) * 5, 1) + "%";
                }
            }
            return(s);
        }
Exemple #7
0
 public override void mine(World world, int x, int y, int data, ItemPick pick, World.TileDepth tileDepth)
 {
     if (world.getTileDataNoCheck(x, y, tileDepth) != 0)
     {
     }
     else
     {
         if (world.getTileIndex(x, y - 1, tileDepth) == index && world.getTileIndex(x, y + 1, tileDepth) == index)
         {
             world.setTileWithUpdate(x, y - 1, Tile.TileAir.index, tileDepth);
             world.setTileWithUpdate(x, y + 1, Tile.TileAir.index, tileDepth);
         }
         else if (world.getTileIndex(x, y - 1, tileDepth) == index && world.getTileIndex(x, y - 2, tileDepth) == index)
         {
             world.setTileWithUpdate(x, y - 1, Tile.TileAir.index, tileDepth);
             world.setTileWithUpdate(x, y - 2, Tile.TileAir.index, tileDepth);
         }
         else if (world.getTileIndex(x, y + 1, tileDepth) == index && world.getTileIndex(x, y + 2, tileDepth) == index)
         {
             world.setTileWithUpdate(x, y + 1, Tile.TileAir.index, tileDepth);
             world.setTileWithUpdate(x, y + 2, Tile.TileAir.index, tileDepth);
         }
     }
 }
Exemple #8
0
        /*public override TextureInfo getTextureInfo(int x, int y, World world, World.TileDepth tileDepth) {

            int leftIndex = world.getTileObject(x - 1, y, tileDepth).index;
            int rightIndex = world.getTileObject(x + 1, y, tileDepth).index;
            int downIndex = world.getTileObject(x, y + 1, tileDepth).index;
            int upIndex = world.getTileObject(x, y - 1, tileDepth).index;

            bool left = leftIndex == index;// || leftIndex == tree;
            bool right = rightIndex == index;// || rightIndex == tree;
            bool down = downIndex == index;// || downIndex == tree;
            bool up = upIndex == index;// || upIndex == tree;

            bool leftSolid = world.isTileSolid(x - 1, y, tileDepth);
            bool rightSolid = world.isTileSolid(x + 1, y, tileDepth);
            bool downSolid = world.isTileSolid(x, y + 1, tileDepth);
            bool upSolid = world.isTileSolid(x, y - 1, tileDepth);

            Rectangle r;
            bool t = transparent;
            if (left) {
                if (right) {
                    if (up) {
                        if (down) {
                            r = get8(1, 1);
                        } else {
                            r = get8(1, 2);
                            t = true;
                        }
                    } else {
                        if (down) {
                            r = get8(1, 0);
                            t = true;
                        } else {
                            r = get8(1, 3);
                            t = true;
                        }
                    }
                } else {
                    if (up) {
                        if (down) {
                            r = get8(2, 1);
                            t = true;
                        } else {
                            r = get8(2, 2);
                            t = true;
                        }
                    } else {
                        if (down) {
                            r = get8(2, 0);
                            t = true;
                        } else {
                            r = get8(2, 3);
                            t = true;
                        }
                    }
                }
            } else {
                if (right) {
                    if (up) {
                        if (down) {
                            r = get8(0, 1);
                            t = true;
                        } else {
                            r = get8(0, 2);
                            t = true;
                        }
                    } else {
                        if (down) {
                            r = get8(0, 0);
                            t = true;
                        } else {
                            r = get8(0, 3);
                            t = true;
                        }
                    }
                } else {
                    if (up) {
                        if (down) {
                            r = get8(3, 1);
                            t = true;
                        } else {
                            r = get8(3, 2);
                            t = true;
                        }
                    } else {
                        if (down) {
                            r = get8(3, 0);
                            t = true;
                        } else {
                            r = get8(3, 3);
                            t = true;
                        }
                    }
                }
            }
            return new TextureInfo(r, t);
        }*/
        public override void mine(World world, int x, int y, int data, ItemPick pick, World.TileDepth tileDepth)
        {
        }
Exemple #9
0
 public override ItemStack dropStack(World world, ItemPick itemPick, Random rand, int x, int y, World.TileDepth tileDepth)
 {
     return(new ItemStack(Item.itemTile, 1, index));
 }
Exemple #10
0
 public bool mineTileNoNearUpdate(int x, int y, ItemPick pick, World.TileDepth tileDepth)
 {
     Tile tile = getTileObject(x, y, tileDepth);
     int data = getTileDataNoCheck(x, y, tileDepth);
     if (setTile(x, y, Tile.TileAir.index, tileDepth)) {
         Entity e = new EntityItem(new Vector2((x) * World.tileSizeInPixels, (y) * World.tileSizeInPixels), tile.dropStack(this, pick, Game.rand, x, y, tileDepth));
         tile.mine(this, x, y, data, pick, tileDepth);
         EntityAddingList.Add(e);
         return true;
     }
     return false;
 }
Exemple #11
0
 public bool mineTile(int x, int y, ItemPick pick, World.TileDepth tileDepth)
 {
     if (!getTileObject(x, y, tileDepth).canBeDestroyed(this, x, y, tileDepth)) {
         return false;
     }
     if (mineTileNoNearUpdate(x, y, pick, tileDepth)) {
         setTileForUpdate(x - 1, y, tileDepth);
         setTileForUpdate(x + 1, y, tileDepth);
         setTileForUpdate(x, y - 1, tileDepth);
         setTileForUpdate(x, y + 1, tileDepth);
         return true;
     }
     return false;
 }
Exemple #12
0
 public override ItemStack dropStack(World world, ItemPick itemPick, Random rand, int x, int y, World.TileDepth tileDepth)
 {
     return drop?new ItemStack(this, 1):new ItemStack(Item.itemEmpty);
 }
Exemple #13
0
 public override ItemStack dropStack(World world, ItemPick itemPick, Random rand, int x, int y, World.TileDepth tileDepth)
 {
     return rand.Next(8) == 0 ? new ItemStack(Item.itemTile, 1, Tile.TileSapling.index) : new ItemStack(Item.itemEmpty);
 }
Exemple #14
0
 public virtual void mine(World world, int x, int y, int data, ItemPick pick, World.TileDepth tileDepth)
 {
 }
Exemple #15
0
        public override void mine(World world, int x, int y, int data, ItemPick pick, World.TileDepth tileDepth)
        {
            int k = 1;

            int ii = 0;
            int jj = 0;
            bool kk = false;

            for (int i = 0; i < size.X; i++) {
                for (int j = size.Y-1; j >=0 ; j--) {
                    if (k == data || k == -data) {
                        ii = i;
                        jj = j;
                        kk = true;
                        break;
                    }
                    k++;
                }
                if (kk) {
                    break;
                }
            }

            for (int i = 0; i < size.X; i++) {
                for (int j = size.Y - 1; j >= 0; j--) {
                    world.setTileWithUpdate(x + i - ii, y + j - jj, Tile.TileAir.index, tileDepth);
                }
            }
        }
Exemple #16
0
 public override ItemStack dropStack(World world, ItemPick itemPick, Random rand, int x, int y, World.TileDepth tileDepth)
 {
     return(rand.Next(2) == 0?new ItemStack(Item.itemTile, 1, Tile.TileWood.index):new ItemStack(Item.itemEmpty));
 }
Exemple #17
0
 public override ItemStack dropStack(World world, ItemPick itemPick, Random rand, int x, int y, World.TileDepth tileDepth)
 {
     return(drop?new ItemStack(this, 1):new ItemStack(Item.itemEmpty));
 }
Exemple #18
0
        public override void mine(World world, int x, int y, int data, ItemPick pick, World.TileDepth tileDepth)
        {
            if (world.getTileDataNoCheck(x, y, tileDepth)!=0) {

            }else{
                if (world.getTileIndex(x, y - 1, tileDepth) == index && world.getTileIndex(x, y + 1, tileDepth) == index) {
                    world.setTileWithUpdate(x, y - 1, Tile.TileAir.index, tileDepth);
                    world.setTileWithUpdate(x, y + 1, Tile.TileAir.index, tileDepth);
                }else if (world.getTileIndex(x, y - 1, tileDepth) == index && world.getTileIndex(x, y - 2, tileDepth) == index) {
                    world.setTileWithUpdate(x, y - 1, Tile.TileAir.index, tileDepth);
                    world.setTileWithUpdate(x, y - 2, Tile.TileAir.index, tileDepth);
                }else if (world.getTileIndex(x, y + 1, tileDepth) == index && world.getTileIndex(x, y + 2, tileDepth) == index) {
                    world.setTileWithUpdate(x, y + 1, Tile.TileAir.index, tileDepth);
                    world.setTileWithUpdate(x, y + 2, Tile.TileAir.index, tileDepth);
                }
            }
        }
Exemple #19
0
 public virtual void mine(World world, int x, int y, int data, ItemPick pick, World.TileDepth tileDepth)
 {
 }
Exemple #20
0
 public override ItemStack dropStack(World world, ItemPick itemPick, Random rand, int x, int y, World.TileDepth tileDepth)
 {
     return new ItemStack(Item.itemTile, 1, index);
 }
Exemple #21
0
        /*public override TextureInfo getTextureInfo(int x, int y, World world, World.TileDepth tileDepth) {
         *
         *  int leftIndex = world.getTileObject(x - 1, y, tileDepth).index;
         *  int rightIndex = world.getTileObject(x + 1, y, tileDepth).index;
         *  int downIndex = world.getTileObject(x, y + 1, tileDepth).index;
         *  int upIndex = world.getTileObject(x, y - 1, tileDepth).index;
         *
         *  bool left = leftIndex == index;// || leftIndex == tree;
         *  bool right = rightIndex == index;// || rightIndex == tree;
         *  bool down = downIndex == index;// || downIndex == tree;
         *  bool up = upIndex == index;// || upIndex == tree;
         *
         *  bool leftSolid = world.isTileSolid(x - 1, y, tileDepth);
         *  bool rightSolid = world.isTileSolid(x + 1, y, tileDepth);
         *  bool downSolid = world.isTileSolid(x, y + 1, tileDepth);
         *  bool upSolid = world.isTileSolid(x, y - 1, tileDepth);
         *
         *  Rectangle r;
         *  bool t = transparent;
         *  if (left) {
         *      if (right) {
         *          if (up) {
         *              if (down) {
         *                  r = get8(1, 1);
         *              } else {
         *                  r = get8(1, 2);
         *                  t = true;
         *              }
         *          } else {
         *              if (down) {
         *                  r = get8(1, 0);
         *                  t = true;
         *              } else {
         *                  r = get8(1, 3);
         *                  t = true;
         *              }
         *          }
         *      } else {
         *          if (up) {
         *              if (down) {
         *                  r = get8(2, 1);
         *                  t = true;
         *              } else {
         *                  r = get8(2, 2);
         *                  t = true;
         *              }
         *          } else {
         *              if (down) {
         *                  r = get8(2, 0);
         *                  t = true;
         *              } else {
         *                  r = get8(2, 3);
         *                  t = true;
         *              }
         *          }
         *      }
         *  } else {
         *      if (right) {
         *          if (up) {
         *              if (down) {
         *                  r = get8(0, 1);
         *                  t = true;
         *              } else {
         *                  r = get8(0, 2);
         *                  t = true;
         *              }
         *          } else {
         *              if (down) {
         *                  r = get8(0, 0);
         *                  t = true;
         *              } else {
         *                  r = get8(0, 3);
         *                  t = true;
         *              }
         *          }
         *      } else {
         *          if (up) {
         *              if (down) {
         *                  r = get8(3, 1);
         *                  t = true;
         *              } else {
         *                  r = get8(3, 2);
         *                  t = true;
         *              }
         *          } else {
         *              if (down) {
         *                  r = get8(3, 0);
         *                  t = true;
         *              } else {
         *                  r = get8(3, 3);
         *                  t = true;
         *              }
         *          }
         *      }
         *  }
         *  return new TextureInfo(r, t);
         * }*/

        public override void mine(World world, int x, int y, int data, ItemPick pick, World.TileDepth tileDepth)
        {
        }