From bbde3b551f08a3dbe8a727b5acd49e54f495df59 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 00:01:30 +0200 Subject: [PATCH] [mcl_enchanting] fix warnings --- mods/ITEMS/mcl_enchanting/engine.lua | 4 ++-- mods/ITEMS/mcl_enchanting/init.lua | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/mods/ITEMS/mcl_enchanting/engine.lua b/mods/ITEMS/mcl_enchanting/engine.lua index 89fdc393d..47db36870 100644 --- a/mods/ITEMS/mcl_enchanting/engine.lua +++ b/mods/ITEMS/mcl_enchanting/engine.lua @@ -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 diff --git a/mods/ITEMS/mcl_enchanting/init.lua b/mods/ITEMS/mcl_enchanting/init.lua index 26fd5e19d..06f9b0f75 100644 --- a/mods/ITEMS/mcl_enchanting/init.lua +++ b/mods/ITEMS/mcl_enchanting/init.lua @@ -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