1
0
Fork 0

First steps to implement MC-like digging times

This involves MASSIVE hacks around the digging system in Minetest.
Implemented so far: Hardness, nodes in mcl_core, digging for nodes
diggable by pickaxe, shovel, axe.
Not implemented: Nodes diggable by hand alone (except insta-dig),
shears and sword.
objects
Wuzzy 2017-02-25 16:19:24 +01:00
parent d3b3c596bd
commit 4ecef7b411
3 changed files with 175 additions and 115 deletions

View File

@ -1,17 +1,67 @@
-- Automatically assign the “solid” group for solid nodes
local overwrite = function()
local materials = { "wood", "gold", "stone", "iron", "diamond" }
local material_divisors = { 2, 12, 4, 6, 8 }
local basegroups = { "pickaxey", "axey", "shovely" }
local minigroups = { "handy", "shearsy", "swordy" }
for nname, ndef in pairs(minetest.registered_nodes) do
if (nname ~= "ignore")
and (ndef.walkable == nil or ndef.walkable == true)
and (ndef.collision_box == nil or ndef.collision_box.type == "regular")
and (ndef.node_box == nil or ndef.node_box.type == "regular")
and (ndef.groups.falling_node == 0 or ndef.groups.falling_node == nil)
and (ndef.groups.not_solid == 0 or ndef.groups.not_solid == nil) then
local groups = table.copy(ndef.groups)
groups.solid = 1
minetest.override_item(nname, {
groups = groups
})
local groups_changed = false
local newgroups = table.copy(ndef.groups)
if (nname ~= "ignore") then
-- Automatically assign the “solid” group for solid nodes
if (ndef.walkable == nil or ndef.walkable == true)
and (ndef.collision_box == nil or ndef.collision_box.type == "regular")
and (ndef.node_box == nil or ndef.node_box.type == "regular")
and (ndef.groups.falling_node == 0 or ndef.groups.falling_node == nil)
and (ndef.groups.not_solid == 0 or ndef.groups.not_solid == nil) then
newgroups.solid = 1
groups_changed = true
end
-- Hack in digging times
local hardness = ndef._mcl_hardness
if not hardness then
hardness = 0
end
-- Handle pickaxey, axey and shovely, and also handy indirectly
for _, basegroup in pairs(basegroups) do
if (hardness ~= -1 and ndef.groups[basegroup]) then
for g=1,#materials do
local diggroup = basegroup.."_dig_"..materials[g]
local time, validity_factor
if g >= ndef.groups[basegroup] then
-- Valid tool
validity_factor = 1.5
else
-- Wrong tool (higher digging time)
validity_factor = 5
end
time = (hardness * validity_factor) / material_divisors[g]
if time <= 0.05 then
time = 1
else
time = math.ceil(time * 20)
end
newgroups[diggroup] = time
groups_changed = true
end
if not ndef.groups.handy then
local time = hardness * 5
if time <= 0.05 then
time = 1
else
time = math.ceil(time * 20)
end
newgroups.handy_dig = time
end
end
end
if groups_changed then
minetest.override_item(nname, {
groups = newgroups
})
end
end
end
end

View File

@ -17,7 +17,7 @@ minetest.register_node("mcl_core:barrier", {
stack_max = 64,
sunlight_propagates = true,
is_ground_content = false,
groups = { not_in_creative_inventory = 1, oddly_breakable_by_hand = 5, not_solid = 1 },
groups = {creative_breakable=1, not_in_creative_inventory = 1, not_solid = 1 },
on_blast = function() end,
drop = "",
_mcl_blast_resistance = 18000003,
@ -65,7 +65,7 @@ minetest.register_node("mcl_core:stone", {
tiles = {"default_stone.png"},
is_ground_content = true,
stack_max = 64,
groups = {cracky=3, stone=1, building_block=1, deco_block=1},
groups = {pickaxey=1, stone=1, building_block=1, deco_block=1},
drop = 'mcl_core:cobble',
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 30,
@ -77,7 +77,7 @@ minetest.register_node("mcl_core:stone_with_coal", {
tiles = {"default_stone.png^default_mineral_coal.png"},
is_ground_content = true,
stack_max = 64,
groups = {cracky=3, building_block=1},
groups = {pickaxey=1, building_block=1},
drop = 'mcl_core:coal_lump',
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 15,
@ -89,7 +89,7 @@ minetest.register_node("mcl_core:stone_with_iron", {
tiles = {"default_stone.png^default_mineral_iron.png"},
is_ground_content = true,
stack_max = 64,
groups = {cracky=2, building_block=1},
groups = {pickaxey=3, building_block=1},
drop = 'mcl_core:stone_with_iron',
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 15,
@ -102,7 +102,7 @@ minetest.register_node("mcl_core:stone_with_gold", {
tiles = {"default_stone.png^default_mineral_gold.png"},
is_ground_content = true,
stack_max = 64,
groups = {cracky=2, building_block=1},
groups = {pickaxey=4, building_block=1},
drop = "mcl_core:stone_with_gold",
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 15,
@ -120,7 +120,7 @@ minetest.register_node("mcl_core:stone_with_redstone", {
tiles = {"default_stone.png^default_mineral_redstone.png"},
is_ground_content = true,
stack_max = 64,
groups = {cracky=2, building_block=1},
groups = {pickaxey=4, building_block=1},
drop = {
items = {
max_items = 1,
@ -152,7 +152,7 @@ minetest.register_node("mcl_core:stone_with_redstone_lit", {
light_source = 9,
is_ground_content = true,
stack_max = 64,
groups = {cracky=2, not_in_creative_inventory=1},
groups = {pickaxey=4, not_in_creative_inventory=1},
drop = {
items = {
max_items = 1,
@ -182,7 +182,7 @@ minetest.register_node("mcl_core:stone_with_lapis", {
tiles = {"default_stone.png^default_mineral_lapis.png"},
is_ground_content = true,
stack_max = 64,
groups = {cracky=2, building_block=1},
groups = {pickaxey=3, building_block=1},
drop = {
max_items = 1,
items = {
@ -203,7 +203,7 @@ minetest.register_node("mcl_core:stone_with_emerald", {
tiles = {"default_stone.png^default_mineral_emerald.png"},
is_ground_content = true,
stack_max = 64,
groups = {cracky=2, building_block=1},
groups = {pickaxey=4, building_block=1},
drop = "mcl_core:emerald",
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 15,
@ -215,7 +215,7 @@ minetest.register_node("mcl_core:stone_with_diamond", {
tiles = {"default_stone.png^default_mineral_diamond.png"},
is_ground_content = true,
stack_max = 64,
groups = {cracky=1, building_block=1},
groups = {pickaxey=4, building_block=1},
drop = "mcl_core:diamond",
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 15,
@ -226,7 +226,7 @@ minetest.register_node("mcl_core:stonebrick", {
description = "Stone Bricks",
tiles = {"default_stone_brick.png"},
stack_max = 64,
groups = {cracky=3, stone=1, stonebrick=1, building_block=1, deco_block=1},
groups = {pickaxey=1, stone=1, stonebrick=1, building_block=1, deco_block=1},
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 30,
_mcl_hardness = 1.5,
@ -237,7 +237,7 @@ minetest.register_node("mcl_core:stonebrickcarved", {
tiles = {"default_stonebrick_carved.png"},
is_ground_content = false,
stack_max = 64,
groups = {cracky=3, stone=1, stonebrick=1, building_block=1, deco_block=1},
groups = {pickaxey=1, stone=1, stonebrick=1, building_block=1, deco_block=1},
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 30,
_mcl_hardness = 1.5,
@ -248,7 +248,7 @@ minetest.register_node("mcl_core:stonebrickcracked", {
tiles = {"default_stonebrick_cracked.png"},
is_ground_content = false,
stack_max = 64,
groups = {cracky=3, stone=1, stonebrick=1, building_block=1, deco_block=1},
groups = {pickaxey=1, stone=1, stonebrick=1, building_block=1, deco_block=1},
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 30,
_mcl_hardness = 1.5,
@ -258,7 +258,7 @@ minetest.register_node("mcl_core:stonebrickmossy", {
description = "Mossy Stone Bricks",
tiles = {"default_stonebrick_mossy.png"},
stack_max = 64,
groups = {cracky=3, stone=1, stonebrick=1, building_block=1, deco_block=1},
groups = {pickaxey=1, stone=1, stonebrick=1, building_block=1, deco_block=1},
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 30,
_mcl_hardness = 1.5,
@ -269,7 +269,7 @@ minetest.register_node("mcl_core:granite", {
tiles = {"default_granite.png"},
is_ground_content = true,
stack_max = 64,
groups = {cracky=3, stone=1, building_block=1},
groups = {pickaxey=1, stone=1, building_block=1},
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 30,
_mcl_hardness = 1.5,
@ -279,7 +279,7 @@ minetest.register_node("mcl_core:granite_smooth", {
description = "Polished Granite",
tiles = {"default_granite_smooth.png"},
stack_max = 64,
groups = {cracky=3, stone=1, building_block=1},
groups = {pickaxey=1, stone=1, building_block=1},
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 30,
_mcl_hardness = 1.5,
@ -290,7 +290,7 @@ minetest.register_node("mcl_core:andesite", {
tiles = {"default_andesite.png"},
is_ground_content = true,
stack_max = 64,
groups = {cracky=3, stone=1, building_block=1},
groups = {pickaxey=1, stone=1, building_block=1},
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 30,
_mcl_hardness = 1.5,
@ -300,7 +300,7 @@ minetest.register_node("mcl_core:andesite_smooth", {
description = "Polished Andesite",
tiles = {"default_andesite_smooth.png"},
stack_max = 64,
groups = {cracky=3, stone=1, building_block=1},
groups = {pickaxey=1, stone=1, building_block=1},
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 30,
_mcl_hardness = 1.5,
@ -311,7 +311,7 @@ minetest.register_node("mcl_core:diorite", {
tiles = {"default_diorite.png"},
is_ground_content = true,
stack_max = 64,
groups = {cracky=3, stone=1, building_block=1},
groups = {pickaxey=1, stone=1, building_block=1},
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 30,
_mcl_hardness = 1.5,
@ -321,7 +321,7 @@ minetest.register_node("mcl_core:diorite_smooth", {
description = "Polished Diorite",
tiles = {"default_diorite_smooth.png"},
stack_max = 64,
groups = {cracky=3, stone=1, building_block=1},
groups = {pickaxey=1, stone=1, building_block=1},
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 30,
_mcl_hardness = 1.5,
@ -332,7 +332,7 @@ minetest.register_node("mcl_core:dirt_with_grass", {
tiles = {"default_grass.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"},
is_ground_content = true,
stack_max = 64,
groups = {crumbly=3, soil=1, soil_sapling=2, soil_sugarcane=1, cultivatable=2, building_block=1},
groups = {handy=1,shovely=1, soil=1, soil_sapling=2, soil_sugarcane=1, cultivatable=2, building_block=1},
drop = 'mcl_core:dirt',
sounds = mcl_sounds.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4},
@ -355,7 +355,7 @@ minetest.register_node("mcl_core:grass_path", {
{-0.5, -0.5, -0.5, 0.5, 0.4375, 0.5},
}
},
groups = { crumbly=3, not_in_creative_inventory=1, },
groups = {handy=1,shovely=1, not_in_creative_inventory=1, },
sounds = mcl_sounds.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4},
}),
@ -369,7 +369,7 @@ minetest.register_node("mcl_core:mycelium", {
tiles = {"default_mycelium_top.png", "default_dirt.png", "default_mycelium_side.png"},
is_ground_content = true,
stack_max = 64,
groups = {crumbly=3, building_block=1},
groups = {handy=1,shovely=1, building_block=1},
drop = 'mcl_core:dirt',
sounds = mcl_sounds.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4},
@ -383,7 +383,7 @@ minetest.register_node("mcl_core:podzol", {
tiles = {"default_dirt_podzol_top.png", "default_dirt.png", "default_dirt_podzol_side.png"},
is_ground_content = true,
stack_max = 64,
groups = {crumbly=3, soil=1, soil_sapling=2, soil_sugarcane=1, building_block=1},
groups = {handy=1,shovely=3, soil=1, soil_sapling=2, soil_sugarcane=1, building_block=1},
drop = 'mcl_core:dirt',
sounds = mcl_sounds.node_sound_dirt_defaults(),
_mcl_blast_resistance = 2.5,
@ -395,7 +395,7 @@ minetest.register_node("mcl_core:dirt", {
tiles = {"default_dirt.png"},
is_ground_content = true,
stack_max = 64,
groups = {crumbly=3, soil=1, soil_sapling=2, soil_sugarcane=1, cultivatable=2, building_block=1},
groups = {handy=1,shovely=1, soil=1, soil_sapling=2, soil_sugarcane=1, cultivatable=2, building_block=1},
sounds = mcl_sounds.node_sound_dirt_defaults(),
_mcl_blast_resistance = 3,
_mcl_hardness = 0.5,
@ -406,7 +406,7 @@ minetest.register_node("mcl_core:coarse_dirt", {
tiles = {"default_coarse_dirt.png"},
is_ground_content = true,
stack_max = 64,
groups = {crumbly=3, soil=1, soil_sugarcane=1, cultivatable=1, building_block=1},
groups = {handy=1,shovely=1, soil=1, soil_sugarcane=1, cultivatable=1, building_block=1},
sounds = mcl_sounds.node_sound_dirt_defaults(),
_mcl_blast_resistance = 3,
_mcl_hardness = 0.5,
@ -417,7 +417,7 @@ minetest.register_node("mcl_core:gravel", {
tiles = {"default_gravel.png"},
is_ground_content = true,
stack_max = 64,
groups = {crumbly=2, falling_node=1, building_block=1},
groups = {handy=1,shovely=1, falling_node=1, building_block=1},
drop = {
max_items = 1,
items = {
@ -438,7 +438,7 @@ minetest.register_node("mcl_core:sand", {
tiles = {"default_sand.png"},
is_ground_content = true,
stack_max = 64,
groups = {crumbly=3, falling_node=1, sand=1, soil_sugarcane=1, building_block=1},
groups = {handy=1,shovely=1, falling_node=1, sand=1, soil_sugarcane=1, building_block=1},
sounds = mcl_sounds.node_sound_sand_defaults(),
_mcl_blast_resistance = 2.5,
_mcl_hardness = 0.5,
@ -449,7 +449,7 @@ minetest.register_node("mcl_core:sandstone", {
tiles = {"default_sandstone_top.png", "default_sandstone_bottom.png", "default_sandstone_normal.png"},
is_ground_content = true,
stack_max = 64,
groups = {crumbly=2,cracky=2,sandstone=1, building_block=1},
groups = {pickaxey=2, sandstone=1, building_block=1},
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 4,
_mcl_hardness = 0.8,
@ -460,7 +460,7 @@ minetest.register_node("mcl_core:sandstonesmooth", {
tiles = {"default_sandstone_top.png", "default_sandstone_bottom.png", "default_sandstone_smooth.png"},
is_ground_content = true,
stack_max = 64,
groups = {crumbly=2,cracky=2,sandstone=1, building_block=1},
groups = {pickaxey=1, sandstone=1, building_block=1},
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 4,
_mcl_hardness = 0.8,
@ -471,7 +471,7 @@ minetest.register_node("mcl_core:sandstonecarved", {
tiles = {"default_sandstone_top.png", "default_sandstone_bottom.png", "default_sandstone_carved.png"},
is_ground_content = true,
stack_max = 64,
groups = {crumbly=2,cracky=2,sandstone=1, building_block=1},
groups = {pickaxey=1, sandstone=1, building_block=1},
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 4,
_mcl_hardness = 0.8,
@ -484,7 +484,7 @@ minetest.register_node("mcl_core:redsand", {
tiles = {"default_red_sand.png"},
is_ground_content = true,
stack_max = 64,
groups = {crumbly=3, falling_node=1, sand=1, soil_sugarcane=1, building_block=1},
groups = {handy=1,shovely=1, falling_node=1, sand=1, soil_sugarcane=1, building_block=1},
sounds = mcl_sounds.node_sound_sand_defaults(),
_mcl_blast_resistance = 2.5,
_mcl_hardness = 0.5,
@ -495,7 +495,7 @@ minetest.register_node("mcl_core:redsandstone", {
tiles = {"default_redsandstone_top.png", "default_redsandstone_bottom.png", "default_redsandstone_normal.png"},
is_ground_content = true,
stack_max = 64,
groups = {crumbly=2,cracky=2,redsandstone=1, building_block=1},
groups = {pickaxey=1, redsandstone=1, building_block=1},
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 4,
_mcl_hardness = 0.8,
@ -506,7 +506,7 @@ minetest.register_node("mcl_core:redsandstonesmooth", {
tiles = {"default_redsandstone_top.png", "default_redsandstone_bottom.png", "default_redsandstone_smooth.png"},
is_ground_content = true,
stack_max = 64,
groups = {crumbly=2,cracky=2,redsandstone=1, building_block=1},
groups = {pickaxey=1, redsandstone=1, building_block=1},
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 4,
_mcl_hardness = 0.8,
@ -517,7 +517,7 @@ minetest.register_node("mcl_core:redsandstonecarved", {
tiles = {"default_redsandstone_top.png", "default_redsandstone_bottom.png", "default_redsandstone_carved.png"},
is_ground_content = true,
stack_max = 64,
groups = {crumbly=2,cracky=2,redsandstone=1, building_block=1},
groups = {pickaxey=1, redsandstone=1, building_block=1},
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 4,
_mcl_hardness = 0.8,
@ -531,7 +531,7 @@ minetest.register_node("mcl_core:clay", {
tiles = {"default_clay.png"},
is_ground_content = true,
stack_max = 64,
groups = {crumbly=3, building_block=1},
groups = {handy=1,shovely=1, building_block=1},
drop = 'mcl_core:clay_lump 4',
sounds = mcl_sounds.node_sound_dirt_defaults({
footstep = "",
@ -546,7 +546,7 @@ minetest.register_node("mcl_core:brick_block", {
tiles = {"default_brick.png"},
is_ground_content = false,
stack_max = 64,
groups = {cracky=3, building_block=1},
groups = {pickaxey=1, building_block=1},
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 30,
_mcl_hardness = 2,
@ -558,7 +558,7 @@ minetest.register_node("mcl_core:bone_block", {
is_ground_content = false,
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,
groups = {cracky=2, building_block=1},
groups = {pickaxey=1, building_block=1},
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 10,
_mcl_hardness = 2,
@ -574,7 +574,7 @@ minetest.register_node("mcl_core:tree", {
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,
stack_max = 64,
groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2, building_block=1},
groups = {handy=1,axey=1, tree=1, flammable=2, building_block=1},
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 10,
_mcl_hardness = 2,
@ -594,7 +594,7 @@ minetest.register_node("mcl_core:sapling", {
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
},
stack_max = 64,
groups = {sapling=1,dig_immediate=3,attached_node=1,dig_by_water=1,deco_block=1},
groups = {dig_immediate=3, sapling=1,attached_node=1,dig_by_water=1,deco_block=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 0,
_mcl_hardness = 0,
@ -607,7 +607,7 @@ minetest.register_node("mcl_core:leaves", {
tiles = {"default_leaves.png"},
paramtype = "light",
stack_max = 64,
groups = {snappy=3, leafdecay=3, flammable=2, leaves=1, deco_block=1},
groups = {handy=1,shearsy=1,swordy=1, leafdecay=3, flammable=2, leaves=1, deco_block=1},
drop = {
max_items = 1,
items = {
@ -633,7 +633,7 @@ minetest.register_node("mcl_core:wood", {
tiles = {"default_wood.png"},
stack_max = 64,
is_ground_content = false,
groups = {choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1,building_block=1},
groups = {handy=1,axey=2, flammable=3,wood=1,building_block=1},
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 15,
_mcl_hardness = 2,
@ -646,7 +646,7 @@ minetest.register_node("mcl_core:darktree", {
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,
stack_max = 64,
groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2,building_block=1},
groups = {handy=1,axey=1, tree=1,flammable=2,building_block=1},
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 10,
_mcl_hardness = 2,
@ -666,7 +666,7 @@ minetest.register_node("mcl_core:darksapling", {
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
},
stack_max = 64,
groups = {sapling=1,dig_immediate=3,attached_node=1,dig_by_water=1,deco_block=1},
groups = {dig_immediate=3, sapling=1,attached_node=1,dig_by_water=1,deco_block=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 0,
_mcl_hardness = 0,
@ -679,7 +679,7 @@ minetest.register_node("mcl_core:darkleaves", {
tiles = {"default_leaves_big_oak.png"},
paramtype = "light",
stack_max = 64,
groups = {snappy=3, leafdecay=3, flammable=2, leaves=1, deco_block=1},
groups = {handy=1,shearsy=1,swordy=1, leafdecay=3, flammable=2, leaves=1, deco_block=1},
drop = {
max_items = 1,
items = {
@ -705,7 +705,7 @@ minetest.register_node("mcl_core:darkwood", {
tiles = {"default_planks_big_oak.png"},
stack_max = 64,
is_ground_content = false,
groups = {choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1,building_block=1},
groups = {handy=1,axey=1, flammable=3,wood=1,building_block=1},
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 15,
_mcl_hardness = 2,
@ -741,7 +741,7 @@ minetest.register_node("mcl_core:jungletree", {
end
end
end,
groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2,building_block=1},
groups = {handy=1,axey=1, tree=1,flammable=2,building_block=1},
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 10,
_mcl_hardness = 2,
@ -752,7 +752,7 @@ minetest.register_node("mcl_core:junglewood", {
tiles = {"default_junglewood.png"},
stack_max = 64,
is_ground_content = false,
groups = {choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1,building_block=1},
groups = {handy=1,axey=1, flammable=3,wood=1,building_block=1},
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 15,
_mcl_hardness = 2,
@ -765,7 +765,7 @@ minetest.register_node("mcl_core:jungleleaves", {
tiles = {"default_jungleleaves.png"},
paramtype = "light",
stack_max = 64,
groups = {snappy=3, leafdecay=3, flammable=2, leaves=1, deco_block=1},
groups = {handy=1,shearsy=1,swordy=1, leafdecay=3, flammable=2, leaves=1, deco_block=1},
drop = {
max_items = 1,
items = {
@ -794,7 +794,7 @@ minetest.register_node("mcl_core:junglesapling", {
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
},
stack_max = 64,
groups = {sapling=1,dig_immediate=3,attached_node=1,dig_by_water=1,deco_block=1},
groups = {dig_immediate=3, sapling=1,attached_node=1,dig_by_water=1,deco_block=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 0,
_mcl_hardness = 0,
@ -809,7 +809,7 @@ minetest.register_node("mcl_core:acaciatree", {
stack_max = 64,
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,
groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2,building_block=1},
groups = {handy=1,axey=1, tree=1,flammable=2,building_block=1},
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 10,
_mcl_hardness = 2,
@ -820,7 +820,7 @@ minetest.register_node("mcl_core:acaciawood", {
tiles = {"default_acaciawood.png"},
stack_max = 64,
is_ground_content = false,
groups = {choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1,building_block=1},
groups = {handy=1,axey=1, flammable=3,wood=1,building_block=1},
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 15,
_mcl_hardness = 2,
@ -833,7 +833,7 @@ minetest.register_node("mcl_core:acacialeaves", {
tiles = {"default_acacialeaves.png"},
paramtype = "light",
stack_max = 64,
groups = {snappy=3, leafdecay=3, flammable=2, leaves=1, deco_block=1},
groups = {handy=1,shearsy=1,swordy=1, leafdecay=3, flammable=2, leaves=1, deco_block=1},
drop = {
max_items = 1,
items = {
@ -862,7 +862,7 @@ minetest.register_node("mcl_core:acaciasapling", {
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
},
stack_max = 64,
groups = {sapling=1,dig_immediate=3,attached_node=1,dig_by_water=1,deco_block=1},
groups = {dig_immediate=3, sapling=1,attached_node=1,dig_by_water=1,deco_block=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 0,
_mcl_hardness = 0,
@ -876,7 +876,7 @@ minetest.register_node("mcl_core:sprucetree", {
stack_max = 64,
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,
groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2,building_block=1},
groups = {handy=1,axey=1, tree=1,flammable=2,building_block=1},
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 10,
_mcl_hardness = 2,
@ -887,7 +887,7 @@ minetest.register_node("mcl_core:sprucewood", {
tiles = {"default_sprucewood.png"},
stack_max = 64,
is_ground_content = false,
groups = {choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1,building_block=1},
groups = {handy=1,axey=1, flammable=3,wood=1,building_block=1},
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 15,
_mcl_hardness = 2,
@ -900,7 +900,7 @@ minetest.register_node("mcl_core:spruceleaves", {
tiles = {"default_spruceleaves.png"},
paramtype = "light",
stack_max = 64,
groups = {snappy=3, leafdecay=3, flammable=2, leaves=1, deco_block=1},
groups = {handy=1,shearsy=1,swordy=1, leafdecay=3, flammable=2, leaves=1, deco_block=1},
drop = {
max_items = 1,
items = {
@ -935,7 +935,7 @@ minetest.register_node("mcl_core:sprucesapling", {
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
},
stack_max = 64,
groups = {sapling=1,dig_immediate=3,attached_node=1,dig_by_water=1,deco_block=1},
groups = {dig_immediate=3, sapling=1,attached_node=1,dig_by_water=1,deco_block=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 0,
_mcl_hardness = 0,
@ -949,7 +949,7 @@ minetest.register_node("mcl_core:birchtree", {
stack_max = 64,
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,
groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2,building_block=1},
groups = {handy=1,axey=1, tree=1,flammable=2,building_block=1},
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 10,
_mcl_hardness = 2,
@ -960,7 +960,7 @@ minetest.register_node("mcl_core:birchwood", {
tiles = {"default_planks_birch.png"},
stack_max = 64,
is_ground_content = false,
groups = {choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1,building_block=1},
groups = {handy=1,axey=1, flammable=3,wood=1,building_block=1},
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 15,
_mcl_hardness = 2,
@ -973,7 +973,7 @@ minetest.register_node("mcl_core:birchleaves", {
tiles = {"default_leaves_birch.png"},
paramtype = "light",
stack_max = 64,
groups = {snappy=3, leafdecay=3, flammable=2, leaves=1, deco_block=1},
groups = {handy=1,shearsy=1,swordy=1, leafdecay=3, flammable=2, leaves=1, deco_block=1},
drop = {
max_items = 1,
items = {
@ -1003,7 +1003,7 @@ minetest.register_node("mcl_core:birchsapling", {
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
},
stack_max = 64,
groups = {sapling=1,dig_immediate=3,attached_node=1,dig_by_water=1,deco_block=1},
groups = {dig_immediate=3, sapling=1,attached_node=1,dig_by_water=1,deco_block=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 0,
_mcl_hardness = 0,
@ -1015,7 +1015,7 @@ minetest.register_node("mcl_core:cactus", {
tiles = {"default_cactus_top.png", "default_cactus_bottom.png", "default_cactus_side.png","default_cactus_side.png","default_cactus_side.png","default_cactus_side.png"},
is_ground_content = true,
stack_max = 64,
groups = {oddly_breakable_by_hand=2,deco_block=1},
groups = {handy=1, deco_block=1},
sounds = mcl_sounds.node_sound_wood_defaults(),
paramtype = "light",
node_box = {
@ -1064,7 +1064,7 @@ minetest.register_node("mcl_core:reeds", {
},
},
stack_max = 64,
groups = {dig_immediate=3,craftitem=1},
groups = {dig_immediate=3, craftitem=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 0,
_mcl_hardness = 0,
@ -1075,7 +1075,7 @@ minetest.register_node("mcl_core:bedrock", {
description = "Bedrock",
tiles = {"default_bedrock.png"},
stack_max = 64,
groups = {oddly_breakable_by_hand=5,building_block=1},
groups = {creative_breakable=1, building_block=1},
sounds = mcl_sounds.node_sound_stone_defaults(),
is_ground_content = false,
on_blast = function() end,
@ -1103,7 +1103,7 @@ minetest.register_node("mcl_core:slimeblock", {
stack_max = 64,
-- According to Minecraft Wiki, bouncing off a slime block from a height off 255 blocks should result in a bounce height of 50 blocks
-- bouncy=44 makes the player bounce up to 49.6. This value was chosen by experiment.
groups = {dig_immediate=3,bouncy=44,fall_damage_add_percent=-100,deco_block=1},
groups = {dig_immediate=3, bouncy=44,fall_damage_add_percent=-100,deco_block=1},
_mcl_blast_resistance = 0,
_mcl_hardness = 0,
})
@ -1116,7 +1116,7 @@ minetest.register_node("mcl_core:glass", {
paramtype = "light",
sunlight_propagates = true,
stack_max = 64,
groups = {cracky=3,oddly_breakable_by_hand=3,building_block=1},
groups = {handy=1, building_block=1},
sounds = mcl_sounds.node_sound_glass_defaults(),
drop = "",
_mcl_blast_resistance = 1.5,
@ -1159,7 +1159,7 @@ minetest.register_node("mcl_core:ladder", {
--wall_side = = <default>
},
stack_max = 64,
groups = {choppy=2,oddly_breakable_by_hand=3,deco_block=1},
groups = {handy=1,axey=1, deco_block=1},
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 2,
_mcl_hardness = 0.4,
@ -1182,7 +1182,7 @@ minetest.register_node("mcl_core:vine", {
type = "wallmounted",
},
stack_max = 64,
groups = {choppy=2,oddly_breakable_by_hand=3,flammable=2,deco_block=1},
groups = {handy=1,axey=1,shearsy=1,swordy=1, flammable=2,deco_block=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
drop = "",
after_dig_node = function(pos, oldnode, oldmetadata, user)
@ -1242,7 +1242,7 @@ minetest.register_node("mcl_core:water_flowing", {
liquid_range = 7,
freezemelt = "mcl_core:snow",
post_effect_color = {a=64, r=100, g=100, b=200},
groups = {water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1, freezes=1, melt_around=1},
groups = { water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1, freezes=1, melt_around=1},
_mcl_blast_resistance = 500,
_mcl_hardness = 100,
})
@ -1278,7 +1278,7 @@ minetest.register_node("mcl_core:water_source", {
freezemelt = "mcl_core:ice",
post_effect_color = {a=64, r=100, g=100, b=200},
stack_max = 64,
groups = {water=3, liquid=3, puts_out_fire=1, freezes=1, not_in_creative_inventory=1},
groups = { water=3, liquid=3, puts_out_fire=1, freezes=1, not_in_creative_inventory=1},
_mcl_blast_resistance = 500,
_mcl_hardness = 100,
})
@ -1321,7 +1321,7 @@ minetest.register_node("mcl_core:lava_flowing", {
liquid_range = 4,
damage_per_second = 4*2,
post_effect_color = {a=192, r=255, g=64, b=0},
groups = {lava=3, liquid=2, igniter=3, destroys_items=1, not_in_creative_inventory=1},
groups = { lava=3, liquid=2, igniter=3, destroys_items=1, not_in_creative_inventory=1},
_mcl_blast_resistance = 500,
_mcl_hardness = 100,
})
@ -1359,7 +1359,7 @@ minetest.register_node("mcl_core:lava_source", {
damage_per_second = 4*2,
post_effect_color = {a=192, r=255, g=64, b=0},
stack_max = 64,
groups = {lava=3, liquid=2, igniter=3, destroys_items=1, not_in_creative_inventory=1},
groups = { lava=3, liquid=2, igniter=3, destroys_items=1, not_in_creative_inventory=1},
_mcl_blast_resistance = 500,
_mcl_hardness = 100,
})
@ -1369,7 +1369,7 @@ minetest.register_node("mcl_core:cobble", {
tiles = {"default_cobble.png"},
is_ground_content = true,
stack_max = 64,
groups = {cracky=3, stone=2, building_block=1, deco_block=1},
groups = {pickaxey=1, building_block=1, deco_block=1},
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 30,
_mcl_hardness = 2,
@ -1380,7 +1380,7 @@ minetest.register_node("mcl_core:mossycobble", {
tiles = {"default_mossycobble.png"},
is_ground_content = true,
stack_max = 64,
groups = {cracky=3, building_block=1},
groups = {pickaxey=1, building_block=1},
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 30,
_mcl_hardness = 2,
@ -1391,7 +1391,7 @@ minetest.register_node("mcl_core:coalblock", {
tiles = {"default_coal_block.png"},
is_ground_content = false,
stack_max = 64,
groups = {cracky=2, flammable=1, building_block=1},
groups = {pickaxey=1, flammable=1, building_block=1},
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 30,
_mcl_hardness = 5,
@ -1402,7 +1402,7 @@ minetest.register_node("mcl_core:ironblock", {
tiles = {"default_steel_block.png"},
is_ground_content = false,
stack_max = 64,
groups = {cracky=1,level=2,building_block=1},
groups = {pickaxey=2, building_block=1},
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 30,
_mcl_hardness = 5,
@ -1413,7 +1413,7 @@ minetest.register_node("mcl_core:goldblock", {
tiles = {"default_gold_block.png"},
is_ground_content = false,
stack_max = 64,
groups = {cracky=1,building_block=1},
groups = {pickaxey=4, building_block=1},
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 30,
_mcl_hardness = 5,
@ -1424,7 +1424,7 @@ minetest.register_node("mcl_core:diamondblock", {
tiles = {"default_diamond_block.png"},
is_ground_content = false,
stack_max = 64,
groups = {cracky=1,level=3,building_block=1},
groups = {pickaxey=4, building_block=1},
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 30,
_mcl_hardness = 5,
@ -1435,7 +1435,7 @@ minetest.register_node("mcl_core:lapisblock", {
tiles = {"default_lapis_block.png"},
is_ground_content = false,
stack_max = 64,
groups = {cracky=1,building_block=1},
groups = {pickaxey=3, building_block=1},
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 15,
_mcl_hardness = 3,
@ -1446,7 +1446,7 @@ minetest.register_node("mcl_core:emeraldblock", {
tiles = {"default_emerald_block.png"},
is_ground_content = false,
stack_max = 64,
groups = {cracky=1,building_block=1},
groups = {pickaxey=4, building_block=1},
sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 30,
_mcl_hardness = 5,
@ -1458,7 +1458,7 @@ minetest.register_node("mcl_core:obsidian", {
is_ground_content = true,
sounds = mcl_sounds.node_sound_stone_defaults(),
stack_max = 64,
groups = {cracky=4,level=2,oddly_breakable_by_hand=4,building_block=1},
groups = {pickaxey=5, building_block=1},
_mcl_blast_resistance = 6000,
_mcl_hardness = 50,
})
@ -1473,7 +1473,7 @@ minetest.register_node("mcl_core:deadbush", {
paramtype = "light",
walkable = false,
stack_max = 64,
groups = {dig_immediate=3,flammable=3,attached_node=1,dig_by_water=1,deco_block=1},
groups = {dig_immediate=3, flammable=3,attached_node=1,dig_by_water=1,deco_block=1},
drop = {
max_items = 1,
items = {
@ -1515,7 +1515,7 @@ minetest.register_node("mcl_core:tallgrass", {
walkable = false,
buildable_to = true,
is_ground_content = true,
groups = {flammable=3,attached_node=1,dig_immediate=3,dig_by_water=1,deco_block=1},
groups = {dig_immediate=3, flammable=3,attached_node=1,dig_by_water=1,deco_block=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
after_dig_node = function(pos, oldnode, oldmetadata, user)
local item = user:get_wielded_item()
@ -1535,7 +1535,7 @@ minetest.register_node("mcl_core:ice", {
paramtype = "light",
use_texture_alpha = true,
stack_max = 64,
groups = {cracky=3,oddly_breakable_by_hand=2,building_block=1},
groups = {handy=1,pickaxey=1, building_block=1},
drop = "",
sounds = mcl_sounds.node_sound_glass_defaults(),
_mcl_blast_resistance = 2.5,
@ -1550,7 +1550,7 @@ minetest.register_node("mcl_core:packed_ice", {
paramtype = "light",
use_texture_alpha = true,
stack_max = 64,
groups = {cracky=3,oddly_breakable_by_hand=2,building_block=1},
groups = {handy=1,pickaxey=1, building_block=1},
drop = "",
sounds = mcl_sounds.node_sound_glass_defaults(),
_mcl_blast_resistance = 2.5,
@ -1587,7 +1587,7 @@ for i=0,3 do
paramtype = "light",
use_texture_alpha = true,
stack_max = 64,
groups = {cracky=2, frosted_ice=1, not_in_creative_inventory=1},
groups = {handy=1, frosted_ice=1, not_in_creative_inventory=1},
drop = "",
sounds = mcl_sounds.node_sound_glass_defaults(),
on_construct = function(pos)
@ -1626,7 +1626,7 @@ minetest.register_node("mcl_core:snow", {
{-0.5, -0.5, -0.5, 0.5, -0.5+2/16, 0.5},
},
},
groups = {crumbly=3,falling_node=1,deco_block=1},
groups = {shovely=1, falling_node=1,deco_block=1},
sounds = mcl_sounds.node_sound_snow_defaults(),
drop = "mcl_throwing:snowball 2",
_mcl_blast_resistance = 0.5,
@ -1638,7 +1638,7 @@ minetest.register_node("mcl_core:snowblock", {
tiles = {"default_snow.png"},
is_ground_content = true,
stack_max = 64,
groups = {crumbly=3,building_block=1},
groups = {shovely=1, building_block=1},
sounds = mcl_sounds.node_sound_snow_defaults(),
drop = "mcl_throwing:snowball 4",
_mcl_blast_resistance = 1,
@ -1662,7 +1662,7 @@ minetest.register_node("mcl_core:cobweb", {
liquid_renewable = false,
liquid_range = 0,
walkable = false,
groups = {snappy=1,liquid=3,deco_block=1},
groups = {swordy=1,shearsy=1, deco_block=1},
drop = "mcl_mobitems:string",
_mcl_blast_resistance = 20,
_mcl_hardness = 4,

View File

@ -13,21 +13,31 @@
- 5: Diamond
]]
-- Table for tool digging times, everything from 0 to 250
-- Minecraft digging times are always multiples of 0.05
local tooltimes = {}
for i=1,5000 do
local time
if i == 1 then
time = 0
else
time = i*0.05
end
table.insert(tooltimes, time)
end
-- TODO: Add legacy support for Minetest Game groups like crumbly, snappy, cracky, etc. for all tools
-- The hand
local groupcaps
if minetest.setting_getbool("creative_mode") then
groupcaps = {
snappy = {times={[1]=0, [2]=0, [3]=0}, uses=0, maxlevel=255},
cracky = {times={[1]=0, [2]=0, [3]=0}, uses=0, maxlevel=255},
crumbly = {times={[1]=0, [2]=0, [3]=0}, uses=0, maxlevel=255},
choppy = {times={[1]=0, [2]=0, [3]=0}, uses=0, maxlevel=255},
oddly_breakable_by_hand = {times={[1]=0, [2]=0, [3]=0, [4]=0, [5]=0}, uses=0, maxlevel=255},
creative_breakable = {times={[1]=0}, uses=0},
}
else
groupcaps = {
crumbly = {times={[2]=3.00, [3]=0.70}, uses=0, maxlevel=1},
snappy = {times={[3]=0.40}, uses=0, maxlevel=1},
oddly_breakable_by_hand = {times={[0]=90.00,[1]=7.00,[2]=4.00,[3]=1.40,[4]=480.70,}, uses=0, maxlevel=5}
handy_dig = {times=tooltimes, uses=0},
}
end
minetest.register_item(":", {
@ -53,7 +63,7 @@ minetest.register_tool("mcl_core:pick_wood", {
full_punch_interval = 0.83333333,
max_drop_level=1,
groupcaps={
cracky = {times={[3]=1.60}, uses=10, maxlevel=1},
pickaxey_dig_wood = {times=tooltimes, uses=0},
},
damage_groups = {fleshy=2},
},
@ -68,7 +78,7 @@ minetest.register_tool("mcl_core:pick_stone", {
full_punch_interval = 0.83333333,
max_drop_level=3,
groupcaps={
cracky = {times={[2]=2.0, [3]=1.20}, uses=20, maxlevel=1},
pickaxey_dig_stone = {times=tooltimes, uses=0},
},
damage_groups = {fleshy=3},
},
@ -83,7 +93,7 @@ minetest.register_tool("mcl_core:pick_iron", {
full_punch_interval = 0.83333333,
max_drop_level=4,
groupcaps={
cracky = {times={[1]=4.00, [2]=1.60, [3]=0.80}, uses=20, maxlevel=2},
pickaxey_dig_iron = {times=tooltimes, uses=0},
},
damage_groups = {fleshy=4},
},
@ -98,7 +108,7 @@ minetest.register_tool("mcl_core:pick_gold", {
full_punch_interval = 0.83333333,
max_drop_level=2,
groupcaps={
cracky = {times={[2]=2.0, [3]=1.20}, uses=20, maxlevel=1},
pickaxey_dig_gold = {times=tooltimes, uses=0},
},
damage_groups = {fleshy=2},
},
@ -113,7 +123,7 @@ minetest.register_tool("mcl_core:pick_diamond", {
full_punch_interval = 0.83333333,
max_drop_level=5,
groupcaps={
cracky = {times={[1]=2.0, [2]=1.0, [3]=0.50,[4]=20.00 }, uses=30, maxlevel=4},
pickaxey_dig_diamond = {times=tooltimes, uses=0},
},
damage_groups = {fleshy=5},
},