mirror of
https://github.com/minetest-mods/unified_inventory.git
synced 2025-07-04 09:20:28 +02:00
Merge 8a91596940
into 5e52f3c49c
This commit is contained in:
24
bags.lua
24
bags.lua
@ -3,15 +3,23 @@
|
|||||||
-- Copyright (c) 2012 cornernote, Brett O'Donnell <cornernote@gmail.com>
|
-- Copyright (c) 2012 cornernote, Brett O'Donnell <cornernote@gmail.com>
|
||||||
-- License: GPLv3
|
-- License: GPLv3
|
||||||
|
|
||||||
|
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||||
|
local S
|
||||||
|
if intllib then
|
||||||
|
S = intllib.Getter()
|
||||||
|
else
|
||||||
|
S = function(s) return s end
|
||||||
|
end
|
||||||
|
|
||||||
unified_inventory.register_page("bags", {
|
unified_inventory.register_page("bags", {
|
||||||
get_formspec = function(player)
|
get_formspec = function(player)
|
||||||
local player_name = player:get_player_name()
|
local player_name = player:get_player_name()
|
||||||
local formspec = "background[0.06,0.99;7.92,7.52;ui_bags_main_form.png]"
|
local formspec = "background[0.06,0.99;7.92,7.52;ui_bags_main_form.png]"
|
||||||
formspec = formspec.."label[0,0;Bags]"
|
formspec = formspec.."label[0,0;"..S("Bags").."]"
|
||||||
formspec = formspec.."button[0,2;2,0.5;bag1;Bag 1]"
|
formspec = formspec.."button[0,2;2,0.5;bag1;"..S("Bag 1").."]"
|
||||||
formspec = formspec.."button[2,2;2,0.5;bag2;Bag 2]"
|
formspec = formspec.."button[2,2;2,0.5;bag2;"..S("Bag 2").."]"
|
||||||
formspec = formspec.."button[4,2;2,0.5;bag3;Bag 3]"
|
formspec = formspec.."button[4,2;2,0.5;bag3;"..S("Bag 3").."]"
|
||||||
formspec = formspec.."button[6,2;2,0.5;bag4;Bag 4]"
|
formspec = formspec.."button[6,2;2,0.5;bag4;"..S("Bag 4").."]"
|
||||||
formspec = formspec.."listcolors[#00000000;#00000000]"
|
formspec = formspec.."listcolors[#00000000;#00000000]"
|
||||||
formspec = formspec.."list[detached:"..player_name.."_bags;bag1;0.5,1;1,1;]"
|
formspec = formspec.."list[detached:"..player_name.."_bags;bag1;0.5,1;1,1;]"
|
||||||
formspec = formspec.."list[detached:"..player_name.."_bags;bag2;2.5,1;1,1;]"
|
formspec = formspec.."list[detached:"..player_name.."_bags;bag2;2.5,1;1,1;]"
|
||||||
@ -102,19 +110,19 @@ end)
|
|||||||
|
|
||||||
-- register bag tools
|
-- register bag tools
|
||||||
minetest.register_tool("unified_inventory:bag_small", {
|
minetest.register_tool("unified_inventory:bag_small", {
|
||||||
description = "Small Bag",
|
description = S("Small Bag"),
|
||||||
inventory_image = "bags_small.png",
|
inventory_image = "bags_small.png",
|
||||||
groups = {bagslots=8},
|
groups = {bagslots=8},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_tool("unified_inventory:bag_medium", {
|
minetest.register_tool("unified_inventory:bag_medium", {
|
||||||
description = "Medium Bag",
|
description = S("Medium Bag"),
|
||||||
inventory_image = "bags_medium.png",
|
inventory_image = "bags_medium.png",
|
||||||
groups = {bagslots=16},
|
groups = {bagslots=16},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_tool("unified_inventory:bag_large", {
|
minetest.register_tool("unified_inventory:bag_large", {
|
||||||
description = "Large Bag",
|
description = S("Large Bag"),
|
||||||
inventory_image = "bags_large.png",
|
inventory_image = "bags_large.png",
|
||||||
groups = {bagslots=24},
|
groups = {bagslots=24},
|
||||||
})
|
})
|
||||||
|
@ -1 +1,2 @@
|
|||||||
creative?
|
creative?
|
||||||
|
intllib?
|
||||||
|
13
internal.lua
13
internal.lua
@ -1,3 +1,10 @@
|
|||||||
|
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||||
|
local S
|
||||||
|
if intllib then
|
||||||
|
S = intllib.Getter()
|
||||||
|
else
|
||||||
|
S = function(s) return s end
|
||||||
|
end
|
||||||
|
|
||||||
function unified_inventory.get_formspec(player, page)
|
function unified_inventory.get_formspec(player, page)
|
||||||
if not player then
|
if not player then
|
||||||
@ -73,9 +80,9 @@ function unified_inventory.get_formspec(player, page)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
formspec = formspec.."label[8.2,0;Page:]"
|
formspec = formspec.."label[8.2,0;"..S("Page:").."]"
|
||||||
formspec = formspec.."label[9,0;"..page.." of "..pagemax.."]"
|
formspec = formspec.."label[9,0;"..S("%s of %s"):format(page,pagemax).."]"
|
||||||
formspec = formspec.."label[8.2,0.4;Filter:]"
|
formspec = formspec.."label[8.2,0.4;"..S("Filter:").."]"
|
||||||
formspec = formspec.."label[9,0.4;"..unified_inventory.activefilter[player_name].."]"
|
formspec = formspec.."label[9,0.4;"..unified_inventory.activefilter[player_name].."]"
|
||||||
return formspec
|
return formspec
|
||||||
end
|
end
|
||||||
|
39
locale/de.txt
Normal file
39
locale/de.txt
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
# Translation by Xanthin
|
||||||
|
|
||||||
|
### bags.lua ###
|
||||||
|
Bags = Rucksaecke
|
||||||
|
Bag 1 = Rucksack 1
|
||||||
|
Bag 2 = Rucksack 2
|
||||||
|
Bag 3 = Rucksack 3
|
||||||
|
Bag 4 = Rucksack 4
|
||||||
|
Small Bag = Rucksack (klein)
|
||||||
|
Medium Bag = Rucksack (mittel)
|
||||||
|
Large Bag = Rucksack (gross)
|
||||||
|
|
||||||
|
### inernal.lua ###
|
||||||
|
Page: = Seite:
|
||||||
|
%s of %s = %s von %s
|
||||||
|
Filter: = Suche:
|
||||||
|
|
||||||
|
### register.lua ###
|
||||||
|
Can use the creative inventory = Kann das Kreativinventar nutzen
|
||||||
|
Home position set to: %s = Ausgangsposition nach: %s gesetzt
|
||||||
|
Time of day set to 6am = Tageszeit auf 6 Uhr morgens geaendert
|
||||||
|
You don't have the settime priviledge! = Du hast nicht das "settime" Privileg!
|
||||||
|
Time of day set to 9pm = Tageszeit auf 9 Uhr abends geaendert
|
||||||
|
This button has been disabled outside of creative mode to prevent accidental inventory trashing. Use the trash slot instead. = Diese Funktion ist ausserhalb des Kreativmodus deaktiviert um ein versehentliches Loeschen des ganzen Inventars zu verhindern. Nutze stattdessen das Muellfeld.
|
||||||
|
Inventory Cleared! = Inventar geleert!
|
||||||
|
Crafting = Bauen
|
||||||
|
Trash: = Muell:
|
||||||
|
Refill: = Nachfuellen:
|
||||||
|
Crafting Guide = Bauanleitung
|
||||||
|
Method: = Methode:
|
||||||
|
Result: %s = Ergebnis: %s
|
||||||
|
crafting = Bauen
|
||||||
|
shapeless crafting = Formloses Bauen
|
||||||
|
cooking = Kochen
|
||||||
|
alloy cooking = Legierung Kochen
|
||||||
|
Copy to craft grid: = Kopiere ins Baufeld:
|
||||||
|
All = Alles
|
||||||
|
Recipe %s of %s = Rezept %s von %s
|
||||||
|
Alternate = Alternative
|
38
locale/template.txt
Normal file
38
locale/template.txt
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# Template
|
||||||
|
### bags.lua ###
|
||||||
|
Bags = Ruchsaecke
|
||||||
|
Bag 1 =
|
||||||
|
Bag 2 =
|
||||||
|
Bag 3 =
|
||||||
|
Bag 4 =
|
||||||
|
Small Bag =
|
||||||
|
Medium Bag =
|
||||||
|
Large Bag =
|
||||||
|
|
||||||
|
### inernal.lua ###
|
||||||
|
Page: =
|
||||||
|
%s of %s =
|
||||||
|
Filter: =
|
||||||
|
|
||||||
|
### register.lua ###
|
||||||
|
Can use the creative inventory =
|
||||||
|
Home position set to: %s =
|
||||||
|
Time of day set to 6am =
|
||||||
|
You don't have the settime priviledge! =
|
||||||
|
Time of day set to 9pm =
|
||||||
|
This button has been disabled outside of creative mode to prevent accidental inventory trashing. Use the trash slot instead. =
|
||||||
|
Inventory Cleared! =
|
||||||
|
Crafting =
|
||||||
|
Trash: =
|
||||||
|
Refill: =
|
||||||
|
Crafting Guide =
|
||||||
|
Method: =
|
||||||
|
Result: %s =
|
||||||
|
crafting =
|
||||||
|
shapeless crafting =
|
||||||
|
cooking =
|
||||||
|
alloy cooking =
|
||||||
|
Copy to craft grid: =
|
||||||
|
All =
|
||||||
|
Recipe %s of %s =
|
||||||
|
Alternate =
|
59
register.lua
59
register.lua
@ -1,6 +1,13 @@
|
|||||||
|
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||||
|
local S
|
||||||
|
if intllib then
|
||||||
|
S = intllib.Getter()
|
||||||
|
else
|
||||||
|
S = function(s) return s end
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_privilege("creative", {
|
minetest.register_privilege("creative", {
|
||||||
description = "Can use the creative inventory",
|
description = S("Can use the creative inventory"),
|
||||||
give_to_singleplayer = false,
|
give_to_singleplayer = false,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -41,8 +48,7 @@ unified_inventory.register_button("home_gui_set", {
|
|||||||
minetest.sound_play("dingdong",
|
minetest.sound_play("dingdong",
|
||||||
{to_player=player_name, gain = 1.0})
|
{to_player=player_name, gain = 1.0})
|
||||||
minetest.chat_send_player(player_name,
|
minetest.chat_send_player(player_name,
|
||||||
"Home position set to: "
|
S("Home position set to: %s"):format(minetest.pos_to_string(home)))
|
||||||
..minetest.pos_to_string(home))
|
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
@ -67,11 +73,10 @@ unified_inventory.register_button("misc_set_day", {
|
|||||||
{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,
|
||||||
"Time of day set to 6am")
|
S("Time of day set to 6am"))
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(player_name,
|
minetest.chat_send_player(player_name,
|
||||||
"You don't have the"
|
S("You don't have the settime priviledge!"))
|
||||||
.." settime priviledge!")
|
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
@ -86,11 +91,10 @@ unified_inventory.register_button("misc_set_night", {
|
|||||||
{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,
|
||||||
"Time of day set to 9pm")
|
S("Time of day set to 9pm"))
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(player_name,
|
minetest.chat_send_player(player_name,
|
||||||
"You don't have the"
|
S("You don't have the settime priviledge!"))
|
||||||
.." settime priviledge!")
|
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
@ -102,14 +106,11 @@ unified_inventory.register_button("clear_inv", {
|
|||||||
local player_name = player:get_player_name()
|
local player_name = player:get_player_name()
|
||||||
if not unified_inventory.is_creative(player_name) then
|
if not unified_inventory.is_creative(player_name) then
|
||||||
minetest.chat_send_player(player_name,
|
minetest.chat_send_player(player_name,
|
||||||
"This button has been disabled outside"
|
S("This button has been disabled outside of creative mode to prevent accidental inventory trashing. Use the trash slot instead."))
|
||||||
.." of creative mode to prevent"
|
|
||||||
.." accidental inventory trashing."
|
|
||||||
.." Use the trash slot instead.")
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
player:get_inventory():set_list("main", {})
|
player:get_inventory():set_list("main", {})
|
||||||
minetest.chat_send_player(player_name, 'Inventory Cleared!')
|
minetest.chat_send_player(player_name, S('Inventory Cleared!'))
|
||||||
minetest.sound_play("trash_all",
|
minetest.sound_play("trash_all",
|
||||||
{to_player=player_name, gain = 1.0})
|
{to_player=player_name, gain = 1.0})
|
||||||
end,
|
end,
|
||||||
@ -120,14 +121,14 @@ unified_inventory.register_page("craft", {
|
|||||||
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,1;8,3;ui_crafting_form.png]"
|
||||||
formspec = formspec.."background[0,4.5;8,4;ui_main_inventory.png]"
|
formspec = formspec.."background[0,4.5;8,4;ui_main_inventory.png]"
|
||||||
formspec = formspec.."label[0,0;Crafting]"
|
formspec = formspec.."label[0,0;"..S("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,1;1,1;]"
|
||||||
formspec = formspec.."list[current_player;craft;2,1;3,3;]"
|
formspec = formspec.."list[current_player;craft;2,1;3,3;]"
|
||||||
formspec = formspec.."label[7,2.5;Trash:]"
|
formspec = formspec.."label[7,2.5;"..S("Trash:").."]"
|
||||||
formspec = formspec.."list[detached:trash;main;7,3;1,1;]"
|
formspec = formspec.."list[detached:trash;main;7,3;1,1;]"
|
||||||
if unified_inventory.is_creative(player_name) then
|
if unified_inventory.is_creative(player_name) then
|
||||||
formspec = formspec.."label[0,2.5;Refill:]"
|
formspec = formspec.."label[0,2.5;"..S("Refill:").."]"
|
||||||
formspec = formspec.."list[detached:"..player_name.."refill;main;0,3;1,1;]"
|
formspec = formspec.."list[detached:"..player_name.."refill;main;0,3;1,1;]"
|
||||||
end
|
end
|
||||||
return {formspec=formspec}
|
return {formspec=formspec}
|
||||||
@ -139,14 +140,14 @@ unified_inventory.register_page("craftguide", {
|
|||||||
local player_name = player:get_player_name()
|
local player_name = player:get_player_name()
|
||||||
local formspec = "background[0,1;8,3;ui_craftguide_form.png]"
|
local formspec = "background[0,1;8,3;ui_craftguide_form.png]"
|
||||||
formspec = formspec.."background[0,4.5;8,4;ui_main_inventory.png]"
|
formspec = formspec.."background[0,4.5;8,4;ui_main_inventory.png]"
|
||||||
formspec = formspec.."label[0,0;Crafting Guide]"
|
formspec = formspec.."label[0,0;"..S("Crafting Guide").."]"
|
||||||
formspec = formspec.."listcolors[#00000000;#00000000]"
|
formspec = formspec.."listcolors[#00000000;#00000000]"
|
||||||
formspec = formspec.."list[detached:"..player_name.."craftrecipe;output;6,1;1,1;]"
|
formspec = formspec.."list[detached:"..player_name.."craftrecipe;output;6,1;1,1;]"
|
||||||
formspec = formspec.."label[6,3.35;Method:]"
|
formspec = formspec.."label[6,3.35;"..S("Method:").."]"
|
||||||
local item_name = unified_inventory.current_item[player_name]
|
local item_name = unified_inventory.current_item[player_name]
|
||||||
local craft = nil
|
local craft = nil
|
||||||
if item_name then
|
if item_name then
|
||||||
formspec = formspec.."textarea[0.3,0.6;10,1;;Result: "..item_name..";]"
|
formspec = formspec.."textarea[0.3,0.6;10,1;;"..S("Result: %s"):format(item_name)..";]"
|
||||||
local alternates = 0
|
local alternates = 0
|
||||||
local alternate = unified_inventory.alternate[player_name]
|
local alternate = unified_inventory.alternate[player_name]
|
||||||
local crafts = unified_inventory.crafts_table[item_name]
|
local crafts = unified_inventory.crafts_table[item_name]
|
||||||
@ -156,25 +157,25 @@ unified_inventory.register_page("craftguide", {
|
|||||||
local method = craft.type
|
local method = craft.type
|
||||||
local allow_auto_craft = ((method == "normal") or (method == "shapeless"))
|
local allow_auto_craft = ((method == "normal") or (method == "shapeless"))
|
||||||
if craft.type == "normal" then
|
if craft.type == "normal" then
|
||||||
method = "crafting"
|
method = S("crafting")
|
||||||
elseif craft.type == "shapeless" then
|
elseif craft.type == "shapeless" then
|
||||||
method = "shapeless crafting"
|
method = S("shapeless crafting")
|
||||||
|
elseif craft.type == "cooking" then
|
||||||
|
method = S("cooking")
|
||||||
elseif craft.type == "alloy" then
|
elseif craft.type == "alloy" then
|
||||||
method = "alloy cooking"
|
method = S("alloy cooking")
|
||||||
end
|
end
|
||||||
formspec = formspec.."label[6,3.75;"..method.."]"
|
formspec = formspec.."label[6,3.75;"..method.."]"
|
||||||
if allow_auto_craft then
|
if allow_auto_craft then
|
||||||
formspec = formspec.."label[6,1.95;Copy to craft grid:]"
|
formspec = formspec.."label[6,1.95;"..S("Copy to craft grid:").."]"
|
||||||
.."button[6,2.5;0.6,0.5;craftguide_craft_1;1]"
|
.."button[6,2.5;0.6,0.5;craftguide_craft_1;1]"
|
||||||
.."button[6.6,2.5;0.6,0.5;craftguide_craft_10;10]"
|
.."button[6.6,2.5;0.6,0.5;craftguide_craft_10;10]"
|
||||||
.."button[7.2,2.5;0.6,0.5;craftguide_craft_max;All]"
|
.."button[7.2,2.5;0.6,0.5;craftguide_craft_max;"..S("All").."]"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if alternates > 1 then
|
if alternates > 1 then
|
||||||
formspec = formspec.."label[0,2.6;Recipe "
|
formspec = formspec.."label[0,2.6;"..S("Recipe %s of %s"):format(alternate,alternates).."]"
|
||||||
..tostring(alternate).." of "
|
.."button[0,3.15;2,1;alternate;"..S("Alternate").."]"
|
||||||
..tostring(alternates).."]"
|
|
||||||
.."button[0,3.15;2,1;alternate;Alternate]"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user