Small refactor on ench. table
This commit is contained in:
parent
0896285fb7
commit
5374adc69e
@ -89,28 +89,29 @@ xdecor.register("enchantment_table", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
function enchanting.register_enchtools(init, m, def)
|
function enchanting.register_enchtools(init, m, def)
|
||||||
local faster, longer = {}, {}
|
local longer = init["uses"] * 1.2 -- Higher number = longer use.
|
||||||
longer = init["uses"] * 1.2 -- Wearing factor for enchanted tools (higher number = longer use).
|
local faster = {}
|
||||||
for i = 1, 3 do
|
for i = 1, 3 do
|
||||||
faster[i] = init["times"][i] - 0.1 -- Digging factor for enchanted tools (higher number = faster dig).
|
faster[i] = init["times"][i] - 0.1 -- Higher number = faster dig.
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local fast = {times=faster, uses=def.uses, maxlevel=def.maxlvl}
|
||||||
|
local long = {times=def.times, uses=longer, maxlevel=def.maxlvl}
|
||||||
|
|
||||||
local enchtools = {
|
local enchtools = {
|
||||||
{"axe", "durable", {choppy = {times=def.times, uses=longer, maxlevel=def.maxlvl}}},
|
{"axe", "durable", {choppy = long}}, {"axe", "fast", {choppy = fast}},
|
||||||
{"axe", "fast", {choppy = {times=faster, uses=def.uses, maxlevel=def.maxlvl}}},
|
{"pick", "durable", {cracky = long}}, {"pick", "fast", {cracky = fast}},
|
||||||
{"pick", "durable", {cracky = {times=def.times, uses=longer, maxlevel=def.maxlvl}}},
|
{"shovel", "durable", {crumbly = long}}, {"shovel", "fast", {crumbly = fast}}
|
||||||
{"pick", "fast", {cracky = {times=faster, uses=def.uses, maxlevel=def.maxlvl}}},
|
|
||||||
{"shovel", "durable", {crumbly = {times=def.times, uses=longer, maxlevel=def.maxlvl}}},
|
|
||||||
{"shovel", "fast", {crumbly = {times=faster, uses=def.uses, maxlevel=def.maxlvl}}}
|
|
||||||
}
|
}
|
||||||
for _, x in pairs(enchtools) do
|
for _, x in pairs(enchtools) do
|
||||||
local tool, ench, grp = x[1], x[2], x[3]
|
local t, e, g = x[1], x[2], x[3]
|
||||||
minetest.register_tool("xdecor:enchanted_"..tool.."_"..m.."_"..ench, {
|
minetest.register_tool("xdecor:enchanted_"..t.."_"..m.."_"..e, {
|
||||||
description = "Enchanted "..string.gsub(m, "%l", string.upper, 1)..
|
description = "Enchanted "..string.gsub(m, "%l", string.upper, 1)..
|
||||||
" "..string.gsub(tool, "%l", string.upper, 1).." ("..string.gsub(ench, "%l", string.upper, 1)..")",
|
" "..string.gsub(t, "%l", string.upper, 1)..
|
||||||
inventory_image = minetest.registered_tools["default:"..tool.."_"..m]["inventory_image"],
|
" ("..string.gsub(e, "%l", string.upper, 1)..")",
|
||||||
|
inventory_image = minetest.registered_tools["default:"..t.."_"..m]["inventory_image"],
|
||||||
groups = {not_in_creative_inventory=1},
|
groups = {not_in_creative_inventory=1},
|
||||||
tool_capabilities = {groupcaps = grp, damage_groups = def.dmg}
|
tool_capabilities = {groupcaps = g, damage_groups = def.dmg}
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
5
rope.lua
5
rope.lua
@ -39,9 +39,8 @@ function remove_rope(pos, oldnode, digger, rope_name)
|
|||||||
below.y = below.y - 1
|
below.y = below.y - 1
|
||||||
num = num + 1
|
num = num + 1
|
||||||
end
|
end
|
||||||
if num ~= 0 then
|
if num == 0 then return end
|
||||||
digger_inv:add_item("main", rope_name.." "..num)
|
digger_inv:add_item("main", rope_name.." "..num)
|
||||||
end
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user