Remove inventory images of some internal nodes
[MineClone/MineClone2.git] / mods / ITEMS / mcl_fences / API.md
blob39ba314f2de86e3892af3ce51931b47322a8793c
1 # API for adding MineClone 2 fences
2 This API allows you to add fences and fence gates.
3 The recommended function is `mcl_fences.register_fence_and_fence_gate`.
5 ## ` mcl_fences.register_fence = function(id, fence_name, texture, groups, connects_to, sounds)`
6 Adds a fence without crafting recipe. A single node is created.
8 ### Parameter
9 * `id`: A part of the itemstring of the node to create. The node name will be “`<modname>:<id>`”
10 * `fence_name`: User-visible name (`description`)
11 * `texture`: Texture to apply on the fence (all sides)
12 * `groups`: Table of groups to which the fence belongs to
13 * `hardness`: Hardness (if unsure, pick the hardness of the material node)
14 * `blast_resistance`: Blast resistance (if unsure, pick the blast resistance of the material node)
15 * `connects_to`: Table of nodes (itemstrings) to which the fence will connect to. Use `group:<groupname>` for all members of the group `<groupname>`
16 * `sounds`: Node sound table for the fence
18 ### Return value
19 The full itemstring of the new fence node.
21 Notes: Fences will always have the group `fence=1`. They will always connect to solid nodes (group `solid=1`).
23 ## `mcl_fences.register_fence_gate = function(id, fence_gate_name, texture, groups, sounds, sound_open, sound_close, sound_gain_open, sound_gain_close)`
24 Adds a fence gate without crafting recipe. This will create 2 nodes.
26 ### Parameters
27 * `id`: A part of the itemstring of the nodes to create. The node names will be “`<modname>:<id>_gate`” and “`<modname>:<id>_gate_open`”
28 * `fence_gate_name`: User-visible name (`description`)
29 * `texture`: Texture to apply on the fence gate (all sides)
30 * `groups`: Table of groups to which the fence gate belongs to
31 * `hardness`: Hardness (if unsure, pick the hardness of the material node)
32 * `blast_resistance`: Blast resistance (if unsure, pick the blast resistance of the material node)
33 * `sounds`: Node sound table for the fence gate
34 * `sound_open`: Sound to play when opening fence gate (optional, default is wooden sound)
35 * `sound_close`: Sound to play when closing fence gate (optional, default is wooden sound)
36 * `sound_gain_open`: Gain (0.0-1.0) of the opening fence gate sound (optional, default is 0.3)
37 * `sound_gain_close`: Gain (0.0-1.0) of the closing fence gate sound (optional, default is 0.3)
39 Notes: Fence gates will always have the group `fence_gate=1`. The open fence gate will always have the group `not_in_creative_inventory=1`.
41 ### Return value
42 This function returns 2 values, in the following order:
44 1. Itemstring of the closed fence gate
45 2. Itemstring of the open fence gate
47 ## `mcl_fences.register_fence_and_fence_gate = function(id, fence_name, fence_gate_name, texture, groups, connects_to, sounds, sound_open, sound_close, sound_gain_open, sound_gain_close)`
48 Registers a fence and fence gate. This is basically a combination of the two functions above. This is the recommended way to add a fence / fence gate pair.
49 This will register 3 nodes in total without crafting recipes.
51 * `id`: A part of the itemstring of the nodes to create.
52 * `fence_name`: User-visible name (`description`) of the fence
53 * `fence_gate_name`: User-visible name (`description`) of the fence gate
54 * `texture`: Texture to apply on the fence and fence gate (all sides)
55 * `groups`: Table of groups to which the fence and fence gate belong to
56 * `hardness`: Hardness (if unsure, pick the hardness of the material node)
57 * `blast_resistance`: Blast resistance (if unsure, pick the blast resistance of the material node)
58 * `connects_to`: Table of nodes (itemstrings) to which the fence will connect to. Use `group:<groupname>` for all members of the group `<groupname>`
59 * `sounds`: Node sound table for the fence and the fence gate
60 * `sound_open`: Sound to play when opening fence gate (optional, default is wooden sound)
61 * `sound_close`: Sound to play when closing fence gate (optional, default is wooden sound)
62 * `sound_gain_open`: Gain (0.0-1.0) of the opening fence gate sound (optional, default is 0.3)
63 * `sound_gain_close`: Gain (0.0-1.0) of the closing fence gate sound (optional, default is 0.3)
65 ### Return value
66 This function returns 3 values, in this order:
68 1. Itemstring of the fence
69 2. Itemstring of the closed fence gate
70 3. Itemstring of the open fence gate