minetest_doc_example/doc_identifier.lua

27 lines
1.1 KiB
Lua
Raw Normal View History

2016-12-19 10:00:52 -08:00
-- Example for using doc_identifier (Lookup Tool)
-- NOTE: Use the API to make custom entities identifiable by the lookup tool.
-- If you do not define any custom entities, using the API is not needed.
-- This example adds one example entity and adds doc_identifier support for it.
-- To spawn this entity, use the chat command “/spawnentity doc_example:entity”
minetest.register_entity("doc_example:entity", {
physical = true,
collide_with_objects = true,
visual = "cube",
size = { x = 0.2, y = 0.2, z = 0.2 },
textures = {
"unknown_object.png", "unknown_object.png",
"unknown_object.png", "unknown_object.png",
"unknown_object.png", "unknown_object.png"
},
2016-12-19 10:00:52 -08:00
hp_max = 1,
})
--[[ This is the actual code you need to add doc_identifier support.
The following code means, whenever you use the lookup tool on the example
entity, the entry entity in category example1 will be shown. ]]
2016-12-19 10:00:52 -08:00
doc.sub.identifier.register_object("doc_example:entity", "example1", "entity")
--[[ NOTE: If you don't do this, the lookup tool will show an error message
when you use it on this entity. ]]