Merge remote-tracking branch 'upstream/master' into nalc-1.2-dev

This commit is contained in:
Sys Quatre 2020-06-14 22:55:56 +02:00
commit 9a31609cfd
13 changed files with 405 additions and 57 deletions

11
.github/workflows/check-release.yml vendored Normal file
View File

@ -0,0 +1,11 @@
on: [push, pull_request]
name: Check & Release
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: lint
uses: Roang-zero1/factorio-mod-luacheck@master
with:
luacheckrc_url: https://raw.githubusercontent.com/minetest-mods/unified_inventory/master/.luacheckrc

20
.luacheckrc Normal file
View File

@ -0,0 +1,20 @@
unused_args = false
allow_defined_top = true
max_line_length = 999
globals = {
"unified_inventory",
}
read_globals = {
string = {fields = {"split", "trim"}},
table = {fields = {"copy", "getn"}},
"minetest", "vector",
"ItemStack", "datastorage",
"hb",
}
files["callbacks.lua"].ignore = { "player", "draw_lite_mode" }
files["bags.lua"].ignore = { "player" }

View File

@ -1,5 +1,9 @@
# Unified Inventory # Unified Inventory
[![](https://github.com/minetest-mods/unified_inventory/workflows/Check%20&%20Release/badge.svg)](https://github.com/minetest-mods/unified_inventory/actions)
![Screenshot](screenshot.png)
Unified Inventory replaces the default survival and creative inventory. Unified Inventory replaces the default survival and creative inventory.
@ -13,15 +17,14 @@ Unified Inventory replaces the default survival and creative inventory.
* Home function to teleport * Home function to teleport
* Trash slot * Trash slot
* Lite mode: reduces the item browser width * Lite mode: reduces the item browser width
* `minetest.conf` setting `unified_inventory_lite = true`
* Mod API for modders: see [mod_api.txt](doc/mod_api.txt) * Mod API for modders: see [mod_api.txt](doc/mod_api.txt)
* Setting-determinated features: see [settingtypes.txt](settingtypes.txt) * Setting-determinated features: see [settingtypes.txt](settingtypes.txt)
## Requirements ## Requirements
* Minetest 5.0.0+ since commit 4403b69 * Minetest 5.0.0+
* Minetest 0.4.16+ prior commit 4403b69
# Licenses # Licenses

View File

@ -16,8 +16,8 @@ minetest.after(0.01, function()
table.insert(unified_inventory.items_list, name) table.insert(unified_inventory.items_list, name)
local all_names = rev_aliases[name] or {} local all_names = rev_aliases[name] or {}
table.insert(all_names, name) table.insert(all_names, name)
for _, name in ipairs(all_names) do for _, player_name in ipairs(all_names) do
local recipes = minetest.get_all_craft_recipes(name) local recipes = minetest.get_all_craft_recipes(player_name)
if recipes then if recipes then
for _, recipe in ipairs(recipes) do for _, recipe in ipairs(recipes) do

View File

@ -1,4 +1,4 @@
--[[ --[[
Bags for Minetest Bags for Minetest
Copyright (c) 2012 cornernote, Brett O'Donnell <cornernote@gmail.com> Copyright (c) 2012 cornernote, Brett O'Donnell <cornernote@gmail.com>
@ -166,7 +166,6 @@ local function load_bags_metadata(player, bags_inv)
end end
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)
local player_inv = player:get_inventory()
local player_name = player:get_player_name() local player_name = player:get_player_name()
local bags_inv = minetest.create_detached_inventory(player_name .. "_bags",{ local bags_inv = minetest.create_detached_inventory(player_name .. "_bags",{
on_put = function(inv, listname, index, stack, player) on_put = function(inv, listname, index, stack, player)
@ -250,7 +249,7 @@ if minetest.get_modpath("farming") ~= nil then
minetest.register_craft({ minetest.register_craft({
output = "unified_inventory:bag_small", output = "unified_inventory:bag_small",
recipe = { recipe = {
{"", "farming:cotton", ""}, {"", "farming:string", ""},
{"group:wool", "group:wool", "group:wool"}, {"group:wool", "group:wool", "group:wool"},
{"group:wool", "group:wool", "group:wool"}, {"group:wool", "group:wool", "group:wool"},
}, },
@ -260,8 +259,8 @@ if minetest.get_modpath("farming") ~= nil then
output = "unified_inventory:bag_medium", output = "unified_inventory:bag_medium",
recipe = { recipe = {
{"", "", ""}, {"", "", ""},
{"farming:cotton", "unified_inventory:bag_small", "farming:cotton"}, {"farming:string", "unified_inventory:bag_small", "farming:string"},
{"farming:cotton", "unified_inventory:bag_small", "farming:cotton"}, {"farming:string", "unified_inventory:bag_small", "farming:string"},
}, },
}) })
@ -269,8 +268,8 @@ if minetest.get_modpath("farming") ~= nil then
output = "unified_inventory:bag_large", output = "unified_inventory:bag_large",
recipe = { recipe = {
{"", "", ""}, {"", "", ""},
{"farming:cotton", "unified_inventory:bag_medium", "farming:cotton"}, {"farming:string", "unified_inventory:bag_medium", "farming:string"},
{"farming:cotton", "unified_inventory:bag_medium", "farming:cotton"}, {"farming:string", "unified_inventory:bag_medium", "farming:string"},
}, },
}) })
end end

View File

@ -28,7 +28,6 @@ minetest.register_on_joinplayer(function(player)
-- Refill slot -- Refill slot
local refill = minetest.create_detached_inventory(player_name.."refill", { local refill = minetest.create_detached_inventory(player_name.."refill", {
allow_put = function(inv, listname, index, stack, player) allow_put = function(inv, listname, index, stack, player)
local player_name = player:get_player_name()
if unified_inventory.is_creative(player_name) then if unified_inventory.is_creative(player_name) then
return stack:get_count() return stack:get_count()
else else
@ -36,7 +35,6 @@ minetest.register_on_joinplayer(function(player)
end end
end, end,
on_put = function(inv, listname, index, stack, player) on_put = function(inv, listname, index, stack, player)
local player_name = player:get_player_name()
local handle_refill = (minetest.registered_items[stack:get_name()] or {}).on_refill or default_refill local handle_refill = (minetest.registered_items[stack:get_name()] or {}).on_refill or default_refill
stack = handle_refill(stack) stack = handle_refill(stack)
inv:set_stack(listname, index, stack) inv:set_stack(listname, index, stack)

View File

@ -220,11 +220,10 @@ function unified_inventory.get_formspec(player, page)
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 / (ui_peruser.items_per_page) + 1) local page2 = math.floor(list_index / (ui_peruser.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)
/ (ui_peruser.items_per_page) + 1) / (ui_peruser.items_per_page) + 1)
local item = {}
for y = 0, ui_peruser.pagerows - 1 do for y = 0, ui_peruser.pagerows - 1 do
for x = 0, ui_peruser.pagecols - 1 do for x = 0, ui_peruser.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]
@ -259,7 +258,7 @@ function unified_inventory.get_formspec(player, page)
end end
end end
formspec[n] = "label[8.2,"..ui_peruser.form_header_y..";"..F(S("Page")) .. ": " formspec[n] = "label[8.2,"..ui_peruser.form_header_y..";"..F(S("Page")) .. ": "
.. S("@1 of @2",page,pagemax).."]" .. S("@1 of @2",page2,pagemax).."]"
end end
n= n+1 n= n+1

View File

@ -1,25 +1,25 @@
-- Based on 4itemnames mod by 4aiman -- Based on 4itemnames mod by 4aiman
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 air_hud_mod = minetest.get_modpath("4air")
local hud_mod = minetest.get_modpath("hud")
local hudbars_mod = minetest.get_modpath("hudbars") local hudbars_mod = minetest.get_modpath("hudbars")
local function set_hud(player) local function set_hud(player)
local player_name = player:get_player_name() local player_name = player:get_player_name()
local off = {x=0, y=-70} local off = {x=0, y=-65}
if air_hud_mod or hud_mod then if hudbars_mod then
off.y = off.y - 20 -- Assume no alignment (2 per line)
elseif hudbars_mod then off.y = off.y - math.ceil(hb.hudbars_count / 2) * 25
off.y = off.y + 13 else
off.y = off.y - 25
end end
item_names[player_name] = { item_names[player_name] = {
hud = player:hud_add({ hud = player:hud_add({
hud_elem_type = "text", hud_elem_type = "text",
position = {x=0.5, y=1}, position = {x=0.5, y=1},
offset = off, offset = off,
alignment = {x=0, y=0}, alignment = {x=0, y=-1},
number = 0xFFFFFF, number = 0xFFFFFF,
text = "", text = "",
}), }),

View File

@ -1,38 +1,100 @@
# textdomain: unified_inventory # textdomain: unified_inventory
Crafting=Elaboración
Cooking=hornear # waypoints.lua
Bags=Bolsas
Bag @1=Bolsa @1
Small Bag=Bolsa Pequeña
Medium Bag=Bolsa Mediana
Large Bag=Bolsa Grande
Page=Página
@1 of @2=@1 de @2
Filter=Filtro
Can use the creative inventory=Puede usar el inventario creativo
Crafting Guide=Guía de Elaboración
Set home position=Posición en el mundo
Home position set to: @1=Posición de hogar cambiada a: @1
You don't have the "home" privilege!=¡No tienes el privilegio "home"!
Time of day set to 6am=Hora del día cambiada a 6AM
You don't have the settime privilege!=¡No tienes el privilegio "settime"!
Time of day set to 9pm=Hora del día cambiada a 9PM
Inventory cleared!=¡Inventario limpio!
Trash:=Basura:
Refill:=Rellenar:
Recipe @1 of @2=Receta @1 de @2
Result=Resultado
To craft grid:=Copiar al cuadro de elaboración
All=Todos
White=Blanco White=Blanco
Yellow=Amarillo Yellow=Amarillo
Red=Rojo Red=Rojo
Green=Verde Green=Verde
Blue=Azul Blue=Azul
Waypoints=Puntos de paso Waypoints=Puntos
Waypoint @1=Puntos de paso @1 Select Waypoint #@1=Seleccionar Punto #@1
Waypoint active=Punto de paso activo Waypoint @1=Punto @1
Waypoint inactive=Punto de paso inactivo Set waypoint to current location=Establecer el punto a la ubicación actual
Make waypoint @1=Hacer punto @1
invisible=invisible
visible=visible
@1 display of waypoint coordinates=Visualizar coordenadas del punto @1
Disable=Deshabilitado
Enable=Habilitado
Change color of waypoint display=Cambiar el color del punto
Edit waypoint name=Editar nombre del punto
Waypoint active=Punto activo
Waypoint inactive=Punto inactivo
Finish editing=Terminar edición
World position=Posición en el mundo World position=Posición en el mundo
Name=Nombre Name=Nombre
HUD text color=Color del HUD HUD text color=Color del texto de la Interfaz
# group.lua
and = y
# register.lua
Can use the creative inventory=Puede usar el inventario creativo
Forces Unified Inventory to be displayed in Full mode if Lite mode is configured globally=Obliga al Inventario Unificado a mostrarse en modo Completo si el modo Simple está configurado globalmente
Crafting Grid=Cuadricula de Elaboración
Crafting Guide=Guía de Elaboración
Set home position=Establecer posición de la casa
Home position set to: @1=Posición de la casa cambiada a: @1
You don't have the \"home\" privilege!=¡No tienes el privilegio \"home\"!
Go home=Ir a casa
Set time to day=Cambiar a dia
Set time to night=Cambiar a noche
Time of day set to 6am=Hora del día cambiada a 6 AM
Time of day set to 9pm=Hora del día cambiada a 9 PM
You don't have the settime privilege!=¡No tienes el privilegio "settime"!
Clear inventory=Limpiar inventario
Inventory cleared!=¡Inventario limpio!
This button has been disabled outside=Este botón ha sido deshabilitado
Crafting=Elaboración
Trash:=Basura:
Refill:=Rellenar:
Any item belonging to the @1 group=Cualquier elemento que pertenezca al grupo @1
Any item belonging to the groups @1=Cualquier elemento perteneciente a los grupos @1
Recipe @1 of @2=Receta @1 de @2
Usage @1 of @2=Uso @1 de @2
No recipes=No tiene receta
No usages=No tiene uso
Result=Resultado
Ingredient=Ingrediente
Show next recipe=Mostrar la siguiente receta
Show next usage=Mostrar el siguiente uso
Show previous recipe=Mostrar la receta anterior
Show previous usage=Mostrar el uso anterior
@1 (@2)=@1 (@2)
Give me:=Dame:
This recipe is too@nlarge to be displayed.=Esta receta es demasiado@ngrande para ser mostrada.
To craft grid:=Construir:
All=Todos
# api.lua
Mixing=Mezclar
Cooking=Hornear
Digging=Recoger
# internal.lua
First page=Primera página
Back three pages=Volver tres páginas
Back one page=Volver una página
Forward one page=Avanzar una página
Forward three pages=Avanzar tres páginas
Last page=Ultima Pagina
Search=Buscar
Reset search and display everything=Limpiar la busqueda y mostrar todo
No matching items=No se encontraron elementos
No matches.=No hay resultados.
Page=Página
@1 of @2=@1 de @2
Filter=Filtro
# bags.lua
Bags=Bolsos
Bag @1=Bolso @1
Small Bag=Bolso Pequeño
Medium Bag=Bolso Mediano
Large Bag=Bolso Grande

View File

@ -0,0 +1,100 @@
# textdomain: unified_inventory
# waypoints.lua
White=
Yellow=
Red=
Green=
Blue=
Waypoints=
Select Waypoint #@1=
Waypoint @1=
Set waypoint to current location=
Make waypoint @1=
invisible=
visible=
@1 display of waypoint coordinates=
Disable=
Enable=
Change color of waypoint display=
Edit waypoint name=
Waypoint active=
Waypoint inactive=
Finish editing=
World position=
Name=
HUD text color=
# group.lua
and =
# register.lua
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=
Home position set to: @1=
You don't have the \"home\" privilege!=
Go home=
Set time to day=
Set time to night=
Time of day set to 6am=
Time of day set to 9pm=
You don't have the settime privilege!=
Clear inventory=
Inventory cleared!=
This button has been disabled outside=
Crafting=
Trash:=
Refill:=
Any item belonging to the @1 group=
Any item belonging to the groups @1=
Recipe @1 of @2=
Usage @1 of @2=
No recipes=
No usages=
Result=
Ingredient=
Show next recipe=
Show next usage=
Show previous recipe=
Show previous usage=
@1 (@2)=
Give me:=
This recipe is too@nlarge to be displayed.=
To craft grid:=
All=
# api.lua
Mixing=
Cooking=
Digging=
# internal.lua
First page=
Back three pages=
Back one page=
Forward one page=
Forward three pages=
Last page=
Search=
Reset search and display everything=
No matching items=
No matches.=
Page=
@1 of @2=
Filter=
# bags.lua
Bags=
Bag @1=
Small Bag=
Medium Bag=
Large Bag=

View File

@ -0,0 +1,78 @@
# textdomain: unified_inventory
# traslation by: IFRFSX(BingFengFSX)
#Email: IFRFSX@Protonmail.com
Crafting=合成
Mixing=混合
Cooking=烹饪
Digging=挖出
Bags=背包
Bag @1=背包@1
Small Bag=小背包
Medium Bag=中背包
Large Bag=大背包
and = 和
First page=第一页
Back three pages=后退三页
Back one page=后退一页
Forward one page=前进一页
Forward three pages=前进三页
Last page=最后一页
Search=搜索
No matching items=没有匹配物品
No matches.=没有匹配
Page=页面
@1 of @2=第@1页共@2页
Filter=过滤器
Can use the creative inventory=可以使用创造背包
Crafting Grid=合成表
Crafting Guide=合成指南
Set home position=设置家的位置
Home position set to: @1=家的位置设置到: @1
You don't have the "home" privilege!=你没有“home”权限
Go home=回家
Set time to day=设置时间到白天
Time of day set to 6am=时间设置到早晨6点
You don't have the settime privilege!=你没有“settime”权限
Set time to night=设置时间到晚上
Time of day set to 9pm=时间设置到晚上9点
Inventory cleared!=清空背包
Clear inventory=清空背包
Trash:=丢弃:
Refill:=填满:
Recipe @1 of @2=第@1配方共@2个
Usage @1 of @2=第@1用法共@2个
No recipes=没有配方
No usages=没有用法
Result=结果
Ingredient=原料
Give me:=给予:
To craft grid:=填充物品到合成表
All=全部
White=白
Yellow=黄
Red=红
Green=绿
Blue=蓝
Waypoints=航路点
Select Waypoint #@1=查询航路点 #@1
Waypoint @1=航路点 @1
Set waypoint to current location=将航路点设置到当前位置
invisible=不可见的
visible=可见的
Make waypoint @1=设置航路点 @1
@1 display of waypoint coordinates=显示航路点@1坐标
Change color of waypoint display=改变航路点显示的颜色
Edit waypoint name=编辑航路点名称
Waypoint active=航路点已激活
Waypoint inactive=航路点未激活
Finish editing=完成编辑
World position=世界位置
Name=名称
HUD text color=HUD文本颜色
#new
Reset search and display everything=重置搜索并显示所有物品

View File

@ -0,0 +1,78 @@
# textdomain: unified_inventory
# traslation by: IFRFSX(BingFengFSX)
#Email: IFRFSX@Protonmail.com
Crafting=合成
Mixing=混合
Cooking=烹飪
Digging=挖出
Bags=揹包
Bag @1=揹包@1
Small Bag=小揹包
Medium Bag=中揹包
Large Bag=大揹包
and = 和
First page=第一頁
Back three pages=後退三頁
Back one page=後退一頁
Forward one page=前進一頁
Forward three pages=前進三頁
Last page=最後一頁
Search=搜索
No matching items=沒有匹配物品
No matches.=沒有匹配
Page=頁面
@1 of @2=第@1頁共@2頁
Filter=過濾器
Can use the creative inventory=可以使用創造揹包
Crafting Grid=合成表
Crafting Guide=合成指南
Set home position=設置家的位置
Home position set to: @1=家的位置設置到: @1
You don't have the "home" privilege!=你沒有“home”權限
Go home=回家
Set time to day=設置時間到白天
Time of day set to 6am=時間設置到早晨6點
You don't have the settime privilege!=你沒有“settime”權限
Set time to night=設置時間到晚上
Time of day set to 9pm=時間設置到晚上9點
Inventory cleared!=清空揹包
Clear inventory=清空揹包
Trash:=丟棄:
Refill:=填滿:
Recipe @1 of @2=第@1配方共@2個
Usage @1 of @2=第@1用法共@2個
No recipes=沒有配方
No usages=沒有用法
Result=結果
Ingredient=原料
Give me:=給予:
To craft grid:=填充物品到合成表
All=全部
White=白
Yellow=黃
Red=紅
Green=綠
Blue=藍
Waypoints=航路點
Select Waypoint #@1=查詢航路點 #@1
Waypoint @1=航路點 @1
Set waypoint to current location=將航路點設置到當前位置
invisible=不可見的
visible=可見的
Make waypoint @1=設置航路點 @1
@1 display of waypoint coordinates=顯示航路點@1座標
Change color of waypoint display=改變航路點顯示的顏色
Edit waypoint name=編輯航路點名稱
Waypoint active=航路點已激活
Waypoint inactive=航路點未激活
Finish editing=完成編輯
World position=世界位置
Name=名稱
HUD text color=HUD文本顏色
#new
Reset search and display everything=重置搜索並顯示所有物品

View File

@ -337,7 +337,7 @@ unified_inventory.register_page("craftguide", {
else else
-- Error -- Error
fs[#fs + 1] = string.format("label[2,%f;%s]", fs[#fs + 1] = string.format("label[2,%f;%s]",
formspecy, F(S("This recipe is too\nlarge to be displayed."))) formspecy, F(S("This recipe is too@nlarge to be displayed.")))
end end
if craft_type.uses_crafting_grid and display_size.width <= 3 then if craft_type.uses_crafting_grid and display_size.width <= 3 then