mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-27 01:23:45 +01:00
add //listentities
This commit is contained in:
parent
daae15eb57
commit
aec204de8e
@ -3,6 +3,9 @@ It's about time I started a changelog! This will serve from now on as the main c
|
||||
|
||||
Note to self: See the bottom of this file for the release template text.
|
||||
|
||||
## v1.14.5: The multipoint update, hotfix 5 (unreleased)
|
||||
- Added `//listentities`, which lists all currently loaded `ObjectRef`s. This is intended for debugging mods.
|
||||
|
||||
|
||||
## v1.14.4: The multipoint update, hotfix 4 (31st July 2023)
|
||||
- When any segment of the marker wall is punched, unmark the entire wall
|
||||
@ -11,6 +14,7 @@ Note to self: See the bottom of this file for the release template text.
|
||||
## v1.14.3: The multipoint update, hotfix 3 (18th July 2023)
|
||||
- Fix regions not remembering their state and being unresettable
|
||||
|
||||
|
||||
## v1.14.2: The multipoint update, hotfix 2 (15th July 2023)
|
||||
- Fix crash in `//subdivide`, again due to the new position system
|
||||
|
||||
|
@ -16,3 +16,5 @@ dofile(we_cmdpath.."many.lua")
|
||||
dofile(we_cmdpath.."multi.lua")
|
||||
dofile(we_cmdpath.."noiseapply2d.lua")
|
||||
dofile(we_cmdpath.."subdivide.lua")
|
||||
|
||||
dofile(we_cmdpath.."listentities.lua")
|
39
worldeditadditions_commands/commands/meta/listentities.lua
Normal file
39
worldeditadditions_commands/commands/meta/listentities.lua
Normal file
@ -0,0 +1,39 @@
|
||||
-- Lists all currently loaded entities.
|
||||
|
||||
local weac = worldeditadditions_core
|
||||
|
||||
minetest.register_chatcommand("/listentities", {
|
||||
params = "",
|
||||
description =
|
||||
"Lists all currently loaded entities. This is a command for debugging and development. You will not need this unless you are developing a mod.",
|
||||
privs = { worldedit = true },
|
||||
func = function(name, params_text)
|
||||
local table_vals = {
|
||||
{ "ID", "Name", "Position" },
|
||||
{ "------", "-------", "---------" },
|
||||
}
|
||||
for id, obj in pairs(minetest.object_refs) do
|
||||
local obj_name = "[ObjectRef]"
|
||||
if obj.get_luaentity then
|
||||
local luaentity = obj:get_luaentity()
|
||||
if luaentity then
|
||||
obj_name = "[LuaEntity:"..luaentity.name.."]"
|
||||
else
|
||||
obj_name = "[LuaEntity:__UNKNOWN__]"
|
||||
end
|
||||
end
|
||||
local pos = weac.Vector3.clone(obj:get_pos())
|
||||
table.insert(table_vals, {
|
||||
id,
|
||||
obj_name,
|
||||
tostring(pos)
|
||||
})
|
||||
end
|
||||
worldedit.player_notify(name, table.concat({
|
||||
"Currently loaded entities:",
|
||||
weac.format.make_ascii_table(table_vals),
|
||||
"",
|
||||
"Total "..tostring(#table_vals).." objects"
|
||||
}, "\n"))
|
||||
end
|
||||
})
|
Loading…
Reference in New Issue
Block a user