Do the same on ench. table code
This commit is contained in:
parent
f1ff9b6e0c
commit
b194e5f7a7
@ -36,12 +36,12 @@ end
|
|||||||
function enchanting.on_put(pos, listname, _, stack)
|
function enchanting.on_put(pos, listname, _, stack)
|
||||||
if listname == "tool" then
|
if listname == "tool" then
|
||||||
local tools_cat = {
|
local tools_cat = {
|
||||||
["tool"] = {"pick", "axe", "shovel"},
|
["tool"] = "pick, axe, shovel",
|
||||||
["armor"] = {"chestplate", "leggings", "helmet"},
|
["armor"] = "chestplate, leggings, helmet",
|
||||||
["sword"] = {"sword"}, ["boots"] = {"boots"} }
|
["sword"] = "sword", ["boots"] = "boots" }
|
||||||
|
|
||||||
for cat, name in pairs(tools_cat) do
|
for cat, name in pairs(tools_cat) do
|
||||||
for _, n in pairs(name) do
|
for n in name:gmatch("[%w_]+") do
|
||||||
if stack:get_name():find(n) then
|
if stack:get_name():find(n) then
|
||||||
enchanting.formspec(pos, cat)
|
enchanting.formspec(pos, cat)
|
||||||
end
|
end
|
||||||
@ -141,31 +141,31 @@ enchanting.jump = 0.2
|
|||||||
local tools = {
|
local tools = {
|
||||||
--[[ Registration format:
|
--[[ Registration format:
|
||||||
[Mod name] = {
|
[Mod name] = {
|
||||||
{materials},
|
materials,
|
||||||
{tool name, tool group, {enchantments}}
|
{tool name, tool group, enchantments}
|
||||||
}
|
}
|
||||||
--]]
|
--]]
|
||||||
["default"] = {
|
["default"] = {
|
||||||
{"steel", "bronze", "mese", "diamond"},
|
"steel, bronze, mese, diamond",
|
||||||
{"axe", "choppy", {"durable", "fast"}},
|
{"axe", "choppy", "durable, fast"},
|
||||||
{"pick", "cracky", {"durable", "fast"}},
|
{"pick", "cracky", "durable, fast"},
|
||||||
{"shovel", "crumbly", {"durable", "fast"}},
|
{"shovel", "crumbly", "durable, fast"},
|
||||||
{"sword", "fleshy", {"sharp"}}
|
{"sword", "fleshy", "sharp"}
|
||||||
},
|
},
|
||||||
["3d_armor"] = {
|
["3d_armor"] = {
|
||||||
{"steel", "bronze", "gold", "diamond"},
|
"steel, bronze, gold, diamond",
|
||||||
{"boots", nil, {"strong", "speed"}},
|
{"boots", nil, "strong, speed"},
|
||||||
{"chestplate", nil, {"strong"}},
|
{"chestplate", nil, "strong"},
|
||||||
{"helmet", nil, {"strong"}},
|
{"helmet", nil, "strong"},
|
||||||
{"leggings", nil, {"strong"}}
|
{"leggings", nil, "strong"}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for mod, defs in pairs(tools) do
|
for mod, defs in pairs(tools) do
|
||||||
for _, mat in pairs(defs[1]) do
|
for material in defs[1]:gmatch("[%w_]+") do
|
||||||
for _, tooldef in next, defs, 1 do
|
for _, tooldef in next, defs, 1 do
|
||||||
for _, ench in pairs(tooldef[3]) do
|
for enchant in tooldef[3]:gmatch("[%w_]+") do
|
||||||
local tool, group, material, enchant = tooldef[1], tooldef[2], mat, ench
|
local tool, group = tooldef[1], tooldef[2]
|
||||||
local original_tool = minetest.registered_tools[mod..":"..tool.."_"..material]
|
local original_tool = minetest.registered_tools[mod..":"..tool.."_"..material]
|
||||||
|
|
||||||
if original_tool then
|
if original_tool then
|
||||||
@ -191,7 +191,7 @@ for _, ench in pairs(tooldef[3]) do
|
|||||||
description = "Enchanted "..cap(material).." "..cap(tool).." ("..cap(enchant)..")",
|
description = "Enchanted "..cap(material).." "..cap(tool).." ("..cap(enchant)..")",
|
||||||
inventory_image = original_tool.inventory_image.."^[colorize:violet:50",
|
inventory_image = original_tool.inventory_image.."^[colorize:violet:50",
|
||||||
wield_image = original_tool.wield_image,
|
wield_image = original_tool.wield_image,
|
||||||
groups = {not_in_creative_inventory=1},
|
groups = {not_in_creative_inventory=0},
|
||||||
tool_capabilities = {
|
tool_capabilities = {
|
||||||
groupcaps = groupcaps, damage_groups = {fleshy = fleshy},
|
groupcaps = groupcaps, damage_groups = {fleshy = fleshy},
|
||||||
full_punch_interval = full_punch_interval, max_drop_level = max_drop_level
|
full_punch_interval = full_punch_interval, max_drop_level = max_drop_level
|
||||||
|
Loading…
Reference in New Issue
Block a user