formspec tables can't handle compositing/modifiers in images, it seems

This commit is contained in:
FaceDeer 2019-08-04 23:58:08 -06:00
parent 17d88415d0
commit 716513002c

View File

@ -1,5 +1,6 @@
local get_icon = function(item)
local def = minetest.registered_items[item]
local returnstring = "unknown_item.png"
if def then
local inventory_image = def.inventory_image
if inventory_image and inventory_image ~= "" then
@ -10,15 +11,21 @@ local get_icon = function(item)
-- Textures of node; +Y, -Y, +X, -X, +Z, -Z
local selected_tile = tiles[math.min(5,tilecount)]
if type(selected_tile) == "string" then
return selected_tile
returnstring = selected_tile
else
local tile_name = selected_tile.name
if tile_name then
returnstring = tile_name
end
end
-- Formspec tables apparently can't handle image compositing and modifiers
local found_caret = returnstring:find("%^")
if found_caret then
returnstring = returnstring:sub(1, found_caret-1)
end
local tile_name = selected_tile.name
if tile_name then
return tile_name
end
end
end
return "unknown_item.png"
return returnstring
end
local get_item_description = function(item)
@ -370,7 +377,6 @@ local get_market_formspec = function(market, account)
else
formspec[#formspec+1] = "label[0.1,5.1;Select an item to view or place orders]"
end
minetest.debug(table.concat(formspec))
return table.concat(formspec)
end