diff options
Diffstat (limited to 'inspector')
-rw-r--r-- | inspector/depends.txt | 1 | ||||
-rw-r--r-- | inspector/description.txt | 1 | ||||
-rw-r--r-- | inspector/init.lua | 151 | ||||
-rw-r--r-- | inspector/mod.conf | 3 | ||||
-rw-r--r-- | inspector/screenshot.png | bin | 50324 -> 0 bytes | |||
-rw-r--r-- | inspector/textures/inspector.png | bin | 284 -> 0 bytes |
6 files changed, 0 insertions, 156 deletions
diff --git a/inspector/depends.txt b/inspector/depends.txt deleted file mode 100644 index b75ab62..0000000 --- a/inspector/depends.txt +++ /dev/null @@ -1 +0,0 @@ -fsc diff --git a/inspector/description.txt b/inspector/description.txt deleted file mode 100644 index a4144f2..0000000 --- a/inspector/description.txt +++ /dev/null @@ -1 +0,0 @@ -An in-game tool to inspect node parameters and metadata. diff --git a/inspector/init.lua b/inspector/init.lua deleted file mode 100644 index 4b4b711..0000000 --- a/inspector/init.lua +++ /dev/null @@ -1,151 +0,0 @@ - ---[[ - -Copyright (C) 2015 - Auke Kok <sofar@foo-projects.org> - -"inspector" is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as -published by the Free Software Foundation; either version 2.1 -of the license, or (at your option) any later version. - ---]] - -local function make_fs(title, desc) - return "size[12,8]".. - "label[0.2,0.2;"..title.."]".. - "textlist[0.2,1.0;11.5,7;;".. - desc:gsub("\n", ",").."]".. - "button_exit[11.1,0.2;0.8,0.8;close;x]" -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" - desc = desc .. "param2 = " .. node.param2 .. "\n" - local light = minetest.get_node_light({x = pos.x, y = pos.y + 1, z = pos.x}, nil) - if light then - desc = desc .. "light = " .. light .. "\n" - 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" - 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 - desc = desc .. key .. " : \n" - local size = #list - for i = 1, size do - local stack = list[i] - if not stack:is_empty() then - desc = desc .. "\"" .. stack:get_name() .. "\" - " .. stack:get_count() .. "\n" - end - end - end - - if nodedef then -- Some built in nodes have no nodedef - desc = desc .. "==== nodedef ====\n" - desc = desc .. dump(nodedef) .. "\n" - end - - return desc -end - -minetest.register_tool("inspector:inspector", { - description = "Inspector Tool", - inventory_image = "inspector.png", - liquids_pointable = true, -- makes it hard to use underwater. - - on_use = function(itemstack, user, pointed_thing) - - local desc = "" - if pointed_thing.type == "nothing" then - return - elseif pointed_thing.type == "node" then - local pos = pointed_thing.under - - 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, - 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", { - params = "inspect", - description = "inspect a pos", - privs = {server = true}, - func = function(name, param) - local paramlist = {} - 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]" - - fsc.show(name, formspec, {}, function() end) - return true - end, -}) diff --git a/inspector/mod.conf b/inspector/mod.conf deleted file mode 100644 index d2898c0..0000000 --- a/inspector/mod.conf +++ /dev/null @@ -1,3 +0,0 @@ -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 Binary files differdeleted file mode 100644 index fc64fb2..0000000 --- a/inspector/screenshot.png +++ /dev/null diff --git a/inspector/textures/inspector.png b/inspector/textures/inspector.png Binary files differdeleted file mode 100644 index 62da6ad..0000000 --- a/inspector/textures/inspector.png +++ /dev/null |