mirror of
https://git.minetest.org/BuckarooBanzay/digibuilder.git
synced 2024-12-12 03:53:16 +01:00
ui fixes
This commit is contained in:
parent
7da9603d13
commit
40ab039591
10
formspec.lua
10
formspec.lua
@ -1,14 +1,19 @@
|
||||
|
||||
function digibuilder.update_formspec(meta)
|
||||
local message = meta:get_string("message")
|
||||
|
||||
local formspec =
|
||||
"size[8,9;]" ..
|
||||
"size[8,9.2;]" ..
|
||||
|
||||
-- main inventory
|
||||
"list[context;main;0,3.25;8,1;]" ..
|
||||
"list[context;main;0,0.25;8,4;]" ..
|
||||
|
||||
-- player inventory
|
||||
"list[current_player;main;0,4.5;8,4;]" ..
|
||||
|
||||
-- message
|
||||
"label[0,8.7;" .. message .. "]" ..
|
||||
|
||||
-- digiline channel
|
||||
"field[4.3,9;3.2,1;digiline_channel;Digiline channel;" .. (meta:get_string("channel") or "") .. "]" ..
|
||||
"button_exit[7,8.7;1,1;set_digiline_channel;Set]" ..
|
||||
@ -18,4 +23,5 @@ function digibuilder.update_formspec(meta)
|
||||
"listring[current_player;main]"
|
||||
|
||||
meta:set_string("formspec", formspec)
|
||||
meta:set_string("infotext", "Digibuilder: " .. message)
|
||||
end
|
||||
|
1
init.lua
1
init.lua
@ -5,5 +5,6 @@ local MP = minetest.get_modpath("digibuilder")
|
||||
|
||||
-- common functions
|
||||
dofile(MP.."/common.lua")
|
||||
dofile(MP.."/formspec.lua")
|
||||
dofile(MP.."/digiline.lua")
|
||||
dofile(MP.."/node.lua")
|
||||
|
17
node.lua
17
node.lua
@ -46,8 +46,6 @@ minetest.register_node("digibuilder:digibuilder", {
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("owner", placer:get_player_name() or "")
|
||||
-- default digiline channel
|
||||
meta:set_string("channel", "digibuilder")
|
||||
end,
|
||||
|
||||
on_construct = function(pos)
|
||||
@ -62,6 +60,12 @@ minetest.register_node("digibuilder:digibuilder", {
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main", 8*4)
|
||||
|
||||
-- default digiline channel
|
||||
meta:set_string("channel", "digibuilder")
|
||||
|
||||
-- last message
|
||||
meta:set_string("message", "Ready!")
|
||||
|
||||
-- formspec
|
||||
digibuilder.update_formspec(meta)
|
||||
end,
|
||||
@ -71,9 +75,7 @@ minetest.register_node("digibuilder:digibuilder", {
|
||||
local inv = meta:get_inventory()
|
||||
local name = player:get_player_name()
|
||||
|
||||
return inv:is_empty("main") and
|
||||
inv:is_empty("upgrade") and
|
||||
not minetest.is_protected(pos, name)
|
||||
return inv:is_empty("main") and not minetest.is_protected(pos, name)
|
||||
end,
|
||||
|
||||
on_timer = function()--pos, elapsed)
|
||||
@ -95,8 +97,9 @@ minetest.register_node("digibuilder:digibuilder", {
|
||||
end
|
||||
|
||||
|
||||
if fields.save then
|
||||
print("save")
|
||||
if fields.set_digiline_channel then
|
||||
local meta = minetest.get_meta(pos);
|
||||
meta:set_string("channel", fields.digiline_channel or "")
|
||||
end
|
||||
|
||||
end,
|
||||
|
BIN
textures/digibuilder.png
Normal file
BIN
textures/digibuilder.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
Loading…
Reference in New Issue
Block a user