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 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 diff --git a/init.lua b/init.lua index cf2f5b6..de114c8 100644 --- a/init.lua +++ b/init.lua @@ -191,9 +191,12 @@ dofile(modpath.."/register.lua") if minetest.settings:get_bool("unified_inventory_bags") ~= false then dofile(modpath.."/bags.lua") end - -dofile(modpath.."/item_names.lua") -dofile(modpath.."/waypoints.lua") +if minetest.settings:get_bool("unified_inventory_item_names") ~= false then + dofile(modpath.."/item_names.lua") +end +if minetest.settings:get_bool("unified_inventory_waypoints") ~= false then + dofile(modpath.."/waypoints.lua") +end dofile(modpath.."/legacy.lua") -- mod compatibility minetest.log("action", "[unified_inventory] loaded.") 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/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 diff --git a/settingtypes.txt b/settingtypes.txt index 5ab7f84..4fabbe5 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -1,17 +1,32 @@ -#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. +# 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 +# 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 + +# Trims the shown wielded item description to the first line. +unified_inventory_only_names (HUD item name: first line only) bool true + +# 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