80 chars max in doc files
parent
4782e34041
commit
2cadd15bad
30
API.md
30
API.md
|
@ -1,24 +1,26 @@
|
|||
# Minimal API for `doc_identifier`
|
||||
## Introduction
|
||||
The tool can identify blocks and players natively, and also handles falling nodes
|
||||
(`__builtin:falling_node`) and dropped items (`__builtin:item`) on its own.
|
||||
The tool can identify blocks and players natively, and also handles falling
|
||||
nodes (`__builtin:falling_node`) and dropped items (`__builtin:item`) on its
|
||||
own.
|
||||
|
||||
However, the identifier can't “identify” (=open the appropriate entry) custom objects
|
||||
because the mod doesn't know which help entry to open (if there is any).
|
||||
One example would be the boat object (`boats:boat`) from the boats mod in Minetest
|
||||
Game.
|
||||
If the player tries to use the tool on an unknown object, an error message is shown.
|
||||
However, the identifier can't “identify” (=open the appropriate entry) custom
|
||||
objects because the mod doesn't know which help entry to open (if there is
|
||||
any). One example would be the boat object (`boats:boat`) from the boats mod
|
||||
in Minetest Game.
|
||||
If the player tries to use the tool on an unknown object, an error message is
|
||||
shown.
|
||||
|
||||
Because of this, this mod provides a minimal API for mods to assign a help entry
|
||||
to an object type: `doc_identifier.register_object`.
|
||||
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.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
|
||||
entry already exist (use `doc.entry_exists` or depend (optionally or not) on the
|
||||
respective mods) at the time of the function call, otherwise, stability can not be
|
||||
guaranteed.
|
||||
entry already exist (use `doc.entry_exists` or depend (optionally or not) on
|
||||
the respective mods) at the time of the function call, otherwise, stability can
|
||||
not be guaranteed.
|
||||
|
||||
Returns `nil`.
|
||||
|
||||
|
@ -29,8 +31,8 @@ From `doc_minetest_game`:
|
|||
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
|
||||
idiom to check for the existence of this mod.
|
||||
This enables the tool to be used on the boat object itself. The conditional is
|
||||
an idiom to check for the existence of this mod.
|
||||
|
||||
## Note on dependencies
|
||||
If you just need `doc.sub.identifier.register_object` using only an **optional**
|
||||
|
|
29
README.md
29
README.md
|
@ -2,23 +2,28 @@
|
|||
Version: 0.7.0
|
||||
|
||||
## Description
|
||||
The lookup tool is an useful little helper which can be used to quickly learn more about about one's closer environment.
|
||||
It identifies blocks, dropped items and other objects and it shows extensive information about the item on which it is used,
|
||||
provided documentation is available.
|
||||
The lookup tool is an useful little helper which can be used to quickly learn
|
||||
more about about one's closer environment. It identifies blocks, dropped items
|
||||
and other objects and it shows extensive information about the item on which it
|
||||
is used, provided documentation is available.
|
||||
|
||||
## How to use the lookup tool
|
||||
Punch any block or item about you wish to learn more about. This will open up the Documentation System entry of this particular
|
||||
item.
|
||||
The tool comes in two modes which are changed by a right-click. In liquid mode (blue) this tool points to liquids as well
|
||||
while in solid mode (red) this is not the case. Liquid mode is required if you want to identify a liquid.
|
||||
Punch any block or item about you wish to learn more about. This will open up
|
||||
the Documentation System entry of this particular item.
|
||||
The tool comes in two modes which are changed by a right-click. In liquid mode
|
||||
(blue) this tool points to liquids as well while in solid mode (red) this is not
|
||||
the case. Liquid mode is required if you want to identify a liquid.
|
||||
|
||||
## For modders
|
||||
If you want the tool to identify nodes and (dropped) items, you probably don't have to do anything, it is probably already
|
||||
supported. The only thing you have to make sure is that all pointable blocks and items have a help entry, which is already
|
||||
the case for most items, but you may want to do some testing on “tricky” items. Consult the documentation of the
|
||||
Documentation System [`doc`] and Item Documentation [`doc_items`] for getting the item documentation right.
|
||||
If you want the tool to identify nodes and (dropped) items, you probably don't
|
||||
have to do anything, it is probably already supported. The only thing you have
|
||||
to make sure is that all pointable blocks and items have a help entry, which
|
||||
is already the case for most items, but you may want to do some testing on
|
||||
“tricky” items. Consult the documentation of the Documentation System [`doc`]
|
||||
and Item Documentation [`doc_items`] for getting the item documentation right.
|
||||
|
||||
For the lookup tool to be able to work on custom objects/entities, you have to use the tiny API of this mod, see `API.md`.
|
||||
For the lookup tool to be able to work on custom objects/entities, you have to
|
||||
use the tiny API of this mod, see `API.md`.
|
||||
|
||||
## License
|
||||
Everything in this mod is licensed under the MIT License.
|
||||
|
|
Loading…
Reference in New Issue