From b9cef3f7840b5dd7af907cfbad3a592343dc85e3 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sat, 31 Aug 2019 14:06:32 +0200 Subject: [PATCH] Add a bunch of helpful groups --- mods/bed/init.lua | 2 +- mods/default/bucket.lua | 8 +++++--- mods/default/nodes.lua | 22 +++++++++++----------- mods/default/tools.lua | 40 +++++++++++++++++++++++++++++++++------- mods/default/torch.lua | 4 ++-- mods/farming/craft.lua | 1 + mods/mobs/api.lua | 1 + mods/mobs/crafts.lua | 2 ++ mods/mobs/mob_boar.lua | 2 ++ 9 files changed, 58 insertions(+), 24 deletions(-) diff --git a/mods/bed/init.lua b/mods/bed/init.lua index 430bba6..09c305a 100644 --- a/mods/bed/init.lua +++ b/mods/bed/init.lua @@ -266,7 +266,7 @@ minetest.register_node( wield_image = "bed_bed_inventory.png", inventory_image = "bed_bed_inventory.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, sounds = default.node_sound_wood_defaults(), node_box = { diff --git a/mods/default/bucket.lua b/mods/default/bucket.lua index a82f127..1d51b22 100644 --- a/mods/default/bucket.lua +++ b/mods/default/bucket.lua @@ -1,13 +1,13 @@ local S = minetest.get_translator("default") -local filled_buckets = { +local water_buckets = { { "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" }, { "swamp_water", S("Swamp Water Bucket"), "default_bucket_swamp_water.png", "default:swamp_water_source" }, } -for b=1, #filled_buckets do - local bucket = filled_buckets[b] +for b=1, #water_buckets do + local bucket = water_buckets[b] minetest.register_craftitem( "default:bucket_"..bucket[1], { @@ -16,6 +16,7 @@ for b=1, #filled_buckets do stack_max = 1, wield_scale = {x=1,y=1,z=2}, liquids_pointable = true, + groups = { bucket = 2, bucket_water = 1 }, on_place = function(itemstack, user, pointed_thing) if pointed_thing.type ~= "node" then return end @@ -63,6 +64,7 @@ minetest.register_craftitem( stack_max = 10, wield_scale = {x=1,y=1,z=2}, liquids_pointable = true, + groups = { bucket = 1 }, on_use = function(itemstack, user, pointed_thing) if pointed_thing.type ~= "node" then return end diff --git a/mods/default/nodes.lua b/mods/default/nodes.lua index d7bf230..0ef0336 100644 --- a/mods/default/nodes.lua +++ b/mods/default/nodes.lua @@ -375,7 +375,7 @@ minetest.register_node( { description = S("Sandstone"), tiles = {"default_sandstone.png"}, - groups = {crumbly = 2, cracky = 3}, + groups = {crumbly = 2, cracky = 3, sandstone = 1}, drop = "default:sand 2", sounds = default.node_sound_stone_defaults(), }) @@ -385,7 +385,7 @@ minetest.register_node( { description = S("Compressed Sandstone"), 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, sounds = default.node_sound_stone_defaults(), }) @@ -740,7 +740,7 @@ minetest.register_node( tiles = {"default_glass_frame.png", "default_glass.png"}, paramtype = "light", 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, sounds = default.node_sound_glass_defaults(), }) @@ -858,7 +858,7 @@ minetest.register_node( { description = S("Wooden Planks"), 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, sounds = default.node_sound_wood_defaults(), }) @@ -868,7 +868,7 @@ minetest.register_node( { description = S("Oak Planks"), 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, sounds = default.node_sound_wood_defaults(), }) @@ -878,7 +878,7 @@ minetest.register_node( { description = S("Birch Planks"), 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, sounds = default.node_sound_wood_defaults(), }) @@ -950,7 +950,7 @@ minetest.register_node( walkable = false, buildable_to = 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(), }) @@ -1017,7 +1017,7 @@ minetest.register_node( walkable = false, buildable_to = 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(), }) @@ -1040,7 +1040,7 @@ minetest.register_node( walkable = false, buildable_to = 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(), }) @@ -1091,7 +1091,7 @@ minetest.register_node( sunlight_propagates = true, walkable = false, 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}), sounds = default.node_sound_defaults(), }) @@ -1121,7 +1121,7 @@ minetest.register_node( {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}), sounds = default.node_sound_defaults(), }) diff --git a/mods/default/tools.lua b/mods/default/tools.lua index d23f523..30de559 100644 --- a/mods/default/tools.lua +++ b/mods/default/tools.lua @@ -351,6 +351,7 @@ minetest.register_tool( }, damage_groups = {fleshy = 2} }, + groups = { pickaxe = 1 }, }) minetest.register_tool( @@ -365,6 +366,7 @@ minetest.register_tool( }, damage_groups = {fleshy = 3} }, + groups = { pickaxe = 1 }, }) minetest.register_tool( @@ -379,6 +381,7 @@ minetest.register_tool( }, damage_groups = {fleshy = 4} }, + groups = { pickaxe = 1 }, }) minetest.register_tool( @@ -393,6 +396,7 @@ minetest.register_tool( }, damage_groups = {fleshy = 5} }, + groups = { pickaxe = 1 }, }) minetest.register_tool( @@ -407,6 +411,7 @@ minetest.register_tool( }, damage_groups = {fleshy = 5} }, + groups = { pickaxe = 1 }, }) minetest.register_tool( @@ -421,6 +426,7 @@ minetest.register_tool( }, damage_groups = {fleshy = 5} }, + groups = { pickaxe = 1 }, }) -- Shovels @@ -437,6 +443,7 @@ minetest.register_tool( }, damage_groups = {fleshy = 2} }, + groups = { shovel = 1 }, }) minetest.register_tool( @@ -451,6 +458,7 @@ minetest.register_tool( }, damage_groups = {fleshy = 3} }, + groups = { shovel = 1 }, }) minetest.register_tool( @@ -465,6 +473,7 @@ minetest.register_tool( }, damage_groups = {fleshy = 4} }, + groups = { shovel = 1 }, }) minetest.register_tool( @@ -479,6 +488,7 @@ minetest.register_tool( }, damage_groups = {fleshy = 5} }, + groups = { shovel = 1 }, }) minetest.register_tool( @@ -493,6 +503,7 @@ minetest.register_tool( }, damage_groups = {fleshy = 5} }, + groups = { shovel = 1 }, }) minetest.register_tool( @@ -507,6 +518,7 @@ minetest.register_tool( }, damage_groups = {fleshy = 5} }, + groups = { shovel = 1 }, }) -- Axes @@ -524,6 +536,7 @@ minetest.register_tool( }, damage_groups = {fleshy = 3} }, + groups = { axe = 1 }, }) minetest.register_tool( @@ -539,6 +552,7 @@ minetest.register_tool( }, damage_groups = {fleshy = 4} }, + groups = { axe = 1 }, }) minetest.register_tool( @@ -554,6 +568,7 @@ minetest.register_tool( }, damage_groups = {fleshy = 5} }, + groups = { axe = 1 }, }) minetest.register_tool( @@ -569,6 +584,7 @@ minetest.register_tool( }, damage_groups = {fleshy = 6} }, + groups = { axe = 1 }, }) minetest.register_tool( @@ -584,6 +600,7 @@ minetest.register_tool( }, damage_groups = {fleshy = 6} }, + groups = { axe = 1 }, }) minetest.register_tool( @@ -599,6 +616,7 @@ minetest.register_tool( }, damage_groups = {fleshy = 6} }, + groups = { axe = 1 }, }) -- Spears @@ -616,7 +634,8 @@ minetest.register_tool( fleshy={times={[2]=1.10, [3]=0.60}, uses=10, maxlevel=1}, }, damage_groups = {fleshy = 4} - } + }, + groups = { spear = 1 }, }) minetest.register_tool( @@ -632,7 +651,8 @@ minetest.register_tool( fleshy={times={[2]=0.80, [3]=0.40}, uses=20, maxlevel=1}, }, damage_groups = {fleshy = 5} - } + }, + groups = { spear = 1 }, }) 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}, }, damage_groups = {fleshy = 6} - } + }, + groups = { spear = 1 }, }) 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}, }, damage_groups = {fleshy = 10} - } + }, + groups = { spear = 1 }, }) 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}, }, damage_groups = {fleshy = 10} - } + }, + groups = { spear = 1 }, }) 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}, }, damage_groups = {fleshy = 10} - } + }, + groups = { spear = 1 }, }) -- Broadsword @@ -711,7 +735,8 @@ minetest.register_tool( tool_capabilities = { full_punch_interval = 4.0, damage_groups = {fleshy = 12} - } + }, + groups = { sword = 1 }, }) -- Other @@ -721,6 +746,7 @@ minetest.register_tool( { description = S("Wrought Iron Shears"), inventory_image = "default_shears.png", + groups = { shears = 1 }, }) minetest.register_tool( diff --git a/mods/default/torch.lua b/mods/default/torch.lua index d8b605f..d6cfb77 100644 --- a/mods/default/torch.lua +++ b/mods/default/torch.lua @@ -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_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, sounds = default.node_sound_defaults(), 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}, }, 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, sounds = default.node_sound_defaults(), }) diff --git a/mods/farming/craft.lua b/mods/farming/craft.lua index 74e02ba..6e2fd45 100644 --- a/mods/farming/craft.lua +++ b/mods/farming/craft.lua @@ -31,6 +31,7 @@ minetest.register_craftitem( { description = S("Bread"), inventory_image = "farming_bread.png", + groups = { food = 2 }, on_use = minetest.item_eat({hp = 4, sat = 40}) }) diff --git a/mods/mobs/api.lua b/mods/mobs/api.lua index 94a0e5a..f74031f 100644 --- a/mods/mobs/api.lua +++ b/mods/mobs/api.lua @@ -1523,6 +1523,7 @@ function mobs:register_egg(mob, desc, background) { description = desc, inventory_image = invimg, + groups = { spawn_egg = 1 }, on_place = function(itemstack, placer, pointed_thing) local pos = pointed_thing.above if pointed_thing.above diff --git a/mods/mobs/crafts.lua b/mods/mobs/crafts.lua index f54fbe1..32bd893 100644 --- a/mods/mobs/crafts.lua +++ b/mods/mobs/crafts.lua @@ -23,6 +23,7 @@ minetest.register_craftitem( { description = S("Raw Meat"), inventory_image = "mobs_meat_raw.png", + groups = { food = 2 }, on_use = minetest.item_eat({hp = 3, sat = 30}), }) @@ -33,6 +34,7 @@ minetest.register_craftitem( { description = S("Cooked Meat"), inventory_image = "mobs_meat_cooked.png", + groups = { food = 2 }, on_use = minetest.item_eat({hp = 7, sat = 70}), }) diff --git a/mods/mobs/mob_boar.lua b/mods/mobs/mob_boar.lua index 5a32cdc..33490ae 100644 --- a/mods/mobs/mob_boar.lua +++ b/mods/mobs/mob_boar.lua @@ -83,6 +83,7 @@ minetest.register_craftitem( { description = S("Raw Porkchop"), inventory_image = "mobs_pork_raw.png", + groups = { food = 2 }, on_use = minetest.item_eat({hp = 4, sat = 30}), }) @@ -93,6 +94,7 @@ minetest.register_craftitem( { description = S("Cooked Porkchop"), inventory_image = "mobs_pork_cooked.png", + groups = { food = 2 }, on_use = minetest.item_eat({hp = 8, sat = 50}), })