From d6d4bea819fe44ef447491834ef25a834a575bc2 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Sun, 18 Jun 2023 18:48:15 +0200 Subject: [PATCH 1/6] Bags: Prevent error caused by moving the opened bag --- bags.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bags.lua b/bags.lua index 464b65b..f6d4da6 100644 --- a/bags.lua +++ b/bags.lua @@ -221,6 +221,11 @@ minetest.register_on_joinplayer(function(player) on_take = function(inv, listname, index, stack, player) player:get_inventory():set_size(listname .. "contents", 0) save_bags_metadata(player, inv) + if listname == ui.current_page[player:get_player_name()] then + -- Bag is currently open: avoid follow-up issues by navigating back + -- Trick: the list name is the same as the registered page name + ui.set_inventory_formspec(player, "bags") + end end, allow_move = function() return 0 From 2426b6c91223c985d85c007e5e5bb046c18ed995 Mon Sep 17 00:00:00 2001 From: Nolt Date: Sat, 24 Jun 2023 08:43:04 +0200 Subject: [PATCH 2/6] Full polish translation (#231) --- locale/unified_inventory.pl.tr | 125 ++++++++++++++++----------------- 1 file changed, 59 insertions(+), 66 deletions(-) diff --git a/locale/unified_inventory.pl.tr b/locale/unified_inventory.pl.tr index 69d39e3..1e06bc1 100644 --- a/locale/unified_inventory.pl.tr +++ b/locale/unified_inventory.pl.tr @@ -1,98 +1,91 @@ # textdomain: unified_inventory -Mixing= -Cooking= -Digging= +Category:=Kategorie: +Mixing=Miksowanie +Cooking=Gotowanie +Digging=Kopanie Bags=Plecaki Bag @1=Plecak @1 -Small Bag=Maly plecak -Medium Bag=Sredni plecak -Large Bag=Duzy plecak -All Items= -Misc. Items= -Plant Life= -Building Materials= -Tools= -Minerals and Metals= -Environment and Worldgen= -Lighting= +Small Bag=Mały plecak +Medium Bag=Średni plecak +Large Bag=Duży plecak +All Items=Wszystkie przedmioty +Misc. Items=Różne przedmioty +Plant Life=Życie roślin +Building Materials=Materiały budowlane +Tools=Narzędzia +Minerals and Metals=Minerały i metale +Environment and Worldgen=Otoczenie i generowanie świata +Lighting=Oświetlenie and = i -Scroll categories left= -Scroll categories right= +Scroll categories left=Przewiń kategorię w lewo +Scroll categories right=Przewiń kategorię w prawo Search=Szukaj -Reset search and display everything= +Reset search and display everything=Zresetuj wyszukiwanie i pokaż wszystko First page=Pierwsza strona -Back three pages=3 strony w tyl -Back one page=1 strona w tyl -Forward one page=1 strona do przodu -Forward three pages=3 strony do przodu +Back three pages=Trzy strony do tyłu +Back one page=Stronę do tyłu +Forward one page=Stronę do przodu +Forward three pages=Trzy strony do przodu Last page=Ostatnia strona -No matching items=Brak pasujacych przedmiotow +No matching items=Brak pasujących przedmiotów No matches.=Brak wyników Page=Strona @1 of @2=@1 z @2 Filter=Filtr -Can use the creative inventory= -Forces Unified Inventory to be displayed in Full mode if Lite mode is configured globally= -Crafting Grid= -Crafting Guide= -Set home position=Ustaw pozycję wyjściową -Home position set to: @1=Pozycja domowa ustawiona na: @1 -You don't have the "home" privilege!=Nie masz uprawnien do zmiany czasu "home"! +Can use the creative inventory=Może używać kreatywnego ekwipunku +Forces Unified Inventory to be displayed in Full mode if Lite mode is configured globally=Wymusza wyświetlanie Unified Inventory w trybie Full jeżeli tryb Lite jest skonfigurowany globalnie +Crafting Grid=Siatka craftingu +Crafting Guide=Przewodnik craftingu +Set home position=Ustaw pozycję domu +Home position set to: @1=Pozycja domu ustawiona na: @1 +You don't have the "home" privilege!=Brak uprawnień "home"! Go home=Idź do domu Set time to day=Ustaw czas na dzień Time of day set to 6am=Czas ustawiony na 6:00 -You don't have the settime privilege!=Nie masz uprawnien do zmiany czasu "settime"! +You don't have the settime privilege!=Brak uprawnień "settime"! Set time to night=Ustaw czas na noc Time of day set to 9pm=Czas ustawiony na 21:00 -Clear inventory=Wyczyść zapasy -This button has been disabled outside of creative mode to prevent accidental inventory trashing.@nUse the trash slot instead.= -Inventory cleared!=Zapasy zostały wyczyszczone! -Trash:=Smietnik: -Refill:=Uzupelnianie: -Any item belonging to the @1 group= -Any item belonging to the groups @1= +Clear inventory=Wyczyść ekwipunek +This button has been disabled outside of creative mode to prevent accidental inventory trashing.@nUse the trash slot instead.=Aby zapobiec przypadkowemu skasowaniu ekwipunku, ten przycisk został wyłączony poza trybem kreatywnym.@nUżyj zamiast tego ikony śmietnika. +Inventory cleared!=Ekwipunek został wyczyszczony! +Trash:=Śmietnik: +Refill:=Uzupełnianie: +Any item belonging to the @1 group=Każdy przedmiot należący do @1 grupy +Any item belonging to the groups @1=Każdy przedmiot należacy do grup @1 Recipe @1 of @2=Recepta @1 z @2 Usage @1 of @2=Użycie @1 z @2 No recipes=Brak recepty No usages=Bez użycia Result=Wynik Ingredient=Składnik -Show next recipe= -Show next usage= -Show previous recipe= -Show previous usage= -@1 (@2)= +Show next recipe=Pokaż nastepną recepturę +Show next usage=Pokaż następne użycie +Show previous recipe=Pokaż poprzednią recepturę +Show previous usage=Pokaż poprzednie użycie +@1 (@2)=@1 (@2) Give me:=Daj mi: -This recipe is too@@large to be displayed.= -To craft grid:= +This recipe is too@@large to be displayed.=Receptura jest zbyt@@duża aby ją wyświetlić. +To craft grid:=Do siatki craftingu. All=Wszystko -Crafting= -White=Bialy -Yellow=Zolty +Crafting=Crafting +White=Biały +Yellow=Zółty Red=Czerwony Green=Zielony Blue=Niebieski Waypoints=Punkty orientacyjne Select Waypoint #@1=Wybierz punkt #@1 Waypoint @1=Punkty orientacyjne @1 -Set waypoint to current location=Ustaw punkt orientacyjny na biezacej pozycji -Hide waypoint= -Show waypoint= -Hide coordinates= -Show coordinates= -Change color of waypoint display=Zmien kolor punktu -Edit waypoint name=Edytuj nazwe punktu -Waypoint active=Punkt wlaczony -Waypoint inactive=Punkt wylaczony -Finish editing=Zakoncz edycje +Set waypoint to current location=Ustaw punkt orientacyjny na bieżacej pozycji +Hide waypoint=Ukryj punkt orientacyjny +Show waypoint=Pokaż punkt orientacyjny +Hide coordinates=Ukryj koordynaty +Show coordinates=Pokaż koordynaty +Change color of waypoint display=Zmień kolor punktu +Edit waypoint name=Edytuj nazwę punktu +Waypoint active=Punkt włączony +Waypoint inactive=Punkt wyłączony +Finish editing=Zakończ edycję World position=Pozycja Name=Nazwa -HUD text color=Kolor tekstu HUD - - -##### not used anymore ##### - -invisible=niewidzialny -visible=widomy -Make waypoint @1=Robić punkt @1 -@1 display of waypoint coordinates=@1 koordynatow punktu +HUD text color=Kolor tekstu HUD \ No newline at end of file From 5d233a0f0afe5b0ec63b8ec2a1fdb2c6ea918b00 Mon Sep 17 00:00:00 2001 From: Niklp <89982526+Niklp09@users.noreply.github.com> Date: Tue, 11 Jul 2023 18:12:35 +0200 Subject: [PATCH 3/6] Clean itemname before checking existence (#234) important when the item string contains metadata --- api.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api.lua b/api.lua index 0437391..1c756d9 100644 --- a/api.lua +++ b/api.lua @@ -12,8 +12,9 @@ local function is_recipe_craftable(recipe) end else -- Possibly an item - if not minetest.registered_items[itemname] - or minetest.get_item_group(itemname, "not_in_craft_guide") ~= 0 then + local itemname_cleaned = ItemStack(itemname):get_name() + if not minetest.registered_items[itemname_cleaned] + or minetest.get_item_group(itemname_cleaned, "not_in_craft_guide") ~= 0 then return false end end From 43c9b5080031093f86530c38fa613cd4e79dd625 Mon Sep 17 00:00:00 2001 From: fmmaks <108734737+fmmaks666@users.noreply.github.com> Date: Sun, 15 Oct 2023 22:02:35 +0300 Subject: [PATCH 4/6] Add `unified_inventory_enable_item_names` setting (#235) Show only names settings: in case of multi-line descriptions, only the first line is shown Shorten long descriptions: Removes all characters after x index, and add `[...]` Max length before truncation: x for Shorten long descriptions Notes: If Max length == 0, then item names won't be displayed --- init.lua | 5 +++-- item_names.lua | 11 +++++++++++ settingtypes.txt | 6 ++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 4a09b32..8f91aca 100644 --- a/init.lua +++ b/init.lua @@ -191,7 +191,8 @@ dofile(modpath.."/register.lua") if minetest.settings:get_bool("unified_inventory_bags") ~= false then dofile(modpath.."/bags.lua") end - -dofile(modpath.."/item_names.lua") +if minetest.settings:get_bool("unified_inventory_item_names") ~= false then + dofile(modpath.."/item_names.lua") +end dofile(modpath.."/waypoints.lua") dofile(modpath.."/legacy.lua") -- mod compatibility diff --git a/item_names.lua b/item_names.lua index a1368f8..cb9f2a3 100644 --- a/item_names.lua +++ b/item_names.lua @@ -3,6 +3,8 @@ local item_names = {} -- [player_name] = { hud, dtime, itemname } local dlimit = 3 -- HUD element will be hidden after this many seconds local hudbars_mod = minetest.get_modpath("hudbars") +local only_names = minetest.settings:get_bool("unified_inventory_only_names", true) +local max_length = tonumber(minetest.settings:get("unified_inventory_max_item_name_length")) or 80 local function set_hud(player) local player_name = player:get_player_name() @@ -60,6 +62,7 @@ minetest.register_globalstep(function(dtime) data.itemname = itemname data.index = index data.dtime = 0 + local lang_code = minetest.get_player_information(player:get_player_name()).lang_code local desc = stack.get_meta and stack:get_meta():get_string("description") @@ -69,6 +72,14 @@ minetest.register_globalstep(function(dtime) local def = minetest.registered_items[itemname] desc = def and def.description or "" end + if only_names and desc and string.find(desc, "\n") then + desc = string.match(desc, "([^\n]*)") + end + desc = minetest.get_translated_string(lang_code, desc) + desc = minetest.strip_colors(desc) + if string.len(desc) > max_length and max_length > 0 then + desc = string.sub(desc, 1, max_length) .. " [...]" + end player:hud_change(data.hud, 'text', desc) end end diff --git a/settingtypes.txt b/settingtypes.txt index 5ab7f84..83190a9 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -15,3 +15,9 @@ unified_inventory_hide_disabled_buttons (Hide disabled buttons) bool false unified_inventory_automatic_categorization (Items automatically added to categories) bool true + +unified_inventory_item_names (Item names are shown above hotbar) bool true + +unified_inventory_only_names (Show only item name) bool true + +unified_inventory_max_item_name_length (Maximum length of an item name before it's truncated, 0 disables option) int 80 From 380b77d0fbb178709f7d2699a5d04f55690a8646 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Mon, 20 Nov 2023 17:51:34 +0100 Subject: [PATCH 5/6] Improve settings descriptions --- settingtypes.txt | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/settingtypes.txt b/settingtypes.txt index 83190a9..f8e5607 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -1,23 +1,29 @@ -#Enabling lite mode enables a smaller and simpler version of the Unified -#Inventory, optimized for small displays. +# Reduced formspec layout, optimized for smaller displays. +# Note: This may also disable some features to free up visual space. unified_inventory_lite (Lite mode) bool false -#If enabled, bags will be made available which can be used to extend -#inventory storage size. +# Provides craftable bag items to extend the inventory space. unified_inventory_bags (Enable bags) bool true -#If enabled, the trash slot can be used by those without both creative -#and the give privilege. +# Shows the trash slot to everyone. +# When disabled, only players with the privilege "creative" or "give" will +# have this slot shown in their inventory. unified_inventory_trash (Enable trash) bool true -#If enabled, disabled buttons will be hidden instead of grayed out. +# If enabled, disabled buttons will be hidden instead of grayed out. unified_inventory_hide_disabled_buttons (Hide disabled buttons) bool false +# Automatically categorizes registered items based on their +# groups. This is based on a fuzzy match, thus is not 100% accurate. +unified_inventory_automatic_categorization (Categories: add items automatically) bool true -unified_inventory_automatic_categorization (Items automatically added to categories) bool true +# Shows the selected wielded item description in the HUD for a few seconds. +unified_inventory_item_names (Enable HUD item names) bool true -unified_inventory_item_names (Item names are shown above hotbar) bool true +# Trims the shown wielded item description to the first line. +unified_inventory_only_names (HUD item name: first line only) bool true -unified_inventory_only_names (Show only item name) bool true - -unified_inventory_max_item_name_length (Maximum length of an item name before it's truncated, 0 disables option) int 80 +# Hard character limit of the wielded item description. +# Crops the shown description to the specified length. +# 0 disables this functionality. +unified_inventory_max_item_name_length (HUD item names: character limit) int 80 From 693ca112b8be0b982543e62fb9b068075b2873ea Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Mon, 20 Nov 2023 17:54:44 +0100 Subject: [PATCH 6/6] Add setting to disable waypoints --- init.lua | 4 +++- settingtypes.txt | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 8f91aca..35a2e83 100644 --- a/init.lua +++ b/init.lua @@ -194,5 +194,7 @@ end if minetest.settings:get_bool("unified_inventory_item_names") ~= false then dofile(modpath.."/item_names.lua") end -dofile(modpath.."/waypoints.lua") +if minetest.settings:get_bool("unified_inventory_waypoints") ~= false then + dofile(modpath.."/waypoints.lua") +end dofile(modpath.."/legacy.lua") -- mod compatibility diff --git a/settingtypes.txt b/settingtypes.txt index f8e5607..4fabbe5 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -10,6 +10,9 @@ unified_inventory_bags (Enable bags) bool true # have this slot shown in their inventory. unified_inventory_trash (Enable trash) bool true +# Provides waypoints on a per-player basis to remember positions on the map. +unified_inventory_waypoints (Enable waypoints) bool true + # If enabled, disabled buttons will be hidden instead of grayed out. unified_inventory_hide_disabled_buttons (Hide disabled buttons) bool false