minetest-mods / unified_inventory

An extensible inventory mod which allows searching crafting and browsing for recipes in the same dialogue.
Other
50 stars 38 forks source link

Added `unified_inventory_enable_item_names` option #235

Closed fmmaks666 closed 1 year ago

fmmaks666 commented 1 year ago

Added option to disable Item Names.

Purpose of change

This change allows players to disable item names, addressing the issue of long item descriptions taking up too much screen space in certain mods (e.g., ranged weapons).

Alternative solution

Show only first line of Item's description

SmallJoker commented 1 year ago

For clarification: is this fix only to work around long descriptions? If so, you could still preserve the name HUD but perform a string length check to then shorten the description to the first line and first (e.g.) 50 characters.

EDIT: In case overlaps with other HUD elements are an issue, it might make sense (in regard to #135) to take other mods into account to place the item name element in a better position.

fmmaks666 commented 1 year ago

This change is a small addition to the customization. Well, item names are sometimes useful, so I'll try to implement a fix for them as soon as possible.

// It's not related to #135.

fmmaks666 commented 1 year ago

Added option to show only first line of item's description, option to truncate item's description if its too long. Before: screenshot_20231001_173829 After: screenshot_20231001_173905 Before: screenshot_20231001_174034 After (Max length can be changed): screenshot_20231001_174053 Also: screenshot_20231001_174410 Before on Mobile: Screenshot_20231001-174829 After on Mobile: Screenshot_20231001-174858 Sorry for Image spam...

SmallJoker commented 1 year ago

FYI: \x1B(T@default) indicates a translation, where default is the textdomain. If you want to it 100% properly, you could use minetest.get_translated_string on the item description before cropping it (using a cached per-player language value from minetest.get_player_information().

Unfortunately I cannot find any helper function to strip translation marks. Not handling them might however cause visual errors or warnings on the client.

SmallJoker commented 1 year ago

Thanks. Works. Will merge in a few days unless there are objections.