Make default dependency officially optional
parent
b76b059f1c
commit
379a4e5911
18
API.md
18
API.md
|
@ -1,8 +1,12 @@
|
|||
# Easyvend API
|
||||
Use this API if you want to make an comntainer compatible with vending and
|
||||
Use this API if you want to make an container compatible with vending and
|
||||
depositing machines.
|
||||
|
||||
The API only has one function:
|
||||
## How it works
|
||||
|
||||
* Add `easyvend` as optional dependency
|
||||
* Check for existance of `easyvend` mod in code
|
||||
* Call `easyvend.register_chest` for all containers you want to be compatible
|
||||
|
||||
## `easyvend.register_chest = function(node_name, inv_list, meta_owner)`
|
||||
Registers a node (called “chest”) for use with Easyvend. After calling this function,
|
||||
|
@ -20,6 +24,14 @@ Easyvend makes the following assumptions about the chest:
|
|||
* `meta_owner`: Identifier of the metadata variable storing the owner name
|
||||
|
||||
### Example
|
||||
|
||||
Register the node `example:superchest` as container:
|
||||
|
||||
```
|
||||
easyvend.register_chest("example:superchest", "main", "owner")
|
||||
if minetest.get_modpath("easyvend") then
|
||||
easyvend.register_chest("example:superchest", "main", "owner")
|
||||
end
|
||||
```
|
||||
|
||||
The `if` check is a common trick to check for the existance of the `easyvend`
|
||||
and allows you to make the dependency optional.
|
||||
|
|
10
README.md
10
README.md
|
@ -4,6 +4,14 @@ Version: 0.4.3
|
|||
Adds vending and depositing machines which allow to buy and sell items from
|
||||
other players.
|
||||
|
||||
## Requirements
|
||||
Runs natively in Minetest Game.
|
||||
|
||||
May also run in other games if they have the `default` mod and locked chest
|
||||
(`default:chest_locked`).
|
||||
|
||||
Locked chests from other mods are not supported, but mods can choose
|
||||
to add support for Easyvend on their own (see developer information below).
|
||||
|
||||
## How to use
|
||||
Help is also included as help entry for Item Documentation [`doc_items`].
|
||||
|
@ -24,8 +32,6 @@ But it can be changed via the setting `easyvend_currency`.
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
## Appendix
|
||||
### Developer information
|
||||
If you want to a container node compatible with vending/depositing machines,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
default
|
||||
default?
|
||||
screwdriver?
|
||||
doc?
|
||||
doc_items?
|
||||
|
|
Loading…
Reference in New Issue