DEADSOFTWARE

Add tools
authorfredboy <fredboy@protonmail.com>
Sun, 21 Apr 2024 20:28:17 +0000 (03:28 +0700)
committerfredboy <fredboy@protonmail.com>
Sun, 21 Apr 2024 20:28:17 +0000 (03:28 +0700)
26 files changed:
android/assets/json/game_items.json
android/assets/textures/items/diamond_axe.png [new file with mode: 0644]
android/assets/textures/items/diamond_hoe.png [new file with mode: 0644]
android/assets/textures/items/diamond_pickaxe.png [new file with mode: 0644]
android/assets/textures/items/gold_axe.png [new file with mode: 0644]
android/assets/textures/items/gold_hoe.png [new file with mode: 0644]
android/assets/textures/items/gold_pickaxe.png [new file with mode: 0644]
android/assets/textures/items/iron_axe.png [new file with mode: 0644]
android/assets/textures/items/iron_hoe.png [new file with mode: 0644]
android/assets/textures/items/iron_pickaxe.png [new file with mode: 0644]
android/assets/textures/items/shears.png [new file with mode: 0644]
android/assets/textures/items/stone_axe.png [new file with mode: 0644]
android/assets/textures/items/stone_hoe.png [new file with mode: 0644]
android/assets/textures/items/stone_pickaxe.png [new file with mode: 0644]
android/assets/textures/items/wood_axe.png [new file with mode: 0644]
android/assets/textures/items/wood_hoe.png [new file with mode: 0644]
android/assets/textures/items/wood_pickaxe.png [new file with mode: 0644]
core/src/ru/deadsoftware/cavedroid/game/mobs/Player.java
core/src/ru/deadsoftware/cavedroid/game/model/block/CommonBlockParams.kt
core/src/ru/deadsoftware/cavedroid/game/model/dto/BlockDto.kt
core/src/ru/deadsoftware/cavedroid/game/model/dto/ItemDto.kt
core/src/ru/deadsoftware/cavedroid/game/model/item/CommonItemParams.kt
core/src/ru/deadsoftware/cavedroid/game/model/item/Item.kt
core/src/ru/deadsoftware/cavedroid/game/model/mapper/BlockMapper.kt
core/src/ru/deadsoftware/cavedroid/game/model/mapper/ItemMapper.kt
core/src/ru/deadsoftware/cavedroid/game/render/BlocksRenderer.kt

index 25b8db339112adec06b1c9bb97ed9bdd3c0b4a96..47636290ece1d3ead25ea3fbecd12054c739134e 100644 (file)
@@ -1,7 +1,6 @@
 {
   "blocks": {
     "none": {
-      "id": 0,
       "collision": false,
       "transparent": true,
       "drop": "none",
@@ -9,50 +8,53 @@
       "meta": "none"
     },
     "stone": {
-      "id": 1,
       "hp": 450,
       "drop": "cobblestone",
-      "texture": "stone"
+      "texture": "stone",
+      "tool_level": 1,
+      "tool_type": "pickaxe"
     },
     "grass": {
-      "id": 2,
       "hp": 54,
       "drop": "dirt",
-      "texture": "grass"
+      "texture": "grass",
+      "tool_level": 0,
+      "tool_type": "shovel"
     },
     "dirt": {
-      "id": 3,
       "hp": 45,
       "drop": "dirt",
-      "texture": "dirt"
+      "texture": "dirt",
+      "tool_level": 0,
+      "tool_type": "shovel"
     },
     "cobblestone": {
-      "id": 4,
       "hp": 600,
       "drop": "cobblestone",
-      "texture": "cobblestone"
+      "texture": "cobblestone",
+      "tool_level": 1,
+      "tool_type": "pickaxe"
     },
     "planks_oak": {
-      "id": 5,
       "hp": 180,
       "drop": "planks_oak",
-      "texture": "planks_oak"
+      "texture": "planks_oak",
+      "tool_level": 0,
+      "tool_type": "axe"
     },
     "sapling_oak": {
-      "id": 6,
       "collision": false,
       "transparent": true,
       "block_required": true,
       "drop": "sapling_oak",
-      "texture": "sapling_oak"
+      "texture": "sapling_oak",
+      "hp": 1
     },
     "bedrock": {
-      "id": 7,
       "drop": "bedrock",
       "texture": "bedrock"
     },
     "water": {
-      "id": 8,
       "collision": false,
       "transparent": true,
       "drop": "water",
@@ -63,7 +65,6 @@
       "state": 0
     },
     "lava": {
-      "id": 9,
       "collision": false,
       "drop": "lava",
       "meta": "lava",
       "state": 0
     },
     "sand": {
-      "id": 10,
       "hp": 45,
       "drop": "sand",
-      "texture": "sand"
+      "texture": "sand",
+      "tool_level": 0,
+      "tool_type": "shovel"
     },
     "gravel": {
-      "id": 11,
       "hp": 54,
       "drop": "gravel",
-      "texture": "gravel"
+      "texture": "gravel",
+      "tool_level": 0,
+      "tool_type": "shovel"
     },
     "gold_ore": {
-      "id": 12,
       "hp": 900,
       "drop": "gold_ore",
-      "texture": "gold_ore"
+      "texture": "gold_ore",
+      "tool_level": 3,
+      "tool_type": "pickaxe"
     },
     "iron_ore": {
-      "id": 13,
       "hp": 900,
       "drop": "iron_ore",
-      "texture": "iron_ore"
+      "texture": "iron_ore",
+      "tool_level": 2,
+      "tool_type": "pickaxe"
     },
     "coal_ore": {
-      "id": 14,
       "hp": 900,
       "drop": "coal",
-      "texture": "coal_ore"
+      "texture": "coal_ore",
+      "tool_level": 1,
+      "tool_type": "pickaxe"
     },
     "log_oak": {
-      "id": 15,
       "hp": 180,
       "drop": "log_oak",
-      "texture": "log_oak"
+      "texture": "log_oak",
+      "tool_level": 0,
+      "tool_type": "axe"
     },
     "leaves_oak": {
-      "id": 16,
       "hp": 21,
       "transparent": true,
       "drop": "leaves_oak",
-      "texture": "leaves_oak"
+      "texture": "leaves_oak",
+      "tool_level": 1,
+      "tool_type": "shears"
     },
     "sponge": {
-      "id": 17,
       "hp": 54,
       "drop": "sponge",
-      "texture": "sponge"
+      "texture": "sponge",
+      "tool_level": 0,
+      "tool_type": "hoe"
     },
     "glass": {
-      "id": 18,
       "hp": 27,
       "transparent": true,
       "drop": "none",
       "texture": "glass"
     },
     "lapis_ore": {
-      "id": 19,
       "hp": 900,
       "drop": "lapis",
-      "texture": "lapis_ore"
+      "texture": "lapis_ore",
+      "tool_level": 2,
+      "tool_type": "pickaxe"
     },
     "lapis_block": {
-      "id": 20,
       "hp": 900,
       "drop": "lapis_block",
-      "texture": "lapis_block"
+      "texture": "lapis_block",
+      "tool_level": 2,
+      "tool_type": "pickaxe"
     },
     "sandstone": {
-      "id": 21,
       "hp": 240,
       "drop": "sandstone",
-      "texture": "sandstone"
+      "texture": "sandstone",
+      "tool_level": 1,
+      "tool_type": "pickaxe"
     },
     "noteblock": {
-      "id": 22,
       "hp": 75,
       "drop": "noteblock",
-      "texture": "noteblock"
+      "texture": "noteblock",
+      "tool_level": 0,
+      "tool_type": "axe"
     },
     "bed_l": {
-      "id": 23,
       "hp": 21,
       "collision": false,
       "background": true,
       "transparent": true,
       "drop": "none",
-      "texture": "bed_l"
+      "texture": "bed_l",
+      "tool_level": 0,
+      "tool_type": "axe"
     },
     "bed_r": {
-      "id": 24,
       "hp": 21,
       "collision": false,
       "background": true,
       "transparent": true,
       "drop": "none",
-      "texture": "bed_r"
+      "texture": "bed_r",
+      "tool_level": 0,
+      "tool_type": "axe"
     },
     "web": {
-      "id": 25,
       "hp": 1200,
       "collision": false,
       "transparent": true,
       "drop": "web",
-      "texture": "web"
+      "texture": "web",
+      "tool_level": 1,
+      "tool_type": "shears"
     },
     "tallgrass": {
-      "id": 26,
       "collision": false,
       "transparent": true,
       "block_required": true,
       "drop": "tallgrass",
-      "texture": "tallgrass"
+      "texture": "tallgrass",
+      "tool_level": 1,
+      "tool_type": "shears"
     },
     "deadbush": {
-      "id": 27,
       "collision": false,
       "transparent": true,
       "block_required": true,
       "drop": "deadbush",
-      "texture": "deadbush"
+      "texture": "deadbush",
+      "tool_level": 1,
+      "tool_type": "shears"
     },
     "bricks": {
-      "id": 28,
       "hp": 600,
       "drop": "bricks",
-      "texture": "bricks"
+      "texture": "bricks",
+      "tool_level": 1,
+      "tool_type": "pickaxe"
     },
     "dandelion": {
-      "id": 29,
       "collision": false,
       "transparent": true,
       "block_required": true,
       "texture": "dandelion"
     },
     "rose": {
-      "id": 30,
       "collision": false,
       "transparent": true,
       "block_required": true,
       "texture": "rose"
     },
     "mushroom_brown": {
-      "id": 31,
       "collision": false,
       "transparent": true,
       "block_required": true,
       "texture": "mushroom_brown"
     },
     "mushroom_red": {
-      "id": 32,
       "collision": false,
       "transparent": true,
       "block_required": true,
       "texture": "mushroom_red"
     },
     "wool_colored_white": {
-      "id": 33,
       "hp": 75,
       "drop": "wool_colored_white",
-      "texture": "wool_colored_white"
+      "texture": "wool_colored_white",
+      "tool_level": 0,
+      "tool_type": "shears"
     },
     "wool_colored_orange": {
-      "id": 34,
       "hp": 75,
       "drop": "wool_colored_orange",
-      "texture": "wool_colored_orange"
+      "texture": "wool_colored_orange",
+      "tool_level": 0,
+      "tool_type": "shears"
     },
     "wool_colored_magenta": {
-      "id": 35,
       "hp": 75,
       "drop": "wool_colored_magenta",
-      "texture": "wool_colored_magenta"
+      "texture": "wool_colored_magenta",
+      "tool_level": 0,
+      "tool_type": "shears"
     },
     "wool_colored_light_blue": {
-      "id": 36,
       "hp": 75,
       "drop": "wool_colored_light_blue",
-      "texture": "wool_colored_light_blue"
+      "texture": "wool_colored_light_blue",
+      "tool_level": 0,
+      "tool_type": "shears"
     },
     "wool_colored_yellow": {
-      "id": 37,
       "hp": 75,
       "drop": "wool_colored_yellow",
-      "texture": "wool_colored_yellow"
+      "texture": "wool_colored_yellow",
+      "tool_level": 0,
+      "tool_type": "shears"
     },
     "wool_colored_lime": {
-      "id": 38,
       "hp": 75,
       "drop": "wool_colored_lime",
-      "texture": "wool_colored_lime"
+      "texture": "wool_colored_lime",
+      "tool_level": 0,
+      "tool_type": "shears"
     },
     "wool_colored_pink": {
-      "id": 39,
       "hp": 75,
       "drop": "wool_colored_pink",
-      "texture": "wool_colored_pink"
+      "texture": "wool_colored_pink",
+      "tool_level": 0,
+      "tool_type": "shears"
     },
     "wool_colored_gray": {
-      "id": 40,
       "hp": 75,
       "drop": "wool_colored_gray",
-      "texture": "wool_colored_gray"
+      "texture": "wool_colored_gray",
+      "tool_level": 0,
+      "tool_type": "shears"
     },
     "wool_colored_silver": {
-      "id": 41,
       "hp": 75,
       "drop": "wool_colored_silver",
-      "texture": "wool_colored_silver"
+      "texture": "wool_colored_silver",
+      "tool_level": 0,
+      "tool_type": "shears"
     },
     "wool_colored_cyan": {
-      "id": 42,
       "hp": 75,
       "drop": "wool_colored_cyan",
-      "texture": "wool_colored_cyan"
+      "texture": "wool_colored_cyan",
+      "tool_level": 0,
+      "tool_type": "shears"
     },
     "wool_colored_purple": {
-      "id": 43,
       "hp": 75,
       "drop": "wool_colored_purple",
-      "texture": "wool_colored_purple"
+      "texture": "wool_colored_purple",
+      "tool_level": 0,
+      "tool_type": "shears"
     },
     "wool_colored_blue": {
-      "id": 44,
       "hp": 75,
       "drop": "wool_colored_blue",
-      "texture": "wool_colored_blue"
+      "texture": "wool_colored_blue",
+      "tool_level": 0,
+      "tool_type": "shears"
     },
     "wool_colored_brown": {
-      "id": 45,
       "hp": 75,
       "drop": "wool_colored_brown",
-      "texture": "wool_colored_brown"
+      "texture": "wool_colored_brown",
+      "tool_level": 0,
+      "tool_type": "shears"
     },
     "wool_colored_green": {
-      "id": 46,
       "hp": 75,
       "drop": "wool_colored_green",
-      "texture": "wool_colored_green"
+      "texture": "wool_colored_green",
+      "tool_level": 0,
+      "tool_type": "shears"
     },
     "wool_colored_red": {
-      "id": 47,
       "hp": 75,
       "drop": "wool_colored_red",
-      "texture": "wool_colored_red"
+      "texture": "wool_colored_red",
+      "tool_level": 0,
+      "tool_type": "shears"
     },
     "wool_colored_black": {
-      "id": 48,
       "hp": 75,
       "drop": "wool_colored_black",
-      "texture": "wool_colored_black"
+      "texture": "wool_colored_black",
+      "tool_level": 0,
+      "tool_type": "shears"
     },
     "gold_block": {
-      "id": 49,
       "hp": 900,
       "drop": "gold_block",
-      "texture": "gold_block"
+      "texture": "gold_block",
+      "tool_level": 3,
+      "tool_type": "pickaxe"
     },
     "iron_block": {
-      "id": 50,
       "hp": 1500,
       "drop": "iron_block",
-      "texture": "iron_block"
+      "texture": "iron_block",
+      "tool_level": 2,
+      "tool_type": "pickaxe"
     },
     "stone_slab_bottom": {
-      "id": 51,
       "top": 8,
       "sprite_top": 8,
       "hp": 600,
       "meta": "slab",
       "texture": "stone_slab",
       "full_block": "double_stone_slab",
-      "other_part": "stone_slab_top"
+      "other_part": "stone_slab_top",
+      "tool_level": 1,
+      "tool_type": "pickaxe"
     },
     "stone_slab_top": {
-      "id": 51,
       "hp": 600,
       "bottom": 8,
       "sprite_bottom": 8,
       "meta": "slab",
       "texture": "stone_slab",
       "full_block": "double_stone_slab",
-      "other_part": "stone_slab_bottom"
+      "other_part": "stone_slab_bottom",
+      "tool_level": 1,
+      "tool_type": "pickaxe"
     },
     "double_stone_slab": {
-      "id": 52,
       "hp": 600,
       "drop": "stone_slab",
       "drop_count": 2,
-      "texture": "stone_slab"
+      "texture": "stone_slab",
+      "tool_level": 1,
+      "tool_type": "pickaxe"
     },
     "sandstone_slab_bottom": {
-      "id": 53,
       "top": 8,
       "sprite_top": 8,
       "hp": 600,
       "meta": "slab",
       "texture": "sandstone",
       "full_block": "sandstone",
-      "other_part": "sandstone_slab_top"
+      "other_part": "sandstone_slab_top",
+      "tool_level": 1,
+      "tool_type": "pickaxe"
     },
     "sandstone_slab_top": {
-      "id": 53,
       "bottom": 8,
       "sprite_bottom": 8,
       "hp": 600,
       "meta": "slab",
       "texture": "sandstone",
       "full_block": "sandstone",
-      "other_part": "sandstone_slab_bottom"
+      "other_part": "sandstone_slab_bottom",
+      "tool_level": 1,
+      "tool_type": "pickaxe"
     },
     "oak_slab_bottom": {
-      "id": 54,
       "top": 8,
       "sprite_top": 8,
       "hp": 180,
       "meta": "slab",
       "texture": "planks_oak",
       "full_block": "planks_oak",
-      "other_part": "oak_slab_top"
+      "other_part": "oak_slab_top",
+      "tool_level": 0,
+      "tool_type": "axe"
     },
     "oak_slab_top": {
-      "id": 54,
       "bottom": 8,
       "sprite_bottom": 8,
       "hp": 180,
       "meta": "slab",
       "texture": "planks_oak",
       "full_block": "planks_oak",
-      "other_part": "oak_slab_bottom"
+      "other_part": "oak_slab_bottom",
+      "tool_level": 0,
+      "tool_type": "axe"
     },
     "cobblestone_slab_bottom": {
-      "id": 55,
       "top": 8,
       "sprite_top": 8,
       "hp": 600,
       "drop": "cobblestone_slab",
       "texture": "cobblestone",
       "full_block": "cobblestone",
-      "other_part": "cobblestone_slab_top"
+      "other_part": "cobblestone_slab_top",
+      "tool_level": 1,
+      "tool_type": "pickaxe"
     },
     "cobblestone_slab_top": {
-      "id": 55,
       "bottom": 8,
       "sprite_bottom": 8,
       "hp": 600,
       "drop": "cobblestone_slab",
       "texture": "cobblestone",
       "full_block": "cobblestone",
-      "other_part": "cobblestone_slab_bottom"
+      "other_part": "cobblestone_slab_bottom",
+      "tool_level": 1,
+      "tool_type": "pickaxe"
     },
     "brick_slab_bottom": {
-      "id": 56,
       "top": 8,
       "sprite_top": 8,
       "hp": 600,
       "meta": "slab",
       "texture": "bricks",
       "full_block": "bricks",
-      "other_part": "brick_slab_top"
+      "other_part": "brick_slab_top",
+      "tool_level": 1,
+      "tool_type": "pickaxe"
     },
     "brick_slab_top": {
-      "id": 56,
       "bottom": 8,
       "sprite_bottom": 8,
       "hp": 600,
       "meta": "slab",
       "texture": "bricks",
       "full_block": "bricks",
-      "other_part": "brick_slab_bottom"
+      "other_part": "brick_slab_bottom",
+      "tool_level": 1,
+      "tool_type": "pickaxe"
     },
     "stonebrick": {
-      "id": 57,
       "hp": 450,
       "drop": "stonebrick",
-      "texture": "stonebrick"
+      "texture": "stonebrick",
+      "tool_level": 1,
+      "tool_type": "pickaxe"
     },
     "stonebrick_slab_bottom": {
-      "id": 58,
       "top": 8,
       "sprite_top": 8,
       "hp": 450,
       "meta": "slab",
       "texture": "stonebrick",
       "full_block": "stonebrick",
-      "other_part": "stonebrick_slab_top"
+      "other_part": "stonebrick_slab_top",
+      "tool_level": 1,
+      "tool_type": "pickaxe"
     },
     "stonebrick_slab_top": {
-      "id": 58,
       "bottom": 8,
       "sprite_bottom": 8,
       "hp": 450,
       "meta": "slab",
       "texture": "stonebrick",
       "full_block": "stonebrick",
-      "other_part": "brick_slab_bottom"
+      "other_part": "brick_slab_bottom",
+      "tool_level": 1,
+      "tool_type": "pickaxe"
     },
     "cactus": {
-      "id": 59,
       "left": 1,
       "right": 1,
       "hp": 39,
       "texture": "cactus"
     },
     "water_16": {
-      "id": 60,
       "collision": false,
       "transparent": true,
       "drop": "water_16",
       "state": 1
     },
     "water_12": {
-      "id": 61,
       "top": 4,
       "sprite_top": 4,
       "collision": false,
       "state": 2
     },
     "water_8": {
-      "id": 62,
       "top": 8,
       "sprite_top": 8,
       "collision": false,
       "state": 3
     },
     "water_4": {
-      "id": 63,
       "top": 12,
       "sprite_top": 12,
       "collision": false,
       "state": 4
     },
     "lava_16": {
-      "id": 64,
       "collision": false,
       "drop": "lava_16",
       "meta": "lava",
       "state": 1
     },
     "lava_12": {
-      "id": 65,
       "top": 4,
       "sprite_top": 4,
       "collision": false,
       "state": 2
     },
     "lava_8": {
-      "id": 66,
       "top": 8,
       "sprite_top": 8,
       "collision": false,
       "state": 3
     },
     "lava_4": {
-      "id": 67,
       "top": 12,
       "sprite_top": 12,
       "collision": false,
       "state": 4
     },
     "obsidian": {
-      "id": 68,
       "hp": 1500,
       "drop": "obsidian",
-      "texture": "obsidian"
+      "texture": "obsidian",
+      "tool_level": 4,
+      "tool_type": "pickaxe"
     }
   },
   "items": {
     "none": {
-      "id": 0,
       "name": "",
       "type": "none",
       "texture": "none"
     },
     "stone": {
-      "id": 1,
       "name": "Stone",
       "type": "block",
       "texture": "stone"
     },
     "grass": {
-      "id": 2,
       "name": "Grass",
       "type": "block",
       "texture": "grass"
     },
     "dirt": {
-      "id": 3,
       "name": "Dirt",
       "type": "block",
       "texture": "dirt"
     },
     "cobblestone": {
-      "id": 4,
       "name": "Cobblestone",
       "type": "block",
       "texture": "cobblestone"
     },
     "planks_oak": {
-      "id": 5,
       "name": "Oak Planks",
       "type": "block",
       "texture": "planks_oak"
     },
     "sapling_oak": {
-      "id": 6,
       "name": "Oak Sapling",
       "type": "block",
       "texture": "sapling_oak"
     },
     "bedrock": {
-      "id": 7,
       "name": "Bedrock",
       "type": "block",
       "texture": "bedrock"
     },
     "water": {
-      "id": 8,
       "name": "Water",
       "type": "block",
       "texture": "water"
     },
     "lava": {
-      "id": 9,
       "name": "Lava",
       "type": "block",
       "texture": "lava"
     },
     "sand": {
-      "id": 10,
       "name": "Sand",
       "type": "block",
       "texture": "sand"
     },
     "gravel": {
-      "id": 11,
       "name": "Gravel",
       "type": "block",
       "texture": "gravel"
     },
     "gold_ore": {
-      "id": 12,
       "name": "Golden Ore",
       "type": "block",
       "texture": "gold_ore"
     },
     "iron_ore": {
-      "id": 13,
       "name": "Iron Ore",
       "type": "block",
       "texture": "iron_ore"
     },
     "coal_ore": {
-      "id": 14,
       "name": "Coal Ore",
       "type": "block",
       "texture": "coal_ore"
     },
     "log_oak": {
-      "id": 15,
       "name": "Wood",
       "type": "block",
       "texture": "log_oak"
     },
     "leaves_oak": {
-      "id": 16,
       "name": "Leaves",
       "type": "block",
       "texture": "leaves_oak"
     },
     "glass": {
-      "id": 17,
       "name": "Glass",
       "type": "block",
       "texture": "glass"
     },
     "lapis_ore": {
-      "id": 18,
       "name": "Lapis Ore",
       "type": "block",
       "texture": "lapis_ore"
     },
     "lapis_block": {
-      "id": 19,
       "name": "Lapis Block",
       "type": "block",
       "texture": "lapis_block"
     },
     "sandstone": {
-      "id": 20,
       "name": "Sandstone",
       "type": "block",
       "texture": "sandstone"
     },
     "web": {
-      "id": 21,
       "name": "Cobweb",
       "type": "block",
       "texture": "web"
     },
     "tallgrass": {
-      "id": 22,
       "name": "Tall Grass",
       "type": "block",
       "texture": "tallgrass",
       "origin_x": 0.5
     },
     "deadbush": {
-      "id": 23,
       "name": "Dead Bush",
       "type": "block",
       "texture": "deadbush",
       "origin_x": 0.5
     },
     "bricks": {
-      "id": 24,
       "name": "Bricks",
       "type": "block",
       "texture": "bricks"
     },
     "dandelion": {
-      "id": 25,
       "name": "Dandelion",
       "type": "block",
       "texture": "dandelion",
       "origin_x": 0.5
     },
     "rose": {
-      "id": 26,
       "name": "Rose",
       "type": "block",
       "texture": "rose",
       "origin_x": 0.5
     },
     "mushroom_brown": {
-      "id": 27,
       "name": "Mushroom",
       "type": "block",
       "texture": "mushroom_brown",
       "origin_x": 0.5
     },
     "mushroom_red": {
-      "id": 28,
       "name": "Mushroom",
       "type": "block",
       "texture": "mushroom_red",
       "origin_x": 0.5
     },
     "wool_colored_white": {
-      "id": 29,
       "name": "Wool",
       "type": "block",
       "texture": "wool_colored_white"
     },
     "wool_colored_orange": {
-      "id": 30,
       "name": "Wool",
       "type": "block",
       "texture": "wool_colored_orange"
     },
     "wool_colored_magenta": {
-      "id": 31,
       "name": "Wool",
       "type": "block",
       "texture": "wool_colored_magenta"
     },
     "wool_colored_light_blue": {
-      "id": 32,
       "name": "Wool",
       "type": "block",
       "texture": "wool_colored_light_blue"
     },
     "wool_colored_yellow": {
-      "id": 33,
       "name": "Wool",
       "type": "block",
       "texture": "wool_colored_yellow"
     },
     "wool_colored_lime": {
-      "id": 34,
       "name": "Wool",
       "type": "block",
       "texture": "wool_colored_lime"
     },
     "wool_colored_pink": {
-      "id": 35,
       "name": "Wool",
       "type": "block",
       "texture": "wool_colored_pink"
     },
     "wool_colored_gray": {
-      "id": 36,
       "name": "Wool",
       "type": "block",
       "texture": "wool_colored_gray"
     },
     "wool_colored_silver": {
-      "id": 37,
       "name": "Wool",
       "type": "block",
       "texture": "wool_colored_silver"
     },
     "wool_colored_cyan": {
-      "id": 38,
       "name": "Wool",
       "type": "block",
       "texture": "wool_colored_cyan"
     },
     "wool_colored_purple": {
-      "id": 39,
       "name": "Wool",
       "type": "block",
       "texture": "wool_colored_purple"
     },
     "wool_colored_blue": {
-      "id": 40,
       "name": "Wool",
       "type": "block",
       "texture": "wool_colored_blue"
     },
     "wool_colored_brown": {
-      "id": 41,
       "name": "Wool",
       "type": "block",
       "texture": "wool_colored_brown"
     },
     "wool_colored_green": {
-      "id": 42,
       "name": "Wool",
       "type": "block",
       "texture": "wool_colored_green"
     },
     "wool_colored_red": {
-      "id": 43,
       "name": "Wool",
       "type": "block",
       "texture": "wool_colored_red"
     },
     "wool_colored_black": {
-      "id": 44,
       "name": "Wool",
       "type": "block",
       "texture": "wool_colored_black"
     },
     "gold_block": {
-      "id": 45,
       "name": "Gold Block",
       "type": "block",
       "texture": "gold_block"
     },
     "iron_block": {
-      "id": 46,
       "name": "Iron Block",
       "type": "block",
       "texture": "iron_block"
     },
     "stone_slab": {
-      "id": 47,
       "name": "Stone Slab",
       "type": "slab",
       "texture": "stone_slab",
       "bottom_slab_block": "stone_slab_bottom"
     },
     "sandstone_slab": {
-      "id": 48,
       "name": "Sandstone Slab",
       "type": "slab",
       "texture": "sandstone_slab",
       "bottom_slab_block": "sandstone_slab_bottom"
     },
     "oak_slab": {
-      "id": 49,
       "name": "Oak Slab",
       "type": "slab",
       "texture": "oak_slab",
       "bottom_slab_block": "oak_slab_bottom"
     },
     "cobblestone_slab": {
-      "id": 50,
       "name": "Cobblestone Slab",
       "type": "slab",
       "texture": "cobblestone_slab",
       "bottom_slab_block": "cobblestone_slab_bottom"
     },
     "brick_slab": {
-      "id": 51,
       "name": "Brick Slab",
       "type": "slab",
       "texture": "brick_slab",
       "bottom_slab_block": "brick_slab_bottom"
     },
     "stonebrick": {
-      "id": 52,
       "name": "Stone Brick",
       "type": "block",
       "texture": "stonebrick"
     },
     "stonebrick_slab": {
-      "id": 53,
       "name": "Stone Brick Slab",
       "type": "slab",
       "texture": "stonebrick_slab",
       "bottom_slab_block": "stonebrick_slab_bottom"
     },
     "cactus": {
-      "id": 54,
       "name": "Cactus",
       "type": "block",
       "texture": "cactus"
     },
     "obsidian": {
-      "id": 55,
       "name": "Obsidian",
       "type": "block",
       "texture": "obsidian"
     },
     "wood_sword": {
-      "id": 56,
       "name": "Wooden Sword",
       "type": "sword",
       "texture": "wood_sword",
-      "origin_x": 0.125
+      "origin_x": 0.125,
+      "tool_level": 1
     },
     "stone_sword": {
-      "id": 57,
       "name": "Stone Sword",
       "type": "sword",
       "texture": "stone_sword",
-      "origin_x": 0.125
+      "origin_x": 0.125,
+      "tool_level": 2
     },
     "iron_sword": {
-      "id": 58,
       "name": "Iron Sword",
       "type": "sword",
       "texture": "iron_sword",
-      "origin_x": 0.125
+      "origin_x": 0.125,
+      "tool_level": 3
     },
     "diamond_sword": {
-      "id": 59,
       "name": "Diamond Sword",
       "type": "sword",
       "texture": "diamond_sword",
-      "origin_x": 0.125
+      "origin_x": 0.125,
+      "tool_level": 4
     },
     "gold_sword": {
-      "id": 60,
       "name": "Golden Sword",
       "type": "sword",
       "texture": "gold_sword",
-      "origin_x": 0.125
+      "origin_x": 0.125,
+      "tool_level": 1
     },
     "wood_shovel": {
-      "id": 61,
       "name": "Wooden Shovel",
       "type": "shovel",
       "texture": "wood_shovel",
-      "origin_x": 0.125
+      "origin_x": 0.125,
+      "tool_level" : 1
     },
     "stone_shovel": {
-      "id": 62,
       "name": "Stone Shovel",
       "type": "shovel",
       "texture": "stone_shovel",
-      "origin_x": 0.125
+      "origin_x": 0.125,
+      "tool_level" : 2
     },
     "iron_shovel": {
-      "id": 63,
       "name": "Iron Shovel",
       "type": "shovel",
       "texture": "iron_shovel",
-      "origin_x": 0.125
+      "origin_x": 0.125,
+      "tool_level" : 3
     },
     "diamond_shovel": {
-      "id": 64,
       "name": "Diamond Shovel",
       "type": "shovel",
       "texture": "diamond_shovel",
-      "origin_x": 0.125
+      "origin_x": 0.125,
+      "tool_level" : 4
     },
     "gold_shovel": {
-      "id": 65,
       "name": "Golden Shovel",
       "type": "shovel",
       "texture": "gold_shovel",
+      "origin_x": 0.125,
+      "tool_level" : 1,
+      "block_damage_multiplier": 6
+    },
+    "wood_pickaxe": {
+      "name": "Wooden Pickaxe",
+      "type": "pickaxe",
+      "texture": "wood_pickaxe",
+      "origin_x": 0.125,
+      "tool_level" : 1
+    },
+    "stone_pickaxe": {
+      "name": "Stone Pickaxe",
+      "type": "pickaxe",
+      "texture": "stone_pickaxe",
+      "origin_x": 0.125,
+      "tool_level" : 2
+    },
+    "iron_pickaxe": {
+      "name": "Iron Pickaxe",
+      "type": "pickaxe",
+      "texture": "iron_pickaxe",
+      "origin_x": 0.125,
+      "tool_level" : 3
+    },
+    "diamond_pickaxe": {
+      "name": "Diamond Pickaxe",
+      "type": "pickaxe",
+      "texture": "diamond_pickaxe",
+      "origin_x": 0.125,
+      "tool_level" : 4
+    },
+    "gold_pickaxe": {
+      "name": "Golden Pickaxe",
+      "type": "pickaxe",
+      "texture": "gold_pickaxe",
+      "origin_x": 0.125,
+      "tool_level" : 1,
+      "block_damage_multiplier": 6
+    },
+    "wood_axe": {
+      "name": "Wooden Axe",
+      "type": "axe",
+      "texture": "wood_axe",
+      "origin_x": 0.125,
+      "tool_level" : 1
+    },
+    "stone_axe": {
+      "name": "Stone Axe",
+      "type": "axe",
+      "texture": "stone_axe",
+      "origin_x": 0.125,
+      "tool_level" : 2
+    },
+    "iron_axe": {
+      "name": "Iron Axe",
+      "type": "axe",
+      "texture": "iron_axe",
+      "origin_x": 0.125,
+      "tool_level" : 3
+    },
+    "diamond_axe": {
+      "name": "Diamond Axe",
+      "type": "axe",
+      "texture": "diamond_axe",
+      "origin_x": 0.125,
+      "tool_level" : 4
+    },
+    "gold_axe": {
+      "name": "Golden Axe",
+      "type": "axe",
+      "texture": "gold_axe",
+      "origin_x": 0.125,
+      "tool_level" : 1,
+      "block_damage_multiplier": 6
+    },
+    "shears": {
+      "name": "Shears",
+      "type": "shears",
+      "texture": "shears",
+      "tool_level" : 1,
       "origin_x": 0.125
     },
     "bucket_empty": {
-      "id": 66,
       "name": "Empty Bucket",
       "type": "bucket",
       "texture": "bucket_empty",
       "action_key": "use_empty_bucket"
     },
     "bucket_water": {
-      "id": 67,
       "name": "Water Bucket",
       "type": "bucket",
       "texture": "bucket_water",
       "action_key": "use_water_bucket"
     },
     "bucket_lava": {
-      "id": 68,
       "name": "Lava Bucket",
       "type": "bucket",
       "texture": "bucket_lava",
diff --git a/android/assets/textures/items/diamond_axe.png b/android/assets/textures/items/diamond_axe.png
new file mode 100644 (file)
index 0000000..ac81a23
Binary files /dev/null and b/android/assets/textures/items/diamond_axe.png differ
diff --git a/android/assets/textures/items/diamond_hoe.png b/android/assets/textures/items/diamond_hoe.png
new file mode 100644 (file)
index 0000000..f0ad2c6
Binary files /dev/null and b/android/assets/textures/items/diamond_hoe.png differ
diff --git a/android/assets/textures/items/diamond_pickaxe.png b/android/assets/textures/items/diamond_pickaxe.png
new file mode 100644 (file)
index 0000000..75823f6
Binary files /dev/null and b/android/assets/textures/items/diamond_pickaxe.png differ
diff --git a/android/assets/textures/items/gold_axe.png b/android/assets/textures/items/gold_axe.png
new file mode 100644 (file)
index 0000000..d939170
Binary files /dev/null and b/android/assets/textures/items/gold_axe.png differ
diff --git a/android/assets/textures/items/gold_hoe.png b/android/assets/textures/items/gold_hoe.png
new file mode 100644 (file)
index 0000000..da32a5d
Binary files /dev/null and b/android/assets/textures/items/gold_hoe.png differ
diff --git a/android/assets/textures/items/gold_pickaxe.png b/android/assets/textures/items/gold_pickaxe.png
new file mode 100644 (file)
index 0000000..5b4e6d6
Binary files /dev/null and b/android/assets/textures/items/gold_pickaxe.png differ
diff --git a/android/assets/textures/items/iron_axe.png b/android/assets/textures/items/iron_axe.png
new file mode 100644 (file)
index 0000000..2fd16d0
Binary files /dev/null and b/android/assets/textures/items/iron_axe.png differ
diff --git a/android/assets/textures/items/iron_hoe.png b/android/assets/textures/items/iron_hoe.png
new file mode 100644 (file)
index 0000000..d56485d
Binary files /dev/null and b/android/assets/textures/items/iron_hoe.png differ
diff --git a/android/assets/textures/items/iron_pickaxe.png b/android/assets/textures/items/iron_pickaxe.png
new file mode 100644 (file)
index 0000000..0746cc0
Binary files /dev/null and b/android/assets/textures/items/iron_pickaxe.png differ
diff --git a/android/assets/textures/items/shears.png b/android/assets/textures/items/shears.png
new file mode 100644 (file)
index 0000000..bfa815c
Binary files /dev/null and b/android/assets/textures/items/shears.png differ
diff --git a/android/assets/textures/items/stone_axe.png b/android/assets/textures/items/stone_axe.png
new file mode 100644 (file)
index 0000000..5f42de6
Binary files /dev/null and b/android/assets/textures/items/stone_axe.png differ
diff --git a/android/assets/textures/items/stone_hoe.png b/android/assets/textures/items/stone_hoe.png
new file mode 100644 (file)
index 0000000..2118229
Binary files /dev/null and b/android/assets/textures/items/stone_hoe.png differ
diff --git a/android/assets/textures/items/stone_pickaxe.png b/android/assets/textures/items/stone_pickaxe.png
new file mode 100644 (file)
index 0000000..13bdd75
Binary files /dev/null and b/android/assets/textures/items/stone_pickaxe.png differ
diff --git a/android/assets/textures/items/wood_axe.png b/android/assets/textures/items/wood_axe.png
new file mode 100644 (file)
index 0000000..b0cbde6
Binary files /dev/null and b/android/assets/textures/items/wood_axe.png differ
diff --git a/android/assets/textures/items/wood_hoe.png b/android/assets/textures/items/wood_hoe.png
new file mode 100644 (file)
index 0000000..3744c1b
Binary files /dev/null and b/android/assets/textures/items/wood_hoe.png differ
diff --git a/android/assets/textures/items/wood_pickaxe.png b/android/assets/textures/items/wood_pickaxe.png
new file mode 100644 (file)
index 0000000..5932623
Binary files /dev/null and b/android/assets/textures/items/wood_pickaxe.png differ
index 216db6abbf0f3d6b435fe4ce5c0ef57f2af7b93b..34a936daaa6aaaca19524ab9f66f2f6f56351654 100644 (file)
@@ -118,12 +118,30 @@ public class Player extends Mob {
 
         final Block foregroundBlock = gameWorld.getForeMap(cursorX, cursorY);
         final Block backgroundBlock = gameWorld.getBackMap(cursorX, cursorY);
+        @CheckForNull final Block target;
 
-        final boolean canHitBlock = !foregroundBlock.isNone() && foregroundBlock.getParams().getHitPoints() >= 0
-                || !backgroundBlock.isNone() && backgroundBlock.getParams().getHitPoints() >= 0;
+        if (!foregroundBlock.isNone() && foregroundBlock.getParams().getHitPoints() >= 0) {
+            target = foregroundBlock;
+        } else if (!backgroundBlock.isNone() && backgroundBlock.getParams().getHitPoints() >= 0) {
+            target = backgroundBlock;
+        } else {
+            target = null;
+        }
+
+        final boolean canHitBlock = target != null;
+
+        float multiplier = 1f;
+        final Item currentItem = inventory[slot].getItem();
+        if (currentItem instanceof Item.Tool && canHitBlock) {
+            if (target.getParams().getToolType() == currentItem.getClass()
+                    && ((Item.Tool)currentItem).getLevel() >= target.getParams().getToolLevel()) {
+                multiplier = 2f * ((Item.Tool)currentItem).getLevel();
+            }
+            multiplier *= ((Item.Tool)currentItem).getBlockDamageMultiplier();
+        }
 
         if (hitting && canHitBlock) {
-            blockDamage += 60f * delta;
+            blockDamage += 60f * delta * multiplier;
         } else {
             blockDamage = 0f;
         }
index 1c9c5105560280708fe7988b8b8c4589e969ebb6..584e7376298d4fa103d36b88ed8d9c4e2ee8e6cf 100644 (file)
@@ -1,9 +1,10 @@
 package ru.deadsoftware.cavedroid.game.model.block
 
 import com.badlogic.gdx.graphics.Texture
+import ru.deadsoftware.cavedroid.game.model.item.Item
 
 data class CommonBlockParams(
-    @Deprecated("numeric id's will be removed") val id: Int,
+    @Deprecated("numeric id's will be removed") val id: Int?,
     val key: String,
     val collisionMargins: BlockMargins,
     val hitPoints: Int,
@@ -15,4 +16,6 @@ data class CommonBlockParams(
     val animationInfo: BlockAnimationInfo?,
     val texture: Texture?,
     val spriteMargins: BlockMargins,
+    val toolLevel: Int,
+    val toolType: Class<out Item.Tool>?
 )
index e30ae5286f8f183a4c231bb052291cb93de82caf..1a7dc4b3bf5a813354d65678b69a11b684bbe09d 100644 (file)
@@ -5,7 +5,7 @@ import kotlinx.serialization.Serializable
 
 @Serializable
 data class BlockDto(
-    @Deprecated("numeric ids will be removed") @SerialName("id") val id: Int,
+    @Deprecated("numeric ids will be removed") @SerialName("id") val id: Int? = null,
     @SerialName("left") val left: Int = 0,
     @SerialName("top") val top: Int = 0,
     @SerialName("right") val right: Int = 0,
@@ -28,4 +28,6 @@ data class BlockDto(
     @SerialName("full_block") val fullBlock: String? = null,
     @SerialName("state") val state: Int? = null,
     @SerialName("other_part") val otherPart: String? = null,
+    @SerialName("tool_level") val toolLevel: Int = 0,
+    @SerialName("tool_type") val toolType: String? = null,
 )
index 4d57886372db315bea5d5fa884099c90c0e0aca8..0fa2075e5215416efa11bcfbb8405dd4e3c638a6 100644 (file)
@@ -5,7 +5,7 @@ import kotlinx.serialization.Serializable
 
 @Serializable
 data class ItemDto(
-    @Deprecated("numeric ids will be removed") @SerialName("id") val id: Int,
+    @Deprecated("numeric ids will be removed") @SerialName("id") val id: Int? = null,
     @SerialName("name") val name: String,
     @SerialName("type") val type: String,
     @SerialName("texture") val texture: String,
@@ -16,4 +16,5 @@ data class ItemDto(
     @SerialName("block_damage_multiplier") val blockDamageMultiplier: Float = 1f,
     @SerialName("top_slab_block") val topSlabBlock: String? = null,
     @SerialName("bottom_slab_block") val bottomSlabBlock: String? = null,
+    @SerialName("tool_level") val toolLevel: Int? = null,
 )
index 57480c85b0876f27ae3a338c4b43cf1b3af5dd9f..06da72fd69bd88ade678e4c49c934b5b2a9decea 100644 (file)
@@ -3,7 +3,7 @@ package ru.deadsoftware.cavedroid.game.model.item
 import ru.deadsoftware.cavedroid.misc.utils.SpriteOrigin
 
 data class CommonItemParams(
-    @Deprecated("numeric id's will be removed") val id: Int,
+    @Deprecated("numeric id's will be removed") val id: Int?,
     val key: String,
     val name: String,
     val inHandSpriteOrigin: SpriteOrigin,
index b56f068892af48aebac980418468edc02d51196d..2b6b5fcd2498e82c29e925a685473dafd1d0e360 100644 (file)
@@ -54,6 +54,7 @@ sealed class Item {
     sealed class Tool : Item() {
         abstract val mobDamageMultiplier: Float
         abstract val blockDamageMultiplier: Float
+        abstract val level: Int
     }
 
     sealed class Usable : Item() {
@@ -90,6 +91,7 @@ sealed class Item {
         override val sprite: Sprite,
         override val mobDamageMultiplier: Float,
         override val blockDamageMultiplier: Float,
+        override val level: Int,
     ) : Tool()
 
     data class Shovel(
@@ -97,6 +99,31 @@ sealed class Item {
         override val sprite: Sprite,
         override val mobDamageMultiplier: Float,
         override val blockDamageMultiplier: Float,
+        override val level: Int,
+    ) : Tool()
+
+    data class Axe(
+        override val params: CommonItemParams,
+        override val sprite: Sprite,
+        override val mobDamageMultiplier: Float,
+        override val blockDamageMultiplier: Float,
+        override val level: Int,
+    ) : Tool()
+
+    data class Pickaxe(
+        override val params: CommonItemParams,
+        override val sprite: Sprite,
+        override val mobDamageMultiplier: Float,
+        override val blockDamageMultiplier: Float,
+        override val level: Int,
+    ) : Tool()
+
+    data class Shears(
+        override val params: CommonItemParams,
+        override val sprite: Sprite,
+        override val mobDamageMultiplier: Float,
+        override val blockDamageMultiplier: Float,
+        override val level: Int,
     ) : Tool()
     
     data class Bucket(
index a122754caad73e972a6cb20f7155c6b76f02a9fd..667d92b0e897975a5ea05e75dcc304680fe97c8f 100644 (file)
@@ -6,6 +6,7 @@ import ru.deadsoftware.cavedroid.game.GameItemsHolder
 import ru.deadsoftware.cavedroid.game.model.block.*
 import ru.deadsoftware.cavedroid.game.model.block.Block.*
 import ru.deadsoftware.cavedroid.game.model.dto.BlockDto
+import ru.deadsoftware.cavedroid.game.model.item.Item
 import ru.deadsoftware.cavedroid.misc.Assets
 import javax.inject.Inject
 
@@ -47,10 +48,24 @@ class BlockMapper @Inject constructor() {
                 top = dto.spriteTop,
                 right = dto.spriteRight,
                 bottom = dto.spriteBottom,
-            )
+            ),
+            toolLevel = dto.toolLevel,
+            toolType = mapToolType(dto),
         )
     }
 
+    private fun mapToolType(dto: BlockDto): Class<out Item.Tool>? {
+        return when(dto.toolType) {
+            "shovel" -> Item.Shovel::class.java
+            "sword" -> Item.Sword::class.java
+            "pickaxe" -> Item.Pickaxe::class.java
+            "axe" -> Item.Axe::class.java
+            "shears" -> Item.Shears::class.java
+
+            else -> null
+        }
+    }
+
     private fun mapBlockDropInfo(dto: BlockDto): BlockDropInfo? {
         val drop = dto.drop
         val dropCount = dto.dropCount
index 7646e22d70b756cb07082b2f6425b3eff03a0659..6bcad04d5c454e0f516526d3abb3c8a4c5b7582f 100644 (file)
@@ -20,8 +20,11 @@ class ItemMapper @Inject constructor() {
 
         return when (dto.type) {
             "bucket" -> Bucket(params, requireNotNull(loadSprite(dto)), requireNotNull(dto.actionKey))
-            "shovel" -> Shovel(params, requireNotNull(loadSprite(dto)), dto.mobDamageMultiplier, dto.blockDamageMultiplier)
-            "sword" -> Sword(params, requireNotNull(loadSprite(dto)), dto.mobDamageMultiplier, dto.blockDamageMultiplier)
+            "shovel" -> Shovel(params, requireNotNull(loadSprite(dto)), dto.mobDamageMultiplier, dto.blockDamageMultiplier, requireNotNull(dto.toolLevel))
+            "sword" -> Sword(params, requireNotNull(loadSprite(dto)), dto.mobDamageMultiplier, dto.blockDamageMultiplier, requireNotNull(dto.toolLevel))
+            "pickaxe" -> Pickaxe(params, requireNotNull(loadSprite(dto)), dto.mobDamageMultiplier, dto.blockDamageMultiplier, requireNotNull(dto.toolLevel))
+            "axe" -> Axe(params, requireNotNull(loadSprite(dto)), dto.mobDamageMultiplier, dto.blockDamageMultiplier, requireNotNull(dto.toolLevel))
+            "shears" -> Shears(params, requireNotNull(loadSprite(dto)), dto.mobDamageMultiplier, dto.blockDamageMultiplier, requireNotNull(dto.toolLevel))
             "block" -> Block(params, requireNotNull(block))
             "slab" -> Slab(params, requireNotNull(slabTopBlock), requireNotNull(slabBottomBlock))
             "none" -> None(params)
index 60a9ef80b1e03a074888379e89565f8216e186e2..378ed7b9191c048884db9d80fdc953e7273cb155 100644 (file)
@@ -23,7 +23,7 @@ abstract class BlocksRenderer(
         get() = isNone() || params.isTransparent
 
     private fun blockDamageSprite(index: Int): Sprite? {
-        if (index !in 0..MAX_BLOCK_DAMAGE_INDEX) {
+        if (index !in 0..MAX_BLOCK_DAMAGE_INDEX) {
             return null
         }
         return Assets.blockDamageSprites[index]