fixed crashing with unknown items in the craft guide and fixed getting multiple achievements at once
This commit is contained in:
parent
c8e0dbfe68
commit
41ca6bb52e
|
@ -92,7 +92,7 @@ local function on_craft(itemstack, player, craftgrid, craftinv)
|
||||||
else
|
else
|
||||||
local group = string.match(def.craftitem, "group:(.*)")
|
local group = string.match(def.craftitem, "group:(.*)")
|
||||||
|
|
||||||
if group and minetest.get_item_group(itemstack:get_name(), group) then
|
if group and minetest.get_item_group(itemstack:get_name(), group) ~= 0 then
|
||||||
achievements.trigger_achievement(player, aname)
|
achievements.trigger_achievement(player, aname)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -108,7 +108,7 @@ local function on_dig(pos, oldnode, player)
|
||||||
else
|
else
|
||||||
local group = string.match(def.dignode, "group:(.*)")
|
local group = string.match(def.dignode, "group:(.*)")
|
||||||
|
|
||||||
if group and minetest.get_item_group(def.dignode, group) then
|
if group and minetest.get_item_group(def.dignode, group) ~= 0 then
|
||||||
achievements.trigger_achievement(player, aname)
|
achievements.trigger_achievement(player, aname)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -124,7 +124,7 @@ local function on_place(pos, newnode, player, oldnode, itemstack, pointed_thing)
|
||||||
else
|
else
|
||||||
local group = string.match(def.placenode, "group:(.*)")
|
local group = string.match(def.placenode, "group:(.*)")
|
||||||
|
|
||||||
if group and minetest.get_item_group(newnode.name, group) then
|
if group and minetest.get_item_group(newnode.name, group) ~= 0 then
|
||||||
achievements.trigger_achievement(player, aname)
|
achievements.trigger_achievement(player, aname)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -84,7 +84,7 @@ function default.ui.fake_itemstack(x, y, itemstack, name)
|
||||||
local itemamt = itemstack:get_count()
|
local itemamt = itemstack:get_count()
|
||||||
|
|
||||||
local itemdesc = ""
|
local itemdesc = ""
|
||||||
if minetest.registered_items[itemname].description ~= nil then
|
if minetest.registered_items[itemname] and minetest.registered_items[itemname].description ~= nil then
|
||||||
itemdesc = minetest.registered_items[itemname].description
|
itemdesc = minetest.registered_items[itemname].description
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ function default.ui.fake_simple_itemstack(x, y, itemname, name)
|
||||||
local name = name or "fake_simple_itemstack"
|
local name = name or "fake_simple_itemstack"
|
||||||
|
|
||||||
local itemdesc = ""
|
local itemdesc = ""
|
||||||
if minetest.registered_items[itemname].description ~= nil then
|
if minetest.registered_items[itemname] and minetest.registered_items[itemname].description ~= nil then
|
||||||
itemdesc = minetest.registered_items[itemname].description
|
itemdesc = minetest.registered_items[itemname].description
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ function default.ui.item_group(x, y, group, name)
|
||||||
end
|
end
|
||||||
|
|
||||||
local itemdesc = ""
|
local itemdesc = ""
|
||||||
if minetest.registered_items[itemname].description ~= nil then
|
if minetest.registered_items[itemname] and minetest.registered_items[itemname].description ~= nil then
|
||||||
itemdesc = minetest.registered_items[itemname].description
|
itemdesc = minetest.registered_items[itemname].description
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue