Bags: Code cleanup and per-bag trash slot.

* Turn page creation into a loop.
* Add per-bag trash slot.
* Changed i18n to allow replacements.
This commit is contained in:
Diego Martínez
2016-10-08 06:07:41 -03:00
parent 5b9a53bf29
commit 75a0e6a318
10 changed files with 33 additions and 102 deletions

View File

@ -2,7 +2,15 @@
local modpath = minetest.get_modpath(minetest.get_current_modname())
local worldpath = minetest.get_worldpath()
local mygettext = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end
local mygettext
if rawget(_G, "intllib") then
mygettext = intllib.Getter()
else
function mygettext(s, ...)
local t = { ... }
return (s:gsub("@(%d+)", function(n) return t[tonumber(n)] end))
end
end
-- Data tables definitions
unified_inventory = {
@ -33,7 +41,7 @@ unified_inventory = {
-- intllib
gettext = mygettext,
fgettext = function(s) return minetest.formspec_escape(mygettext(s)) end,
fgettext = function(...) return minetest.formspec_escape(mygettext(...)) end,
-- "Lite" mode
lite_mode = minetest.setting_getbool("unified_inventory_lite"),