14 Commits

Author SHA1 Message Date
4499ae1139 Option to hide uncraftable items
This setting only applies to non-creative players.
2023-12-24 11:54:56 +01:00
693ca112b8 Add setting to disable waypoints 2023-11-20 17:54:44 +01:00
380b77d0fb Improve settings descriptions 2023-11-20 17:51:34 +01:00
43c9b50800 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
2023-10-15 21:02:35 +02:00
5d233a0f0a Clean itemname before checking existence (#234)
important when the item string contains metadata
2023-07-11 18:12:35 +02:00
2426b6c912 Full polish translation (#231) 2023-06-24 08:43:04 +02:00
d6d4bea819 Bags: Prevent error caused by moving the opened bag 2023-06-18 18:48:15 +02:00
15d729c351 Waypoints: Add teleportation button
This also adds button click sounds and makes use of the teleport sound for consistency.
2023-06-06 19:41:03 +02:00
b2cc3d1532 Fix search not working after page flip 2023-01-27 15:57:28 +01:00
37969b2a1b Make bags support lite mode 2023-01-12 22:16:06 +01:00
1b074828a6 Document and replace sounds
A few sounds were replaced because I could not find them on freesound.org
2023-01-10 21:27:56 +01:00
de0063835c Purge recipes with invalid ingredients 2023-01-09 17:42:41 +01:00
bda9f2598f Improve group matching for 'copy to craft' 2023-01-09 17:42:41 +01:00
b590764026 Centre page number label and move refill/trash labels (#221)
* Centre page number label

* Move refill and trash labels
2023-01-04 14:35:46 +01:00
17 changed files with 273 additions and 171 deletions

View File

@ -71,6 +71,9 @@ From http://www.clker.com (Public Domain, CC-BY-4.0):
* [`ui_pencil_icon.pnc`](http://www.clker.com/clipart-2256.html) * [`ui_pencil_icon.pnc`](http://www.clker.com/clipart-2256.html)
* [`ui_waypoint_set_icon.png`](http://www.clker.com/clipart-larger-flag.html) * [`ui_waypoint_set_icon.png`](http://www.clker.com/clipart-larger-flag.html)
From https://www.svgrepo.com (CC-BY)
* [`ui_teleport.png`](https://www.svgrepo.com/svg/321565/teleport)
Everaldo Coelho (YellowIcon) (LGPL v2.1+): Everaldo Coelho (YellowIcon) (LGPL v2.1+):
* [`ui_craftguide_icon.png` / `ui_craft_icon.png`](http://commons.wikimedia.org/wiki/File:Advancedsettings.png) * [`ui_craftguide_icon.png` / `ui_craft_icon.png`](http://commons.wikimedia.org/wiki/File:Advancedsettings.png)
@ -102,3 +105,16 @@ Other files from Wikimedia Commons:
RealBadAngel: (CC-BY-4.0) RealBadAngel: (CC-BY-4.0)
* Everything else. * Everything else.
## Sounds
* [`bell.ogg`](https://freesound.org/people/bennstir/sounds/81072/) by bennstir, CC 4.0
* [`electricity.ogg`](https://freesound.org/people/Halleck/sounds/19486/) by Halleck, CC 4.0 (cut)
* [`pageflip1.ogg`](https://freesound.org/people/themfish/sounds/45823/) by themfish, CC 4.0 (cut, slowed down)
* `pageflip2.ogg` (derived from `pageflip1.ogg`)
* [`trash.ogg`](https://freesound.org/people/OwlStorm/sounds/151231/) by OwlStorm, CC 0 (speed up)
* [`trash_all.ogg`](https://freesound.org/people/abel_K/sounds/68280/) by abel_K, Sampling Plus 1.0 (speed up)
* [`ui_click.ogg`](https://freesound.org/people/lartti/sounds/527569/) by lartti, CC 0 (cut)
* [`ui_morning.ogg`](https://freesound.org/people/InspectorJ/sounds/439472/) by InspectorJ, CC 4.0
* [`ui_owl.ogg`](https://freesound.org/people/manda_g/sounds/54987/) by manda_g, Sampling Plus 1.0 (cut)

View File

@ -12,8 +12,9 @@ local function is_recipe_craftable(recipe)
end end
else else
-- Possibly an item -- Possibly an item
if not minetest.registered_items[itemname] local itemname_cleaned = ItemStack(itemname):get_name()
or minetest.get_item_group(itemname, "not_in_craft_guide") ~= 0 then if not minetest.registered_items[itemname_cleaned]
or minetest.get_item_group(itemname_cleaned, "not_in_craft_guide") ~= 0 then
return false return false
end end
end end
@ -50,6 +51,7 @@ minetest.after(0.01, function()
end end
end end
end end
table.sort(ui.items_list) table.sort(ui.items_list)
ui.items_list_size = #ui.items_list ui.items_list_size = #ui.items_list
print("Unified Inventory. Inventory size: "..ui.items_list_size) print("Unified Inventory. Inventory size: "..ui.items_list_size)

View File

@ -10,25 +10,26 @@ local F = minetest.formspec_escape
local ui = unified_inventory local ui = unified_inventory
ui.register_page("bags", { ui.register_page("bags", {
get_formspec = function(player) get_formspec = function(player, perplayer_formspec)
local player_name = player:get_player_name() local player_name = player:get_player_name()
return { formspec = table.concat({ local std_inv_x = perplayer_formspec.std_inv_x
ui.style_full.standard_inv_bg, local formspec = {
ui.single_slot(0.925, 1.5), perplayer_formspec.standard_inv_bg,
ui.single_slot(3.425, 1.5), "label[", perplayer_formspec.form_header_x, ",",
ui.single_slot(5.925, 1.5), perplayer_formspec.form_header_y, ";", F(S("Bags")), "]",
ui.single_slot(8.425, 1.5),
"label["..ui.style_full.form_header_x..","..ui.style_full.form_header_y..";" .. F(S("Bags")) .. "]",
"button[0.6125,2.75;1.875,0.75;bag1;" .. F(S("Bag @1", 1)) .. "]",
"button[3.1125,2.75;1.875,0.75;bag2;" .. F(S("Bag @1", 2)) .. "]",
"button[5.6125,2.75;1.875,0.75;bag3;" .. F(S("Bag @1", 3)) .. "]",
"button[8.1125,2.75;1.875,0.75;bag4;" .. F(S("Bag @1", 4)) .. "]",
"listcolors[#00000000;#00000000]", "listcolors[#00000000;#00000000]",
"list[detached:" .. F(player_name) .. "_bags;bag1;1.075,1.65;1,1;]", }
"list[detached:" .. F(player_name) .. "_bags;bag2;3.575,1.65;1,1;]",
"list[detached:" .. F(player_name) .. "_bags;bag3;6.075,1.65;1,1;]", for i = 1, 4 do
"list[detached:" .. F(player_name) .. "_bags;bag4;8.575,1.65;1,1;]" local x = std_inv_x + i * 2.5
}) } formspec[#formspec + 1] = ui.single_slot(x - 1.875, 1.5)
formspec[#formspec + 1] = string.format("list[detached:%s_bags;bag%i;%.3f,1.65;1,1;]",
F(player_name), i, x - 1.725)
formspec[#formspec + 1] = string.format("button[%.4f,2.75;1.875,0.75;bag%i;%s]",
x - 2.1875, i, F(S("Bag @1", i)))
end
return { formspec = table.concat(formspec) }
end, end,
}) })
@ -36,7 +37,6 @@ ui.register_button("bags", {
type = "image", type = "image",
image = "ui_bags_icon.png", image = "ui_bags_icon.png",
tooltip = S("Bags"), tooltip = S("Bags"),
hide_lite=true
}) })
local function get_player_bag_stack(player, i) local function get_player_bag_stack(player, i)
@ -48,23 +48,38 @@ end
for bag_i = 1, 4 do for bag_i = 1, 4 do
ui.register_page("bag" .. bag_i, { ui.register_page("bag" .. bag_i, {
get_formspec = function(player) get_formspec = function(player, perplayer_formspec)
local stack = get_player_bag_stack(player, bag_i) local stack = get_player_bag_stack(player, bag_i)
local image = stack:get_definition().inventory_image local image = stack:get_definition().inventory_image
local slots = stack:get_definition().groups.bagslots local slots = stack:get_definition().groups.bagslots
local std_inv_x = perplayer_formspec.std_inv_x
local lite_mode = perplayer_formspec.is_lite_mode
local bag_inv_y, header_x, header_y = 1.5, 0.3, 0.65
if lite_mode then
bag_inv_y = 0.5
header_x = perplayer_formspec.form_header_x
header_y = perplayer_formspec.form_header_y
end
local formspec = { local formspec = {
ui.style_full.standard_inv_bg, perplayer_formspec.standard_inv_bg,
ui.make_inv_img_grid(0.3, 1.5, 8, slots/8), ui.make_inv_img_grid(std_inv_x, bag_inv_y, 8, slots/8),
"image[9.2,0.4;1,1;" .. image .. "]", "label[", header_x, ",", header_y, ";", F(S("Bag @1", bag_i)), "]",
"label[0.3,0.65;" .. F(S("Bag @1", bag_i)) .. "]",
"listcolors[#00000000;#00000000]", "listcolors[#00000000;#00000000]",
"listring[current_player;main]", "listring[current_player;main]",
string.format("list[current_player;bag%icontents;%f,%f;8,3;]", string.format("list[current_player;bag%icontents;%f,%f;8,3;]",
bag_i, 0.3 + ui.list_img_offset, 1.5 + ui.list_img_offset), bag_i, std_inv_x + ui.list_img_offset, bag_inv_y + ui.list_img_offset),
"listring[current_name;bag" .. bag_i .. "contents]", "listring[current_name;bag", bag_i, "contents]",
} }
if lite_mode then
return { formspec = table.concat(formspec) }
end
local n = #formspec + 1 local n = #formspec + 1
formspec[n] = "image[" .. std_inv_x + 8.9 .. ",0.4;1,1;" .. image .. "]"
n = n + 1
local player_name = player:get_player_name() -- For if statement. local player_name = player:get_player_name() -- For if statement.
if ui.trash_enabled if ui.trash_enabled
@ -206,6 +221,11 @@ minetest.register_on_joinplayer(function(player)
on_take = function(inv, listname, index, stack, player) on_take = function(inv, listname, index, stack, player)
player:get_inventory():set_size(listname .. "contents", 0) player:get_inventory():set_size(listname .. "contents", 0)
save_bags_metadata(player, inv) 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, end,
allow_move = function() allow_move = function()
return 0 return 0

View File

@ -57,30 +57,47 @@ end)
local function apply_new_filter(player, search_text, new_dir) local function apply_new_filter(player, search_text, new_dir)
local player_name = player:get_player_name() local player_name = player:get_player_name()
minetest.sound_play("click", {to_player=player_name, gain = 0.1}) minetest.sound_play("ui_click", {to_player=player_name, gain = 0.1})
ui.apply_filter(player, search_text, new_dir) ui.apply_filter(player, search_text, new_dir)
ui.current_searchbox[player_name] = search_text ui.current_searchbox[player_name] = search_text
ui.set_inventory_formspec(player, ui.current_page[player_name]) ui.set_inventory_formspec(player, ui.current_page[player_name])
end end
minetest.register_on_player_receive_fields(function(player, formname, fields) -- Search box handling
local function receive_fields_searchbox(player, formname, fields)
local player_name = player:get_player_name() local player_name = player:get_player_name()
local ui_peruser,draw_lite_mode = unified_inventory.get_per_player_formspec(player_name) -- always take new search text, even if not searching on it yet
if fields.searchbox and fields.searchbox ~= ui.current_searchbox[player_name] then
ui.current_searchbox[player_name] = fields.searchbox
end
if fields.searchbutton
or fields.key_enter_field == "searchbox" then
if ui.current_searchbox[player_name] ~= ui.activefilter[player_name] then
ui.apply_filter(player, ui.current_searchbox[player_name], "nochange")
ui.set_inventory_formspec(player, ui.current_page[player_name])
minetest.sound_play("paperflip2",
{to_player=player_name, gain = 1.0})
end
elseif fields.searchresetbutton then
if ui.activefilter[player_name] ~= "" then
apply_new_filter(player, "", "nochange")
end
end
end
minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname ~= "" then if formname ~= "" then
return return
end end
-- always take new search text, even if not searching on it yet receive_fields_searchbox(player, formname, fields)
local dirty_search_filter = false
if fields.searchbox local player_name = player:get_player_name()
and fields.searchbox ~= unified_inventory.current_searchbox[player_name] then
unified_inventory.current_searchbox[player_name] = fields.searchbox
dirty_search_filter = true
end
local ui_peruser,draw_lite_mode = unified_inventory.get_per_player_formspec(player_name)
local clicked_category local clicked_category
for name, value in pairs(fields) do for name, value in pairs(fields) do
@ -114,7 +131,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
for i, def in pairs(unified_inventory.buttons) do for i, def in pairs(unified_inventory.buttons) do
if fields[def.name] then if fields[def.name] then
def.action(player) def.action(player)
minetest.sound_play("click", minetest.sound_play("ui_click",
{to_player=player_name, gain = 0.1}) {to_player=player_name, gain = 0.1})
return return
end end
@ -179,7 +196,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end end
end end
if clicked_item then if clicked_item then
minetest.sound_play("click", minetest.sound_play("ui_click",
{to_player=player_name, gain = 0.1}) {to_player=player_name, gain = 0.1})
local page = unified_inventory.current_page[player_name] local page = unified_inventory.current_page[player_name]
local player_creative = unified_inventory.is_creative(player_name) local player_creative = unified_inventory.is_creative(player_name)
@ -201,25 +218,11 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end end
end end
if fields.searchbutton
or fields.key_enter_field == "searchbox" then
if dirty_search_filter then
ui.apply_filter(player, ui.current_searchbox[player_name], "nochange")
ui.set_inventory_formspec(player, ui.current_page[player_name])
minetest.sound_play("paperflip2",
{to_player=player_name, gain = 1.0})
end
elseif fields.searchresetbutton then
if ui.activefilter[player_name] ~= "" then
apply_new_filter(player, "", "nochange")
end
end
-- alternate buttons -- alternate buttons
if not (fields.alternate or fields.alternate_prev) then if not (fields.alternate or fields.alternate_prev) then
return return
end end
minetest.sound_play("click", minetest.sound_play("ui_click",
{to_player=player_name, gain = 0.1}) {to_player=player_name, gain = 0.1})
local item_name = unified_inventory.current_item[player_name] local item_name = unified_inventory.current_item[player_name]
if not item_name then if not item_name then

View File

@ -53,8 +53,9 @@ unified_inventory = {
standard_background = "bgcolor[#0000]background9[0,0;1,1;ui_formbg_9_sliced.png;true;16]", standard_background = "bgcolor[#0000]background9[0,0;1,1;ui_formbg_9_sliced.png;true;16]",
hide_disabled_buttons = minetest.settings:get_bool("unified_inventory_hide_disabled_buttons", false), hide_disabled_buttons = minetest.settings:get_bool("unified_inventory_hide_disabled_buttons", false),
hide_uncraftable_items = minetest.settings:get_bool("unified_inventory_hide_uncraftable_items", false),
version = 4 version = 5
} }
local ui = unified_inventory local ui = unified_inventory
@ -191,7 +192,10 @@ dofile(modpath.."/register.lua")
if minetest.settings:get_bool("unified_inventory_bags") ~= false then if minetest.settings:get_bool("unified_inventory_bags") ~= false then
dofile(modpath.."/bags.lua") dofile(modpath.."/bags.lua")
end end
if minetest.settings:get_bool("unified_inventory_item_names") ~= false then
dofile(modpath.."/item_names.lua") dofile(modpath.."/item_names.lua")
end
if minetest.settings:get_bool("unified_inventory_waypoints") ~= false then
dofile(modpath.."/waypoints.lua") dofile(modpath.."/waypoints.lua")
end
dofile(modpath.."/legacy.lua") -- mod compatibility dofile(modpath.."/legacy.lua") -- mod compatibility

View File

@ -270,13 +270,15 @@ local function formspec_add_item_browser(player, formspec, ui_peruser)
button_name, minetest.formspec_escape(tooltip) button_name, minetest.formspec_escape(tooltip)
) )
n = n + 2 n = n + 2
end
list_index = list_index + 1 list_index = list_index + 1
end end
end end
end formspec[n] = "style[page_number;content_offset=0]"
formspec[n] = string.format("label[%f,%f;%s: %s]", formspec[n + 1] = string.format("image_button[%f,%f;%f,0.4;;page_number;%s: %s;false;false;]",
ui_peruser.page_buttons_x + ui_peruser.btn_spc * (ui_peruser.is_lite_mode and 1 or 2), ui_peruser.page_buttons_x,
ui_peruser.page_buttons_y + 0.1 + ui_peruser.btn_spc * 2, ui_peruser.page_buttons_y + ui_peruser.btn_spc * 2 - 0.1,
ui_peruser.btn_spc * (bn - 1) + ui_peruser.btn_size,
F(S("Page")), S("@1 of @2",page2,pagemax)) F(S("Page")), S("@1 of @2",page2,pagemax))
end end
@ -347,12 +349,25 @@ function ui.apply_filter(player, filter, search_dir)
end end
local player_name = player:get_player_name() local player_name = player:get_player_name()
-- Whether to show uncraftable items
local fprefilter = function(_)
return true
end
if ui.hide_uncraftable_items and not ui.is_creative(player_name) then
fprefilter = function(name)
return ui.get_recipe_list(name)
end
end
local registered_items = minetest.registered_items
local lfilter = string.lower(filter) local lfilter = string.lower(filter)
local ffilter local ffilter
if lfilter:sub(1, 6) == "group:" then if lfilter:sub(1, 6) == "group:" then
-- Group filter: all groups of the item must match -- Group filter: all groups of the item must match
local groups = lfilter:sub(7):split(",") local groups = lfilter:sub(7):split(",")
ffilter = function(name, def) ffilter = function(name)
local def = registered_items[name]
for _, group in ipairs(groups) do for _, group in ipairs(groups) do
if not def.groups[group] if not def.groups[group]
or def.groups[group] <= 0 then or def.groups[group] <= 0 then
@ -366,7 +381,8 @@ function ui.apply_filter(player, filter, search_dir)
local player_info = minetest.get_player_information(player_name) local player_info = minetest.get_player_information(player_name)
local lang = player_info and player_info.lang_code or "" local lang = player_info and player_info.lang_code or ""
ffilter = function(name, def) ffilter = function(name)
local def = registered_items[name]
local lname = string.lower(name) local lname = string.lower(name)
local ldesc = string.lower(def.description) local ldesc = string.lower(def.description)
local llocaldesc = minetest.get_translated_string local llocaldesc = minetest.get_translated_string
@ -376,32 +392,29 @@ function ui.apply_filter(player, filter, search_dir)
end end
end end
local is_itemdef_listable = ui.is_itemdef_listable
local filtered_items = {} local filtered_items = {}
local category = ui.current_category[player_name] or 'all' local category = ui.current_category[player_name] or 'all'
if category == 'all' then if category == 'all' then
for name, def in pairs(minetest.registered_items) do for _, name in ipairs(ui.items_list) do
if is_itemdef_listable(def) if fprefilter(name) and ffilter(name) then
and ffilter(name, def) then
table.insert(filtered_items, name) table.insert(filtered_items, name)
end end
end end
elseif category == 'uncategorized' then elseif category == 'uncategorized' then
for name, def in pairs(minetest.registered_items) do for _, name in ipairs(ui.items_list) do
if is_itemdef_listable(def) if not ui.find_category(name)
and not ui.find_category(name) and fprefilter(name)
and ffilter(name, def) then and ffilter(name) then
table.insert(filtered_items, name) table.insert(filtered_items, name)
end end
end end
else else
-- Any other category is selected -- Any other category is selected
for name, exists in pairs(ui.registered_category_items[category]) do for name, exists in pairs(ui.registered_category_items[category]) do
local def = minetest.registered_items[name] if exists
if exists and def and fprefilter(name)
and is_itemdef_listable(def) and ffilter(name) then
and ffilter(name, def) then
table.insert(filtered_items, name) table.insert(filtered_items, name)
end end
end end

View File

@ -3,6 +3,8 @@
local item_names = {} -- [player_name] = { hud, dtime, itemname } local item_names = {} -- [player_name] = { hud, dtime, itemname }
local dlimit = 3 -- HUD element will be hidden after this many seconds local dlimit = 3 -- HUD element will be hidden after this many seconds
local hudbars_mod = minetest.get_modpath("hudbars") 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 function set_hud(player)
local player_name = player:get_player_name() local player_name = player:get_player_name()
@ -60,6 +62,7 @@ minetest.register_globalstep(function(dtime)
data.itemname = itemname data.itemname = itemname
data.index = index data.index = index
data.dtime = 0 data.dtime = 0
local lang_code = minetest.get_player_information(player:get_player_name()).lang_code
local desc = stack.get_meta local desc = stack.get_meta
and stack:get_meta():get_string("description") and stack:get_meta():get_string("description")
@ -69,6 +72,14 @@ minetest.register_globalstep(function(dtime)
local def = minetest.registered_items[itemname] local def = minetest.registered_items[itemname]
desc = def and def.description or "" desc = def and def.description or ""
end 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) player:hud_change(data.hud, 'text', desc)
end end
end end

View File

@ -1,98 +1,91 @@
# textdomain: unified_inventory # textdomain: unified_inventory
Mixing= Category:=Kategorie:
Cooking= Mixing=Miksowanie
Digging= Cooking=Gotowanie
Digging=Kopanie
Bags=Plecaki Bags=Plecaki
Bag @1=Plecak @1 Bag @1=Plecak @1
Small Bag=Maly plecak Small Bag=Mały plecak
Medium Bag=Sredni plecak Medium Bag=Średni plecak
Large Bag=Duzy plecak Large Bag=Duży plecak
All Items= All Items=Wszystkie przedmioty
Misc. Items= Misc. Items=Różne przedmioty
Plant Life= Plant Life=Życie roślin
Building Materials= Building Materials=Materiały budowlane
Tools= Tools=Narzędzia
Minerals and Metals= Minerals and Metals=Minerały i metale
Environment and Worldgen= Environment and Worldgen=Otoczenie i generowanie świata
Lighting= Lighting=Oświetlenie
and = i and = i
Scroll categories left= Scroll categories left=Przewiń kategorię w lewo
Scroll categories right= Scroll categories right=Przewiń kategorię w prawo
Search=Szukaj Search=Szukaj
Reset search and display everything= Reset search and display everything=Zresetuj wyszukiwanie i pokaż wszystko
First page=Pierwsza strona First page=Pierwsza strona
Back three pages=3 strony w tyl Back three pages=Trzy strony do tyłu
Back one page=1 strona w tyl Back one page=Stronę do tyłu
Forward one page=1 strona do przodu Forward one page=Stronę do przodu
Forward three pages=3 strony do przodu Forward three pages=Trzy strony do przodu
Last page=Ostatnia strona Last page=Ostatnia strona
No matching items=Brak pasujacych przedmiotow No matching items=Brak pasujących przedmiotów
No matches.=Brak wyników No matches.=Brak wyników
Page=Strona Page=Strona
@1 of @2=@1 z @2 @1 of @2=@1 z @2
Filter=Filtr Filter=Filtr
Can use the creative inventory= 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= 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= Crafting Grid=Siatka craftingu
Crafting Guide= Crafting Guide=Przewodnik craftingu
Set home position=Ustaw pozycję wyjściową Set home position=Ustaw pozycję domu
Home position set to: @1=Pozycja domowa ustawiona na: @1 Home position set to: @1=Pozycja domu ustawiona na: @1
You don't have the "home" privilege!=Nie masz uprawnien do zmiany czasu "home"! You don't have the "home" privilege!=Brak uprawnień "home"!
Go home=Idź do domu Go home=Idź do domu
Set time to day=Ustaw czas na dzień Set time to day=Ustaw czas na dzień
Time of day set to 6am=Czas ustawiony na 6:00 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 Set time to night=Ustaw czas na noc
Time of day set to 9pm=Czas ustawiony na 21:00 Time of day set to 9pm=Czas ustawiony na 21:00
Clear inventory=Wyczyść zapasy Clear inventory=Wyczyść ekwipunek
This button has been disabled outside of creative mode to prevent accidental inventory trashing.@nUse the trash slot instead.= 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!=Zapasy zostały wyczyszczone! Inventory cleared!=Ekwipunek został wyczyszczony!
Trash:=Smietnik: Trash:=Śmietnik:
Refill:=Uzupelnianie: Refill:=Uzupełnianie:
Any item belonging to the @1 group= Any item belonging to the @1 group=Każdy przedmiot należący do @1 grupy
Any item belonging to the groups @1= Any item belonging to the groups @1=Każdy przedmiot należacy do grup @1
Recipe @1 of @2=Recepta @1 z @2 Recipe @1 of @2=Recepta @1 z @2
Usage @1 of @2=Użycie @1 z @2 Usage @1 of @2=Użycie @1 z @2
No recipes=Brak recepty No recipes=Brak recepty
No usages=Bez użycia No usages=Bez użycia
Result=Wynik Result=Wynik
Ingredient=Składnik Ingredient=Składnik
Show next recipe= Show next recipe=Pokaż nastepną recepturę
Show next usage= Show next usage=Pokaż następne użycie
Show previous recipe= Show previous recipe=Pokaż poprzednią recepturę
Show previous usage= Show previous usage=Pokaż poprzednie użycie
@1 (@2)= @1 (@2)=@1 (@2)
Give me:=Daj mi: Give me:=Daj mi:
This recipe is too@@large to be displayed.= This recipe is too@@large to be displayed.=Receptura jest zbyt@@duża aby ją wyświetlić.
To craft grid:= To craft grid:=Do siatki craftingu.
All=Wszystko All=Wszystko
Crafting= Crafting=Crafting
White=Bialy White=Biały
Yellow=Zolty Yellow=Zółty
Red=Czerwony Red=Czerwony
Green=Zielony Green=Zielony
Blue=Niebieski Blue=Niebieski
Waypoints=Punkty orientacyjne Waypoints=Punkty orientacyjne
Select Waypoint #@1=Wybierz punkt #@1 Select Waypoint #@1=Wybierz punkt #@1
Waypoint @1=Punkty orientacyjne @1 Waypoint @1=Punkty orientacyjne @1
Set waypoint to current location=Ustaw punkt orientacyjny na biezacej pozycji Set waypoint to current location=Ustaw punkt orientacyjny na bieżacej pozycji
Hide waypoint= Hide waypoint=Ukryj punkt orientacyjny
Show waypoint= Show waypoint=Pokaż punkt orientacyjny
Hide coordinates= Hide coordinates=Ukryj koordynaty
Show coordinates= Show coordinates=Pokaż koordynaty
Change color of waypoint display=Zmien kolor punktu Change color of waypoint display=Zmień kolor punktu
Edit waypoint name=Edytuj nazwe punktu Edit waypoint name=Edytuj nazwę punktu
Waypoint active=Punkt wlaczony Waypoint active=Punkt włączony
Waypoint inactive=Punkt wylaczony Waypoint inactive=Punkt wyłączony
Finish editing=Zakoncz edycje Finish editing=Zakończ edycję
World position=Pozycja World position=Pozycja
Name=Nazwa Name=Nazwa
HUD text color=Kolor tekstu HUD 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

View File

@ -98,7 +98,7 @@ ui.register_button("misc_set_day", {
action = function(player) action = function(player)
local player_name = player:get_player_name() local player_name = player:get_player_name()
if minetest.check_player_privs(player_name, {settime=true}) then if minetest.check_player_privs(player_name, {settime=true}) then
minetest.sound_play("birds", minetest.sound_play("ui_morning",
{to_player=player_name, gain = 1.0}) {to_player=player_name, gain = 1.0})
minetest.set_timeofday((6000 % 24000) / 24000) minetest.set_timeofday((6000 % 24000) / 24000)
minetest.chat_send_player(player_name, minetest.chat_send_player(player_name,
@ -122,7 +122,7 @@ ui.register_button("misc_set_night", {
action = function(player) action = function(player)
local player_name = player:get_player_name() local player_name = player:get_player_name()
if minetest.check_player_privs(player_name, {settime=true}) then if minetest.check_player_privs(player_name, {settime=true}) then
minetest.sound_play("owl", minetest.sound_play("ui_owl",
{to_player=player_name, gain = 1.0}) {to_player=player_name, gain = 1.0})
minetest.set_timeofday((21000 % 24000) / 24000) minetest.set_timeofday((21000 % 24000) / 24000)
minetest.chat_send_player(player_name, minetest.chat_send_player(player_name,
@ -183,14 +183,14 @@ ui.register_page("craft", {
local n=#formspec+1 local n=#formspec+1
if ui.trash_enabled or ui.is_creative(player_name) or minetest.get_player_privs(player_name).give then if ui.trash_enabled or ui.is_creative(player_name) or minetest.get_player_privs(player_name).give then
formspec[n] = string.format("label[%f,%f;%s]", craftx + 6.45, crafty + 2.4, F(S("Trash:"))) formspec[n] = string.format("label[%f,%f;%s]", craftx + 6.35, crafty + 2.3, F(S("Trash:")))
formspec[n+1] = ui.make_trash_slot(craftx + 6.25, crafty + 2.5) formspec[n+1] = ui.make_trash_slot(craftx + 6.25, crafty + 2.5)
n=n + 2 n=n + 2
end end
if ui.is_creative(player_name) then if ui.is_creative(player_name) then
formspec[n] = ui.single_slot(craftx - 2.5, crafty + 2.5) formspec[n] = ui.single_slot(craftx - 2.5, crafty + 2.5)
formspec[n+1] = string.format("label[%f,%f;%s]", craftx - 2.3, crafty + 2.4,F(S("Refill:"))) formspec[n+1] = string.format("label[%f,%f;%s]", craftx - 2.4, crafty + 2.3, F(S("Refill:")))
formspec[n+2] = string.format("list[detached:%srefill;main;%f,%f;1,1;]", formspec[n+2] = string.format("list[detached:%srefill;main;%f,%f;1,1;]",
F(player_name), craftx - 2.5 + ui.list_img_offset, crafty + 2.5 + ui.list_img_offset) F(player_name), craftx - 2.5 + ui.list_img_offset, crafty + 2.5 + ui.list_img_offset)
end end

View File

@ -1,17 +1,36 @@
#Enabling lite mode enables a smaller and simpler version of the Unified # Reduced formspec layout, optimized for smaller displays.
#Inventory, optimized for small displays. # Note: This may also disable some features to free up visual space.
unified_inventory_lite (Lite mode) bool false unified_inventory_lite (Lite mode) bool false
#If enabled, bags will be made available which can be used to extend # Provides craftable bag items to extend the inventory space.
#inventory storage size.
unified_inventory_bags (Enable bags) bool true unified_inventory_bags (Enable bags) bool true
#If enabled, the trash slot can be used by those without both creative # Shows the trash slot to everyone.
#and the give privilege. # 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 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. # If enabled, disabled buttons will be hidden instead of grayed out.
unified_inventory_hide_disabled_buttons (Hide disabled buttons) bool false unified_inventory_hide_disabled_buttons (Hide disabled buttons) bool false
# Hides items with no known craft recipe from the category "all" (default).
# This setting has no effect on players in creative mode.
unified_inventory_hide_uncraftable_items (Hide uncraftable items) bool false
unified_inventory_automatic_categorization (Items automatically added to categories) bool true # 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
# 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

Binary file not shown.

Binary file not shown.

BIN
sounds/ui_click.ogg Normal file

Binary file not shown.

BIN
sounds/ui_morning.ogg Normal file

Binary file not shown.

BIN
sounds/ui_owl.ogg Normal file

Binary file not shown.

BIN
textures/ui_teleport.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -140,36 +140,49 @@ ui.register_page("waypoints", {
-- Main buttons: -- Main buttons:
local btnlist = { local btnlist = {
set_waypoint = { -- 1. formspec name
"ui_waypoint_set_icon.png", -- 2. button image
S("Set waypoint to current location") -- 3. translation text
}, {
toggle_waypoint = { "toggle_waypoint",
waypoint.active and "ui_on_icon.png" or "ui_off_icon.png", waypoint.active and "ui_on_icon.png" or "ui_off_icon.png",
waypoint.active and S("Hide waypoint") or S("Show waypoint") waypoint.active and S("Hide waypoint") or S("Show waypoint")
}, },
toggle_display_pos = { {
"rename_waypoint",
"ui_pencil_icon.png",
S("Edit waypoint name")
},
{
"set_waypoint",
"ui_waypoint_set_icon.png",
S("Set waypoint to current location")
},
{
"toggle_display_pos",
waypoint.display_pos and "ui_green_icon_background.png^ui_xyz_icon.png" or "ui_red_icon_background.png^ui_xyz_icon.png^(ui_no.png^[transformR90)", waypoint.display_pos and "ui_green_icon_background.png^ui_xyz_icon.png" or "ui_red_icon_background.png^ui_xyz_icon.png^(ui_no.png^[transformR90)",
waypoint.display_pos and S("Hide coordinates") or S("Show coordinates") waypoint.display_pos and S("Hide coordinates") or S("Show coordinates")
}, },
toggle_color = { {
"toggle_color",
"ui_circular_arrows_icon.png", "ui_circular_arrows_icon.png",
S("Change color of waypoint display") S("Change color of waypoint display")
}, },
rename_waypoint = {
"ui_pencil_icon.png",
S("Edit waypoint name")
}
} }
if minetest.get_player_privs(player_name).teleport then
table.insert(btnlist, {
"teleport_waypoint",
"ui_teleport.png",
S("Teleport to waypoint")
})
end
local x = 4 for i, def in pairs(btnlist) do
for name, def in pairs(btnlist) do
formspec[n] = string.format("image_button[%f,%f;%f,%f;%s;%s%i;]", formspec[n] = string.format("image_button[%f,%f;%f,%f;%s;%s%i;]",
wp_buttons_rj - ui.style_full.btn_spc * x, wp_bottom_row, wp_buttons_rj + ui.style_full.btn_spc * (i - #btnlist), wp_bottom_row,
ui.style_full.btn_size, ui.style_full.btn_size, ui.style_full.btn_size, ui.style_full.btn_size,
def[1], name, sel) def[2], def[1], sel)
formspec[n+1] = "tooltip["..name..sel..";"..F(def[2]).."]" formspec[n+1] = "tooltip["..def[1]..sel..";"..F(def[3]).."]"
x = x - 1
n = n + 2 n = n + 2
end end
@ -313,6 +326,13 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
update_formspec = true update_formspec = true
end end
if fields["teleport_waypoint" .. i] and waypoint.world_pos then
if minetest.get_player_privs(player_name).teleport then
minetest.sound_play("teleport", {to_player = player_name})
player:set_pos(waypoint.world_pos)
end
end
if hit then if hit then
-- Save first -- Save first
waypoints.data[i] = waypoint waypoints.data[i] = waypoint
@ -323,6 +343,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
update_hud(player, waypoints, temp, i) update_hud(player, waypoints, temp, i)
end end
if update_formspec then if update_formspec then
minetest.sound_play("ui_click", {to_player=player_name, gain = 0.1})
ui.set_inventory_formspec(player, "waypoints") ui.set_inventory_formspec(player, "waypoints")
end end