Tools to mcl_tools, way more efficient digging time definitions

This commit is contained in:
Wuzzy 2017-02-26 18:44:48 +01:00
parent 73308cea2b
commit 151c1e62ba
31 changed files with 421 additions and 390 deletions

View File

View File

@ -1,9 +1,21 @@
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" }
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" }
mcl_autogroup = {}
mcl_autogroup.digtimes = {}
for m=1, #materials do
for g=1, #basegroups do
mcl_autogroup.digtimes[basegroups[g].."_dig_"..materials[m]] = {}
end
end
for g=1, #minigroups do
mcl_autogroup.digtimes[minigroups[g].."_dig"] = {}
end
local overwrite = function()
for nname, ndef in pairs(minetest.registered_nodes) do
local groups_changed = false
local newgroups = table.copy(ndef.groups)
@ -40,19 +52,22 @@ local overwrite = function()
if time <= 0.05 then
time = 1
else
time = math.ceil(time * 20)
time = math.ceil(time * 20) / 20
end
newgroups[diggroup] = time
table.insert(mcl_autogroup.digtimes[diggroup], time)
newgroups[diggroup] = #mcl_autogroup.digtimes[diggroup]
groups_changed = true
end
if not ndef.groups.handy then
local time = hardness * 5
if time <= 0.05 then
time = 1
time = 0
else
time = math.ceil(time * 20)
time = math.ceil(time * 20) / 20
end
newgroups.handy_dig = time
table.insert(mcl_autogroup.digtimes.handy_dig, time)
newgroups.handy_dig = #mcl_autogroup.digtimes.handy_dig
groups_changed = true
end
end
end

View File

@ -1,4 +1,5 @@
mcl_core
mcl_tools
mcl_fire
mobs
mcl_tnt

View File

@ -16,7 +16,7 @@ mobs:register_mob("mobs_mc:pigman", {
mesh = "3d_armor_character.b3d",
textures = {{"Original_Zombiepig_Man_by_Fedora_P.png",
"3d_armor_trans.png",
minetest.registered_items["mcl_core:sword_gold"].inventory_image,
minetest.registered_items["mcl_tools:sword_gold"].inventory_image,
}},
makes_footstep_sound = true,
@ -39,7 +39,7 @@ mobs:register_mob("mobs_mc:pigman", {
chance = 40,
min = 1,
max = 1,},
{name = "mcl_core:sword_gold",
{name = "mcl_tools:sword_gold",
-- approximation to 8.5%
chance = 11,
min = 1,

View File

@ -164,240 +164,7 @@ minetest.register_craft({
}
})
minetest.register_craft({
output = 'mcl_core:pick_wood',
recipe = {
{'group:wood', 'group:wood', 'group:wood'},
{'', 'mcl_core:stick', ''},
{'', 'mcl_core:stick', ''},
}
})
minetest.register_craft({
output = 'mcl_core:pick_stone',
recipe = {
{'mcl_core:cobble', 'mcl_core:cobble', 'mcl_core:cobble'},
{'', 'mcl_core:stick', ''},
{'', 'mcl_core:stick', ''},
}
})
minetest.register_craft({
output = 'mcl_core:pick_iron',
recipe = {
{'mcl_core:iron_ingot', 'mcl_core:iron_ingot', 'mcl_core:iron_ingot'},
{'', 'mcl_core:stick', ''},
{'', 'mcl_core:stick', ''},
}
})
minetest.register_craft({
output = 'mcl_core:pick_gold',
recipe = {
{'mcl_core:gold_ingot', 'mcl_core:gold_ingot', 'mcl_core:gold_ingot'},
{'', 'mcl_core:stick', ''},
{'', 'mcl_core:stick', ''},
}
})
minetest.register_craft({
output = 'mcl_core:pick_diamond',
recipe = {
{'mcl_core:diamond', 'mcl_core:diamond', 'mcl_core:diamond'},
{'', 'mcl_core:stick', ''},
{'', 'mcl_core:stick', ''},
}
})
minetest.register_craft({
output = 'mcl_core:shovel_wood',
recipe = {
{'group:wood'},
{'mcl_core:stick'},
{'mcl_core:stick'},
}
})
minetest.register_craft({
output = 'mcl_core:shovel_stone',
recipe = {
{'mcl_core:cobble'},
{'mcl_core:stick'},
{'mcl_core:stick'},
}
})
minetest.register_craft({
output = 'mcl_core:shovel_iron',
recipe = {
{'mcl_core:iron_ingot'},
{'mcl_core:stick'},
{'mcl_core:stick'},
}
})
minetest.register_craft({
output = 'mcl_core:shovel_gold',
recipe = {
{'mcl_core:gold_ingot'},
{'mcl_core:stick'},
{'mcl_core:stick'},
}
})
minetest.register_craft({
output = 'mcl_core:shovel_diamond',
recipe = {
{'mcl_core:diamond'},
{'mcl_core:stick'},
{'mcl_core:stick'},
}
})
minetest.register_craft({
output = 'mcl_core:axe_wood',
recipe = {
{'group:wood', 'group:wood'},
{'group:wood', 'mcl_core:stick'},
{'', 'mcl_core:stick'},
}
})
minetest.register_craft({
output = 'mcl_core:axe_wood',
recipe = {
{'group:wood', 'group:wood'},
{'mcl_core:stick', 'group:wood'},
{'mcl_core:stick', ''},
}
})
minetest.register_craft({
output = 'mcl_core:axe_stone',
recipe = {
{'mcl_core:cobble', 'mcl_core:cobble'},
{'mcl_core:cobble', 'mcl_core:stick'},
{'', 'mcl_core:stick'},
}
})
minetest.register_craft({
output = 'mcl_core:axe_stone',
recipe = {
{'mcl_core:cobble', 'mcl_core:cobble'},
{'mcl_core:stick', 'mcl_core:cobble'},
{'mcl_core:stick', ''},
}
})
minetest.register_craft({
output = 'mcl_core:axe_iron',
recipe = {
{'mcl_core:iron_ingot', 'mcl_core:iron_ingot'},
{'mcl_core:iron_ingot', 'mcl_core:stick'},
{'', 'mcl_core:stick'},
}
})
minetest.register_craft({
output = 'mcl_core:axe_iron',
recipe = {
{'mcl_core:iron_ingot', 'mcl_core:iron_ingot'},
{'mcl_core:stick', 'mcl_core:iron_ingot'},
{'mcl_core:stick', ''},
}
})
minetest.register_craft({
output = 'mcl_core:axe_gold',
recipe = {
{'mcl_core:gold_ingot', 'mcl_core:gold_ingot'},
{'mcl_core:gold_ingot', 'mcl_core:stick'},
{'', 'mcl_core:stick'},
}
})
minetest.register_craft({
output = 'mcl_core:axe_gold',
recipe = {
{'mcl_core:gold_ingot', 'mcl_core:gold_ingot'},
{'mcl_core:stick', 'mcl_core:gold_ingot'},
{'mcl_core:stick', ''},
}
})
minetest.register_craft({
output = 'mcl_core:axe_diamond',
recipe = {
{'mcl_core:diamond', 'mcl_core:diamond'},
{'mcl_core:diamond', 'mcl_core:stick'},
{'', 'mcl_core:stick'},
}
})
minetest.register_craft({
output = 'mcl_core:axe_diamond',
recipe = {
{'mcl_core:diamond', 'mcl_core:diamond'},
{'mcl_core:stick', 'mcl_core:diamond'},
{'mcl_core:stick', ''},
}
})
minetest.register_craft({
output = 'mcl_core:sword_wood',
recipe = {
{'group:wood'},
{'group:wood'},
{'mcl_core:stick'},
}
})
minetest.register_craft({
output = 'mcl_core:sword_stone',
recipe = {
{'mcl_core:cobble'},
{'mcl_core:cobble'},
{'mcl_core:stick'},
}
})
minetest.register_craft({
output = 'mcl_core:sword_iron',
recipe = {
{'mcl_core:iron_ingot'},
{'mcl_core:iron_ingot'},
{'mcl_core:stick'},
}
})
minetest.register_craft({
output = 'mcl_core:sword_gold',
recipe = {
{'mcl_core:gold_ingot'},
{'mcl_core:gold_ingot'},
{'mcl_core:stick'},
}
})
minetest.register_craft({
output = 'mcl_core:sword_diamond',
recipe = {
{'mcl_core:diamond'},
{'mcl_core:diamond'},
{'mcl_core:stick'},
}
})
minetest.register_craft({
output = 'mcl_core:shears',
recipe = {
{ 'mcl_core:iron_ingot', '' },
{ '', 'mcl_core:iron_ingot', },
}
})
minetest.register_craft({
output = 'mcl_core:shears',
recipe = {
{ '', 'mcl_core:iron_ingot', },
{ 'mcl_core:iron_ingot', '' },
}
})
minetest.register_craft({
output = 'mcl_core:coalblock',
@ -708,64 +475,6 @@ minetest.register_craft({
cooktime = 10,
})
minetest.register_craft({
type = "cooking",
output = "mcl_core:gold_nugget",
recipe = "mcl_core:sword_gold",
cooktime = 10,
})
minetest.register_craft({
type = "cooking",
output = "mcl_core:gold_nugget",
recipe = "mcl_core:axe_gold",
cooktime = 10,
})
minetest.register_craft({
type = "cooking",
output = "mcl_core:gold_nugget",
recipe = "mcl_core:shovel_gold",
cooktime = 10,
})
minetest.register_craft({
type = "cooking",
output = "mcl_core:gold_nugget",
recipe = "mcl_core:pick_gold",
cooktime = 10,
})
minetest.register_craft({
type = "cooking",
output = "mcl_core:iron_nugget",
recipe = "mcl_core:sword_iron",
cooktime = 10,
})
minetest.register_craft({
type = "cooking",
output = "mcl_core:iron_nugget",
recipe = "mcl_core:axe_iron",
cooktime = 10,
})
minetest.register_craft({
type = "cooking",
output = "mcl_core:iron_nugget",
recipe = "mcl_core:shovel_iron",
cooktime = 10,
})
minetest.register_craft({
type = "cooking",
output = "mcl_core:iron_nugget",
recipe = "mcl_core:pick_iron",
cooktime = 10,
})
--
-- Fuels
--
@ -812,29 +521,7 @@ minetest.register_craft({
burntime = 5,
})
minetest.register_craft({
type = "fuel",
recipe = "mcl_core:pick_wood",
burntime = 10,
})
minetest.register_craft({
type = "fuel",
recipe = "mcl_core:shovel_wood",
burntime = 10,
})
minetest.register_craft({
type = "fuel",
recipe = "mcl_core:sword_wood",
burntime = 10,
})
minetest.register_craft({
type = "fuel",
recipe = "mcl_core:axe_wood",
burntime = 10,
})
minetest.register_craft({
type = "fuel",

View File

@ -6,6 +6,5 @@ mcl_core.repair = 0.05
-- Load files
dofile(minetest.get_modpath("mcl_core").."/functions.lua")
dofile(minetest.get_modpath("mcl_core").."/nodes.lua")
dofile(minetest.get_modpath("mcl_core").."/tools.lua")
dofile(minetest.get_modpath("mcl_core").."/craftitems.lua")
dofile(minetest.get_modpath("mcl_core").."/crafting.lua")

View File

@ -0,0 +1,338 @@
minetest.register_craft({
output = 'mcl_tools:pick_wood',
recipe = {
{'group:wood', 'group:wood', 'group:wood'},
{'', 'mcl_tools:stick', ''},
{'', 'mcl_tools:stick', ''},
}
})
minetest.register_craft({
output = 'mcl_tools:pick_stone',
recipe = {
{'mcl_tools:cobble', 'mcl_tools:cobble', 'mcl_tools:cobble'},
{'', 'mcl_tools:stick', ''},
{'', 'mcl_tools:stick', ''},
}
})
minetest.register_craft({
output = 'mcl_tools:pick_iron',
recipe = {
{'mcl_tools:iron_ingot', 'mcl_tools:iron_ingot', 'mcl_tools:iron_ingot'},
{'', 'mcl_tools:stick', ''},
{'', 'mcl_tools:stick', ''},
}
})
minetest.register_craft({
output = 'mcl_tools:pick_gold',
recipe = {
{'mcl_tools:gold_ingot', 'mcl_tools:gold_ingot', 'mcl_tools:gold_ingot'},
{'', 'mcl_tools:stick', ''},
{'', 'mcl_tools:stick', ''},
}
})
minetest.register_craft({
output = 'mcl_tools:pick_diamond',
recipe = {
{'mcl_tools:diamond', 'mcl_tools:diamond', 'mcl_tools:diamond'},
{'', 'mcl_tools:stick', ''},
{'', 'mcl_tools:stick', ''},
}
})
minetest.register_craft({
output = 'mcl_tools:shovel_wood',
recipe = {
{'group:wood'},
{'mcl_tools:stick'},
{'mcl_tools:stick'},
}
})
minetest.register_craft({
output = 'mcl_tools:shovel_stone',
recipe = {
{'mcl_tools:cobble'},
{'mcl_tools:stick'},
{'mcl_tools:stick'},
}
})
minetest.register_craft({
output = 'mcl_tools:shovel_iron',
recipe = {
{'mcl_tools:iron_ingot'},
{'mcl_tools:stick'},
{'mcl_tools:stick'},
}
})
minetest.register_craft({
output = 'mcl_tools:shovel_gold',
recipe = {
{'mcl_tools:gold_ingot'},
{'mcl_tools:stick'},
{'mcl_tools:stick'},
}
})
minetest.register_craft({
output = 'mcl_tools:shovel_diamond',
recipe = {
{'mcl_tools:diamond'},
{'mcl_tools:stick'},
{'mcl_tools:stick'},
}
})
minetest.register_craft({
output = 'mcl_tools:axe_wood',
recipe = {
{'group:wood', 'group:wood'},
{'group:wood', 'mcl_tools:stick'},
{'', 'mcl_tools:stick'},
}
})
minetest.register_craft({
output = 'mcl_tools:axe_wood',
recipe = {
{'group:wood', 'group:wood'},
{'mcl_tools:stick', 'group:wood'},
{'mcl_tools:stick', ''},
}
})
minetest.register_craft({
output = 'mcl_tools:axe_stone',
recipe = {
{'mcl_tools:cobble', 'mcl_tools:cobble'},
{'mcl_tools:cobble', 'mcl_tools:stick'},
{'', 'mcl_tools:stick'},
}
})
minetest.register_craft({
output = 'mcl_tools:axe_stone',
recipe = {
{'mcl_tools:cobble', 'mcl_tools:cobble'},
{'mcl_tools:stick', 'mcl_tools:cobble'},
{'mcl_tools:stick', ''},
}
})
minetest.register_craft({
output = 'mcl_tools:axe_iron',
recipe = {
{'mcl_tools:iron_ingot', 'mcl_tools:iron_ingot'},
{'mcl_tools:iron_ingot', 'mcl_tools:stick'},
{'', 'mcl_tools:stick'},
}
})
minetest.register_craft({
output = 'mcl_tools:axe_iron',
recipe = {
{'mcl_tools:iron_ingot', 'mcl_tools:iron_ingot'},
{'mcl_tools:stick', 'mcl_tools:iron_ingot'},
{'mcl_tools:stick', ''},
}
})
minetest.register_craft({
output = 'mcl_tools:axe_gold',
recipe = {
{'mcl_tools:gold_ingot', 'mcl_tools:gold_ingot'},
{'mcl_tools:gold_ingot', 'mcl_tools:stick'},
{'', 'mcl_tools:stick'},
}
})
minetest.register_craft({
output = 'mcl_tools:axe_gold',
recipe = {
{'mcl_tools:gold_ingot', 'mcl_tools:gold_ingot'},
{'mcl_tools:stick', 'mcl_tools:gold_ingot'},
{'mcl_tools:stick', ''},
}
})
minetest.register_craft({
output = 'mcl_tools:axe_diamond',
recipe = {
{'mcl_tools:diamond', 'mcl_tools:diamond'},
{'mcl_tools:diamond', 'mcl_tools:stick'},
{'', 'mcl_tools:stick'},
}
})
minetest.register_craft({
output = 'mcl_tools:axe_diamond',
recipe = {
{'mcl_tools:diamond', 'mcl_tools:diamond'},
{'mcl_tools:stick', 'mcl_tools:diamond'},
{'mcl_tools:stick', ''},
}
})
minetest.register_craft({
output = 'mcl_tools:sword_wood',
recipe = {
{'group:wood'},
{'group:wood'},
{'mcl_tools:stick'},
}
})
minetest.register_craft({
output = 'mcl_tools:sword_stone',
recipe = {
{'mcl_tools:cobble'},
{'mcl_tools:cobble'},
{'mcl_tools:stick'},
}
})
minetest.register_craft({
output = 'mcl_tools:sword_iron',
recipe = {
{'mcl_tools:iron_ingot'},
{'mcl_tools:iron_ingot'},
{'mcl_tools:stick'},
}
})
minetest.register_craft({
output = 'mcl_tools:sword_gold',
recipe = {
{'mcl_tools:gold_ingot'},
{'mcl_tools:gold_ingot'},
{'mcl_tools:stick'},
}
})
minetest.register_craft({
output = 'mcl_tools:sword_diamond',
recipe = {
{'mcl_tools:diamond'},
{'mcl_tools:diamond'},
{'mcl_tools:stick'},
}
})
minetest.register_craft({
output = 'mcl_tools:shears',
recipe = {
{ 'mcl_tools:iron_ingot', '' },
{ '', 'mcl_tools:iron_ingot', },
}
})
minetest.register_craft({
output = 'mcl_tools:shears',
recipe = {
{ '', 'mcl_tools:iron_ingot', },
{ 'mcl_tools:iron_ingot', '' },
}
})
minetest.register_craft({
type = "fuel",
recipe = "mcl_tools:pick_wood",
burntime = 10,
})
minetest.register_craft({
type = "fuel",
recipe = "mcl_tools:shovel_wood",
burntime = 10,
})
minetest.register_craft({
type = "fuel",
recipe = "mcl_tools:sword_wood",
burntime = 10,
})
minetest.register_craft({
type = "fuel",
recipe = "mcl_tools:axe_wood",
burntime = 10,
})
minetest.register_craft({
type = "cooking",
output = "mcl_tools:gold_nugget",
recipe = "mcl_tools:sword_gold",
cooktime = 10,
})
minetest.register_craft({
type = "cooking",
output = "mcl_tools:gold_nugget",
recipe = "mcl_tools:axe_gold",
cooktime = 10,
})
minetest.register_craft({
type = "cooking",
output = "mcl_tools:gold_nugget",
recipe = "mcl_tools:shovel_gold",
cooktime = 10,
})
minetest.register_craft({
type = "cooking",
output = "mcl_tools:gold_nugget",
recipe = "mcl_tools:pick_gold",
cooktime = 10,
})
minetest.register_craft({
type = "cooking",
output = "mcl_tools:iron_nugget",
recipe = "mcl_tools:sword_iron",
cooktime = 10,
})
minetest.register_craft({
type = "cooking",
output = "mcl_tools:iron_nugget",
recipe = "mcl_tools:axe_iron",
cooktime = 10,
})
minetest.register_craft({
type = "cooking",
output = "mcl_tools:iron_nugget",
recipe = "mcl_tools:shovel_iron",
cooktime = 10,
})
minetest.register_craft({
type = "cooking",
output = "mcl_tools:iron_nugget",
recipe = "mcl_tools:pick_iron",
cooktime = 10,
})
minetest.register_craft({
type = "fuel",
recipe = "mcl_tools:pick_wood",
burntime = 10,
})
minetest.register_craft({
type = "fuel",
recipe = "mcl_tools:shovel_wood",
burntime = 10,
})
minetest.register_craft({
type = "fuel",
recipe = "mcl_tools:sword_wood",
burntime = 10,
})
minetest.register_craft({
type = "fuel",
recipe = "mcl_tools:axe_wood",
burntime = 10,
})

View File

@ -0,0 +1,2 @@
mcl_sounds
mcl_autogroup

View File

@ -13,19 +13,6 @@
- 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
@ -37,7 +24,7 @@ if minetest.setting_getbool("creative_mode") then
}
else
groupcaps = {
handy_dig = {times=tooltimes, uses=0},
handy_dig = {times=mcl_autogroup.digtimes.handy_dig, uses=0},
}
end
minetest.register_item(":", {
@ -54,7 +41,7 @@ minetest.register_item(":", {
})
-- Picks
minetest.register_tool("mcl_core:pick_wood", {
minetest.register_tool("mcl_tools:pick_wood", {
description = "Wooden Pickaxe",
inventory_image = "default_tool_woodpick.png",
groups = { tool=1 },
@ -63,13 +50,13 @@ minetest.register_tool("mcl_core:pick_wood", {
full_punch_interval = 0.83333333,
max_drop_level=1,
groupcaps={
pickaxey_dig_wood = {times=tooltimes, uses=0},
pickaxey_dig_wood = {times=mcl_autogroup.digtimes.pickaxey_dig_wood, uses=0},
},
damage_groups = {fleshy=2},
},
sound = { breaks = "default_tool_breaks" },
})
minetest.register_tool("mcl_core:pick_stone", {
minetest.register_tool("mcl_tools:pick_stone", {
description = "Stone Pickaxe",
inventory_image = "default_tool_stonepick.png",
groups = { tool=1 },
@ -78,13 +65,13 @@ minetest.register_tool("mcl_core:pick_stone", {
full_punch_interval = 0.83333333,
max_drop_level=3,
groupcaps={
pickaxey_dig_stone = {times=tooltimes, uses=0},
pickaxey_dig_stone = {times=mcl_autogroup.digtimes.pickaxey_dig_stone , uses=0},
},
damage_groups = {fleshy=3},
},
sound = { breaks = "default_tool_breaks" },
})
minetest.register_tool("mcl_core:pick_iron", {
minetest.register_tool("mcl_tools:pick_iron", {
description = "Iron Pickaxe",
inventory_image = "default_tool_steelpick.png",
groups = { tool=1 },
@ -93,13 +80,13 @@ minetest.register_tool("mcl_core:pick_iron", {
full_punch_interval = 0.83333333,
max_drop_level=4,
groupcaps={
pickaxey_dig_iron = {times=tooltimes, uses=0},
pickaxey_dig_iron = {times=mcl_autogroup.digtimes.pickaxey_dig_iron , uses=0},
},
damage_groups = {fleshy=4},
},
sound = { breaks = "default_tool_breaks" },
})
minetest.register_tool("mcl_core:pick_gold", {
minetest.register_tool("mcl_tools:pick_gold", {
description = "Golden Pickaxe",
inventory_image = "default_tool_goldpick.png",
groups = { tool=1 },
@ -108,13 +95,13 @@ minetest.register_tool("mcl_core:pick_gold", {
full_punch_interval = 0.83333333,
max_drop_level=2,
groupcaps={
pickaxey_dig_gold = {times=tooltimes, uses=0},
pickaxey_dig_gold = {times=mcl_autogroup.digtimes.pickaxey_dig_gold , uses=0},
},
damage_groups = {fleshy=2},
},
sound = { breaks = "default_tool_breaks" },
})
minetest.register_tool("mcl_core:pick_diamond", {
minetest.register_tool("mcl_tools:pick_diamond", {
description = "Diamond Pickaxe",
inventory_image = "default_tool_diamondpick.png",
groups = { tool=1 },
@ -123,7 +110,7 @@ minetest.register_tool("mcl_core:pick_diamond", {
full_punch_interval = 0.83333333,
max_drop_level=5,
groupcaps={
pickaxey_dig_diamond = {times=tooltimes, uses=0},
pickaxey_dig_diamond = {times=mcl_autogroup.digtimes.pickaxey_dig_diamond , uses=0},
},
damage_groups = {fleshy=5},
},
@ -131,7 +118,7 @@ minetest.register_tool("mcl_core:pick_diamond", {
})
local make_grass_path = function(itemstack, placer, pointed_thing)
if minetest.get_node(pointed_thing.under).name == "mcl_core:dirt_with_grass" and pointed_thing.above.y == pointed_thing.under.y then
if minetest.get_node(pointed_thing.under).name == "mcl_tools:dirt_with_grass" and pointed_thing.above.y == pointed_thing.under.y then
local above = table.copy(pointed_thing.under)
above.y = above.y + 1
if minetest.get_node(above).name == "air" then
@ -145,14 +132,14 @@ local make_grass_path = function(itemstack, placer, pointed_thing)
itemstack:add_wear(wear)
end
minetest.sound_play({name="default_grass_footstep", gain=1}, {pos = above})
minetest.swap_node(pointed_thing.under, {name="mcl_core:grass_path"})
minetest.swap_node(pointed_thing.under, {name="mcl_tools:grass_path"})
end
end
return itemstack
end
-- Shovels
minetest.register_tool("mcl_core:shovel_wood", {
minetest.register_tool("mcl_tools:shovel_wood", {
description = "Wooden Shovel",
inventory_image = "default_tool_woodshovel.png",
wield_image = "default_tool_woodshovel.png^[transformR90",
@ -161,14 +148,14 @@ minetest.register_tool("mcl_core:shovel_wood", {
full_punch_interval = 1,
max_drop_level=1,
groupcaps={
shovely_dig_wood = {times=tooltimes, uses=0},
shovely_dig_wood = {times=mcl_autogroup.digtimes.shovely_dig_wood, uses=0},
},
damage_groups = {fleshy=2},
},
on_place = make_grass_path,
sound = { breaks = "default_tool_breaks" },
})
minetest.register_tool("mcl_core:shovel_stone", {
minetest.register_tool("mcl_tools:shovel_stone", {
description = "Stone Shovel",
inventory_image = "default_tool_stoneshovel.png",
wield_image = "default_tool_stoneshovel.png^[transformR90",
@ -177,14 +164,14 @@ minetest.register_tool("mcl_core:shovel_stone", {
full_punch_interval = 1,
max_drop_level=3,
groupcaps={
shovely_dig_stone = {times=tooltimes, uses=0},
shovely_dig_stone = {times=mcl_autogroup.digtimes.shovely_dig_stone, uses=0},
},
damage_groups = {fleshy=3},
},
on_place = make_grass_path,
sound = { breaks = "default_tool_breaks" },
})
minetest.register_tool("mcl_core:shovel_iron", {
minetest.register_tool("mcl_tools:shovel_iron", {
description = "Iron Shovel",
inventory_image = "default_tool_steelshovel.png",
wield_image = "default_tool_steelshovel.png^[transformR90",
@ -193,14 +180,14 @@ minetest.register_tool("mcl_core:shovel_iron", {
full_punch_interval = 1,
max_drop_level=4,
groupcaps={
shovely_dig_iron= {times=tooltimes, uses=0},
shovely_dig_iron = {times=mcl_autogroup.digtimes.shovely_dig_iron, uses=0},
},
damage_groups = {fleshy=4},
},
on_place = make_grass_path,
sound = { breaks = "default_tool_breaks" },
})
minetest.register_tool("mcl_core:shovel_gold", {
minetest.register_tool("mcl_tools:shovel_gold", {
description = "Golden Shovel",
inventory_image = "default_tool_goldshovel.png",
wield_image = "default_tool_goldshovel.png^[transformR90",
@ -209,14 +196,14 @@ minetest.register_tool("mcl_core:shovel_gold", {
full_punch_interval = 1,
max_drop_level=2,
groupcaps={
shovely_dig_gold = {times=tooltimes, uses=0},
shovely_dig_gold = {times=mcl_autogroup.digtimes.shovely_dig_gold, uses=0},
},
damage_groups = {fleshy=2},
},
on_place = make_grass_path,
sound = { breaks = "default_tool_breaks" },
})
minetest.register_tool("mcl_core:shovel_diamond", {
minetest.register_tool("mcl_tools:shovel_diamond", {
description = "Diamond Shovel",
inventory_image = "default_tool_diamondshovel.png",
wield_image = "default_tool_diamondshovel.png^[transformR90",
@ -225,7 +212,7 @@ minetest.register_tool("mcl_core:shovel_diamond", {
full_punch_interval = 1,
max_drop_level=5,
groupcaps={
shovely_dig_diamond = {times=tooltimes, uses=0},
shovely_dig_diamond = {times=mcl_autogroup.digtimes.shovely_dig_diamond, uses=0},
},
damage_groups = {fleshy=5},
},
@ -234,7 +221,7 @@ minetest.register_tool("mcl_core:shovel_diamond", {
})
-- Axes
minetest.register_tool("mcl_core:axe_wood", {
minetest.register_tool("mcl_tools:axe_wood", {
description = "Wooden Axe",
inventory_image = "default_tool_woodaxe.png",
groups = { tool=1 },
@ -242,13 +229,13 @@ minetest.register_tool("mcl_core:axe_wood", {
full_punch_interval = 1.25,
max_drop_level=1,
groupcaps={
axey_dig_wood = {times=tooltimes, uses=0},
axey_dig_wood = {times=mcl_autogroup.digtimes.axey_dig_wood, uses=0},
},
damage_groups = {fleshy=7},
},
sound = { breaks = "default_tool_breaks" },
})
minetest.register_tool("mcl_core:axe_stone", {
minetest.register_tool("mcl_tools:axe_stone", {
description = "Stone Axe",
inventory_image = "default_tool_stoneaxe.png",
groups = { tool=1 },
@ -256,13 +243,13 @@ minetest.register_tool("mcl_core:axe_stone", {
full_punch_interval = 1.25,
max_drop_level=3,
groupcaps={
axey_dig_stone = {times=tooltimes, uses=0},
axey_dig_stone = {times=mcl_autogroup.digtimes.axey_dig_stone, uses=0},
},
damage_groups = {fleshy=9},
},
sound = { breaks = "default_tool_breaks" },
})
minetest.register_tool("mcl_core:axe_iron", {
minetest.register_tool("mcl_tools:axe_iron", {
description = "Iron Axe",
inventory_image = "default_tool_steelaxe.png",
groups = { tool=1 },
@ -271,13 +258,13 @@ minetest.register_tool("mcl_core:axe_iron", {
full_punch_interval = 1.11111111,
max_drop_level=4,
groupcaps={
axey_dig_iron = {times=tooltimes, uses=0},
axey_dig_iron = {times=mcl_autogroup.digtimes.axey_dig_iron, uses=0},
},
damage_groups = {fleshy=9},
},
sound = { breaks = "default_tool_breaks" },
})
minetest.register_tool("mcl_core:axe_gold", {
minetest.register_tool("mcl_tools:axe_gold", {
description = "Golden Axe",
inventory_image = "default_tool_goldaxe.png",
groups = { tool=1 },
@ -285,13 +272,13 @@ minetest.register_tool("mcl_core:axe_gold", {
full_punch_interval = 1.0,
max_drop_level=2,
groupcaps={
axey_dig_gold = {times=tooltimes, uses=0},
axey_dig_gold= {times=mcl_autogroup.digtimes.axey_dig_gold, uses=0},
},
damage_groups = {fleshy=7},
},
sound = { breaks = "default_tool_breaks" },
})
minetest.register_tool("mcl_core:axe_diamond", {
minetest.register_tool("mcl_tools:axe_diamond", {
description = "Diamond Axe",
inventory_image = "default_tool_diamondaxe.png",
groups = { tool=1 },
@ -299,7 +286,7 @@ minetest.register_tool("mcl_core:axe_diamond", {
full_punch_interval = 1.0,
max_drop_level=5,
groupcaps={
axey_dig_diamond = {times=tooltimes, uses=0},
axey_dig_diamond = {times=mcl_autogroup.digtimes.axey_dig_diamond, uses=0},
},
damage_groups = {fleshy=9},
},
@ -307,7 +294,7 @@ minetest.register_tool("mcl_core:axe_diamond", {
})
-- Swords
minetest.register_tool("mcl_core:sword_wood", {
minetest.register_tool("mcl_tools:sword_wood", {
description = "Wooden Sword",
inventory_image = "default_tool_woodsword.png",
groups = { weapon=1 },
@ -315,14 +302,14 @@ minetest.register_tool("mcl_core:sword_wood", {
full_punch_interval = 0.625,
max_drop_level=1,
groupcaps={
swordy_dig = {times=tooltimes, uses=0},
swordy_cobweb_dig = {times=tooltimes, uses=0},
swordy_dig = {times=mcl_autogroup.digtimes.swordy_dig , uses=0},
swordy_cobweb_dig = {times=mcl_autogroup.digtimes.swordy_cobweb_dig , uses=0},
},
damage_groups = {fleshy=4},
},
sound = { breaks = "default_tool_breaks" },
})
minetest.register_tool("mcl_core:sword_stone", {
minetest.register_tool("mcl_tools:sword_stone", {
description = "Stone Sword",
inventory_image = "default_tool_stonesword.png",
groups = { weapon=1 },
@ -330,14 +317,14 @@ minetest.register_tool("mcl_core:sword_stone", {
full_punch_interval = 0.625,
max_drop_level=3,
groupcaps={
swordy_dig = {times=tooltimes, uses=0},
swordy_cobweb_dig = {times=tooltimes, uses=0},
swordy_dig = {times=mcl_autogroup.digtimes.swordy_dig , uses=0},
swordy_cobweb_dig = {times=mcl_autogroup.digtimes.swordy_cobweb_dig , uses=0},
},
damage_groups = {fleshy=5},
},
sound = { breaks = "default_tool_breaks" },
})
minetest.register_tool("mcl_core:sword_iron", {
minetest.register_tool("mcl_tools:sword_iron", {
description = "Iron Sword",
inventory_image = "default_tool_steelsword.png",
groups = { weapon=1 },
@ -345,14 +332,14 @@ minetest.register_tool("mcl_core:sword_iron", {
full_punch_interval = 0.625,
max_drop_level=4,
groupcaps={
swordy_dig = {times=tooltimes, uses=0},
swordy_cobweb_dig = {times=tooltimes, uses=0},
swordy_dig = {times=mcl_autogroup.digtimes.swordy_dig , uses=0},
swordy_cobweb_dig = {times=mcl_autogroup.digtimes.swordy_cobweb_dig , uses=0},
},
damage_groups = {fleshy=6},
},
sound = { breaks = "default_tool_breaks" },
})
minetest.register_tool("mcl_core:sword_gold", {
minetest.register_tool("mcl_tools:sword_gold", {
description = "Golden Sword",
inventory_image = "default_tool_goldsword.png",
groups = { weapon=1 },
@ -360,14 +347,14 @@ minetest.register_tool("mcl_core:sword_gold", {
full_punch_interval = 0.625,
max_drop_level=2,
groupcaps={
swordy_dig = {times=tooltimes, uses=0},
swordy_cobweb_dig = {times=tooltimes, uses=0},
swordy_dig = {times=mcl_autogroup.digtimes.swordy_dig , uses=0},
swordy_cobweb_dig = {times=mcl_autogroup.digtimes.swordy_cobweb_dig , uses=0},
},
damage_groups = {fleshy=4},
},
sound = { breaks = "default_tool_breaks" },
})
minetest.register_tool("mcl_core:sword_diamond", {
minetest.register_tool("mcl_tools:sword_diamond", {
description = "Diamond Sword",
inventory_image = "default_tool_diamondsword.png",
groups = { weapon=1 },
@ -375,8 +362,8 @@ minetest.register_tool("mcl_core:sword_diamond", {
full_punch_interval = 0.625,
max_drop_level=5,
groupcaps={
swordy_dig = {times=tooltimes, uses=0},
swordy_cobweb_dig = {times=tooltimes, uses=0},
swordy_dig = {times=mcl_autogroup.digtimes.swordy_dig , uses=0},
swordy_cobweb_dig = {times=mcl_autogroup.digtimes.swordy_cobweb_dig , uses=0},
},
damage_groups = {fleshy=7},
},
@ -384,7 +371,7 @@ minetest.register_tool("mcl_core:sword_diamond", {
})
--Shears
minetest.register_tool("mcl_core:shears", {
minetest.register_tool("mcl_tools:shears", {
description = "Shears",
inventory_image = "default_tool_shears.png",
wield_image = "default_tool_shears.png",
@ -394,11 +381,12 @@ minetest.register_tool("mcl_core:shears", {
full_punch_interval = 0.5,
max_drop_level=1,
groupcaps={
shearsy_dig = {times=tooltimes, uses=0},
shearsy_wool_dig = {times=tooltimes, uses=0},
shearsy_dig = {times=mcl_autogroup.digtimes.shearsy_dig, uses=0},
shearsy_wool_dig = {times=mcl_autogroup.digtimes.shearsy_wool_dig, uses=0},
}
},
sound = { breaks = "default_tool_breaks" },
})
dofile(minetest.get_modpath("mcl_tools").."/crafting.lua")

View File

@ -0,0 +1 @@
name = mcl_tools

View File

Before

Width:  |  Height:  |  Size: 255 B

After

Width:  |  Height:  |  Size: 255 B

View File

Before

Width:  |  Height:  |  Size: 275 B

After

Width:  |  Height:  |  Size: 275 B

View File

Before

Width:  |  Height:  |  Size: 232 B

After

Width:  |  Height:  |  Size: 232 B

View File

Before

Width:  |  Height:  |  Size: 262 B

After

Width:  |  Height:  |  Size: 262 B

View File

Before

Width:  |  Height:  |  Size: 254 B

After

Width:  |  Height:  |  Size: 254 B

View File

Before

Width:  |  Height:  |  Size: 275 B

After

Width:  |  Height:  |  Size: 275 B

View File

Before

Width:  |  Height:  |  Size: 232 B

After

Width:  |  Height:  |  Size: 232 B

View File

Before

Width:  |  Height:  |  Size: 263 B

After

Width:  |  Height:  |  Size: 263 B

View File

Before

Width:  |  Height:  |  Size: 292 B

After

Width:  |  Height:  |  Size: 292 B

View File

Before

Width:  |  Height:  |  Size: 254 B

After

Width:  |  Height:  |  Size: 254 B

View File

Before

Width:  |  Height:  |  Size: 275 B

After

Width:  |  Height:  |  Size: 275 B

View File

Before

Width:  |  Height:  |  Size: 232 B

After

Width:  |  Height:  |  Size: 232 B

View File

Before

Width:  |  Height:  |  Size: 259 B

After

Width:  |  Height:  |  Size: 259 B

View File

Before

Width:  |  Height:  |  Size: 255 B

After

Width:  |  Height:  |  Size: 255 B

View File

Before

Width:  |  Height:  |  Size: 275 B

After

Width:  |  Height:  |  Size: 275 B

View File

Before

Width:  |  Height:  |  Size: 232 B

After

Width:  |  Height:  |  Size: 232 B

View File

Before

Width:  |  Height:  |  Size: 262 B

After

Width:  |  Height:  |  Size: 262 B

View File

Before

Width:  |  Height:  |  Size: 255 B

After

Width:  |  Height:  |  Size: 255 B

View File

Before

Width:  |  Height:  |  Size: 275 B

After

Width:  |  Height:  |  Size: 275 B

View File

Before

Width:  |  Height:  |  Size: 232 B

After

Width:  |  Height:  |  Size: 232 B

View File

Before

Width:  |  Height:  |  Size: 261 B

After

Width:  |  Height:  |  Size: 261 B