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 },
|
2016-12-20 04:48:16 -08:00
|
|
|
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.
|
2016-12-20 04:48:16 -08:00
|
|
|
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")
|
|
|
|
|
2016-12-20 04:48:16 -08:00
|
|
|
--[[ NOTE: If you don't do this, the lookup tool will show an error message
|
|
|
|
when you use it on this entity. ]]
|