Open gpcf opened 4 years ago
See minetest/minetest#9300
Well, poo. As I mention over on that minetest issue, there isn't an easy workaround for this - I can't tell the table to resize or crop textures, or tell a table column to have a maximum width.
So I've added some not-quite-so-ideal workarounds to commoditymarket for situations like this. There's now a global setting to disable icons entirely, as well as per-player preferences for disabling icons if they should want to do that. That's a decent emergency "just make it usable again" workaround.
For "fixing" things a little better, I added the following two API calls to commoditymarket:
commoditymarket.override_item_icon(item_name, new_icon_texture)
commoditymarket.override_image_icon(old_icon_texture, new_icon_texture)
These can be used to fix a specific problem case in a given game. For example,
commoditymarket.override_item_icon("default:cobble", "default_wood.png")
commoditymarket.override_image_icon("default_stone.png", "default_wood.png")
Will cause cobble and stone to use the default_wood.png texture as their icon, overriding whatever commoditymarket would have been able to deduce from the item's definition. Overriding the item icon is item-specific, overriding the image icon will kick in whenever commoditymarket would determine a particular item's icon to be something that matches the first parameter (useful if there's a whole swath of items that all end up with the same bad icon texture).
This is kind of hacky, it requires server admins to potentially get their hands a little dirty with special-case coding. But you can stick all these overrides into a separate mod, and they're harmless when those items aren't around, so I could create a list of overrides for problems in common mods perhaps. Think this is a sufficient fix for this issue?
I guess I will have to fix mods that have too large textures. On a related issue, the descriptions of many items are too long and maybe should be cropped.
There's already some truncation code in the market formspec. But perhaps it's too generous, and I see that there doesn't seem to be similar truncation done for the inventory formspec, so I'll give that another pass.
Turns out the new translation system adds a bunch of hidden escape sequences to item descriptions, which makes truncation highly unreliable. Localized strings have "\27(T@
I think the real way to solve this is a "maximum width" setting for table columns. I'll add a comment on minetest/minetest#9300 and maybe file a separate issue (since a max column width is already a proposed solution to #9300 I don't know if a separate issue is needed yet).
Edit: the new issue is minetest/minetest#9313
Steps to reproduce: