Use doc naming convention
This commit is contained in:
parent
d806579cd3
commit
6360135a70
4
API.md
4
API.md
@ -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
|
||||
|
5
init.lua
5
init.lua
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user