generated from jasonl8446/minetest-boilerplate
35 lines
1008 B
Lua
35 lines
1008 B
Lua
|
-- TODO:
|
||
|
-- Make sure enchantment is an enchantment
|
||
|
-- Make sure level is a number
|
||
|
function tool_level_enchanting.set_enchantment(itemstack,enchantment_name,level)
|
||
|
local itemmeta = itemstack:get_meta()
|
||
|
itemmeta:set_string(enchantment_name,level)
|
||
|
return itemstack
|
||
|
end
|
||
|
-- Unbreaking
|
||
|
-- 10% chance per level of not using durability each use
|
||
|
-- (Level 10, tool takes no durability usage)
|
||
|
-- This function is used in tool_level_enchanting.on_use
|
||
|
function tool_level_enchanting.unbreaking_proc(enchant_level)
|
||
|
local rand_num = math.random(1,10)
|
||
|
if tonumber(enchant_level) >= tonumber(rand_num) then
|
||
|
return false
|
||
|
else
|
||
|
return true
|
||
|
end
|
||
|
end
|
||
|
|
||
|
-- Fortune
|
||
|
-- 10% Chance per level of doubling ore
|
||
|
-- 5% Chance per level of doubling uses
|
||
|
-- Max level 10
|
||
|
|
||
|
-- Silk Touch
|
||
|
-- Return block mined
|
||
|
-- No idea how to implient yet
|
||
|
|
||
|
-- Auto Repair
|
||
|
-- Auto repairs every few seconds
|
||
|
-- Max Level 5
|
||
|
-- Will work simularly to a compass/clock does
|
||
|
-- Not sure how much per level to repair yet
|