mirror of
https://github.com/rubenwardy/sfinv.git
synced 2024-11-24 16:13:52 +01:00
Update
This commit is contained in:
parent
988ade8f03
commit
556f70ed0e
@ -4,9 +4,11 @@
|
||||
|
||||
A cleaner, simpler solution to having an advanced inventory in Minetest.
|
||||
|
||||
Written by rubenwardy.
|
||||
Written by rubenwardy.\\
|
||||
License: MIT
|
||||
|
||||
* sfinv_crafting_arrow.png - by paramat, derived from a texture by BlockMen (CC BY-SA 3.0).
|
||||
|
||||
## API
|
||||
|
||||
It is recommended that you read this link for a good introduction to the sfinv API
|
||||
|
39
api.lua
39
api.lua
@ -5,16 +5,6 @@ sfinv = {
|
||||
enabled = true
|
||||
}
|
||||
|
||||
if minetest.features.formspec_prepends then
|
||||
sfinv.gui_bg = ""
|
||||
sfinv.gui_bg_img = ""
|
||||
sfinv.gui_slots = ""
|
||||
else
|
||||
sfinv.gui_bg = "bgcolor[#080808BB;true]"
|
||||
sfinv.gui_bg_img = "background[5,5;1,1;gui_formbg.png;true]"
|
||||
sfinv.gui_slots = "listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]"
|
||||
end
|
||||
|
||||
function sfinv.register_page(name, def)
|
||||
assert(name, "Invalid sfinv page. Requires a name")
|
||||
assert(def, "Invalid sfinv page. Requires a def[inition] table")
|
||||
@ -46,24 +36,26 @@ function sfinv.get_nav_fs(player, context, nav, current_idx)
|
||||
end
|
||||
end
|
||||
|
||||
local theme_main = "bgcolor[#080808BB;true]" .. sfinv.gui_bg ..
|
||||
sfinv.gui_bg_img
|
||||
|
||||
local theme_inv = sfinv.gui_slots .. [[
|
||||
list[current_player;main;0,4.7;8,1;]
|
||||
list[current_player;main;0,5.85;8,3;8]
|
||||
local theme_inv = [[
|
||||
image[0,5.2;1,1;gui_hb_bg.png]
|
||||
image[1,5.2;1,1;gui_hb_bg.png]
|
||||
image[2,5.2;1,1;gui_hb_bg.png]
|
||||
image[3,5.2;1,1;gui_hb_bg.png]
|
||||
image[4,5.2;1,1;gui_hb_bg.png]
|
||||
image[5,5.2;1,1;gui_hb_bg.png]
|
||||
image[6,5.2;1,1;gui_hb_bg.png]
|
||||
image[7,5.2;1,1;gui_hb_bg.png]
|
||||
list[current_player;main;0,5.2;8,1;]
|
||||
list[current_player;main;0,6.35;8,3;8]
|
||||
]]
|
||||
|
||||
function sfinv.make_formspec(player, context, content, show_inv, size)
|
||||
local tmp = {
|
||||
size or "size[8,8.6]",
|
||||
theme_main,
|
||||
size or "size[8,9.1]",
|
||||
sfinv.get_nav_fs(player, context, context.nav_titles, context.nav_idx),
|
||||
show_inv and theme_inv or "",
|
||||
content
|
||||
}
|
||||
if show_inv then
|
||||
tmp[#tmp + 1] = theme_inv
|
||||
end
|
||||
return table.concat(tmp, "")
|
||||
end
|
||||
|
||||
@ -149,6 +141,11 @@ function sfinv.set_page(player, pagename)
|
||||
sfinv.set_player_inventory_formspec(player, context)
|
||||
end
|
||||
|
||||
function sfinv.get_page(player)
|
||||
local context = sfinv.contexts[player:get_player_name()]
|
||||
return context and context.page or sfinv.get_homepage_name(player)
|
||||
end
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
if sfinv.enabled then
|
||||
sfinv.set_player_inventory_formspec(player)
|
||||
|
@ -1 +0,0 @@
|
||||
A cleaner, simpler solution to having an advanced inventory in Minetest.
|
17
init.lua
17
init.lua
@ -1,22 +1,19 @@
|
||||
-- sfinv/init.lua
|
||||
|
||||
dofile(minetest.get_modpath("sfinv") .. "/api.lua")
|
||||
|
||||
-- Load support for MT game translation.
|
||||
local S = minetest.get_translator("sfinv")
|
||||
|
||||
sfinv.register_page("sfinv:crafting", {
|
||||
title = "Crafting",
|
||||
title = S("Crafting"),
|
||||
get = function(self, player, context)
|
||||
return sfinv.make_formspec(player, context, [[
|
||||
list[current_player;craft;1.75,0.5;3,3;]
|
||||
list[current_player;craftpreview;5.75,1.5;1,1;]
|
||||
image[4.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270]
|
||||
image[4.75,1.5;1,1;sfinv_crafting_arrow.png]
|
||||
listring[current_player;main]
|
||||
listring[current_player;craft]
|
||||
image[0,4.75;1,1;gui_hb_bg.png]
|
||||
image[1,4.75;1,1;gui_hb_bg.png]
|
||||
image[2,4.75;1,1;gui_hb_bg.png]
|
||||
image[3,4.75;1,1;gui_hb_bg.png]
|
||||
image[4,4.75;1,1;gui_hb_bg.png]
|
||||
image[5,4.75;1,1;gui_hb_bg.png]
|
||||
image[6,4.75;1,1;gui_hb_bg.png]
|
||||
image[7,4.75;1,1;gui_hb_bg.png]
|
||||
]], true)
|
||||
end
|
||||
})
|
||||
|
2
locale/sfinv.de.tr
Normal file
2
locale/sfinv.de.tr
Normal file
@ -0,0 +1,2 @@
|
||||
# textdomain: sfinv
|
||||
Crafting=Fertigung
|
2
locale/sfinv.es.tr
Normal file
2
locale/sfinv.es.tr
Normal file
@ -0,0 +1,2 @@
|
||||
# textdomain: sfinv
|
||||
Crafting=Creación
|
2
locale/sfinv.fr.tr
Normal file
2
locale/sfinv.fr.tr
Normal file
@ -0,0 +1,2 @@
|
||||
# textdomain: sfinv
|
||||
Crafting=Artisanat
|
2
locale/sfinv.id.tr
Normal file
2
locale/sfinv.id.tr
Normal file
@ -0,0 +1,2 @@
|
||||
# textdomain: sfinv
|
||||
Crafting=Kerajinan
|
2
locale/sfinv.it.tr
Normal file
2
locale/sfinv.it.tr
Normal file
@ -0,0 +1,2 @@
|
||||
# textdomain: sfinv
|
||||
Crafting=Assemblaggio
|
2
locale/sfinv.ms.tr
Normal file
2
locale/sfinv.ms.tr
Normal file
@ -0,0 +1,2 @@
|
||||
# textdomain: sfinv
|
||||
Crafting=Pertukangan
|
2
locale/sfinv.ru.tr
Normal file
2
locale/sfinv.ru.tr
Normal file
@ -0,0 +1,2 @@
|
||||
# textdomain: sfinv
|
||||
Crafting=Крафтинг
|
2
locale/sfinv.se.tr
Normal file
2
locale/sfinv.se.tr
Normal file
@ -0,0 +1,2 @@
|
||||
# textdomain: sfinv
|
||||
Crafting=Tillverkning
|
2
locale/sfinv.sk.tr
Normal file
2
locale/sfinv.sk.tr
Normal file
@ -0,0 +1,2 @@
|
||||
# textdomain: sfinv
|
||||
Crafting=Vytváranie
|
2
locale/sfinv.zh_CN.tr
Normal file
2
locale/sfinv.zh_CN.tr
Normal file
@ -0,0 +1,2 @@
|
||||
# textdomain: sfinv
|
||||
Crafting=合成
|
2
locale/sfinv.zh_TW.tr
Normal file
2
locale/sfinv.zh_TW.tr
Normal file
@ -0,0 +1,2 @@
|
||||
# textdomain: sfinv
|
||||
Crafting=合成
|
2
locale/template.txt
Normal file
2
locale/template.txt
Normal file
@ -0,0 +1,2 @@
|
||||
# textdomain: sfinv
|
||||
Crafting=
|
1
mod.conf
1
mod.conf
@ -1 +1,2 @@
|
||||
name = sfinv
|
||||
description = A cleaner, simpler solution to having an advanced inventory in Minetest.
|
||||
|
BIN
textures/sfinv_crafting_arrow.png
Normal file
BIN
textures/sfinv_crafting_arrow.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 469 B |
Loading…
Reference in New Issue
Block a user