master #5

Merged
epCode merged 255 commits from VoxeLibre/VoxeLibre:master into master 2021-02-02 23:20:01 +01:00
1 changed files with 9 additions and 8 deletions
Showing only changes of commit 883056bbc2 - Show all commits

View File

@ -173,16 +173,16 @@ minetest.register_tool("mcl_tools:pick_diamond", {
}) })
local get_shovel_dig_group = function(itemstring) local get_shovel_dig_group = function(itemstring)
local def = minetest.registered_items[itemstring] local string_start = itemstring:sub(1, 21)
if itemstring == "mcl_tools:shovel_wood" then if string_start == "mcl_tools:shovel_wood" then
return "shovely_dig_wood" return "shovely_dig_wood"
elseif itemstring == "mcl_tools:shovel_stone" then elseif string_start == "mcl_tools:shovel_ston" then
return "shovely_dig_stone" return "shovely_dig_stone"
elseif itemstring == "mcl_tools:shovel_iron" then elseif string_start == "mcl_tools:shovel_iron" then
return "shovely_dig_iron" return "shovely_dig_iron"
elseif itemstring == "mcl_tools:shovel_gold" then elseif string_start == "mcl_tools:shovel_gold" then
return "shovely_dig_gold" return "shovely_dig_gold"
elseif itemstring == "mcl_tools:shovel_diamond" then elseif string_start == "mcl_tools:shovel_diam" then
return "shovely_dig_diamond" return "shovely_dig_diamond"
else else
-- Fallback -- Fallback
@ -218,8 +218,9 @@ local make_grass_path = function(itemstack, placer, pointed_thing)
local toolname = itemstack:get_name() local toolname = itemstack:get_name()
local def = minetest.registered_items[toolname] local def = minetest.registered_items[toolname]
local group = get_shovel_dig_group(toolname) local group = get_shovel_dig_group(toolname)
local base_uses = def.tool_capabilities.groupcaps[group].uses local toolcaps = itemstack:get_tool_capabilities()
local maxlevel = def.tool_capabilities.groupcaps[group].maxlevel local base_uses = toolcaps.groupcaps[group].uses
local maxlevel = toolcaps.groupcaps[group].maxlevel
local uses = base_uses * math.pow(3, maxlevel) local uses = base_uses * math.pow(3, maxlevel)
local wear = math.ceil(65535 / uses) local wear = math.ceil(65535 / uses)
itemstack:add_wear(wear) itemstack:add_wear(wear)