1
0
mirror of https://github.com/minetest/minetest_game.git synced 2024-12-23 07:10:19 +01:00

Add groups for tools and mushrooms (#2378)

This commit is contained in:
An0n3m0us 2019-06-01 20:10:30 +01:00 committed by SmallJoker
parent 76a08a7058
commit e19f42d648
6 changed files with 48 additions and 23 deletions

View File

@ -114,6 +114,7 @@ minetest.register_craftitem("bucket:bucket_empty", {
description = "Empty Bucket", description = "Empty Bucket",
inventory_image = "bucket.png", inventory_image = "bucket.png",
stack_max = 99, stack_max = 99,
groups = {tool = 1},
liquids_pointable = true, liquids_pointable = true,
on_use = function(itemstack, user, pointed_thing) on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type == "object" then if pointed_thing.type == "object" then
@ -186,7 +187,7 @@ bucket.register_liquid(
"bucket:bucket_water", "bucket:bucket_water",
"bucket_water.png", "bucket_water.png",
"Water Bucket", "Water Bucket",
{water_bucket = 1} {tool = 1, water_bucket = 1}
) )
-- River water source is 'liquid_renewable = false' to avoid horizontal spread -- River water source is 'liquid_renewable = false' to avoid horizontal spread
@ -201,7 +202,7 @@ bucket.register_liquid(
"bucket:bucket_river_water", "bucket:bucket_river_water",
"bucket_river_water.png", "bucket_river_water.png",
"River Water Bucket", "River Water Bucket",
{water_bucket = 1}, {tool = 1, water_bucket = 1},
true true
) )
@ -210,7 +211,8 @@ bucket.register_liquid(
"default:lava_flowing", "default:lava_flowing",
"bucket:bucket_lava", "bucket:bucket_lava",
"bucket_lava.png", "bucket_lava.png",
"Lava Bucket" "Lava Bucket",
{tool = 1}
) )
minetest.register_craft({ minetest.register_craft({

View File

@ -262,17 +262,17 @@ minetest.register_craftitem("default:coal_lump", {
minetest.register_craftitem("default:iron_lump", { minetest.register_craftitem("default:iron_lump", {
description = "Iron Lump", description = "Iron Lump",
inventory_image = "default_iron_lump.png", inventory_image = "default_iron_lump.png"
}) })
minetest.register_craftitem("default:copper_lump", { minetest.register_craftitem("default:copper_lump", {
description = "Copper Lump", description = "Copper Lump",
inventory_image = "default_copper_lump.png", inventory_image = "default_copper_lump.png"
}) })
minetest.register_craftitem("default:tin_lump", { minetest.register_craftitem("default:tin_lump", {
description = "Tin Lump", description = "Tin Lump",
inventory_image = "default_tin_lump.png", inventory_image = "default_tin_lump.png"
}) })
minetest.register_craftitem("default:mese_crystal", { minetest.register_craftitem("default:mese_crystal", {
@ -282,7 +282,7 @@ minetest.register_craftitem("default:mese_crystal", {
minetest.register_craftitem("default:gold_lump", { minetest.register_craftitem("default:gold_lump", {
description = "Gold Lump", description = "Gold Lump",
inventory_image = "default_gold_lump.png", inventory_image = "default_gold_lump.png"
}) })
minetest.register_craftitem("default:diamond", { minetest.register_craftitem("default:diamond", {
@ -297,22 +297,22 @@ minetest.register_craftitem("default:clay_lump", {
minetest.register_craftitem("default:steel_ingot", { minetest.register_craftitem("default:steel_ingot", {
description = "Steel Ingot", description = "Steel Ingot",
inventory_image = "default_steel_ingot.png", inventory_image = "default_steel_ingot.png"
}) })
minetest.register_craftitem("default:copper_ingot", { minetest.register_craftitem("default:copper_ingot", {
description = "Copper Ingot", description = "Copper Ingot",
inventory_image = "default_copper_ingot.png", inventory_image = "default_copper_ingot.png"
}) })
minetest.register_craftitem("default:tin_ingot", { minetest.register_craftitem("default:tin_ingot", {
description = "Tin Ingot", description = "Tin Ingot",
inventory_image = "default_tin_ingot.png", inventory_image = "default_tin_ingot.png"
}) })
minetest.register_craftitem("default:bronze_ingot", { minetest.register_craftitem("default:bronze_ingot", {
description = "Bronze Ingot", description = "Bronze Ingot",
inventory_image = "default_bronze_ingot.png", inventory_image = "default_bronze_ingot.png"
}) })
minetest.register_craftitem("default:gold_ingot", { minetest.register_craftitem("default:gold_ingot", {

View File

@ -32,8 +32,8 @@ minetest.register_tool("default:pick_wood", {
}, },
damage_groups = {fleshy=2}, damage_groups = {fleshy=2},
}, },
groups = {flammable = 2},
sound = {breaks = "default_tool_breaks"}, sound = {breaks = "default_tool_breaks"},
groups = {pickaxe = 1, flammable = 2}
}) })
minetest.register_tool("default:pick_stone", { minetest.register_tool("default:pick_stone", {
@ -48,6 +48,7 @@ minetest.register_tool("default:pick_stone", {
damage_groups = {fleshy=3}, damage_groups = {fleshy=3},
}, },
sound = {breaks = "default_tool_breaks"}, sound = {breaks = "default_tool_breaks"},
groups = {pickaxe = 1}
}) })
minetest.register_tool("default:pick_bronze", { minetest.register_tool("default:pick_bronze", {
@ -62,6 +63,7 @@ minetest.register_tool("default:pick_bronze", {
damage_groups = {fleshy=4}, damage_groups = {fleshy=4},
}, },
sound = {breaks = "default_tool_breaks"}, sound = {breaks = "default_tool_breaks"},
groups = {pickaxe = 1}
}) })
minetest.register_tool("default:pick_steel", { minetest.register_tool("default:pick_steel", {
@ -76,6 +78,7 @@ minetest.register_tool("default:pick_steel", {
damage_groups = {fleshy=4}, damage_groups = {fleshy=4},
}, },
sound = {breaks = "default_tool_breaks"}, sound = {breaks = "default_tool_breaks"},
groups = {pickaxe = 1}
}) })
minetest.register_tool("default:pick_mese", { minetest.register_tool("default:pick_mese", {
@ -90,6 +93,7 @@ minetest.register_tool("default:pick_mese", {
damage_groups = {fleshy=5}, damage_groups = {fleshy=5},
}, },
sound = {breaks = "default_tool_breaks"}, sound = {breaks = "default_tool_breaks"},
groups = {pickaxe = 1}
}) })
minetest.register_tool("default:pick_diamond", { minetest.register_tool("default:pick_diamond", {
@ -104,6 +108,7 @@ minetest.register_tool("default:pick_diamond", {
damage_groups = {fleshy=5}, damage_groups = {fleshy=5},
}, },
sound = {breaks = "default_tool_breaks"}, sound = {breaks = "default_tool_breaks"},
groups = {pickaxe = 1}
}) })
-- --
@ -122,8 +127,8 @@ minetest.register_tool("default:shovel_wood", {
}, },
damage_groups = {fleshy=2}, damage_groups = {fleshy=2},
}, },
groups = {flammable = 2},
sound = {breaks = "default_tool_breaks"}, sound = {breaks = "default_tool_breaks"},
groups = {shovel = 1, flammable = 2}
}) })
minetest.register_tool("default:shovel_stone", { minetest.register_tool("default:shovel_stone", {
@ -139,6 +144,7 @@ minetest.register_tool("default:shovel_stone", {
damage_groups = {fleshy=2}, damage_groups = {fleshy=2},
}, },
sound = {breaks = "default_tool_breaks"}, sound = {breaks = "default_tool_breaks"},
groups = {shovel = 1}
}) })
minetest.register_tool("default:shovel_bronze", { minetest.register_tool("default:shovel_bronze", {
@ -154,6 +160,7 @@ minetest.register_tool("default:shovel_bronze", {
damage_groups = {fleshy=3}, damage_groups = {fleshy=3},
}, },
sound = {breaks = "default_tool_breaks"}, sound = {breaks = "default_tool_breaks"},
groups = {shovel = 1}
}) })
minetest.register_tool("default:shovel_steel", { minetest.register_tool("default:shovel_steel", {
@ -169,6 +176,7 @@ minetest.register_tool("default:shovel_steel", {
damage_groups = {fleshy=3}, damage_groups = {fleshy=3},
}, },
sound = {breaks = "default_tool_breaks"}, sound = {breaks = "default_tool_breaks"},
groups = {shovel = 1}
}) })
minetest.register_tool("default:shovel_mese", { minetest.register_tool("default:shovel_mese", {
@ -184,6 +192,7 @@ minetest.register_tool("default:shovel_mese", {
damage_groups = {fleshy=4}, damage_groups = {fleshy=4},
}, },
sound = {breaks = "default_tool_breaks"}, sound = {breaks = "default_tool_breaks"},
groups = {shovel = 1}
}) })
minetest.register_tool("default:shovel_diamond", { minetest.register_tool("default:shovel_diamond", {
@ -199,6 +208,7 @@ minetest.register_tool("default:shovel_diamond", {
damage_groups = {fleshy=4}, damage_groups = {fleshy=4},
}, },
sound = {breaks = "default_tool_breaks"}, sound = {breaks = "default_tool_breaks"},
groups = {shovel = 1}
}) })
-- --
@ -216,8 +226,8 @@ minetest.register_tool("default:axe_wood", {
}, },
damage_groups = {fleshy=2}, damage_groups = {fleshy=2},
}, },
groups = {flammable = 2},
sound = {breaks = "default_tool_breaks"}, sound = {breaks = "default_tool_breaks"},
groups = {axe = 1, flammable = 2}
}) })
minetest.register_tool("default:axe_stone", { minetest.register_tool("default:axe_stone", {
@ -232,6 +242,7 @@ minetest.register_tool("default:axe_stone", {
damage_groups = {fleshy=3}, damage_groups = {fleshy=3},
}, },
sound = {breaks = "default_tool_breaks"}, sound = {breaks = "default_tool_breaks"},
groups = {axe = 1}
}) })
minetest.register_tool("default:axe_bronze", { minetest.register_tool("default:axe_bronze", {
@ -246,6 +257,7 @@ minetest.register_tool("default:axe_bronze", {
damage_groups = {fleshy=4}, damage_groups = {fleshy=4},
}, },
sound = {breaks = "default_tool_breaks"}, sound = {breaks = "default_tool_breaks"},
groups = {axe = 1}
}) })
minetest.register_tool("default:axe_steel", { minetest.register_tool("default:axe_steel", {
@ -260,6 +272,7 @@ minetest.register_tool("default:axe_steel", {
damage_groups = {fleshy=4}, damage_groups = {fleshy=4},
}, },
sound = {breaks = "default_tool_breaks"}, sound = {breaks = "default_tool_breaks"},
groups = {axe = 1}
}) })
minetest.register_tool("default:axe_mese", { minetest.register_tool("default:axe_mese", {
@ -274,6 +287,7 @@ minetest.register_tool("default:axe_mese", {
damage_groups = {fleshy=6}, damage_groups = {fleshy=6},
}, },
sound = {breaks = "default_tool_breaks"}, sound = {breaks = "default_tool_breaks"},
groups = {axe = 1}
}) })
minetest.register_tool("default:axe_diamond", { minetest.register_tool("default:axe_diamond", {
@ -288,6 +302,7 @@ minetest.register_tool("default:axe_diamond", {
damage_groups = {fleshy=7}, damage_groups = {fleshy=7},
}, },
sound = {breaks = "default_tool_breaks"}, sound = {breaks = "default_tool_breaks"},
groups = {axe = 1}
}) })
-- --
@ -305,8 +320,8 @@ minetest.register_tool("default:sword_wood", {
}, },
damage_groups = {fleshy=2}, damage_groups = {fleshy=2},
}, },
groups = {flammable = 2},
sound = {breaks = "default_tool_breaks"}, sound = {breaks = "default_tool_breaks"},
groups = {sword = 1, flammable = 2}
}) })
minetest.register_tool("default:sword_stone", { minetest.register_tool("default:sword_stone", {
@ -321,6 +336,7 @@ minetest.register_tool("default:sword_stone", {
damage_groups = {fleshy=4}, damage_groups = {fleshy=4},
}, },
sound = {breaks = "default_tool_breaks"}, sound = {breaks = "default_tool_breaks"},
groups = {sword = 1}
}) })
minetest.register_tool("default:sword_bronze", { minetest.register_tool("default:sword_bronze", {
@ -335,6 +351,7 @@ minetest.register_tool("default:sword_bronze", {
damage_groups = {fleshy=6}, damage_groups = {fleshy=6},
}, },
sound = {breaks = "default_tool_breaks"}, sound = {breaks = "default_tool_breaks"},
groups = {sword = 1}
}) })
minetest.register_tool("default:sword_steel", { minetest.register_tool("default:sword_steel", {
@ -349,6 +366,7 @@ minetest.register_tool("default:sword_steel", {
damage_groups = {fleshy=6}, damage_groups = {fleshy=6},
}, },
sound = {breaks = "default_tool_breaks"}, sound = {breaks = "default_tool_breaks"},
groups = {sword = 1}
}) })
minetest.register_tool("default:sword_mese", { minetest.register_tool("default:sword_mese", {
@ -363,6 +381,7 @@ minetest.register_tool("default:sword_mese", {
damage_groups = {fleshy=7}, damage_groups = {fleshy=7},
}, },
sound = {breaks = "default_tool_breaks"}, sound = {breaks = "default_tool_breaks"},
groups = {sword = 1}
}) })
minetest.register_tool("default:sword_diamond", { minetest.register_tool("default:sword_diamond", {
@ -377,6 +396,7 @@ minetest.register_tool("default:sword_diamond", {
damage_groups = {fleshy=8}, damage_groups = {fleshy=8},
}, },
sound = {breaks = "default_tool_breaks"}, sound = {breaks = "default_tool_breaks"},
groups = {sword = 1}
}) })
minetest.register_tool("default:key", { minetest.register_tool("default:key", {

View File

@ -3,21 +3,23 @@ farming.register_hoe(":farming:hoe_wood", {
inventory_image = "farming_tool_woodhoe.png", inventory_image = "farming_tool_woodhoe.png",
max_uses = 30, max_uses = 30,
material = "group:wood", material = "group:wood",
groups = {flammable = 2}, groups = {hoe = 1, flammable = 2},
}) })
farming.register_hoe(":farming:hoe_stone", { farming.register_hoe(":farming:hoe_stone", {
description = "Stone Hoe", description = "Stone Hoe",
inventory_image = "farming_tool_stonehoe.png", inventory_image = "farming_tool_stonehoe.png",
max_uses = 90, max_uses = 90,
material = "group:stone" material = "group:stone",
groups = {hoe = 1}
}) })
farming.register_hoe(":farming:hoe_steel", { farming.register_hoe(":farming:hoe_steel", {
description = "Steel Hoe", description = "Steel Hoe",
inventory_image = "farming_tool_steelhoe.png", inventory_image = "farming_tool_steelhoe.png",
max_uses = 500, max_uses = 500,
material = "default:steel_ingot" material = "default:steel_ingot",
groups = {hoe = 1}
}) })
-- The following are deprecated by removing the 'material' field to prevent -- The following are deprecated by removing the 'material' field to prevent
@ -29,19 +31,19 @@ farming.register_hoe(":farming:hoe_bronze", {
description = "Bronze Hoe", description = "Bronze Hoe",
inventory_image = "farming_tool_bronzehoe.png", inventory_image = "farming_tool_bronzehoe.png",
max_uses = 220, max_uses = 220,
groups = {not_in_creative_inventory = 1}, groups = {hoe = 1, not_in_creative_inventory = 1},
}) })
farming.register_hoe(":farming:hoe_mese", { farming.register_hoe(":farming:hoe_mese", {
description = "Mese Hoe", description = "Mese Hoe",
inventory_image = "farming_tool_mesehoe.png", inventory_image = "farming_tool_mesehoe.png",
max_uses = 350, max_uses = 350,
groups = {not_in_creative_inventory = 1}, groups = {hoe = 1, not_in_creative_inventory = 1},
}) })
farming.register_hoe(":farming:hoe_diamond", { farming.register_hoe(":farming:hoe_diamond", {
description = "Diamond Hoe", description = "Diamond Hoe",
inventory_image = "farming_tool_diamondhoe.png", inventory_image = "farming_tool_diamondhoe.png",
max_uses = 500, max_uses = 500,
groups = {not_in_creative_inventory = 1}, groups = {hoe = 1, not_in_creative_inventory = 1},
}) })

View File

@ -189,7 +189,7 @@ minetest.register_node("flowers:mushroom_red", {
sunlight_propagates = true, sunlight_propagates = true,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
groups = {snappy = 3, attached_node = 1, flammable = 1}, groups = {mushroom = 1, snappy = 3, attached_node = 1, flammable = 1},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
on_use = minetest.item_eat(-5), on_use = minetest.item_eat(-5),
selection_box = { selection_box = {
@ -208,7 +208,7 @@ minetest.register_node("flowers:mushroom_brown", {
sunlight_propagates = true, sunlight_propagates = true,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
groups = {food_mushroom = 1, snappy = 3, attached_node = 1, flammable = 1}, groups = {mushroom = 1, food_mushroom = 1, snappy = 3, attached_node = 1, flammable = 1},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
on_use = minetest.item_eat(1), on_use = minetest.item_eat(1),
selection_box = { selection_box = {

View File

@ -146,6 +146,7 @@ end
minetest.register_tool("screwdriver:screwdriver", { minetest.register_tool("screwdriver:screwdriver", {
description = "Screwdriver (left-click rotates face, right-click rotates axis)", description = "Screwdriver (left-click rotates face, right-click rotates axis)",
inventory_image = "screwdriver.png", inventory_image = "screwdriver.png",
groups = {tool = 1},
on_use = function(itemstack, user, pointed_thing) on_use = function(itemstack, user, pointed_thing)
screwdriver.handler(itemstack, user, pointed_thing, screwdriver.ROTATE_FACE, 200) screwdriver.handler(itemstack, user, pointed_thing, screwdriver.ROTATE_FACE, 200)
return itemstack return itemstack