mirror of
https://github.com/Uberi/Minetest-WorldEdit.git
synced 2024-12-25 18:20:38 +01:00
GUI: Use nicer picture to indicate unknown nodes (-> no search results)
This commit is contained in:
parent
e49f717000
commit
c0f3bb6958
@ -40,7 +40,7 @@ local angle_values = {90, 180, 270}
|
|||||||
setmetatable(angle_indices, {__index = function () return 1 end})
|
setmetatable(angle_indices, {__index = function () return 1 end})
|
||||||
setmetatable(angle_values, {__index = function () return 90 end})
|
setmetatable(angle_values, {__index = function () return 90 end})
|
||||||
|
|
||||||
--given multiple sets of privileges, produces a single set of privs that would have the same effect as requiring all of them at the same time
|
-- given multiple sets of privileges, produces a single set of privs that would have the same effect as requiring all of them at the same time
|
||||||
local combine_privs = function(...)
|
local combine_privs = function(...)
|
||||||
local result = {}
|
local result = {}
|
||||||
for i, privs in ipairs({...}) do
|
for i, privs in ipairs({...}) do
|
||||||
@ -54,6 +54,12 @@ local combine_privs = function(...)
|
|||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- display node (or unknown_node image otherwise) at specified pos in formspec
|
||||||
|
local formspec_node = function(pos, nodename)
|
||||||
|
return nodename and string.format("item_image[%s;1,1;%s]", pos, nodename)
|
||||||
|
or string.format("image[%s;1,1;worldedit_gui_unknown.png]", pos)
|
||||||
|
end
|
||||||
|
|
||||||
worldedit.register_gui_function("worldedit_gui_about", {
|
worldedit.register_gui_function("worldedit_gui_about", {
|
||||||
name = "About", privs = minetest.chatcommands["/about"].privs,
|
name = "About", privs = minetest.chatcommands["/about"].privs,
|
||||||
on_select = function(name)
|
on_select = function(name)
|
||||||
@ -155,8 +161,7 @@ worldedit.register_gui_function("worldedit_gui_set", {
|
|||||||
return "size[6.5,3]" .. worldedit.get_formspec_header("worldedit_gui_set") ..
|
return "size[6.5,3]" .. worldedit.get_formspec_header("worldedit_gui_set") ..
|
||||||
string.format("field[0.5,1.5;4,0.8;worldedit_gui_set_node;Name;%s]", minetest.formspec_escape(node)) ..
|
string.format("field[0.5,1.5;4,0.8;worldedit_gui_set_node;Name;%s]", minetest.formspec_escape(node)) ..
|
||||||
"button[4,1.18;1.5,0.8;worldedit_gui_set_search;Search]" ..
|
"button[4,1.18;1.5,0.8;worldedit_gui_set_search;Search]" ..
|
||||||
(nodename and string.format("item_image[5.5,1.1;1,1;%s]", nodename)
|
formspec_node("5.5,1.1", nodename) ..
|
||||||
or "image[5.5,1.1;1,1;unknown_node.png]") ..
|
|
||||||
"button_exit[0,2.5;3,0.8;worldedit_gui_set_submit;Set Nodes]"
|
"button_exit[0,2.5;3,0.8;worldedit_gui_set_submit;Set Nodes]"
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
@ -184,12 +189,10 @@ worldedit.register_gui_function("worldedit_gui_replace", {
|
|||||||
return "size[6.5,4]" .. worldedit.get_formspec_header("worldedit_gui_replace") ..
|
return "size[6.5,4]" .. worldedit.get_formspec_header("worldedit_gui_replace") ..
|
||||||
string.format("field[0.5,1.5;4,0.8;worldedit_gui_replace_search;Name;%s]", minetest.formspec_escape(search)) ..
|
string.format("field[0.5,1.5;4,0.8;worldedit_gui_replace_search;Name;%s]", minetest.formspec_escape(search)) ..
|
||||||
"button[4,1.18;1.5,0.8;worldedit_gui_replace_search_search;Search]" ..
|
"button[4,1.18;1.5,0.8;worldedit_gui_replace_search_search;Search]" ..
|
||||||
(search_nodename and string.format("item_image[5.5,1.1;1,1;%s]", search_nodename)
|
formspec_node("5.5,1.1", search_nodename) ..
|
||||||
or "image[5.5,1.1;1,1;unknown_node.png]") ..
|
|
||||||
string.format("field[0.5,2.5;4,0.8;worldedit_gui_replace_replace;Name;%s]", minetest.formspec_escape(replace)) ..
|
string.format("field[0.5,2.5;4,0.8;worldedit_gui_replace_replace;Name;%s]", minetest.formspec_escape(replace)) ..
|
||||||
"button[4,2.18;1.5,0.8;worldedit_gui_replace_replace_search;Search]" ..
|
"button[4,2.18;1.5,0.8;worldedit_gui_replace_replace_search;Search]" ..
|
||||||
(replace_nodename and string.format("item_image[5.5,2.1;1,1;%s]", replace_nodename)
|
formspec_node("5.5,2.1", replace_nodename) ..
|
||||||
or "image[5.5,2.1;1,1;unknown_node.png]") ..
|
|
||||||
"button_exit[0,3.5;3,0.8;worldedit_gui_replace_submit;Replace Nodes]" ..
|
"button_exit[0,3.5;3,0.8;worldedit_gui_replace_submit;Replace Nodes]" ..
|
||||||
"button_exit[3.5,3.5;3,0.8;worldedit_gui_replace_submit_inverse;Replace Inverse]"
|
"button_exit[3.5,3.5;3,0.8;worldedit_gui_replace_submit_inverse;Replace Inverse]"
|
||||||
end,
|
end,
|
||||||
@ -228,8 +231,7 @@ worldedit.register_gui_function("worldedit_gui_sphere_dome", {
|
|||||||
return "size[6.5,5]" .. worldedit.get_formspec_header("worldedit_gui_sphere_dome") ..
|
return "size[6.5,5]" .. worldedit.get_formspec_header("worldedit_gui_sphere_dome") ..
|
||||||
string.format("field[0.5,1.5;4,0.8;worldedit_gui_sphere_dome_node;Name;%s]", minetest.formspec_escape(node)) ..
|
string.format("field[0.5,1.5;4,0.8;worldedit_gui_sphere_dome_node;Name;%s]", minetest.formspec_escape(node)) ..
|
||||||
"button[4,1.18;1.5,0.8;worldedit_gui_sphere_dome_search;Search]" ..
|
"button[4,1.18;1.5,0.8;worldedit_gui_sphere_dome_search;Search]" ..
|
||||||
(nodename and string.format("item_image[5.5,1.1;1,1;%s]", nodename)
|
formspec_node("5.5,1.1", nodename) ..
|
||||||
or "image[5.5,1.1;1,1;unknown_node.png]") ..
|
|
||||||
string.format("field[0.5,2.5;4,0.8;worldedit_gui_sphere_dome_radius;Radius;%s]", minetest.formspec_escape(radius)) ..
|
string.format("field[0.5,2.5;4,0.8;worldedit_gui_sphere_dome_radius;Radius;%s]", minetest.formspec_escape(radius)) ..
|
||||||
"button_exit[0,3.5;3,0.8;worldedit_gui_sphere_dome_submit_hollow;Hollow Sphere]" ..
|
"button_exit[0,3.5;3,0.8;worldedit_gui_sphere_dome_submit_hollow;Hollow Sphere]" ..
|
||||||
"button_exit[3.5,3.5;3,0.8;worldedit_gui_sphere_dome_submit_solid;Solid Sphere]" ..
|
"button_exit[3.5,3.5;3,0.8;worldedit_gui_sphere_dome_submit_solid;Solid Sphere]" ..
|
||||||
@ -275,8 +277,7 @@ worldedit.register_gui_function("worldedit_gui_cylinder", {
|
|||||||
return "size[6.5,5]" .. worldedit.get_formspec_header("worldedit_gui_cylinder") ..
|
return "size[6.5,5]" .. worldedit.get_formspec_header("worldedit_gui_cylinder") ..
|
||||||
string.format("field[0.5,1.5;4,0.8;worldedit_gui_cylinder_node;Name;%s]", minetest.formspec_escape(node)) ..
|
string.format("field[0.5,1.5;4,0.8;worldedit_gui_cylinder_node;Name;%s]", minetest.formspec_escape(node)) ..
|
||||||
"button[4,1.18;1.5,0.8;worldedit_gui_cylinder_search;Search]" ..
|
"button[4,1.18;1.5,0.8;worldedit_gui_cylinder_search;Search]" ..
|
||||||
(nodename and string.format("item_image[5.5,1.1;1,1;%s]", nodename)
|
formspec_node("5.5,1.1", nodename) ..
|
||||||
or "image[5.5,1.1;1,1;unknown_node.png]") ..
|
|
||||||
string.format("field[0.5,2.5;4,0.8;worldedit_gui_cylinder_length;Length;%s]", minetest.formspec_escape(length)) ..
|
string.format("field[0.5,2.5;4,0.8;worldedit_gui_cylinder_length;Length;%s]", minetest.formspec_escape(length)) ..
|
||||||
string.format("dropdown[4,2.18;2.5;worldedit_gui_cylinder_axis;X axis,Y axis,Z axis,Look direction;%d]", axis) ..
|
string.format("dropdown[4,2.18;2.5;worldedit_gui_cylinder_axis;X axis,Y axis,Z axis,Look direction;%d]", axis) ..
|
||||||
string.format("field[0.5,3.5;4,0.8;worldedit_gui_cylinder_radius;Radius;%s]", minetest.formspec_escape(radius)) ..
|
string.format("field[0.5,3.5;4,0.8;worldedit_gui_cylinder_radius;Radius;%s]", minetest.formspec_escape(radius)) ..
|
||||||
@ -324,8 +325,7 @@ worldedit.register_gui_function("worldedit_gui_pyramid", {
|
|||||||
return "size[6.5,4]" .. worldedit.get_formspec_header("worldedit_gui_pyramid") ..
|
return "size[6.5,4]" .. worldedit.get_formspec_header("worldedit_gui_pyramid") ..
|
||||||
string.format("field[0.5,1.5;4,0.8;worldedit_gui_pyramid_node;Name;%s]", minetest.formspec_escape(node)) ..
|
string.format("field[0.5,1.5;4,0.8;worldedit_gui_pyramid_node;Name;%s]", minetest.formspec_escape(node)) ..
|
||||||
"button[4,1.18;1.5,0.8;worldedit_gui_pyramid_search;Search]" ..
|
"button[4,1.18;1.5,0.8;worldedit_gui_pyramid_search;Search]" ..
|
||||||
(nodename and string.format("item_image[5.5,1.1;1,1;%s]", nodename)
|
formspec_node("5.5,1.1", nodename) ..
|
||||||
or "image[5.5,1.1;1,1;unknown_node.png]") ..
|
|
||||||
string.format("field[0.5,2.5;4,0.8;worldedit_gui_pyramid_length;Length;%s]", minetest.formspec_escape(length)) ..
|
string.format("field[0.5,2.5;4,0.8;worldedit_gui_pyramid_length;Length;%s]", minetest.formspec_escape(length)) ..
|
||||||
string.format("dropdown[4,2.18;2.5;worldedit_gui_pyramid_axis;X axis,Y axis,Z axis,Look direction;%d]", axis) ..
|
string.format("dropdown[4,2.18;2.5;worldedit_gui_pyramid_axis;X axis,Y axis,Z axis,Look direction;%d]", axis) ..
|
||||||
"button_exit[0,3.5;3,0.8;worldedit_gui_pyramid_submit_hollow;Hollow Pyramid]" ..
|
"button_exit[0,3.5;3,0.8;worldedit_gui_pyramid_submit_hollow;Hollow Pyramid]" ..
|
||||||
@ -370,8 +370,7 @@ worldedit.register_gui_function("worldedit_gui_spiral", {
|
|||||||
return "size[6.5,6]" .. worldedit.get_formspec_header("worldedit_gui_spiral") ..
|
return "size[6.5,6]" .. worldedit.get_formspec_header("worldedit_gui_spiral") ..
|
||||||
string.format("field[0.5,1.5;4,0.8;worldedit_gui_spiral_node;Name;%s]", minetest.formspec_escape(node)) ..
|
string.format("field[0.5,1.5;4,0.8;worldedit_gui_spiral_node;Name;%s]", minetest.formspec_escape(node)) ..
|
||||||
"button[4,1.18;1.5,0.8;worldedit_gui_spiral_search;Search]" ..
|
"button[4,1.18;1.5,0.8;worldedit_gui_spiral_search;Search]" ..
|
||||||
(nodename and string.format("item_image[5.5,1.1;1,1;%s]", nodename)
|
formspec_node("5.5,1.1", nodename) ..
|
||||||
or "image[5.5,1.1;1,1;unknown_node.png]") ..
|
|
||||||
string.format("field[0.5,2.5;4,0.8;worldedit_gui_spiral_length;Side Length;%s]", minetest.formspec_escape(length)) ..
|
string.format("field[0.5,2.5;4,0.8;worldedit_gui_spiral_length;Side Length;%s]", minetest.formspec_escape(length)) ..
|
||||||
string.format("field[0.5,3.5;4,0.8;worldedit_gui_spiral_height;Height;%s]", minetest.formspec_escape(height)) ..
|
string.format("field[0.5,3.5;4,0.8;worldedit_gui_spiral_height;Height;%s]", minetest.formspec_escape(height)) ..
|
||||||
string.format("field[0.5,4.5;4,0.8;worldedit_gui_spiral_space;Wall Spacing;%s]", minetest.formspec_escape(space)) ..
|
string.format("field[0.5,4.5;4,0.8;worldedit_gui_spiral_space;Wall Spacing;%s]", minetest.formspec_escape(space)) ..
|
||||||
@ -616,8 +615,7 @@ worldedit.register_gui_function("worldedit_gui_suppress", {
|
|||||||
return "size[6.5,3]" .. worldedit.get_formspec_header("worldedit_gui_suppress") ..
|
return "size[6.5,3]" .. worldedit.get_formspec_header("worldedit_gui_suppress") ..
|
||||||
string.format("field[0.5,1.5;4,0.8;worldedit_gui_suppress_node;Name;%s]", minetest.formspec_escape(node)) ..
|
string.format("field[0.5,1.5;4,0.8;worldedit_gui_suppress_node;Name;%s]", minetest.formspec_escape(node)) ..
|
||||||
"button[4,1.18;1.5,0.8;worldedit_gui_suppress_search;Search]" ..
|
"button[4,1.18;1.5,0.8;worldedit_gui_suppress_search;Search]" ..
|
||||||
(nodename and string.format("item_image[5.5,1.1;1,1;%s]", nodename)
|
formspec_node("5.5,1.1", nodename) ..
|
||||||
or "image[5.5,1.1;1,1;unknown_node.png]") ..
|
|
||||||
"button_exit[0,2.5;3,0.8;worldedit_gui_suppress_submit;Suppress Nodes]"
|
"button_exit[0,2.5;3,0.8;worldedit_gui_suppress_submit;Suppress Nodes]"
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
@ -645,8 +643,7 @@ worldedit.register_gui_function("worldedit_gui_highlight", {
|
|||||||
return "size[6.5,3]" .. worldedit.get_formspec_header("worldedit_gui_highlight") ..
|
return "size[6.5,3]" .. worldedit.get_formspec_header("worldedit_gui_highlight") ..
|
||||||
string.format("field[0.5,1.5;4,0.8;worldedit_gui_highlight_node;Name;%s]", minetest.formspec_escape(node)) ..
|
string.format("field[0.5,1.5;4,0.8;worldedit_gui_highlight_node;Name;%s]", minetest.formspec_escape(node)) ..
|
||||||
"button[4,1.18;1.5,0.8;worldedit_gui_highlight_search;Search]" ..
|
"button[4,1.18;1.5,0.8;worldedit_gui_highlight_search;Search]" ..
|
||||||
(nodename and string.format("item_image[5.5,1.1;1,1;%s]", nodename)
|
formspec_node("5.5,1.1", nodename) ..
|
||||||
or "image[5.5,1.1;1,1;unknown_node.png]") ..
|
|
||||||
"button_exit[0,2.5;3,0.8;worldedit_gui_highlight_submit;Highlight Nodes]"
|
"button_exit[0,2.5;3,0.8;worldedit_gui_highlight_submit;Highlight Nodes]"
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
BIN
worldedit_gui/textures/worldedit_gui_unknown.png
Normal file
BIN
worldedit_gui/textures/worldedit_gui_unknown.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 597 B |
Loading…
Reference in New Issue
Block a user