[mcl_enchanting] fix warnings

This commit is contained in:
AFCMS 2021-05-23 00:01:30 +02:00
parent 56310a3624
commit bbde3b551f
2 changed files with 9 additions and 6 deletions

View File

@ -250,7 +250,7 @@ local function get_after_use_callback(itemdef)
itemstack:add_wear(digparams.wear)
end
local enchantments = mcl_enchanting.get_enchantments(itemstack)
--local enchantments = mcl_enchanting.get_enchantments(itemstack)
mcl_enchanting.update_groupcaps(itemstack)
end
end
@ -292,7 +292,7 @@ end
function mcl_enchanting.get_possible_enchantments(itemstack, enchantment_level, treasure)
local possible_enchantments, weights, accum_weight = {}, {}, 0
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
table.insert(possible_enchantments, enchantment)
accum_weight = accum_weight + enchantment_def.weight

View File

@ -1,6 +1,9 @@
local modpath = minetest.get_modpath("mcl_enchanting")
local S = minetest.get_translator("mcl_enchanting")
local math = math
local vector = vector
mcl_enchanting = {
book_offset = vector.new(0, 0.75, 0),
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)
end
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
return false, S("There is no such enchantment '@1'.", enchantment)
elseif errorstring == "item missing" then
@ -242,9 +245,9 @@ minetest.register_node("mcl_enchanting:table", {
on_rotate = rotate,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local player_meta = clicker:get_meta()
local table_meta = minetest.get_meta(pos)
local num_bookshelves = table_meta:get_int("mcl_enchanting:num_bookshelves")
local table_name = table_meta:get_string("name")
--local table_meta = minetest.get_meta(pos)
--local num_bookshelves = table_meta:get_int("mcl_enchanting:num_bookshelves")
local table_name = minetest.get_meta(pos):get_string("name")
if table_name == "" then
table_name = S("Enchant")
end