1
0
Fork 0

[awards] fix warnings

This commit is contained in:
AFCMS 2021-05-23 13:43:59 +02:00
parent 8536e2c033
commit ce9258b764
3 changed files with 15 additions and 15 deletions

View File

@ -40,4 +40,13 @@ read_globals = {
"factorial" "factorial"
} }
}, },
------
--MODS
------
--GENERAL
"default",
--HUD
"sfinv", "unified_inventory",
} }

View File

@ -250,9 +250,7 @@ minetest.register_on_dignode(function(pos, oldnode, digger)
local tnodedug = string.split(entry.node, ":") local tnodedug = string.split(entry.node, ":")
local tmod = tnodedug[1] local tmod = tnodedug[1]
local titem = tnodedug[2] local titem = tnodedug[2]
if not tmod or not titem or not data.count[tmod] or not data.count[tmod][titem] then if tmod and titem and data.count[tmod] and data.count[tmod][titem] and data.count[tmod][titem] > entry.target-1 then
-- table running failed!
elseif data.count[tmod][titem] > entry.target-1 then
return entry.award return entry.award
end end
elseif awards.get_total_item_count(data, "count") > entry.target-1 then elseif awards.get_total_item_count(data, "count") > entry.target-1 then
@ -277,9 +275,7 @@ minetest.register_on_placenode(function(pos, node, digger)
local tnodedug = string.split(entry.node, ":") local tnodedug = string.split(entry.node, ":")
local tmod = tnodedug[1] local tmod = tnodedug[1]
local titem = tnodedug[2] local titem = tnodedug[2]
if not tmod or not titem or not data.place[tmod] or not data.place[tmod][titem] then if tmod and titem and data.place[tmod] and data.place[tmod][titem] and data.place[tmod][titem] > entry.target-1 then
-- table running failed!
elseif data.place[tmod][titem] > entry.target-1 then
return entry.award return entry.award
end end
elseif awards.get_total_item_count(data, "place") > entry.target-1 then elseif awards.get_total_item_count(data, "place") > entry.target-1 then
@ -303,9 +299,7 @@ minetest.register_on_item_eat(function(hp_change, replace_with_item, itemstack,
local titemstring = string.split(entry.item, ":") local titemstring = string.split(entry.item, ":")
local tmod = titemstring[1] local tmod = titemstring[1]
local titem = titemstring[2] local titem = titemstring[2]
if not tmod or not titem or not data.eat[tmod] or not data.eat[tmod][titem] then if tmod and titem and data.eat[tmod] and data.eat[tmod][titem] and data.eat[tmod][titem] > entry.target-1 then
-- table running failed!
elseif data.eat[tmod][titem] > entry.target-1 then
return entry.award return entry.award
end end
elseif awards.get_total_item_count(data, "eat") > entry.target-1 then elseif awards.get_total_item_count(data, "eat") > entry.target-1 then
@ -331,9 +325,7 @@ minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv
local titemcrafted = string.split(entry.item, ":") local titemcrafted = string.split(entry.item, ":")
local tmod = titemcrafted[1] local tmod = titemcrafted[1]
local titem = titemcrafted[2] local titem = titemcrafted[2]
if not tmod or not titem or not data.craft[tmod] or not data.craft[tmod][titem] then if tmod and titem and data.craft[tmod] and data.craft[tmod][titem] and data.craft[tmod][titem] > entry.target-1 then
-- table running failed!
elseif data.craft[tmod][titem] > entry.target-1 then
return entry.award return entry.award
end end
elseif awards.get_total_item_count(data, "craft") > entry.target-1 then elseif awards.get_total_item_count(data, "craft") > entry.target-1 then

View File

@ -1,6 +1,5 @@
if minetest.get_modpath("unified_inventory") ~= nil then if minetest.get_modpath("unified_inventory") then
local S = minetest.get_translator("awards") local S = minetest.get_translator(minetest.get_current_modname())
unified_inventory.register_button("awards", { unified_inventory.register_button("awards", {
type = "image", type = "image",
image = "awards_ui_icon.png", image = "awards_ui_icon.png",