1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-25 02:00:37 +01:00

update unified_inventory

This commit is contained in:
crabman77 2015-06-30 14:29:12 +02:00
parent 704dd0b625
commit 04e5e49904
31 changed files with 529 additions and 173 deletions

View File

@ -133,7 +133,7 @@ minetest.register_tool("unified_inventory:bag_large", {
minetest.register_craft({ minetest.register_craft({
output = "unified_inventory:bag_small", output = "unified_inventory:bag_small",
recipe = { recipe = {
{"", "default:stick", ""}, {"", "group:stick", ""},
{"group:wood", "group:wood", "group:wood"}, {"group:wood", "group:wood", "group:wood"},
{"group:wood", "group:wood", "group:wood"}, {"group:wood", "group:wood", "group:wood"},
}, },
@ -143,8 +143,8 @@ minetest.register_craft({
output = "unified_inventory:bag_medium", output = "unified_inventory:bag_medium",
recipe = { recipe = {
{"", "", ""}, {"", "", ""},
{"default:stick", "unified_inventory:bag_small", "default:stick"}, {"group:stick", "unified_inventory:bag_small", "group:stick"},
{"default:stick", "unified_inventory:bag_small", "default:stick"}, {"group:stick", "unified_inventory:bag_small", "group:stick"},
}, },
}) })
@ -152,8 +152,8 @@ minetest.register_craft({
output = "unified_inventory:bag_large", output = "unified_inventory:bag_large",
recipe = { recipe = {
{"", "", ""}, {"", "", ""},
{"default:stick", "unified_inventory:bag_medium", "default:stick"}, {"group:stick", "unified_inventory:bag_medium", "group:stick"},
{"default:stick", "unified_inventory:bag_medium", "default:stick"}, {"group:stick", "unified_inventory:bag_medium", "group:stick"},
}, },
}) })

View File

@ -68,11 +68,11 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
-- Inventory page controls -- Inventory page controls
local start = math.floor( local start = math.floor(
unified_inventory.current_index[player_name] / 80 + 1) unified_inventory.current_index[player_name] / unified_inventory.items_per_page + 1)
local start_i = start local start_i = start
local pagemax = math.floor( local pagemax = math.floor(
(#unified_inventory.filtered_items_list[player_name] - 1) (#unified_inventory.filtered_items_list[player_name] - 1)
/ (80) + 1) / (unified_inventory.items_per_page) + 1)
if fields.start_list then if fields.start_list then
start_i = 1 start_i = 1
@ -101,7 +101,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
if not (start_i == start) then if not (start_i == start) then
minetest.sound_play("paperflip1", minetest.sound_play("paperflip1",
{to_player=player_name, gain = 1.0}) {to_player=player_name, gain = 1.0})
unified_inventory.current_index[player_name] = (start_i - 1) * 80 + 1 unified_inventory.current_index[player_name] = (start_i - 1) * unified_inventory.items_per_page + 1
unified_inventory.set_inventory_formspec(player, unified_inventory.set_inventory_formspec(player,
unified_inventory.current_page[player_name]) unified_inventory.current_page[player_name])
end end

View File

@ -4,35 +4,65 @@ local modpath = minetest.get_modpath(minetest.get_current_modname())
local worldpath = minetest.get_worldpath() local worldpath = minetest.get_worldpath()
-- Data tables definitions -- Data tables definitions
unified_inventory = {} unified_inventory = {
unified_inventory.activefilter = {} activefilter = {},
unified_inventory.active_search_direction = {} active_search_direction = {},
unified_inventory.alternate = {} alternate = {},
unified_inventory.current_page = {} current_page = {},
unified_inventory.current_searchbox = {} current_searchbox = {},
unified_inventory.current_index = {} current_index = {},
unified_inventory.current_item = {} current_item = {},
unified_inventory.current_craft_direction = {} current_craft_direction = {},
unified_inventory.registered_craft_types = {} registered_craft_types = {},
unified_inventory.crafts_for = { usage = {}, recipe = {} } crafts_for = {usage = {}, recipe = {} },
unified_inventory.players = {} players = {},
unified_inventory.items_list_size = 0 items_list_size = 0,
unified_inventory.items_list = {} items_list = {},
unified_inventory.filtered_items_list_size = {} filtered_items_list_size = {},
unified_inventory.filtered_items_list = {} filtered_items_list = {},
unified_inventory.pages = {} pages = {},
unified_inventory.buttons = {} buttons = {},
-- Homepos stuff -- Homepos stuff
unified_inventory.home_pos = {} home_pos = {},
unified_inventory.home_filename = home_filename = worldpath.."/unified_inventory_home.home",
worldpath.."/unified_inventory_home.home"
-- Default inventory page -- Default inventory page
unified_inventory.default = "craft" default = "craft",
-- intllib
gettext = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end,
-- "Lite" mode
lite_mode = minetest.setting_getbool("unified_inventory_lite"),
pagecols = 8,
pagerows = 10,
page_y = 0,
formspec_y = 1,
main_button_x = 0,
main_button_y = 9,
craft_result_x = 0.3,
craft_result_y = 0.5,
form_header_y = 0
}
if unified_inventory.lite_mode then
unified_inventory.pagecols = 4
unified_inventory.pagerows = 6
unified_inventory.page_y = 0.25
unified_inventory.formspec_y = 0.47
unified_inventory.main_button_x = 8.2
unified_inventory.main_button_y = 6.5
unified_inventory.craft_result_x = 2.8
unified_inventory.craft_result_y = 3.4
unified_inventory.form_header_y = -0.1
end
unified_inventory.items_per_page = unified_inventory.pagecols * unified_inventory.pagerows
-- Disable default creative inventory -- Disable default creative inventory
if creative_inventory then if rawget(_G, "creative_inventory") then
function creative_inventory.set_creative_formspec(player, start_i, pagenum) function creative_inventory.set_creative_formspec(player, start_i, pagenum)
return return
end end
@ -43,8 +73,13 @@ dofile(modpath.."/api.lua")
dofile(modpath.."/internal.lua") dofile(modpath.."/internal.lua")
dofile(modpath.."/callbacks.lua") dofile(modpath.."/callbacks.lua")
dofile(modpath.."/register.lua") dofile(modpath.."/register.lua")
dofile(modpath.."/bags.lua")
if not unified_inventory.lite_mode then
dofile(modpath.."/bags.lua")
end
dofile(modpath.."/item_names.lua") dofile(modpath.."/item_names.lua")
if minetest.get_modpath("datastorage") then
if minetest.get_modpath("datastorage") and not unified_inventory.lite_mode then
dofile(modpath.."/waypoints.lua") dofile(modpath.."/waypoints.lua")
end end

View File

@ -30,10 +30,16 @@ function unified_inventory.get_formspec(player, page)
local pagedef = unified_inventory.pages[page] local pagedef = unified_inventory.pages[page]
local formspec = "size[14,10]" local formspec = "size[14,10]"
local fsdata = nil
-- Background -- Background
formspec = formspec .. "background[-0.19,-0.25;14.4,10.75;ui_form_bg.png]" formspec = formspec .. "background[-0.19,-0.25;14.4,10.75;ui_form_bg.png]"
if unified_inventory.lite_mode then
formspec = "size[11,7.7]"
formspec = formspec .. "background[-0.19,-0.2;11.4,8.4;ui_form_bg.png]"
end
local fsdata = nil
-- Current page -- Current page
if unified_inventory.pages[page] then if unified_inventory.pages[page] then
fsdata = pagedef.get_formspec(player) fsdata = pagedef.get_formspec(player)
@ -42,12 +48,22 @@ function unified_inventory.get_formspec(player, page)
return "" -- Invalid page name return "" -- Invalid page name
end end
local button_row = 0
local button_col = 0
-- Main buttons -- Main buttons
for i, def in pairs(unified_inventory.buttons) do for i, def in pairs(unified_inventory.buttons) do
if unified_inventory.lite_mode and i > 4 then
button_row = 1
button_col = 1
end
local tooltip = def.tooltip or "" local tooltip = def.tooltip or ""
if def.type == "image" then if def.type == "image" then
formspec = formspec.."image_button[" formspec = formspec.."image_button["
..(0.65 * (i - 1))..",9;0.8,0.8;" ..( unified_inventory.main_button_x + 0.65 * (i - 1) - button_col * 0.65 * 4)
..","..(unified_inventory.main_button_y + button_row * 0.7)..";0.8,0.8;"
..minetest.formspec_escape(def.image)..";" ..minetest.formspec_escape(def.image)..";"
..minetest.formspec_escape(def.name)..";]" ..minetest.formspec_escape(def.name)..";]"
.."tooltip["..minetest.formspec_escape(def.name) .."tooltip["..minetest.formspec_escape(def.name)
@ -58,7 +74,7 @@ function unified_inventory.get_formspec(player, page)
if fsdata.draw_inventory ~= false then if fsdata.draw_inventory ~= false then
-- Player inventory -- Player inventory
formspec = formspec.."listcolors[#00000000;#00000000]" formspec = formspec.."listcolors[#00000000;#00000000]"
formspec = formspec .. "list[current_player;main;0,4.5;8,4;]" formspec = formspec .. "list[current_player;main;0,"..(unified_inventory.formspec_y + 3.5)..";8,4;]"
end end
if fsdata.draw_item_list == false then if fsdata.draw_item_list == false then
@ -67,6 +83,8 @@ function unified_inventory.get_formspec(player, page)
-- Controls to flip items pages -- Controls to flip items pages
local start_x = 9.2 local start_x = 9.2
if not unified_inventory.lite_mode then
formspec = formspec formspec = formspec
.. "image_button[" .. (start_x + 0.6 * 0) .. "image_button[" .. (start_x + 0.6 * 0)
.. ",9;.8,.8;ui_skip_backward_icon.png;start_list;]" .. ",9;.8,.8;ui_skip_backward_icon.png;start_list;]"
@ -75,7 +93,6 @@ function unified_inventory.get_formspec(player, page)
.. "image_button[" .. (start_x + 0.6 * 1) .. "image_button[" .. (start_x + 0.6 * 1)
.. ",9;.8,.8;ui_doubleleft_icon.png;rewind3;]" .. ",9;.8,.8;ui_doubleleft_icon.png;rewind3;]"
.. "tooltip[rewind3;" .. minetest.formspec_escape(S("Back three pages")) .. "]" .. "tooltip[rewind3;" .. minetest.formspec_escape(S("Back three pages")) .. "]"
.. "image_button[" .. (start_x + 0.6 * 2) .. "image_button[" .. (start_x + 0.6 * 2)
.. ",9;.8,.8;ui_left_icon.png;rewind1;]" .. ",9;.8,.8;ui_left_icon.png;rewind1;]"
.. "tooltip[rewind1;" .. minetest.formspec_escape(S("Back one page")) .. "]" .. "tooltip[rewind1;" .. minetest.formspec_escape(S("Back one page")) .. "]"
@ -83,7 +100,6 @@ function unified_inventory.get_formspec(player, page)
.. "image_button[" .. (start_x + 0.6 * 3) .. "image_button[" .. (start_x + 0.6 * 3)
.. ",9;.8,.8;ui_right_icon.png;forward1;]" .. ",9;.8,.8;ui_right_icon.png;forward1;]"
.. "tooltip[forward1;" .. minetest.formspec_escape(S("Forward one page")) .. "]" .. "tooltip[forward1;" .. minetest.formspec_escape(S("Forward one page")) .. "]"
.. "image_button[" .. (start_x + 0.6 * 4) .. "image_button[" .. (start_x + 0.6 * 4)
.. ",9;.8,.8;ui_doubleright_icon.png;forward3;]" .. ",9;.8,.8;ui_doubleright_icon.png;forward3;]"
.. "tooltip[forward3;" .. minetest.formspec_escape(S("Forward three pages")) .. "]" .. "tooltip[forward3;" .. minetest.formspec_escape(S("Forward three pages")) .. "]"
@ -91,43 +107,71 @@ function unified_inventory.get_formspec(player, page)
.. "image_button[" .. (start_x + 0.6 * 5) .. "image_button[" .. (start_x + 0.6 * 5)
.. ",9;.8,.8;ui_skip_forward_icon.png;end_list;]" .. ",9;.8,.8;ui_skip_forward_icon.png;end_list;]"
.. "tooltip[end_list;" .. minetest.formspec_escape(S("Last page")) .. "]" .. "tooltip[end_list;" .. minetest.formspec_escape(S("Last page")) .. "]"
else
formspec = formspec
.. "image_button[" .. (8.2 + 0.65 * 0)
.. ",5.8;.8,.8;ui_skip_backward_icon.png;start_list;]"
.. "tooltip[start_list;" .. minetest.formspec_escape(S("First page")) .. "]"
.. "image_button[" .. (8.2 + 0.65 * 1)
.. ",5.8;.8,.8;ui_left_icon.png;rewind1;]"
.. "tooltip[rewind1;" .. minetest.formspec_escape(S("Back one page")) .. "]"
.. "image_button[" .. (8.2 + 0.65 * 2)
.. ",5.8;.8,.8;ui_right_icon.png;forward1;]"
.. "tooltip[forward1;" .. minetest.formspec_escape(S("Forward one page")) .. "]"
.. "image_button[" .. (8.2 + 0.65 * 3)
.. ",5.8;.8,.8;ui_skip_forward_icon.png;end_list;]"
.. "tooltip[end_list;" .. minetest.formspec_escape(S("Last page")) .. "]"
end
-- Search box -- Search box
if not unified_inventory.lite_mode then
formspec = formspec .. "field[9.5,8.325;3,1;searchbox;;" formspec = formspec .. "field[9.5,8.325;3,1;searchbox;;"
.. minetest.formspec_escape(unified_inventory.current_searchbox[player_name]) .. "]" .. minetest.formspec_escape(unified_inventory.current_searchbox[player_name]) .. "]"
formspec = formspec .. "image_button[12.2,8.1;.8,.8;ui_search_icon.png;searchbutton;]" formspec = formspec .. "image_button[12.2,8.1;.8,.8;ui_search_icon.png;searchbutton;]"
.. "tooltip[searchbutton;" ..S("Search") .. "]" .. "tooltip[searchbutton;" ..S("Search") .. "]"
else
formspec = formspec .. "field[8.5,5.225;2.2,1;searchbox;;"
.. minetest.formspec_escape(unified_inventory.current_searchbox[player_name]) .. "]"
formspec = formspec .. "image_button[10.3,5;.8,.8;ui_search_icon.png;searchbutton;]"
.. "tooltip[searchbutton;" ..S("Search") .. "]"
end
local no_matches = "No matching items"
if unified_inventory.lite_mode then
no_matches = "No matches."
end
-- Items list -- Items list
if #unified_inventory.filtered_items_list[player_name] == 0 then if #unified_inventory.filtered_items_list[player_name] == 0 then
formspec = formspec.."label[8.2,0;" .. S("No matching items") .. "]" formspec = formspec.."label[8.2,"..unified_inventory.form_header_y..";" .. S(no_matches) .. "]"
else else
local dir = unified_inventory.active_search_direction[player_name] local dir = unified_inventory.active_search_direction[player_name]
local list_index = unified_inventory.current_index[player_name] local list_index = unified_inventory.current_index[player_name]
local page = math.floor(list_index / (80) + 1) local page = math.floor(list_index / (unified_inventory.items_per_page) + 1)
local pagemax = math.floor( local pagemax = math.floor(
(#unified_inventory.filtered_items_list[player_name] - 1) (#unified_inventory.filtered_items_list[player_name] - 1)
/ (80) + 1) / (unified_inventory.items_per_page) + 1)
local item = {} local item = {}
for y = 0, 9 do for y = 0, unified_inventory.pagerows - 1 do
for x = 0, 7 do for x = 0, unified_inventory.pagecols - 1 do
local name = unified_inventory.filtered_items_list[player_name][list_index] local name = unified_inventory.filtered_items_list[player_name][list_index]
if minetest.registered_items[name] then if minetest.registered_items[name] then
formspec = formspec.."item_image_button[" formspec = formspec.."item_image_button["
..(8.2 + x * 0.7).."," ..(8.2 + x * 0.7)..","
..(1 + y * 0.7)..";.81,.81;" ..(unified_inventory.formspec_y + unified_inventory.page_y + y * 0.7)..";.81,.81;"
..name..";item_button_"..dir.."_" ..name..";item_button_"..dir.."_"
..unified_inventory.mangle_for_formspec(name)..";]" ..unified_inventory.mangle_for_formspec(name)..";]"
list_index = list_index + 1 list_index = list_index + 1
end end
end end
end end
formspec = formspec.."label[8.2,0;"..S("Page") .. ": " formspec = formspec.."label[8.2,"..unified_inventory.form_header_y..";"..S("Page") .. ": "
.. S("%s of %s"):format(page,pagemax).."]" .. S("%s of %s"):format(page,pagemax).."]"
end end
if unified_inventory.activefilter[player_name] ~= "" then if unified_inventory.activefilter[player_name] ~= "" then
formspec = formspec.."label[8.2,0.4;" .. S("Filter") .. ":]" formspec = formspec.."label[8.2,"..(unified_inventory.form_header_y + 0.4)..";" .. S("Filter") .. ":]"
formspec = formspec.."label[9,0.4;"..minetest.formspec_escape(unified_inventory.activefilter[player_name]).."]" formspec = formspec.."label[9.1,"..(unified_inventory.form_header_y + 0.4)..";"..minetest.formspec_escape(unified_inventory.activefilter[player_name]).."]"
end end
return formspec return formspec
end end
@ -141,6 +185,7 @@ end
--apply filter to the inventory list (create filtered copy of full one) --apply filter to the inventory list (create filtered copy of full one)
function unified_inventory.apply_filter(player, filter, search_dir) function unified_inventory.apply_filter(player, filter, search_dir)
if not player then return false end
local player_name = player:get_player_name() local player_name = player:get_player_name()
local lfilter = string.lower(filter) local lfilter = string.lower(filter)
local ffilter local ffilter

View File

@ -0,0 +1,72 @@
# Translation by kilbith
# Template
### bags.lua ###
Bags = Sacs
Bag 1 = Sac 1
Bag 2 = Sac 2
Bag 3 = Sac 3
Bag 4 = Sac 4
Small Bag = Petit sac
Medium Bag = Sac moyen
Large Bag = Grand sac
### inernal.lua ###
First page = 1ère page
Back three pages = 3 pages en arrière
Back one page = Page précédente
Forward one page = Page suivante
Forward three pages = 3 pages en avant
Last page = Dernière page
No matching items = Aucun élément correspondant
Page = Page
%s of %s = %s de %s
Filter = Filtre
Search = Rechercher
### register.lua ###
Can use the creative inventory = Vous pouvez utiliser l'inventaire créatif
Home position set to: %s = Position de votre base fixée à : %s
Time of day set to 6am = Heure fixée à 6h
You don't have the settime priviledge! = Vous n'avez pas le privilège 'settime' !
Time of day set to 9pm = Heure fixée à 21h
This button has been disabled outside of creative mode to prevent accidental inventory trashing.\nUse the trash slot instead. = Ce bouton a été désactivé en dehors du mode créatif pour éviter des saccages dans l'inventaire.\nUtilisez plutôt la case poubelle.
Inventory Cleared! = Inventaire vidé !
Crafting = Création
Trash: = Poubelle :
Refill: = Remplir :
Crafting Guide = Guide de création
Method: = Méthode :
Result: %s = Résultat : %s
crafting = fabrication
shapeless crafting = fabrication sans forme
cooking = cuisson
alloy cooking = cuisson des métaux
Copy to craft grid: = Copier sur la grille de création
All = Tout
Recipe %s of %s = Recette %s de %d
Alternate = Alternative
Crafting Grid = Grille de création
### waypoints.lua ###
White = Blanc
Yellow = Jaune
Red = Rouge
Green = Vert
Blue = Bleu
Waypoints = Point de passage
Waypoint active = Point de passage actif
Waypoint inactive = Point de passage inactif
World position = Position dans le monde
Name = Nom
HUD text color = Couleur de texte du HUD
Edit waypoint name = Editer le nom du point de passage
Rename waypoint = Renommer le point de passage
Change color of waypoint display = Changer la couleur du point de passage
Set waypoint to current location = Marquer un point de passage à la position actuelle
Make waypoint visible = Rendre visible le point de passage
Make waypoint invisible = Rendre invisible le point de passage
Disable display of waypoint coordinates = Masquer les coordonnées des points de passages
Enable display of waypoint coordinates = Montrer les coordonnées des points de passages
Finish editing = Terminer l'édition
Select Waypoint #%d = Choisir un point de passage #%d

View File

@ -0,0 +1,76 @@
# Translation by eternal_sorrow
# Template
### bags.lua ###
Bags = Сумки
Bag 1 = Сумка 1
Bag 2 = Сумка 2
Bag 3 = Сумка 3
Bag 4 = Сумка 4
Small Bag = Малая сумка
Medium Bag = Средняя сумка
Large Bag = Большая сумка
### inernal.lua ###
First page = Первая страница
Back three pages = Назад на три страницы
Back one page = Назад на одну страницу
Forward one page = Вперед на одну страницу
Forward three pages = Вперед на три страницы
Last page = Последняя страница
No matching items = Совпадений нет
Page = Страница
%s of %s = %s из %s
Filter = Фильтр
Search = Поиск
### register.lua ###
Can use the creative inventory = Можно использовать инвентарь творческого режима
Home position set to: %s = Дом теперь расположен по коодинатам: %s
Time of day set to 6am = Установлено время 6 утра
You don't have the settime priviledge! = Вам не разрешено устанавливать время!
Time of day set to 9pm = Установлено время 9 вечера
This button has been disabled outside of creative mode to prevent accidental inventory trashing.\nUse the trash slot instead. = Эта кнопка отключена вне творческого режима, чтобы предотвратить случайное уничтожение предметов.\nИспользуйте слот корзины вместо нее.
Inventory Cleared! = Инвентарь очищен!
Crafting = Крафт
Trash: = Корзина:
Refill: = Размножить:
Crafting Guide = Книга рецептов
Method: = Способ:
Result: %s = Результат: %s
crafting = крафт
shapeless crafting = бесформенный крафт
cooking = жарка
alloy cooking = приготовление сплавов
Copy to craft grid: = В решетку крафта:
All = Все
Recipe %s of %s = Рецепт %s из %s
Alternate = Следующий
Crafting Grid = Решетка крафта
Go home = Отправиться домой
Set time to day = День
Set time to night = Ночь
Clear inventory = Очистить инвентарь
### waypoints.lua ###
White = Белый
Yellow = Желтый
Red = Красный
Green = Зелёный
Blue = Синий
Waypoints = Путевые точки
Waypoint active = Путевая точка активна
Waypoint inactive = Путевая точка неактивна
World position = Позиция
Name = Имя
HUD text color = Цвет текста
Edit waypoint name = Редактировать имя путевой точки
Rename waypoint = Переименовать путевую точку
Change color of waypoint display = Изменить цвет путевой точки
Set waypoint to current location = Установить путевую точку в текущем местоположении
Make waypoint visible = Сделать путевую точку видимой
Make waypoint invisible = Сделать путевую точку невидимой
Disable display of waypoint coordinates = Отключить отображение координат путевой точки
Enable display of waypoint coordinates = Включить отображение координат путевой точки
Finish editing = Завершить редактирование
Select Waypoint #%d = Выбрать путевую точку №%d

View File

@ -0,0 +1,72 @@
# Translation by Mahmutelmas06@hotmail.com
# Template
### bags.lua ###
Bags = Çantalarım
Bag 1 = 1. Çanta
Bag 2 = 2. Çanta
Bag 3 = 3. Çanta
Bag 4 = 4. Çanta
Small Bag = Küçük Çanta
Medium Bag = Çanta
Large Bag = Büyük Çanta
### inernal.lua ###
First page = İlk Sayfa
Back three pages = 3 Sayfa Gerile
Back one page = Geri
Forward one page = İleri
Forward three pages = 3 Sayfa İlerile
Last page = Son Sayfa
No matching items = Eşleşme yok
Page = Sayfa
%s of %s = %s dan %s
Filter = Süzgeç
Search = Ara
### register.lua ###
Can use the creative inventory = Yaratıcı envanteri kullanabilir
Home position set to: %s = Yeni eviniz: %s
Time of day set to 6am = Saat 06:00 olarak ayarlandı
You don't have the settime priviledge = Saati düzenleme yetkiniz yok!
Time of day set to 9pm = Saat 19:00 olarak ayarlandı
This button has been disabled outside of creative mode to prevent accidental inventory trashing.\nUse the trash slot instead. = Yaratıcı modu dışında iken bu tuş kullanılamaz.
Inventory Cleared! = Envanter temizlendi!
Crafting = Üretim
Trash: = Çöp
Refill: = Doldur
Crafting Guide = Kılavuz
Method: = Yöntem
Result: %s = Çıktı: %s
crafting = üretim
shapeless crafting = şekilsiz üretim
cooking = pişirme
alloy cooking = karıştırma
Copy to craft grid: = Üretim tablosuna kopyala
All = Tümü
Recipe %s of %s = %s dan %s tarifi
Alternate = Altarnatif
Crafting Grid = Üretim tablosu
### waypoints.lua ###
White = Beyaz
Yellow = Sarı
Red = Kırmızı
Green = Yeşil
Blue = Mavi
Waypoints = Konum Noktaları
Waypoint active = Konum Etkin
Waypoint inactive = Konum Devredışı
World position = Dünya konumu
Name = İsim
HUD text color = Metin rengi
Edit waypoint name = Konum Noktasını Düzenle
Rename waypoint = Konum Noktasını Adlandır
Change color of waypoint display = Konum Gösterge Rengi
Set waypoint to current location = Bulunduğun noktayı işaretle
Make waypoint visible = Konumlar görünür
Make waypoint invisible = Konumlar gözükmez
Disable display of waypoint coordinates = Koordinatları gizle
Enable display of waypoint coordinates = Koordinatları göster
Finish editing = Düzenleme bitti
Select Waypoint #%d = #%d konum noktası seç

View File

@ -42,31 +42,32 @@ unified_inventory.register_button("craftguide", {
tooltip = S("Crafting Guide") tooltip = S("Crafting Guide")
}) })
unified_inventory.register_button("home_gui_set", { if not unified_inventory.lite_mode then
unified_inventory.register_button("home_gui_set", {
type = "image", type = "image",
image = "ui_sethome_icon.png", image = "ui_sethome_icon.png",
tooltip = S("Set home position"), tooltip = S("Set home position"),
action = function(player) action = function(player)
if home.sethome(player:get_player_name()) == true then if home.sethome(player:get_player_name()) == true then --modif MFF
minetest.sound_play("dingdong", minetest.sound_play("dingdong",
{to_player=player:get_player_name(), gain = 1.0}) {to_player=player:get_player_name(), gain = 1.0})
end end
end, end,
}) })
unified_inventory.register_button("home_gui_go", { unified_inventory.register_button("home_gui_go", {
type = "image", type = "image",
image = "ui_gohome_icon.png", image = "ui_gohome_icon.png",
tooltip = S("Go home"), tooltip = S("Go home"),
action = function(player) action = function(player)
if home.tohome(player:get_player_name()) == true then if home.tohome(player:get_player_name()) == true then --modif MFF
minetest.sound_play("teleport", minetest.sound_play("teleport",
{to_player=player:get_player_name(), gain = 1.0}) {to_player=player:get_player_name(), gain = 1.0})
end end
end, end,
}) })
unified_inventory.register_button("misc_set_day", { unified_inventory.register_button("misc_set_day", {
type = "image", type = "image",
image = "ui_sun_icon.png", image = "ui_sun_icon.png",
tooltip = S("Set time to day"), tooltip = S("Set time to day"),
@ -83,9 +84,9 @@ unified_inventory.register_button("misc_set_day", {
S("You don't have the settime priviledge!")) S("You don't have the settime priviledge!"))
end end
end, end,
}) })
unified_inventory.register_button("misc_set_night", { unified_inventory.register_button("misc_set_night", {
type = "image", type = "image",
image = "ui_moon_icon.png", image = "ui_moon_icon.png",
tooltip = S("Set time to night"), tooltip = S("Set time to night"),
@ -102,7 +103,8 @@ unified_inventory.register_button("misc_set_night", {
S("You don't have the settime priviledge!")) S("You don't have the settime priviledge!"))
end end
end, end,
}) })
end
unified_inventory.register_button("clear_inv", { unified_inventory.register_button("clear_inv", {
type = "image", type = "image",
@ -128,23 +130,22 @@ unified_inventory.register_button("clear_inv", {
unified_inventory.register_page("craft", { unified_inventory.register_page("craft", {
get_formspec = function(player, formspec) get_formspec = function(player, formspec)
local player_name = player:get_player_name() local player_name = player:get_player_name()
local formspec = "background[0,1;8,3;ui_crafting_form.png]" local formspec = "background[0,"..unified_inventory.formspec_y..";8,3;ui_crafting_form.png]"
formspec = formspec.."background[0,4.5;8,4;ui_main_inventory.png]" formspec = formspec.."background[0,"..(unified_inventory.formspec_y + 3.5)..";8,4;ui_main_inventory.png]"
formspec = formspec.."label[0,0;Crafting]" formspec = formspec.."label[0,"..unified_inventory.form_header_y..";Crafting]"
formspec = formspec.."listcolors[#00000000;#00000000]" formspec = formspec.."listcolors[#00000000;#00000000]"
formspec = formspec.."list[current_player;craftpreview;6,1;1,1;]" formspec = formspec.."list[current_player;craftpreview;6,"..unified_inventory.formspec_y..";1,1;]"
formspec = formspec.."list[current_player;craft;2,1;3,3;]" formspec = formspec.."list[current_player;craft;2,"..unified_inventory.formspec_y..";3,3;]"
formspec = formspec.."label[7,2.5;" .. S("Trash:") .. "]" formspec = formspec.."label[7,"..(unified_inventory.formspec_y + 1.5)..";" .. S("Trash:") .. "]"
formspec = formspec.."list[detached:trash;main;7,3;1,1;]" formspec = formspec.."list[detached:trash;main;7,"..(unified_inventory.formspec_y + 2)..";1,1;]"
if unified_inventory.is_creative(player_name) then if unified_inventory.is_creative(player_name) then
formspec = formspec.."label[0,2.5;" .. S("Refill:") .. "]" formspec = formspec.."label[0,"..(unified_inventory.formspec_y + 1.5)..";" .. S("Refill:") .. "]"
formspec = formspec.."list[detached:"..minetest.formspec_escape(player_name).."refill;main;0,3;1,1;]" formspec = formspec.."list[detached:"..minetest.formspec_escape(player_name).."refill;main;0,"..(unified_inventory.formspec_y +2)..";1,1;]"
end end
return {formspec=formspec} return {formspec=formspec}
end, end,
}) })
-- stack_image_button(): generate a form button displaying a stack of items -- stack_image_button(): generate a form button displaying a stack of items
-- --
-- Normally a simple item_image_button[] is used. If the stack contains -- Normally a simple item_image_button[] is used. If the stack contains
@ -170,9 +171,9 @@ local function stack_image_button(x, y, w, h, buttonname_prefix, item)
displayitem = group_item.item or "unknown" displayitem = group_item.item or "unknown"
selectitem = group_item.sole and displayitem or name selectitem = group_item.sole and displayitem or name
end end
local label = string.format("\n\n%s%7d", show_is_group and "G" or " ", count):gsub(" 1$", " .") local label = string.format("\n\n%s%7d", show_is_group and " G\n" or " ", count):gsub(" 1$", " .")
if label == "\n\n ." then label = "" end if label == "\n\n ." then label = "" end
return string.format("item_image_button[%u,%u;%u,%u;%s;%s;%s]", return string.format("item_image_button[%f,%f;%u,%u;%s;%s;%s]",
x, y, w, h, x, y, w, h,
minetest.formspec_escape(displayitem), minetest.formspec_escape(displayitem),
minetest.formspec_escape(buttonname_prefix..unified_inventory.mangle_for_formspec(selectitem)), minetest.formspec_escape(buttonname_prefix..unified_inventory.mangle_for_formspec(selectitem)),
@ -199,14 +200,18 @@ local other_dir = {
unified_inventory.register_page("craftguide", { unified_inventory.register_page("craftguide", {
get_formspec = function(player) get_formspec = function(player)
local player_name = player:get_player_name() local player_name = player:get_player_name()
local player_privs = minetest.get_player_privs(player_name)
local formspec = "" local formspec = ""
formspec = formspec.."background[0,4.5;8,4;ui_main_inventory.png]" formspec = formspec.."background[0,"..(unified_inventory.formspec_y + 3.5)..";8,4;ui_main_inventory.png]"
formspec = formspec.."label[0,0;" .. S("Crafting Guide") .. "]" formspec = formspec.."label[0,"..unified_inventory.form_header_y..";" .. S("Crafting Guide") .. "]"
formspec = formspec.."listcolors[#00000000;#00000000]" formspec = formspec.."listcolors[#00000000;#00000000]"
local item_name = unified_inventory.current_item[player_name] local item_name = unified_inventory.current_item[player_name]
if not item_name then return {formspec=formspec} end if not item_name then return {formspec=formspec} end
local dir = unified_inventory.current_craft_direction[player_name] local dir = unified_inventory.current_craft_direction[player_name]
local rdir
if dir == "recipe" then rdir = "usage" end
if dir == "usage" then rdir = "recipe" end
local crafts = unified_inventory.crafts_for[dir][item_name] local crafts = unified_inventory.crafts_for[dir][item_name]
local alternate = unified_inventory.alternate[player_name] local alternate = unified_inventory.alternate[player_name]
local alternates, craft local alternates, craft
@ -215,30 +220,42 @@ unified_inventory.register_page("craftguide", {
craft = crafts[alternate] craft = crafts[alternate]
end end
formspec = formspec.."background[0,1;8,3;ui_craftguide_form.png]" formspec = formspec.."background[0.5,"..(unified_inventory.formspec_y + 0.2)..";8,3;ui_craftguide_form.png]"
formspec = formspec.."textarea[0.3,0.6;10,1;;"..minetest.formspec_escape(role_text[dir]..": "..item_name)..";]" formspec = formspec.."textarea["..unified_inventory.craft_result_x..","..unified_inventory.craft_result_y
..";10,1;;"..minetest.formspec_escape(role_text[dir]..": "..item_name)..";]"
formspec = formspec..stack_image_button(0, unified_inventory.formspec_y, 1.1, 1.1, "item_button_"
.. rdir .. "_", ItemStack(item_name))
if not craft then if not craft then
formspec = formspec.."label[6,3.35;"..minetest.formspec_escape(no_recipe_text[dir]).."]" formspec = formspec.."label[5.5,"..(unified_inventory.formspec_y + 2.35)..";"
local no_pos = dir == "recipe" and 4 or 6 ..minetest.formspec_escape(no_recipe_text[dir]).."]"
local item_pos = dir == "recipe" and 6 or 4 local no_pos = dir == "recipe" and 4.5 or 6.5
formspec = formspec.."image["..no_pos..",1;1.1,1.1;ui_no.png]" local item_pos = dir == "recipe" and 6.5 or 4.5
formspec = formspec..stack_image_button(item_pos, 1, 1.1, 1.1, "item_button_"..other_dir[dir].."_", ItemStack(item_name)) formspec = formspec.."image["..no_pos..","..unified_inventory.formspec_y..";1.1,1.1;ui_no.png]"
formspec = formspec..stack_image_button(item_pos, unified_inventory.formspec_y, 1.1, 1.1, "item_button_"
..other_dir[dir].."_", ItemStack(item_name))
if player_privs.give == true then
formspec = formspec.."label[0,"..(unified_inventory.formspec_y + 2.10)..";" .. S("Give me:") .. "]"
.."button[0, "..(unified_inventory.formspec_y + 2.7)..";0.6,0.5;craftguide_giveme_1;1]"
.."button[0.6,"..(unified_inventory.formspec_y + 2.7)..";0.7,0.5;craftguide_giveme_10;10]"
.."button[1.3,"..(unified_inventory.formspec_y + 2.7)..";0.8,0.5;craftguide_giveme_99;99]"
end
return {formspec = formspec} return {formspec = formspec}
end end
local craft_type = unified_inventory.registered_craft_types[craft.type] or local craft_type = unified_inventory.registered_craft_types[craft.type] or
unified_inventory.craft_type_defaults(craft.type, {}) unified_inventory.craft_type_defaults(craft.type, {})
formspec = formspec.."label[6,3.35;" .. S("Method:") .. "]" if craft_type.icon then
formspec = formspec.."label[6,3.75;" formspec = formspec..string.format(" image[%f,%f;%f,%f;%s]",5.7,(unified_inventory.formspec_y + 0.05),0.5,0.5,craft_type.icon)
..minetest.formspec_escape(craft_type.description).."]" end
formspec = formspec..stack_image_button(6, 1, 1.1, 1.1, "item_button_usage_", ItemStack(craft.output)) formspec = formspec.."label[5.5,"..(unified_inventory.formspec_y + 1)..";" .. minetest.formspec_escape(craft_type.description).."]"
formspec = formspec..stack_image_button(6.5, unified_inventory.formspec_y, 1.1, 1.1, "item_button_usage_", ItemStack(craft.output))
local display_size = craft_type.dynamic_display_size and craft_type.dynamic_display_size(craft) or { width = craft_type.width, height = craft_type.height } local display_size = craft_type.dynamic_display_size and craft_type.dynamic_display_size(craft) or { width = craft_type.width, height = craft_type.height }
local craft_width = craft_type.get_shaped_craft_width and craft_type.get_shaped_craft_width(craft) or display_size.width local craft_width = craft_type.get_shaped_craft_width and craft_type.get_shaped_craft_width(craft) or display_size.width
-- This keeps recipes aligned to the right, -- This keeps recipes aligned to the right,
-- so that they're close to the arrow. -- so that they're close to the arrow.
local xoffset = 1 + (3 - display_size.width) local xoffset = 1.5 + (3 - display_size.width)
for y = 1, display_size.height do for y = 1, display_size.height do
for x = 1, display_size.width do for x = 1, display_size.width do
local item local item
@ -247,36 +264,63 @@ unified_inventory.register_page("craftguide", {
end end
if item then if item then
formspec = formspec..stack_image_button( formspec = formspec..stack_image_button(
xoffset + x, y, 1.1, 1.1, xoffset + x, unified_inventory.formspec_y - 1 + y, 1.1, 1.1,
"item_button_recipe_", "item_button_recipe_",
ItemStack(item)) ItemStack(item))
else else
-- Fake buttons just to make grid -- Fake buttons just to make grid
formspec = formspec.."image_button[" formspec = formspec.."image_button["
..tostring(xoffset + x)..","..tostring(y) ..tostring(xoffset + x)..","..tostring(unified_inventory.formspec_y - 1 + y)
..";1,1;ui_blank_image.png;;]" ..";1,1;ui_blank_image.png;;]"
end end
end end
end end
if craft_type.uses_crafting_grid then if craft_type.uses_crafting_grid then
formspec = formspec.."label[6,1.95;" .. S("Copy to craft grid:") .. "]" formspec = formspec.."label[0,"..(unified_inventory.formspec_y + 0.9)..";" .. S("To craft grid:") .. "]"
.."button[6,2.5;0.6,0.5;craftguide_craft_1;1]" .."button[0, "..(unified_inventory.formspec_y + 1.5)..";0.6,0.5;craftguide_craft_1;1]"
.."button[6.6,2.5;0.6,0.5;craftguide_craft_10;10]" .."button[0.6,"..(unified_inventory.formspec_y + 1.5)..";0.7,0.5;craftguide_craft_10;10]"
.."button[7.2,2.5;0.6,0.5;craftguide_craft_max;" .. S("All") .. "]" .."button[1.3,"..(unified_inventory.formspec_y + 1.5)..";0.8,0.5;craftguide_craft_max;" .. S("All") .. "]"
end
if player_privs.give then
formspec = formspec.."label[0,"..(unified_inventory.formspec_y + 2.1)..";" .. S("Give me:") .. "]"
.."button[0, "..(unified_inventory.formspec_y + 2.7)..";0.6,0.5;craftguide_giveme_1;1]"
.."button[0.6,"..(unified_inventory.formspec_y + 2.7)..";0.7,0.5;craftguide_giveme_10;10]"
.."button[1.3,"..(unified_inventory.formspec_y + 2.7)..";0.8,0.5;craftguide_giveme_99;99]"
end end
if alternates and alternates > 1 then if alternates and alternates > 1 then
formspec = formspec.."label[0,2.6;"..recipe_text[dir].." " formspec = formspec.."label[5.5,"..(unified_inventory.formspec_y + 1.6)..";"..recipe_text[dir].." "
..tostring(alternate).." of " ..tostring(alternate).." of "
..tostring(alternates).."]" ..tostring(alternates).."]"
.."button[0,3.15;2,1;alternate;" .. S("Alternate") .. "]" .."button[5.5,"..(unified_inventory.formspec_y + 2)..";2,1;alternate;" .. S("Alternate") .. "]"
end end
return {formspec = formspec} return {formspec = formspec}
end, end,
}) })
minetest.register_on_player_receive_fields(function(player, formname, fields) local function craftguide_giveme(player, formname, fields)
local amount
for k, v in pairs(fields) do
amount = k:match("craftguide_giveme_(.*)")
if amount then break end
end
if not amount then return end
amount = tonumber(amount)
if amount == 0 then return end
local player_name = player:get_player_name()
local output = unified_inventory.current_item[player_name]
if (not output) or (output == "") then return end
local player_inv = player:get_inventory()
player_inv:add_item("main", {name = output, count = amount})
end
local function craftguide_craft(player, formname, fields)
local amount local amount
for k, v in pairs(fields) do for k, v in pairs(fields) do
amount = k:match("craftguide_craft_(.*)") amount = k:match("craftguide_craft_(.*)")
@ -343,4 +387,16 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
player_inv:set_list("craft", craft_list) player_inv:set_list("craft", craft_list)
unified_inventory.set_inventory_formspec(player, "craft") unified_inventory.set_inventory_formspec(player, "craft")
end
minetest.register_on_player_receive_fields(function(player, formname, fields)
for k, v in pairs(fields) do
if k:match("craftguide_craft_") then
craftguide_craft(player, formname, fields)
break
elseif k:match("craftguide_giveme_") then
craftguide_giveme(player, formname, fields)
break
end
end
end) end)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 572 B

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 797 B

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 572 B

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 680 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -184,7 +184,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
if fields["rename_waypoint"..i] then if fields["rename_waypoint"..i] then
hit = true hit = true
waypoints[i] = waypoints[i] or {} temp[i] = temp[i] or {}
temp[i].edit = true temp[i].edit = true
update_formspec = true update_formspec = true
end end