Allow inspection of players/objects.

At minimum, base properties and phsyics settings. Others need
adding as well.
This commit is contained in:
Auke Kok 2019-08-30 17:14:14 -07:00
parent b5eca5eb52
commit c93f8402e5

View File

@ -140,6 +140,8 @@ minetest.register_tool("inspector:inspector", {
return return
end end
local t = "Node"
local desc = "" local desc = ""
if pointed_thing.type == "nothing" then if pointed_thing.type == "nothing" then
return return
@ -153,12 +155,16 @@ minetest.register_tool("inspector:inspector", {
end end
elseif pointed_thing.type == "object" then elseif pointed_thing.type == "object" then
local ref = pointed_thing.ref local ref = pointed_thing.ref
local entity = ref:get_luaentity() local obj = ref:get_properties()
desc = dump(entity) if ref.get_physics_override then
obj.physics_override = ref:get_physics_override()
end
desc = adjusted_dump(obj)
t = "Entity"
end end
local formspec = "size[12,8]".. local formspec = "size[12,8]"..
"label[0.5,0.5;Node Information]".. "label[0.5,0.5;" .. t .. " Information]"..
"textarea[0.5,1.5;11.5,7;text;Contents:;".. "textarea[0.5,1.5;11.5,7;text;Contents:;"..
minetest.formspec_escape(desc).."]".. minetest.formspec_escape(desc).."]"..
"button_exit[2.5,7.5;3,1;close;Close]" "button_exit[2.5,7.5;3,1;close;Close]"