summaryrefslogtreecommitdiff
path: root/inspector
diff options
context:
space:
mode:
authorVanessa Dannenberg <vanessa.e.dannenberg@gmail.com>2019-04-24 18:59:36 -0400
committerVanessa Dannenberg <vanessa.e.dannenberg@gmail.com>2019-04-24 18:59:36 -0400
commita5eef1c5de77fa7770877802e66c3e1c53f9a0da (patch)
tree0f36e64a58e5f5bb7d95be6ae692f58f2ebfe483 /inspector
parentdda854cf06f90a04a03844e19c4d4ad220e38fe4 (diff)
downloaddreambuilder_modpack-a5eef1c5de77fa7770877802e66c3e1c53f9a0da.tar
dreambuilder_modpack-a5eef1c5de77fa7770877802e66c3e1c53f9a0da.tar.gz
dreambuilder_modpack-a5eef1c5de77fa7770877802e66c3e1c53f9a0da.tar.bz2
dreambuilder_modpack-a5eef1c5de77fa7770877802e66c3e1c53f9a0da.tar.xz
dreambuilder_modpack-a5eef1c5de77fa7770877802e66c3e1c53f9a0da.zip
update castles, areas, homedecor, plantlife,
gloopblocks, hotbar, inspector, maptools, mesecons, moreblocks, moreores, technic, teleport_request, and worldedit switched to caverealms_lite (with minor fixes by me) switched to CWz's fork of player_textures The homedecor update brings in the big split, and will require you to re-enable all modpack components in order to avoid loss of content.
Diffstat (limited to 'inspector')
-rw-r--r--inspector/depends.txt1
-rw-r--r--inspector/init.lua72
-rw-r--r--inspector/mod.conf2
-rw-r--r--inspector/screenshot.pngbin0 -> 50324 bytes
4 files changed, 56 insertions, 19 deletions
diff --git a/inspector/depends.txt b/inspector/depends.txt
new file mode 100644
index 0000000..b75ab62
--- /dev/null
+++ b/inspector/depends.txt
@@ -0,0 +1 @@
+fsc
diff --git a/inspector/init.lua b/inspector/init.lua
index b095964..4b4b711 100644
--- a/inspector/init.lua
+++ b/inspector/init.lua
@@ -20,7 +20,6 @@ end
local function inspect_pos(pos)
local node = minetest.get_node(pos)
-
local desc = "===== node data =====\n"
desc = desc .. "name = " .. node.name .. "\n"
desc = desc .. "param1 = " .. node.param1 .. "\n"
@@ -31,19 +30,19 @@ local function inspect_pos(pos)
end
local timer = minetest.get_node_timer(pos)
- if timer:get_timeout() ~= 0 then
- desc = desc .. "==== node timer ====\n"
- desc = desc .. "timeout = " .. timer:get_timeout() .. "\n"
- desc = desc .. "elapsed = " .. timer:get_elapsed() .. "\n"
+ if timer:get_timeout() ~= 0 then
+ desc = desc .. "==== node timer ====\n"
+ desc = desc .. "timeout = " .. timer:get_timeout() .. "\n"
+ desc = desc .. "elapsed = " .. timer:get_elapsed() .. "\n"
end
+ local nodedef = minetest.registered_items[node.name]
local meta = minetest.get_meta(pos)
local table = meta:to_table()
local fields = minetest.serialize(table.fields)
desc = desc .. "==== meta ====\n"
desc = desc .. "meta.fields = " .. fields .. "\n"
desc = desc .. "\n"
-
local inventory = meta:get_inventory()
desc = desc .. "meta.inventory = \n"
for key, list in pairs(inventory:get_lists()) do
@@ -57,13 +56,12 @@ local function inspect_pos(pos)
end
end
- local nodedef = minetest.registered_items[node.name]
if nodedef then -- Some built in nodes have no nodedef
desc = desc .. "==== nodedef ====\n"
desc = desc .. dump(nodedef) .. "\n"
end
- return minetest.formspec_escape(desc:gsub(",", "\\,"))
+ return desc
end
minetest.register_tool("inspector:inspector", {
@@ -74,12 +72,9 @@ minetest.register_tool("inspector:inspector", {
on_use = function(itemstack, user, pointed_thing)
local desc = ""
- local title = ""
if pointed_thing.type == "nothing" then
return
elseif pointed_thing.type == "node" then
- title = "Node information"
-
local pos = pointed_thing.under
if pointed_thing.type ~= "node" then
@@ -87,18 +82,47 @@ minetest.register_tool("inspector:inspector", {
else
desc = inspect_pos(pos)
end
-
elseif pointed_thing.type == "object" then
- title = "Object information"
-
local ref = pointed_thing.ref
local entity = ref:get_luaentity()
- desc = minetest.formspec_escape(dump(entity):gsub("\n\n", "\n"))
-
+ desc = dump(entity)
end
- minetest.show_formspec(user:get_player_name(), "inspector:inspector", make_fs(title, desc))
+ local formspec = "size[12,8]"..
+ "label[0.5,0.5;Node Information]"..
+ "textarea[0.5,1.5;11.5,7;text;Contents:;"..
+ minetest.formspec_escape(desc).."]"..
+ "button_exit[2.5,7.5;3,1;close;Close]"
+
+ fsc.show(user:get_player_name(), formspec, {}, function() end)
end,
+ on_place = function(itemstack, user, pointed_thing)
+
+ local desc = ""
+ if pointed_thing.type == "nothing" then
+ return
+ elseif pointed_thing.type == "node" then
+ local pos = pointed_thing.above
+
+ if pointed_thing.type ~= "node" then
+ desc = "..."
+ else
+ desc = inspect_pos(pos)
+ end
+ elseif pointed_thing.type == "object" then
+ local ref = pointed_thing.ref
+ local entity = ref:get_luaentity()
+ desc = dump(entity)
+ end
+
+ local formspec = "size[12,8]"..
+ "label[0.5,0.5;Node Information]"..
+ "textarea[0.5,1.5;11.5,7;text;Contents:;"..
+ minetest.formspec_escape(desc).."]"..
+ "button_exit[2.5,7.5;3,1;close;Close]"
+
+ fsc.show(user:get_player_name(), formspec, {}, function() end)
+ end
})
minetest.register_chatcommand("inspect", {
@@ -107,11 +131,21 @@ minetest.register_chatcommand("inspect", {
privs = {server = true},
func = function(name, param)
local paramlist = {}
- for k in string.gmatch(param, "[^%s]+") do table.insert(paramlist, k) end
+ for p in string.gmatch(param, "%S+") do
+ paramlist[#paramlist + 1] = p
+ end
local pos = {x = paramlist[1], y = paramlist[2], z = paramlist[3]}
+ if not pos.x or not pos.y or not pos.z then
+ return false, "Need 3 parameters for X, Y and Z"
+ end
local desc = inspect_pos(pos)
+ local formspec = "size[12,8]"..
+ "label[0.5,0.5;Node Information]"..
+ "textarea[0.5,1.5;11.5,7;text;Contents:;"..
+ minetest.formspec_escape(desc).."]"..
+ "button_exit[2.5,7.5;3,1;close;Close]"
- minetest.show_formspec(name, "inspector:inspector", make_fs("Node information", desc))
+ fsc.show(name, formspec, {}, function() end)
return true
end,
})
diff --git a/inspector/mod.conf b/inspector/mod.conf
index 26227c6..d2898c0 100644
--- a/inspector/mod.conf
+++ b/inspector/mod.conf
@@ -1 +1,3 @@
name = inspector
+description = An in-game tool to inspect node parameters and metadata.
+depends = fsc
diff --git a/inspector/screenshot.png b/inspector/screenshot.png
new file mode 100644
index 0000000..fc64fb2
--- /dev/null
+++ b/inspector/screenshot.png
Binary files differ