11 | 11 |
paramtype2 = "color",
|
12 | 12 |
palette = "unifieddyes_palette_extended.png",
|
13 | 13 |
groups = {snappy = 1, cracky = 2, ud_param2_colorable = 1}
|
14 | |
airbrush_replacement_node = "mymod:my_other_colored_node"
|
|
14 |
airbrush_replacement_node = "mymod:my_other_colored_node",
|
|
15 |
on_dig = unifieddyes.on_dig
|
15 | 16 |
})
|
16 | 17 |
```
|
17 | 18 |
|
|
33 | 34 |
`airbrush_replacement_node`: The node to swap in when the airbrush is used on this node. For example, you could `minetest.override_item()` on some default node to add this field, pointing to a colorable node of your own, so that when the default node is painted, it's replaced with yours in the new color.
|
34 | 35 |
|
35 | 36 |
#### Function calls
|
|
37 |
|
|
38 |
**`unifieddyes.on_dig(pos, node, digger)`**
|
|
39 |
|
|
40 |
Set in a node definition's `on_dig` callback, this makes sure that if the player digs a neutral node, i.e. a colorable node that was left uncolored/white after placing, they receive a version of that item that has been stripped of its itemstack color setting, so that it is identical to what would have been in their inventory when that node was originally placed. This prevents the engine splitting stacks of that item due to technically-different but visually-identical itemstack coloring. This function is only needed in the definition of colorable versions of a node, not any uncolored counterparts. For example, if you have a mod that has a simple, wooden chair, and the mod turns it into one with a colored seat cushion when you airbrush or craft it with dye, then only that latter colored-seat version needs this function.
|
36 | 41 |
|
37 | 42 |
**`unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing)`
|
38 | 43 |
`unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)`**
|
|
119 | 124 |
|
120 | 125 |
Does just what it sounds like - it registers all the nodes that are needed for a given base node (`def`) to be able to use the split palette, each named according to `name`, with the palette hue appended. If a custom drop is needed, it can be passed along (only a string is allowed here, specifying a single item).
|
121 | 126 |
|
122 | |
|
123 | 127 |
#### Tables
|
124 | 128 |
|
125 | 129 |
In addition to the above API calls, Unified Dyes provides several useful tables
|
|
143 | 147 |
```lua
|
144 | 148 |
place_param2 = 240,
|
145 | 149 |
after_dig_node = unifieddyes.after_dig_node,
|
146 | |
after_place_node = unifieddyes.recolor_on_place,
|
147 | |
ud_replacement_node = "mod:some_node"
|
|
150 |
ud_replacement_node = "mod:some_node",
|
|
151 |
on_dig = unifieddyes.on_dig
|
148 | 152 |
```
|
149 | 153 |
|
150 | 154 |
* Add the `airbrush_replacement_node` key to the node definition, if needed.
|