forked from VoxeLibre/VoxeLibre
[mcl_enchanting] fix warnings
This commit is contained in:
parent
56310a3624
commit
bbde3b551f
|
@ -250,7 +250,7 @@ local function get_after_use_callback(itemdef)
|
||||||
itemstack:add_wear(digparams.wear)
|
itemstack:add_wear(digparams.wear)
|
||||||
end
|
end
|
||||||
|
|
||||||
local enchantments = mcl_enchanting.get_enchantments(itemstack)
|
--local enchantments = mcl_enchanting.get_enchantments(itemstack)
|
||||||
mcl_enchanting.update_groupcaps(itemstack)
|
mcl_enchanting.update_groupcaps(itemstack)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -292,7 +292,7 @@ end
|
||||||
function mcl_enchanting.get_possible_enchantments(itemstack, enchantment_level, treasure)
|
function mcl_enchanting.get_possible_enchantments(itemstack, enchantment_level, treasure)
|
||||||
local possible_enchantments, weights, accum_weight = {}, {}, 0
|
local possible_enchantments, weights, accum_weight = {}, {}, 0
|
||||||
for enchantment, enchantment_def in pairs(mcl_enchanting.enchantments) do
|
for enchantment, enchantment_def in pairs(mcl_enchanting.enchantments) do
|
||||||
local supported, _, _, primary = mcl_enchanting.can_enchant(itemstack, enchantment, 1)
|
local _, _, _, primary = mcl_enchanting.can_enchant(itemstack, enchantment, 1)
|
||||||
if primary or treasure then
|
if primary or treasure then
|
||||||
table.insert(possible_enchantments, enchantment)
|
table.insert(possible_enchantments, enchantment)
|
||||||
accum_weight = accum_weight + enchantment_def.weight
|
accum_weight = accum_weight + enchantment_def.weight
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
local modpath = minetest.get_modpath("mcl_enchanting")
|
local modpath = minetest.get_modpath("mcl_enchanting")
|
||||||
local S = minetest.get_translator("mcl_enchanting")
|
local S = minetest.get_translator("mcl_enchanting")
|
||||||
|
|
||||||
|
local math = math
|
||||||
|
local vector = vector
|
||||||
|
|
||||||
mcl_enchanting = {
|
mcl_enchanting = {
|
||||||
book_offset = vector.new(0, 0.75, 0),
|
book_offset = vector.new(0, 0.75, 0),
|
||||||
book_animations = {["close"] = 1, ["opening"] = 2, ["open"] = 3, ["closing"] = 4},
|
book_animations = {["close"] = 1, ["opening"] = 2, ["open"] = 3, ["closing"] = 4},
|
||||||
|
@ -122,7 +125,7 @@ minetest.register_chatcommand("forceenchant", {
|
||||||
return false, S("Player '@1' cannot be found.", target_name)
|
return false, S("Player '@1' cannot be found.", target_name)
|
||||||
end
|
end
|
||||||
local itemstack = target:get_wielded_item()
|
local itemstack = target:get_wielded_item()
|
||||||
local can_enchant, errorstring, extra_info = mcl_enchanting.can_enchant(itemstack, enchantment, level)
|
local _, errorstring = mcl_enchanting.can_enchant(itemstack, enchantment, level)
|
||||||
if errorstring == "enchantment invalid" then
|
if errorstring == "enchantment invalid" then
|
||||||
return false, S("There is no such enchantment '@1'.", enchantment)
|
return false, S("There is no such enchantment '@1'.", enchantment)
|
||||||
elseif errorstring == "item missing" then
|
elseif errorstring == "item missing" then
|
||||||
|
@ -242,9 +245,9 @@ minetest.register_node("mcl_enchanting:table", {
|
||||||
on_rotate = rotate,
|
on_rotate = rotate,
|
||||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||||
local player_meta = clicker:get_meta()
|
local player_meta = clicker:get_meta()
|
||||||
local table_meta = minetest.get_meta(pos)
|
--local table_meta = minetest.get_meta(pos)
|
||||||
local num_bookshelves = table_meta:get_int("mcl_enchanting:num_bookshelves")
|
--local num_bookshelves = table_meta:get_int("mcl_enchanting:num_bookshelves")
|
||||||
local table_name = table_meta:get_string("name")
|
local table_name = minetest.get_meta(pos):get_string("name")
|
||||||
if table_name == "" then
|
if table_name == "" then
|
||||||
table_name = S("Enchant")
|
table_name = S("Enchant")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue