forked from VoxeLibre/VoxeLibre
Bookshelf menu redo
This commit is contained in:
parent
e5ee0c4afc
commit
0ae76776b1
|
@ -125,7 +125,8 @@ minetest.register_craftitem("mcl_books:writable_book", {
|
|||
description = S("Book and Quill"),
|
||||
_tt_help = S("Write down some notes"),
|
||||
_doc_items_longdesc = S("This item can be used to write down some notes."),
|
||||
_doc_items_usagehelp = S("Hold it in the hand, then rightclick to read the current notes and edit then. You can edit the text as often as you like. You can also sign the book which turns it into a written book which you can stack, but it can't be edited anymore.").."\n"..
|
||||
_doc_items_usagehelp = S("Hold it in the hand, then rightclick to read the current notes and edit then. You can edit the text as often as you like. You can also sign the book which turns it into a written book which you can stack, but it can't be edited anymore.")
|
||||
.. "\n" ..
|
||||
S("A book can hold up to 4500 characters. The title length is limited to 64 characters."),
|
||||
inventory_image = "mcl_books_book_writable.png",
|
||||
groups = { book = 1 },
|
||||
|
@ -151,10 +152,12 @@ minetest.register_on_player_receive_fields(function ( player, formname, fields )
|
|||
local formspec = "size[8,9]" ..
|
||||
header ..
|
||||
"background[-0.5,-0.5;9,10;mcl_books_book_bg.png]" ..
|
||||
"field[0.75,1;7.25,1;title;"..minetest.formspec_escape(minetest.colorize("#000000", S("Enter book title:")))..";]"..
|
||||
"field[0.75,1;7.25,1;title;" ..
|
||||
minetest.formspec_escape(minetest.colorize("#000000", S("Enter book title:"))) .. ";]" ..
|
||||
"label[0.75,1.5;" .. minetest.formspec_escape(minetest.colorize("#404040", S("by @1", name))) .. "]" ..
|
||||
"button_exit[0.75,7.95;3,1;sign;" .. minetest.formspec_escape(S("Sign and Close")) .. "]" ..
|
||||
"tooltip[sign;"..minetest.formspec_escape(S("Note: The book will no longer be editable after signing")).."]"..
|
||||
"tooltip[sign;" ..
|
||||
minetest.formspec_escape(S("Note: The book will no longer be editable after signing")) .. "]" ..
|
||||
"button[4.25,7.95;3,1;cancel;" .. minetest.formspec_escape(S("Cancel")) .. "]"
|
||||
minetest.show_formspec(player:get_player_name(), "mcl_books:signing", formspec)
|
||||
end
|
||||
|
@ -367,6 +370,9 @@ local function protection_check_put_take(pos, listname, index, stack, player)
|
|||
end
|
||||
end
|
||||
|
||||
---@param pos Vector
|
||||
---@param node node
|
||||
---@param clicker ObjectRef
|
||||
local function bookshelf_gui(pos, node, clicker)
|
||||
if not bookshelf_inv then return end
|
||||
local name = minetest.get_meta(pos):get_string("name")
|
||||
|
@ -380,15 +386,22 @@ local function bookshelf_gui(pos, node, clicker)
|
|||
minetest.show_formspec(playername,
|
||||
"mcl_books:bookshelf_" .. pos.x .. "_" .. pos.y .. "_" .. pos.z,
|
||||
table.concat({
|
||||
"size[9,8.75]",
|
||||
"label[0,0;"..F(C("#313131", name)).."]",
|
||||
"list[nodemeta:"..pos.x..","..pos.y..","..pos.z..";main;0,0.5;9,3;]",
|
||||
mcl_formspec.get_itemslot_bg(0, 0.5, 9, 3),
|
||||
"label[0,4.0;"..F(C("#313131", S("Inventory"))).."]",
|
||||
"list[current_player;main;0,4.5;9,3;9]",
|
||||
mcl_formspec.get_itemslot_bg(0, 4.5, 9, 3),
|
||||
"list[current_player;main;0,7.74;9,1;]",
|
||||
mcl_formspec.get_itemslot_bg(0, 7.74, 9, 1),
|
||||
"formspec_version[4]",
|
||||
"size[11.75,10.425]",
|
||||
|
||||
"label[0.375,0.375;" .. F(C(mcl_formspec.label_color, name)) .. "]",
|
||||
|
||||
mcl_formspec.get_itemslot_bg_v4(0.375, 0.75, 9, 3),
|
||||
"list[nodemeta:" .. pos.x .. "," .. pos.y .. "," .. pos.z .. ";main;0.375,0.75;9,3;]",
|
||||
|
||||
"label[0.375,4.7;" .. F(C(mcl_formspec.label_color, S("Inventory"))) .. "]",
|
||||
|
||||
mcl_formspec.get_itemslot_bg_v4(0.375, 5.1, 9, 3),
|
||||
"list[current_player;main;0.375,5.1;9,3;9]",
|
||||
|
||||
mcl_formspec.get_itemslot_bg_v4(0.375, 9.05, 9, 1),
|
||||
"list[current_player;main;0.375,9.05;9,1;]",
|
||||
|
||||
"listring[nodemeta:" .. pos.x .. "," .. pos.y .. "," .. pos.z .. ";main]",
|
||||
"listring[current_player;main]",
|
||||
})
|
||||
|
@ -464,4 +477,3 @@ minetest.register_craft({
|
|||
recipe = "mcl_books:bookshelf",
|
||||
burntime = 15,
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue