Use doc naming convention

This commit is contained in:
Wuzzy 2016-08-13 13:46:18 +02:00
parent d806579cd3
commit 6360135a70
2 changed files with 5 additions and 4 deletions

4
API.md
View File

@ -12,7 +12,7 @@ If the player tries to use the tool on an unknown object, an error message is sh
Because of this, this mod provides a minimal API for mods to assign a help entry
to an object type: `doc_identifier.register_object`.
## `doc_identifier.register_object(object_name, category_id, entry_id)`
## `doc.sub.identifier.register_object(object_name, category_id, entry_id)`
Registers the object/entity with the internal name `object_name` to the
entry `entry_id` in the category `category_id`.
It is in the modder's responsibility to make sure that both the category and
@ -25,7 +25,7 @@ Returns `nil`.
From `doc_minetest_game`:
if minetest.get_modpath("doc_identifier") ~= nil then
doc_identifier.register_object("boats:boat", "craftitems", "boats:boat")
doc.sub.identifier.register_object("boats:boat", "craftitems", "boats:boat")
end
This enables the tool to be used on the boat object itself. The conditional is an

View File

@ -1,9 +1,10 @@
doc_identifier = {}
local doc_identifier = {}
doc_identifier.registered_objects = {}
-- API
doc_identifier.register_object = function(object_name, category_id, entry_id)
doc.sub.identifier = {}
doc.sub.identifier.register_object = function(object_name, category_id, entry_id)
doc_identifier.registered_objects[object_name] = { category = category_id, entry = entry_id }
end