1
0
mirror of https://codeberg.org/minenux/minetest-mod-xdecor synced 2023-10-20 21:43:39 -07:00

Style cleaning

This commit is contained in:
kilbith 2015-08-24 21:01:50 +02:00
parent d82f60a904
commit a44a98c44e

View File

@ -90,31 +90,28 @@ xdecor.register("enchantment_table", {
allow_metadata_inventory_move = function(...) return 0 end
})
local function capitalize(str)
return str:gsub("^%l", string.upper)
end
local function capitalize(str) return str:gsub("^%l", string.upper) end
-- Higher number = longer use.
-- Higher number = stronger enchant.
local use_factor = 1.2
-- Higher number = faster dig.
local times_subtractor = 0.1
function enchanting.register_enchtools()
local materials = {"steel", "bronze", "mese", "diamond"}
local tools = { {"axe", "choppy"}, {"pick", "cracky"}, {"shovel", "crumbly"} }
local chants = {"durable", "fast"}
for j = 1, #materials do
local material = materials[j]
for t = 1, #tools do
local tool_name = tools[t][1]
local original_tool = minetest.registered_tools["default:"..tool_name.."_"..material]
local original_groupcaps = original_tool.tool_capabilities.groupcaps
local main_groupcap = tools[t][2]
for j = 1, #materials do
for t = 1, #tools do
for i = 1, #chants do
local chant = chants[i]
local material = materials[j]
local tool_name = tools[t][1]
local main_groupcap = tools[t][2]
local original_tool = minetest.registered_tools["default:"..tool_name.."_"..material]
local original_groupcaps = original_tool.tool_capabilities.groupcaps
local groupcaps = table.copy(original_groupcaps)
if chant == "durable" then
groupcaps[main_groupcap].uses = original_groupcaps[main_groupcap].uses * use_factor
elseif chant == "fast" then
@ -136,4 +133,3 @@ function enchanting.register_enchtools()
end
enchanting.register_enchtools()