Document rp_door API

master
Wuzzy 2022-05-19 22:44:27 +02:00
parent 53fe0ffaa9
commit c11657433c
2 changed files with 37 additions and 3 deletions

29
mods/rp_door/API.md Normal file
View File

@ -0,0 +1,29 @@
# API documentation of `rp_door`
The API allows you to register doors.
## Function reference
### `door.register_door(name, def)`
Registers a door. This will register multiple 'technical' nodes, one for the
top, the other for the bottom door segment, also each in 'open' and
'closed' state. These nodes are not supposed to be gotten by the player.
Also adds a craftitem (with identifier `name`) which the players can use.
* `name`: Door identifier / itemstring
* `def`: Door definition. This is a table with these fields:
* `description`: Same as in node definition
* `inventory_image`: Same as in node definition
* `groups`: List of groups for door item. It is recommended to always add `door=1` here
* `tiles_top`: Table of textures for the top door node. The first field is the front/back, the second field is top/bottom/side
* `tiles_bottom`: Same as `tiles_top`, except for the bottom door node
* `sounds`: Node sounds. Same as of node definition
* `sunlight`: If true, will set `sunlight_propagates` of door nodes to true
* `sound_close_door`: Sound to play when door closes (optional, has a default sound)
* `sound_open_door`: Sound to play when door opens (optional, has a default sound)
* `node_box_top`: Custom node box table for top door segment (optional)
* `node_box_bottom`: Custom node box table for bottom door segment (optional)
* `selection_box_top`: Custom selection box table for top door segment (optional)
* `selection_box_bottom`: Custom selection box table for bottom door segment (optional)

View File

@ -3,7 +3,12 @@ Door mod
By PilzAdam
Tweaked by Kaadmy, for Pixture
Right-click doors to open/close them
Use the 'place' key on doors to open/close them.
Asset license: CC BY-SA 4.0
Source license: LGPLv2.1
Developers: See `API.md` if you want to add
your own door.
## Licenses
Media file license: CC BY-SA 4.0
Source code license: LGPLv2.1