| 
							
							
							
						 |  |  | @@ -1,5 +1,4 @@ | 
		
	
		
			
				|  |  |  |  | local mod_storage = minetest.get_mod_storage() | 
		
	
		
			
				|  |  |  |  | local S = minetest.get_translator("toolranks") | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | toolranks = {} | 
		
	
		
			
				|  |  |  |  |  | 
		
	
	
		
			
				
					
					|  |  |  | @@ -10,167 +9,282 @@ toolranks.colors = { | 
		
	
		
			
				|  |  |  |  |   white = minetest.get_color_escape_sequence("#ffffff") | 
		
	
		
			
				|  |  |  |  | } | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | local max_speed = tonumber(minetest.settings:get("toolranks_speed_multiplier")) or 2.0 | 
		
	
		
			
				|  |  |  |  | local max_use = tonumber(minetest.settings:get("toolranks_use_multiplier")) or 2.0 | 
		
	
		
			
				|  |  |  |  | local max_level = tonumber(minetest.settings:get("toolranks_levels")) or 10 | 
		
	
		
			
				|  |  |  |  | local level_digs = tonumber(minetest.settings:get("toolranks_level_digs")) or 500 | 
		
	
		
			
				|  |  |  |  | local level_multiplier = 1 / max_level | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | function toolranks.get_tool_type(description) | 
		
	
		
			
				|  |  |  |  |   if not description then | 
		
	
		
			
				|  |  |  |  |     return "tool" | 
		
	
		
			
				|  |  |  |  |   else | 
		
	
		
			
				|  |  |  |  |     local d = string.lower(description) | 
		
	
		
			
				|  |  |  |  |     if string.find(d, "pickaxe") then | 
		
	
		
			
				|  |  |  |  |   elseif string.find(description, "Pickaxe") then | 
		
	
		
			
				|  |  |  |  |     return "pickaxe" | 
		
	
		
			
				|  |  |  |  |     elseif string.find(d, "axe") then | 
		
	
		
			
				|  |  |  |  |   elseif string.find(description, "Axe") then | 
		
	
		
			
				|  |  |  |  |     return "axe" | 
		
	
		
			
				|  |  |  |  |     elseif string.find(d, "shovel") then | 
		
	
		
			
				|  |  |  |  |   elseif string.find(description, "Shovel") then | 
		
	
		
			
				|  |  |  |  |     return "shovel" | 
		
	
		
			
				|  |  |  |  |     elseif string.find(d, "hoe") then | 
		
	
		
			
				|  |  |  |  |   elseif string.find(description, "Hoe") then | 
		
	
		
			
				|  |  |  |  |     return "hoe" | 
		
	
		
			
				|  |  |  |  |     elseif string.find(d, "sword") then | 
		
	
		
			
				|  |  |  |  |       return "sword" | 
		
	
		
			
				|  |  |  |  |   else | 
		
	
		
			
				|  |  |  |  |     return "tool" | 
		
	
		
			
				|  |  |  |  |   end | 
		
	
		
			
				|  |  |  |  |   end | 
		
	
		
			
				|  |  |  |  | end | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | function toolranks.get_level(uses) | 
		
	
		
			
				|  |  |  |  |   if type(uses) == "number" and uses > 0 then | 
		
	
		
			
				|  |  |  |  |     return math.min(max_level, math.floor(uses / level_digs)) | 
		
	
		
			
				|  |  |  |  |   end | 
		
	
		
			
				|  |  |  |  |   return 0 | 
		
	
		
			
				|  |  |  |  | end | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | function toolranks.create_description(name, uses) | 
		
	
		
			
				|  |  |  |  | function toolranks.create_description(name, uses, level) | 
		
	
		
			
				|  |  |  |  |   local description = name | 
		
	
		
			
				|  |  |  |  |   local tooltype    = toolranks.get_tool_type(description) | 
		
	
		
			
				|  |  |  |  |   local newdesc = S( | 
		
	
		
			
				|  |  |  |  |     "@1@2\n@3Level @4 @5\n@6@Node dug: @7", | 
		
	
		
			
				|  |  |  |  |     toolranks.colors.green, | 
		
	
		
			
				|  |  |  |  |     description, | 
		
	
		
			
				|  |  |  |  |     toolranks.colors.gold, | 
		
	
		
			
				|  |  |  |  |     toolranks.get_level(uses), | 
		
	
		
			
				|  |  |  |  |     S(tooltype), | 
		
	
		
			
				|  |  |  |  |     toolranks.colors.grey, | 
		
	
		
			
				|  |  |  |  |     (type(uses) == "number" and uses or 0) | 
		
	
		
			
				|  |  |  |  |   ) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |   local newdesc = toolranks.colors.green .. description .. "\n" .. | 
		
	
		
			
				|  |  |  |  |                   toolranks.colors.gold .. "Level " .. (level or 1) .. " " .. tooltype .. "\n" .. | 
		
	
		
			
				|  |  |  |  |                   toolranks.colors.grey .. "Nodes dug: " .. (uses or 0) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |   return newdesc | 
		
	
		
			
				|  |  |  |  | end | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | function toolranks.get_level(uses) | 
		
	
		
			
				|  |  |  |  |   if uses <= 250 then | 
		
	
		
			
				|  |  |  |  |     return 1 | 
		
	
		
			
				|  |  |  |  |   elseif uses < 500 then | 
		
	
		
			
				|  |  |  |  |     return 2 | 
		
	
		
			
				|  |  |  |  |   elseif uses < 1000 then | 
		
	
		
			
				|  |  |  |  |     return 3 | 
		
	
		
			
				|  |  |  |  |   elseif uses < 2500 then | 
		
	
		
			
				|  |  |  |  |     return 4 | 
		
	
		
			
				|  |  |  |  |   elseif uses < 5000 then | 
		
	
		
			
				|  |  |  |  |     return 5 | 
		
	
		
			
				|  |  |  |  |   elseif uses < 10000 then | 
		
	
		
			
				|  |  |  |  | 	  return 6 | 
		
	
		
			
				|  |  |  |  |   elseif uses < 25000 then | 
		
	
		
			
				|  |  |  |  | 	  return 7 | 
		
	
		
			
				|  |  |  |  |   elseif uses < 50000 then | 
		
	
		
			
				|  |  |  |  | 	  return 8 | 
		
	
		
			
				|  |  |  |  |   elseif uses < 100000 then | 
		
	
		
			
				|  |  |  |  | 	  return 9 | 
		
	
		
			
				|  |  |  |  |   else | 
		
	
		
			
				|  |  |  |  | 	  return 10 | 
		
	
		
			
				|  |  |  |  |   end | 
		
	
		
			
				|  |  |  |  | end | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | function toolranks.new_afteruse(itemstack, user, node, digparams) | 
		
	
		
			
				|  |  |  |  |   local itemmeta = itemstack:get_meta() | 
		
	
		
			
				|  |  |  |  |   local itemdef = itemstack:get_definition() | 
		
	
		
			
				|  |  |  |  |   local itemdesc = itemdef.original_description | 
		
	
		
			
				|  |  |  |  |   local dugnodes = tonumber(itemmeta:get_string("dug")) or 0 | 
		
	
		
			
				|  |  |  |  |   local lastlevel = tonumber(itemmeta:get_string("lastlevel")) or 0 | 
		
	
		
			
				|  |  |  |  |   local itemmeta  = itemstack:get_meta() -- Metadata | 
		
	
		
			
				|  |  |  |  |   local itemdef   = itemstack:get_definition() -- Item Definition | 
		
	
		
			
				|  |  |  |  |   local itemdesc  = itemdef.original_description -- Original Description | 
		
	
		
			
				|  |  |  |  |   local dugnodes  = tonumber(itemmeta:get_string("dug")) or 0 -- Number of nodes dug | 
		
	
		
			
				|  |  |  |  |   local lastlevel = tonumber(itemmeta:get_string("lastlevel")) or 1 -- Level the tool had | 
		
	
		
			
				|  |  |  |  |                                                                     -- on the last dig | 
		
	
		
			
				|  |  |  |  |   local most_digs = mod_storage:get_int("most_digs") or 0 | 
		
	
		
			
				|  |  |  |  |   local most_digs_user = mod_storage:get_string("most_digs_user") or 0 | 
		
	
		
			
				|  |  |  |  |    | 
		
	
		
			
				|  |  |  |  |   if digparams.wear > 0 then -- Only count nodes that spend the tool | 
		
	
		
			
				|  |  |  |  |   -- Only count nodes that spend the tool | 
		
	
		
			
				|  |  |  |  |   if(digparams.wear > 0) then | 
		
	
		
			
				|  |  |  |  |    dugnodes = dugnodes + 1 | 
		
	
		
			
				|  |  |  |  |    itemmeta:set_string("dug", dugnodes) | 
		
	
		
			
				|  |  |  |  |   end | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |   if dugnodes > most_digs then | 
		
	
		
			
				|  |  |  |  |     if most_digs_user ~= user:get_player_name() then -- Avoid spam. | 
		
	
		
			
				|  |  |  |  |       minetest.chat_send_all(S( | 
		
	
		
			
				|  |  |  |  |         "Most used tool is now a @1@2@3 owned by @4 with @5 uses.", | 
		
	
		
			
				|  |  |  |  |         toolranks.colors.green, | 
		
	
		
			
				|  |  |  |  |         itemdesc, | 
		
	
		
			
				|  |  |  |  |         toolranks.colors.white, | 
		
	
		
			
				|  |  |  |  |         user:get_player_name(), | 
		
	
		
			
				|  |  |  |  |         dugnodes | 
		
	
		
			
				|  |  |  |  |       )) | 
		
	
		
			
				|  |  |  |  |   if(dugnodes > most_digs) then | 
		
	
		
			
				|  |  |  |  |     most_digs = dugnodes | 
		
	
		
			
				|  |  |  |  |     if(most_digs_user ~= user:get_player_name()) then -- Avoid spam. | 
		
	
		
			
				|  |  |  |  |       most_digs_user = user:get_player_name() | 
		
	
		
			
				|  |  |  |  |       minetest.chat_send_all("Most used tool is now a " .. toolranks.colors.green .. itemdesc  | 
		
	
		
			
				|  |  |  |  |                              .. toolranks.colors.white .. " owned by " .. user:get_player_name() | 
		
	
		
			
				|  |  |  |  |                              .. " with " .. dugnodes .. " uses.") | 
		
	
		
			
				|  |  |  |  |     end | 
		
	
		
			
				|  |  |  |  |     mod_storage:set_int("most_digs", dugnodes) | 
		
	
		
			
				|  |  |  |  |     mod_storage:set_string("most_digs_user", user:get_player_name()) | 
		
	
		
			
				|  |  |  |  |   end | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |   if itemstack:get_wear() > 60135 then | 
		
	
		
			
				|  |  |  |  |     minetest.chat_send_player(user:get_player_name(), S("Your tool is about to break!")) | 
		
	
		
			
				|  |  |  |  |   if(itemstack:get_wear() > 60135) then | 
		
	
		
			
				|  |  |  |  |     minetest.chat_send_player(user:get_player_name(), "Your tool is about to break!") | 
		
	
		
			
				|  |  |  |  |     minetest.sound_play("default_tool_breaks", { | 
		
	
		
			
				|  |  |  |  |       to_player = user:get_player_name(), | 
		
	
		
			
				|  |  |  |  |       gain = 2.0, | 
		
	
		
			
				|  |  |  |  |     }) | 
		
	
		
			
				|  |  |  |  |   end | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |   local level = toolranks.get_level(dugnodes) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |   if lastlevel < level then | 
		
	
		
			
				|  |  |  |  |     local levelup_text = S( | 
		
	
		
			
				|  |  |  |  |       "Your @1@2@3 just leveled up!", | 
		
	
		
			
				|  |  |  |  |       toolranks.colors.green, | 
		
	
		
			
				|  |  |  |  |       itemdesc, | 
		
	
		
			
				|  |  |  |  |       toolranks.colors.white | 
		
	
		
			
				|  |  |  |  |     ) | 
		
	
		
			
				|  |  |  |  |     minetest.chat_send_player(user:get_player_name(), levelup_text) | 
		
	
		
			
				|  |  |  |  |     local levelup_text = "Your " .. toolranks.colors.green .. | 
		
	
		
			
				|  |  |  |  |                          itemdesc .. toolranks.colors.white .. | 
		
	
		
			
				|  |  |  |  |                          " just leveled up!" | 
		
	
		
			
				|  |  |  |  |     minetest.sound_play("toolranks_levelup", { | 
		
	
		
			
				|  |  |  |  |       to_player = user:get_player_name(), | 
		
	
		
			
				|  |  |  |  |       gain = 2.0, | 
		
	
		
			
				|  |  |  |  |     }) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |     local speed_multiplier = 1 + (level * level_multiplier * (max_speed - 1)) | 
		
	
		
			
				|  |  |  |  |     local use_multiplier = 1 + (level * level_multiplier * (max_use - 1)) | 
		
	
		
			
				|  |  |  |  |     local caps = table.copy(itemdef.tool_capabilities) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |     caps.full_punch_interval = caps.full_punch_interval and (caps.full_punch_interval / speed_multiplier) | 
		
	
		
			
				|  |  |  |  |     caps.punch_attack_uses = caps.punch_attack_uses and (caps.punch_attack_uses * use_multiplier) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |     for _,c in pairs(caps.groupcaps) do | 
		
	
		
			
				|  |  |  |  |       c.uses = c.uses * use_multiplier | 
		
	
		
			
				|  |  |  |  |       for i,t in ipairs(c.times) do | 
		
	
		
			
				|  |  |  |  |         c.times[i] = t / speed_multiplier | 
		
	
		
			
				|  |  |  |  |       end | 
		
	
		
			
				|  |  |  |  |     end | 
		
	
		
			
				|  |  |  |  |     itemmeta:set_tool_capabilities(caps) | 
		
	
		
			
				|  |  |  |  |   end | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |     minetest.chat_send_player(user:get_player_name(), levelup_text) | 
		
	
		
			
				|  |  |  |  |     itemmeta:set_string("lastlevel", level) | 
		
	
		
			
				|  |  |  |  |   itemmeta:set_string("description", toolranks.create_description(itemdesc, dugnodes)) | 
		
	
		
			
				|  |  |  |  |   itemstack:add_wear(digparams.wear) | 
		
	
		
			
				|  |  |  |  |   end | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |   local newdesc   = toolranks.create_description(itemdesc, dugnodes, level) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |   itemmeta:set_string("description", newdesc) | 
		
	
		
			
				|  |  |  |  |   local wear = digparams.wear | 
		
	
		
			
				|  |  |  |  |   if level > 1 then | 
		
	
		
			
				|  |  |  |  |     wear = digparams.wear / (1 + level / 4) | 
		
	
		
			
				|  |  |  |  |   end | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |   --minetest.chat_send_all("wear="..wear.."Original wear: "..digparams.wear.." 1+level/4="..1+level/4) | 
		
	
		
			
				|  |  |  |  |   -- Uncomment for testing ^ | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |   itemstack:add_wear(wear) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |   return itemstack | 
		
	
		
			
				|  |  |  |  | end | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | -- Helper function | 
		
	
		
			
				|  |  |  |  | function toolranks.add_tool(name) | 
		
	
		
			
				|  |  |  |  |   local desc = ItemStack(name):get_definition().description | 
		
	
		
			
				|  |  |  |  |   minetest.override_item(name, { | 
		
	
		
			
				|  |  |  |  |     original_description = desc, | 
		
	
		
			
				|  |  |  |  |     description = toolranks.create_description(desc), | 
		
	
		
			
				|  |  |  |  |     after_use = toolranks.new_afteruse | 
		
	
		
			
				|  |  |  |  |   }) | 
		
	
		
			
				|  |  |  |  | minetest.override_item("default:pick_diamond", { | 
		
	
		
			
				|  |  |  |  |   original_description = "Diamond Pickaxe", | 
		
	
		
			
				|  |  |  |  |   description = toolranks.create_description("Diamond Pickaxe", 0, 1), | 
		
	
		
			
				|  |  |  |  |   after_use = toolranks.new_afteruse}) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | minetest.override_item("default:axe_diamond", { | 
		
	
		
			
				|  |  |  |  |   original_description = "Diamond Axe", | 
		
	
		
			
				|  |  |  |  |   description = toolranks.create_description("Diamond Axe", 0, 1), | 
		
	
		
			
				|  |  |  |  |   after_use = toolranks.new_afteruse}) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | minetest.override_item("default:shovel_diamond", { | 
		
	
		
			
				|  |  |  |  |   original_description = "Diamond Shovel", | 
		
	
		
			
				|  |  |  |  |   description = toolranks.create_description("Diamond Shovel", 0, 1), | 
		
	
		
			
				|  |  |  |  |   after_use = toolranks.new_afteruse}) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | minetest.override_item("default:pick_wood", { | 
		
	
		
			
				|  |  |  |  |   original_description = "Wooden Pickaxe", | 
		
	
		
			
				|  |  |  |  |   description = toolranks.create_description("Wooden Pickaxe", 0, 1), | 
		
	
		
			
				|  |  |  |  |   after_use = toolranks.new_afteruse}) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | minetest.override_item("default:axe_wood", { | 
		
	
		
			
				|  |  |  |  |   original_description = "Wooden Axe", | 
		
	
		
			
				|  |  |  |  |   description = toolranks.create_description("Wooden Axe", 0, 1), | 
		
	
		
			
				|  |  |  |  |   after_use = toolranks.new_afteruse}) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | minetest.override_item("default:shovel_wood", { | 
		
	
		
			
				|  |  |  |  |   original_description = "Wooden Shovel", | 
		
	
		
			
				|  |  |  |  |   description = toolranks.create_description("Wooden Shovel", 0, 1), | 
		
	
		
			
				|  |  |  |  |   after_use = toolranks.new_afteruse}) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | minetest.override_item("default:pick_steel", { | 
		
	
		
			
				|  |  |  |  |   original_description = "Steel Pickaxe", | 
		
	
		
			
				|  |  |  |  |   description = toolranks.create_description("Steel Pickaxe", 0, 1), | 
		
	
		
			
				|  |  |  |  |   after_use = toolranks.new_afteruse}) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | minetest.override_item("default:axe_steel", { | 
		
	
		
			
				|  |  |  |  |   original_description = "Steel Axe", | 
		
	
		
			
				|  |  |  |  |   description = toolranks.create_description("Steel Axe", 0, 1), | 
		
	
		
			
				|  |  |  |  |   after_use = toolranks.new_afteruse}) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | minetest.override_item("default:shovel_steel", { | 
		
	
		
			
				|  |  |  |  |   original_description = "Steel Shovel", | 
		
	
		
			
				|  |  |  |  |   description = toolranks.create_description("Steel Shovel", 0, 1), | 
		
	
		
			
				|  |  |  |  |   after_use = toolranks.new_afteruse}) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | minetest.override_item("default:pick_stone", { | 
		
	
		
			
				|  |  |  |  |   original_description = "Stone Pickaxe", | 
		
	
		
			
				|  |  |  |  |   description = toolranks.create_description("Stone Pickaxe", 0, 1), | 
		
	
		
			
				|  |  |  |  |   after_use = toolranks.new_afteruse}) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | minetest.override_item("default:axe_stone", { | 
		
	
		
			
				|  |  |  |  |   original_description = "Stone Axe", | 
		
	
		
			
				|  |  |  |  |   description = toolranks.create_description("Stone Axe", 0, 1), | 
		
	
		
			
				|  |  |  |  |   after_use = toolranks.new_afteruse}) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | minetest.override_item("default:shovel_stone", { | 
		
	
		
			
				|  |  |  |  |   original_description = "Stone Shovel", | 
		
	
		
			
				|  |  |  |  |   description = toolranks.create_description("Stone Shovel", 0, 1), | 
		
	
		
			
				|  |  |  |  |   after_use = toolranks.new_afteruse}) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | minetest.override_item("default:pick_bronze", { | 
		
	
		
			
				|  |  |  |  |   original_description = "Bronze Pickaxe", | 
		
	
		
			
				|  |  |  |  |   description = toolranks.create_description("Bronze Pickaxe", 0, 1), | 
		
	
		
			
				|  |  |  |  |   after_use = toolranks.new_afteruse}) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | minetest.override_item("default:axe_bronze", { | 
		
	
		
			
				|  |  |  |  |   original_description = "Bronze Axe", | 
		
	
		
			
				|  |  |  |  |   description = toolranks.create_description("Bronze Axe", 0, 1), | 
		
	
		
			
				|  |  |  |  |   after_use = toolranks.new_afteruse}) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | minetest.override_item("default:shovel_bronze", { | 
		
	
		
			
				|  |  |  |  |   original_description = "Bronze Shovel", | 
		
	
		
			
				|  |  |  |  |   description = toolranks.create_description("Bronze Shovel", 0, 1), | 
		
	
		
			
				|  |  |  |  |   after_use = toolranks.new_afteruse}) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | minetest.override_item("default:pick_mese", { | 
		
	
		
			
				|  |  |  |  |   original_description = "Mese Pickaxe", | 
		
	
		
			
				|  |  |  |  |   description = toolranks.create_description("Mese Pickaxe", 0, 1), | 
		
	
		
			
				|  |  |  |  |   after_use = toolranks.new_afteruse}) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | minetest.override_item("default:axe_mese", { | 
		
	
		
			
				|  |  |  |  |   original_description = "Mese Axe", | 
		
	
		
			
				|  |  |  |  |   description = toolranks.create_description("Mese Axe", 0, 1), | 
		
	
		
			
				|  |  |  |  |   after_use = toolranks.new_afteruse}) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | minetest.override_item("default:shovel_mese", { | 
		
	
		
			
				|  |  |  |  |   original_description = "Mese Shovel", | 
		
	
		
			
				|  |  |  |  |   description = toolranks.create_description("Mese Shovel", 0, 1), | 
		
	
		
			
				|  |  |  |  |   after_use = toolranks.new_afteruse}) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | if minetest.get_modpath("moreores") then | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |   minetest.override_item("moreores:pick_mithril", { | 
		
	
		
			
				|  |  |  |  |     original_description = "Mithril Pickaxe", | 
		
	
		
			
				|  |  |  |  |     description = toolranks.create_description("Mithril Pickaxe", 0, 1), | 
		
	
		
			
				|  |  |  |  |     after_use = toolranks.new_afteruse}) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |   minetest.override_item("moreores:axe_mithril", { | 
		
	
		
			
				|  |  |  |  |     original_description = "Mithril Axe", | 
		
	
		
			
				|  |  |  |  |     description = toolranks.create_description("Mithril Axe", 0, 1), | 
		
	
		
			
				|  |  |  |  |     after_use = toolranks.new_afteruse}) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |   minetest.override_item("moreores:shovel_mithril", { | 
		
	
		
			
				|  |  |  |  |     original_description = "Mithril Shovel", | 
		
	
		
			
				|  |  |  |  |     description = toolranks.create_description("Mithril Shovel", 0, 1), | 
		
	
		
			
				|  |  |  |  |     after_use = toolranks.new_afteruse}) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |   minetest.override_item("moreores:sword_mithril", { | 
		
	
		
			
				|  |  |  |  |     original_description = "Mithril Sword", | 
		
	
		
			
				|  |  |  |  |     description = toolranks.create_description("Mithril Sword", 0, 1), | 
		
	
		
			
				|  |  |  |  |     after_use = toolranks.new_afteruse}) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |   minetest.override_item("moreores:pick_silver", { | 
		
	
		
			
				|  |  |  |  |     original_description = "Silver Pickaxe", | 
		
	
		
			
				|  |  |  |  |     description = toolranks.create_description("Silver Pickaxe", 0, 1), | 
		
	
		
			
				|  |  |  |  |     after_use = toolranks.new_afteruse}) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |   minetest.override_item("moreores:axe_silver", { | 
		
	
		
			
				|  |  |  |  |     original_description = "Silver Axe", | 
		
	
		
			
				|  |  |  |  |     description = toolranks.create_description("Silver Axe", 0, 1), | 
		
	
		
			
				|  |  |  |  |     after_use = toolranks.new_afteruse}) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |   minetest.override_item("moreores:shovel_silver", { | 
		
	
		
			
				|  |  |  |  |     original_description = "Silver Shovel", | 
		
	
		
			
				|  |  |  |  |     description = toolranks.create_description("Silver Shovel", 0, 1), | 
		
	
		
			
				|  |  |  |  |     after_use = toolranks.new_afteruse}) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  |   minetest.override_item("moreores:sword_silver", { | 
		
	
		
			
				|  |  |  |  |     original_description = "Silver Sword", | 
		
	
		
			
				|  |  |  |  |     description = toolranks.create_description("Silver Sword", 0, 1), | 
		
	
		
			
				|  |  |  |  |     after_use = toolranks.new_afteruse}) | 
		
	
		
			
				|  |  |  |  | end | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | -- Sword | 
		
	
		
			
				|  |  |  |  | toolranks.add_tool("default:sword_wood") | 
		
	
		
			
				|  |  |  |  | toolranks.add_tool("default:sword_stone") | 
		
	
		
			
				|  |  |  |  | toolranks.add_tool("default:sword_steel") | 
		
	
		
			
				|  |  |  |  | toolranks.add_tool("default:sword_bronze") | 
		
	
		
			
				|  |  |  |  | toolranks.add_tool("default:sword_mese") | 
		
	
		
			
				|  |  |  |  | toolranks.add_tool("default:sword_diamond") | 
		
	
		
			
				|  |  |  |  | -- add swords for snappy nodes | 
		
	
		
			
				|  |  |  |  | minetest.override_item("default:sword_wood", { | 
		
	
		
			
				|  |  |  |  | 	original_description = "Wooden Sword", | 
		
	
		
			
				|  |  |  |  | 	description = toolranks.create_description("Wooden Sword", 0, 1), | 
		
	
		
			
				|  |  |  |  | 	after_use = toolranks.new_afteruse}) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | -- Pickaxe | 
		
	
		
			
				|  |  |  |  | toolranks.add_tool("default:pick_wood") | 
		
	
		
			
				|  |  |  |  | toolranks.add_tool("default:pick_stone") | 
		
	
		
			
				|  |  |  |  | toolranks.add_tool("default:pick_steel") | 
		
	
		
			
				|  |  |  |  | toolranks.add_tool("default:pick_bronze") | 
		
	
		
			
				|  |  |  |  | toolranks.add_tool("default:pick_mese") | 
		
	
		
			
				|  |  |  |  | toolranks.add_tool("default:pick_diamond") | 
		
	
		
			
				|  |  |  |  | minetest.override_item("default:sword_stone", { | 
		
	
		
			
				|  |  |  |  | 	original_description = "Stone Sword", | 
		
	
		
			
				|  |  |  |  | 	description = toolranks.create_description("Stone Sword", 0, 1), | 
		
	
		
			
				|  |  |  |  | 	after_use = toolranks.new_afteruse}) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | -- Axe | 
		
	
		
			
				|  |  |  |  | toolranks.add_tool("default:axe_wood") | 
		
	
		
			
				|  |  |  |  | toolranks.add_tool("default:axe_stone") | 
		
	
		
			
				|  |  |  |  | toolranks.add_tool("default:axe_steel") | 
		
	
		
			
				|  |  |  |  | toolranks.add_tool("default:axe_bronze") | 
		
	
		
			
				|  |  |  |  | toolranks.add_tool("default:axe_mese") | 
		
	
		
			
				|  |  |  |  | toolranks.add_tool("default:axe_diamond") | 
		
	
		
			
				|  |  |  |  | minetest.override_item("default:sword_steel", { | 
		
	
		
			
				|  |  |  |  | 	original_description = "Steel Sword", | 
		
	
		
			
				|  |  |  |  | 	description = toolranks.create_description("Steel Sword", 0, 1), | 
		
	
		
			
				|  |  |  |  | 	after_use = toolranks.new_afteruse}) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | -- Shovel | 
		
	
		
			
				|  |  |  |  | toolranks.add_tool("default:shovel_wood") | 
		
	
		
			
				|  |  |  |  | toolranks.add_tool("default:shovel_stone") | 
		
	
		
			
				|  |  |  |  | toolranks.add_tool("default:shovel_steel") | 
		
	
		
			
				|  |  |  |  | toolranks.add_tool("default:shovel_bronze") | 
		
	
		
			
				|  |  |  |  | toolranks.add_tool("default:shovel_mese") | 
		
	
		
			
				|  |  |  |  | toolranks.add_tool("default:shovel_diamond") | 
		
	
		
			
				|  |  |  |  | minetest.override_item("default:sword_bronze", { | 
		
	
		
			
				|  |  |  |  | 	original_description = "Bronze Sword", | 
		
	
		
			
				|  |  |  |  | 	description = toolranks.create_description("Bronze Sword", 0, 1), | 
		
	
		
			
				|  |  |  |  | 	after_use = toolranks.new_afteruse}) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | minetest.override_item("default:sword_mese", { | 
		
	
		
			
				|  |  |  |  | 	original_description = "Mese Sword", | 
		
	
		
			
				|  |  |  |  | 	description = toolranks.create_description("Mese Sword", 0, 1), | 
		
	
		
			
				|  |  |  |  | 	after_use = toolranks.new_afteruse}) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | minetest.override_item("default:sword_diamond", { | 
		
	
		
			
				|  |  |  |  | 	original_description = "Diamond Sword", | 
		
	
		
			
				|  |  |  |  | 	description = toolranks.create_description("Diamond Sword", 0, 1), | 
		
	
		
			
				|  |  |  |  | 	after_use = toolranks.new_afteruse}) | 
		
	
		
			
				|  |  |  |  |  | 
		
	
		
			
				|  |  |  |  | minetest.log("action", "[toolranks] loaded.") | 
		
	
	
		
			
				
					
					| 
							
							
							
						 |  |  |   |