Add a bunch of helpful groups

This commit is contained in:
Wuzzy 2019-08-31 14:06:32 +02:00
parent 6ed057f3b4
commit b9cef3f784
9 changed files with 58 additions and 24 deletions

View File

@ -266,7 +266,7 @@ minetest.register_node(
wield_image = "bed_bed_inventory.png", wield_image = "bed_bed_inventory.png",
inventory_image = "bed_bed_inventory.png", inventory_image = "bed_bed_inventory.png",
tiles = {"bed_foot.png", "default_wood.png", "bed_side.png"}, tiles = {"bed_foot.png", "default_wood.png", "bed_side.png"},
groups = {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3}, groups = {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 1},
is_ground_content = false, is_ground_content = false,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
node_box = { node_box = {

View File

@ -1,13 +1,13 @@
local S = minetest.get_translator("default") local S = minetest.get_translator("default")
local filled_buckets = { local water_buckets = {
{ "water", S("Water Bucket"), "default_bucket_water.png", "default:water_source" }, { "water", S("Water Bucket"), "default_bucket_water.png", "default:water_source" },
{ "river_water", S("River Water Bucket"), "default_bucket_river_water.png", "default:river_water_source" }, { "river_water", S("River Water Bucket"), "default_bucket_river_water.png", "default:river_water_source" },
{ "swamp_water", S("Swamp Water Bucket"), "default_bucket_swamp_water.png", "default:swamp_water_source" }, { "swamp_water", S("Swamp Water Bucket"), "default_bucket_swamp_water.png", "default:swamp_water_source" },
} }
for b=1, #filled_buckets do for b=1, #water_buckets do
local bucket = filled_buckets[b] local bucket = water_buckets[b]
minetest.register_craftitem( minetest.register_craftitem(
"default:bucket_"..bucket[1], "default:bucket_"..bucket[1],
{ {
@ -16,6 +16,7 @@ for b=1, #filled_buckets do
stack_max = 1, stack_max = 1,
wield_scale = {x=1,y=1,z=2}, wield_scale = {x=1,y=1,z=2},
liquids_pointable = true, liquids_pointable = true,
groups = { bucket = 2, bucket_water = 1 },
on_place = function(itemstack, user, pointed_thing) on_place = function(itemstack, user, pointed_thing)
if pointed_thing.type ~= "node" then return end if pointed_thing.type ~= "node" then return end
@ -63,6 +64,7 @@ minetest.register_craftitem(
stack_max = 10, stack_max = 10,
wield_scale = {x=1,y=1,z=2}, wield_scale = {x=1,y=1,z=2},
liquids_pointable = true, liquids_pointable = true,
groups = { bucket = 1 },
on_use = function(itemstack, user, pointed_thing) on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type ~= "node" then return end if pointed_thing.type ~= "node" then return end

View File

@ -375,7 +375,7 @@ minetest.register_node(
{ {
description = S("Sandstone"), description = S("Sandstone"),
tiles = {"default_sandstone.png"}, tiles = {"default_sandstone.png"},
groups = {crumbly = 2, cracky = 3}, groups = {crumbly = 2, cracky = 3, sandstone = 1},
drop = "default:sand 2", drop = "default:sand 2",
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
}) })
@ -385,7 +385,7 @@ minetest.register_node(
{ {
description = S("Compressed Sandstone"), description = S("Compressed Sandstone"),
tiles = {"default_compressed_sandstone_top.png", "default_compressed_sandstone_top.png", "default_compressed_sandstone.png"}, tiles = {"default_compressed_sandstone_top.png", "default_compressed_sandstone_top.png", "default_compressed_sandstone.png"},
groups = {cracky = 2}, groups = {cracky = 2, sandstone = 1},
is_ground_content = false, is_ground_content = false,
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
}) })
@ -740,7 +740,7 @@ minetest.register_node(
tiles = {"default_glass_frame.png", "default_glass.png"}, tiles = {"default_glass_frame.png", "default_glass.png"},
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
groups = {snappy = 2,cracky = 3,oddly_breakable_by_hand = 2}, groups = {snappy = 2,cracky = 3,oddly_breakable_by_hand = 2, glass=1},
is_ground_content = false, is_ground_content = false,
sounds = default.node_sound_glass_defaults(), sounds = default.node_sound_glass_defaults(),
}) })
@ -858,7 +858,7 @@ minetest.register_node(
{ {
description = S("Wooden Planks"), description = S("Wooden Planks"),
tiles = {"default_wood.png"}, tiles = {"default_wood.png"},
groups = {planks = 1, snappy = 3, choppy = 3, oddly_breakable_by_hand = 3}, groups = {planks = 1, wood = 1, snappy = 3, choppy = 3, oddly_breakable_by_hand = 3},
is_ground_content = false, is_ground_content = false,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
}) })
@ -868,7 +868,7 @@ minetest.register_node(
{ {
description = S("Oak Planks"), description = S("Oak Planks"),
tiles = {"default_wood_oak.png"}, tiles = {"default_wood_oak.png"},
groups = {planks = 1, snappy = 2, choppy = 2, oddly_breakable_by_hand = 3}, groups = {planks = 1, wood = 1, snappy = 2, choppy = 2, oddly_breakable_by_hand = 3},
is_ground_content = false, is_ground_content = false,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
}) })
@ -878,7 +878,7 @@ minetest.register_node(
{ {
description = S("Birch Planks"), description = S("Birch Planks"),
tiles = {"default_wood_birch.png"}, tiles = {"default_wood_birch.png"},
groups = {planks = 1, snappy = 2, choppy = 2, oddly_breakable_by_hand = 2}, groups = {planks = 1, wood = 1, snappy = 2, choppy = 2, oddly_breakable_by_hand = 2},
is_ground_content = false, is_ground_content = false,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
}) })
@ -950,7 +950,7 @@ minetest.register_node(
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
floodable = true, floodable = true,
groups = {snappy = 2, dig_immediate = 3, attached_node = 1}, groups = {snappy = 2, dig_immediate = 3, attached_node = 1, flower = 1},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -1017,7 +1017,7 @@ minetest.register_node(
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
floodable = true, floodable = true,
groups = {snappy = 2, dig_immediate = 3, attached_node = 1, grass = 1}, groups = {snappy = 2, dig_immediate = 3, attached_node = 1, grass = 1, normal_grass = 1},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -1040,7 +1040,7 @@ minetest.register_node(
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
floodable = true, floodable = true,
groups = {snappy = 2, dig_immediate = 3, attached_node = 1, grass = 1}, groups = {snappy = 2, dig_immediate = 3, attached_node = 1, grass = 1, normal_grass = 1},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -1091,7 +1091,7 @@ minetest.register_node(
sunlight_propagates = true, sunlight_propagates = true,
walkable = false, walkable = false,
floodable = true, floodable = true,
groups = {fleshy = 3, dig_immediate = 2, leafdecay = 3, leafdecay_drop = 1, attached_node = 1}, groups = {fleshy = 3, dig_immediate = 2, leafdecay = 3, leafdecay_drop = 1, attached_node = 1, food = 2},
on_use = minetest.item_eat({hp = 2, sat = 10}), on_use = minetest.item_eat({hp = 2, sat = 10}),
sounds = default.node_sound_defaults(), sounds = default.node_sound_defaults(),
}) })
@ -1121,7 +1121,7 @@ minetest.register_node(
{items = {"default:pearl"}, rarity = 20}, {items = {"default:pearl"}, rarity = 20},
} }
}, },
groups = {fleshy = 3, oddly_breakable_by_hand = 2, choppy = 3, attached_node = 1}, groups = {fleshy = 3, oddly_breakable_by_hand = 2, choppy = 3, attached_node = 1, food = 2},
on_use = minetest.item_eat({hp = 4, sat = 40}), on_use = minetest.item_eat({hp = 4, sat = 40}),
sounds = default.node_sound_defaults(), sounds = default.node_sound_defaults(),
}) })

View File

@ -351,6 +351,7 @@ minetest.register_tool(
}, },
damage_groups = {fleshy = 2} damage_groups = {fleshy = 2}
}, },
groups = { pickaxe = 1 },
}) })
minetest.register_tool( minetest.register_tool(
@ -365,6 +366,7 @@ minetest.register_tool(
}, },
damage_groups = {fleshy = 3} damage_groups = {fleshy = 3}
}, },
groups = { pickaxe = 1 },
}) })
minetest.register_tool( minetest.register_tool(
@ -379,6 +381,7 @@ minetest.register_tool(
}, },
damage_groups = {fleshy = 4} damage_groups = {fleshy = 4}
}, },
groups = { pickaxe = 1 },
}) })
minetest.register_tool( minetest.register_tool(
@ -393,6 +396,7 @@ minetest.register_tool(
}, },
damage_groups = {fleshy = 5} damage_groups = {fleshy = 5}
}, },
groups = { pickaxe = 1 },
}) })
minetest.register_tool( minetest.register_tool(
@ -407,6 +411,7 @@ minetest.register_tool(
}, },
damage_groups = {fleshy = 5} damage_groups = {fleshy = 5}
}, },
groups = { pickaxe = 1 },
}) })
minetest.register_tool( minetest.register_tool(
@ -421,6 +426,7 @@ minetest.register_tool(
}, },
damage_groups = {fleshy = 5} damage_groups = {fleshy = 5}
}, },
groups = { pickaxe = 1 },
}) })
-- Shovels -- Shovels
@ -437,6 +443,7 @@ minetest.register_tool(
}, },
damage_groups = {fleshy = 2} damage_groups = {fleshy = 2}
}, },
groups = { shovel = 1 },
}) })
minetest.register_tool( minetest.register_tool(
@ -451,6 +458,7 @@ minetest.register_tool(
}, },
damage_groups = {fleshy = 3} damage_groups = {fleshy = 3}
}, },
groups = { shovel = 1 },
}) })
minetest.register_tool( minetest.register_tool(
@ -465,6 +473,7 @@ minetest.register_tool(
}, },
damage_groups = {fleshy = 4} damage_groups = {fleshy = 4}
}, },
groups = { shovel = 1 },
}) })
minetest.register_tool( minetest.register_tool(
@ -479,6 +488,7 @@ minetest.register_tool(
}, },
damage_groups = {fleshy = 5} damage_groups = {fleshy = 5}
}, },
groups = { shovel = 1 },
}) })
minetest.register_tool( minetest.register_tool(
@ -493,6 +503,7 @@ minetest.register_tool(
}, },
damage_groups = {fleshy = 5} damage_groups = {fleshy = 5}
}, },
groups = { shovel = 1 },
}) })
minetest.register_tool( minetest.register_tool(
@ -507,6 +518,7 @@ minetest.register_tool(
}, },
damage_groups = {fleshy = 5} damage_groups = {fleshy = 5}
}, },
groups = { shovel = 1 },
}) })
-- Axes -- Axes
@ -524,6 +536,7 @@ minetest.register_tool(
}, },
damage_groups = {fleshy = 3} damage_groups = {fleshy = 3}
}, },
groups = { axe = 1 },
}) })
minetest.register_tool( minetest.register_tool(
@ -539,6 +552,7 @@ minetest.register_tool(
}, },
damage_groups = {fleshy = 4} damage_groups = {fleshy = 4}
}, },
groups = { axe = 1 },
}) })
minetest.register_tool( minetest.register_tool(
@ -554,6 +568,7 @@ minetest.register_tool(
}, },
damage_groups = {fleshy = 5} damage_groups = {fleshy = 5}
}, },
groups = { axe = 1 },
}) })
minetest.register_tool( minetest.register_tool(
@ -569,6 +584,7 @@ minetest.register_tool(
}, },
damage_groups = {fleshy = 6} damage_groups = {fleshy = 6}
}, },
groups = { axe = 1 },
}) })
minetest.register_tool( minetest.register_tool(
@ -584,6 +600,7 @@ minetest.register_tool(
}, },
damage_groups = {fleshy = 6} damage_groups = {fleshy = 6}
}, },
groups = { axe = 1 },
}) })
minetest.register_tool( minetest.register_tool(
@ -599,6 +616,7 @@ minetest.register_tool(
}, },
damage_groups = {fleshy = 6} damage_groups = {fleshy = 6}
}, },
groups = { axe = 1 },
}) })
-- Spears -- Spears
@ -616,7 +634,8 @@ minetest.register_tool(
fleshy={times={[2]=1.10, [3]=0.60}, uses=10, maxlevel=1}, fleshy={times={[2]=1.10, [3]=0.60}, uses=10, maxlevel=1},
}, },
damage_groups = {fleshy = 4} damage_groups = {fleshy = 4}
} },
groups = { spear = 1 },
}) })
minetest.register_tool( minetest.register_tool(
@ -632,7 +651,8 @@ minetest.register_tool(
fleshy={times={[2]=0.80, [3]=0.40}, uses=20, maxlevel=1}, fleshy={times={[2]=0.80, [3]=0.40}, uses=20, maxlevel=1},
}, },
damage_groups = {fleshy = 5} damage_groups = {fleshy = 5}
} },
groups = { spear = 1 },
}) })
minetest.register_tool( minetest.register_tool(
@ -648,7 +668,8 @@ minetest.register_tool(
fleshy={times={[1]=2.00, [2]=0.80, [3]=0.40}, uses=15, maxlevel=2}, fleshy={times={[1]=2.00, [2]=0.80, [3]=0.40}, uses=15, maxlevel=2},
}, },
damage_groups = {fleshy = 6} damage_groups = {fleshy = 6}
} },
groups = { spear = 1 },
}) })
minetest.register_tool( minetest.register_tool(
@ -664,7 +685,8 @@ minetest.register_tool(
fleshy={times={[1]=2.00, [2]=0.80, [3]=0.40}, uses=30, maxlevel=2}, fleshy={times={[1]=2.00, [2]=0.80, [3]=0.40}, uses=30, maxlevel=2},
}, },
damage_groups = {fleshy = 10} damage_groups = {fleshy = 10}
} },
groups = { spear = 1 },
}) })
minetest.register_tool( minetest.register_tool(
@ -680,7 +702,8 @@ minetest.register_tool(
fleshy={times={[1]=2.00, [2]=0.80, [3]=0.40}, uses=40, maxlevel=2}, fleshy={times={[1]=2.00, [2]=0.80, [3]=0.40}, uses=40, maxlevel=2},
}, },
damage_groups = {fleshy = 10} damage_groups = {fleshy = 10}
} },
groups = { spear = 1 },
}) })
minetest.register_tool( minetest.register_tool(
@ -696,7 +719,8 @@ minetest.register_tool(
fleshy={times={[1]=2.00, [2]=0.80, [3]=0.40}, uses=30, maxlevel=2}, fleshy={times={[1]=2.00, [2]=0.80, [3]=0.40}, uses=30, maxlevel=2},
}, },
damage_groups = {fleshy = 10} damage_groups = {fleshy = 10}
} },
groups = { spear = 1 },
}) })
-- Broadsword -- Broadsword
@ -711,7 +735,8 @@ minetest.register_tool(
tool_capabilities = { tool_capabilities = {
full_punch_interval = 4.0, full_punch_interval = 4.0,
damage_groups = {fleshy = 12} damage_groups = {fleshy = 12}
} },
groups = { sword = 1 },
}) })
-- Other -- Other
@ -721,6 +746,7 @@ minetest.register_tool(
{ {
description = S("Wrought Iron Shears"), description = S("Wrought Iron Shears"),
inventory_image = "default_shears.png", inventory_image = "default_shears.png",
groups = { shears = 1 },
}) })
minetest.register_tool( minetest.register_tool(

View File

@ -27,7 +27,7 @@ local function register_torch(subname, description, tiles, overlay_tiles, overla
wall_bottom = {-2/16, -0.5, -2/16, 2/16, 0, 2/16}, wall_bottom = {-2/16, -0.5, -2/16, 2/16, 0, 2/16},
wall_side = {-0.5, -8/16, -2/16, -0.5+4/16, 0, 2/16}, wall_side = {-0.5, -8/16, -2/16, -0.5+4/16, 0, 2/16},
}, },
groups = {choppy = 2, dig_immediate = 3, attached_node = 1}, groups = {choppy = 2, dig_immediate = 3, attached_node = 1, torch = 1},
is_ground_content = false, is_ground_content = false,
sounds = default.node_sound_defaults(), sounds = default.node_sound_defaults(),
on_construct = function(pos) on_construct = function(pos)
@ -103,7 +103,7 @@ local function register_torch(subname, description, tiles, overlay_tiles, overla
wall_side = {-0.5, -8/16, -2/16, -0.5+4/16, 0, 2/16}, wall_side = {-0.5, -8/16, -2/16, -0.5+4/16, 0, 2/16},
}, },
drop = "default:"..subname, drop = "default:"..subname,
groups = {choppy = 2, dig_immediate = 3, attached_node = 1, not_in_creative_inventory = 1}, groups = {choppy = 2, dig_immediate = 3, attached_node = 1, not_in_creative_inventory = 1, torch = 2},
is_ground_content = false, is_ground_content = false,
sounds = default.node_sound_defaults(), sounds = default.node_sound_defaults(),
}) })

View File

@ -31,6 +31,7 @@ minetest.register_craftitem(
{ {
description = S("Bread"), description = S("Bread"),
inventory_image = "farming_bread.png", inventory_image = "farming_bread.png",
groups = { food = 2 },
on_use = minetest.item_eat({hp = 4, sat = 40}) on_use = minetest.item_eat({hp = 4, sat = 40})
}) })

View File

@ -1523,6 +1523,7 @@ function mobs:register_egg(mob, desc, background)
{ {
description = desc, description = desc,
inventory_image = invimg, inventory_image = invimg,
groups = { spawn_egg = 1 },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
local pos = pointed_thing.above local pos = pointed_thing.above
if pointed_thing.above if pointed_thing.above

View File

@ -23,6 +23,7 @@ minetest.register_craftitem(
{ {
description = S("Raw Meat"), description = S("Raw Meat"),
inventory_image = "mobs_meat_raw.png", inventory_image = "mobs_meat_raw.png",
groups = { food = 2 },
on_use = minetest.item_eat({hp = 3, sat = 30}), on_use = minetest.item_eat({hp = 3, sat = 30}),
}) })
@ -33,6 +34,7 @@ minetest.register_craftitem(
{ {
description = S("Cooked Meat"), description = S("Cooked Meat"),
inventory_image = "mobs_meat_cooked.png", inventory_image = "mobs_meat_cooked.png",
groups = { food = 2 },
on_use = minetest.item_eat({hp = 7, sat = 70}), on_use = minetest.item_eat({hp = 7, sat = 70}),
}) })

View File

@ -83,6 +83,7 @@ minetest.register_craftitem(
{ {
description = S("Raw Porkchop"), description = S("Raw Porkchop"),
inventory_image = "mobs_pork_raw.png", inventory_image = "mobs_pork_raw.png",
groups = { food = 2 },
on_use = minetest.item_eat({hp = 4, sat = 30}), on_use = minetest.item_eat({hp = 4, sat = 30}),
}) })
@ -93,6 +94,7 @@ minetest.register_craftitem(
{ {
description = S("Cooked Porkchop"), description = S("Cooked Porkchop"),
inventory_image = "mobs_pork_cooked.png", inventory_image = "mobs_pork_cooked.png",
groups = { food = 2 },
on_use = minetest.item_eat({hp = 8, sat = 50}), on_use = minetest.item_eat({hp = 8, sat = 50}),
}) })