Skip to content

Commit 5673a71

Browse files
authoredAug 28, 2018
Game_api.txt: Update and improve dye documentation
1 parent 02c4a05 commit 5673a71

File tree

1 file changed

+46
-59
lines changed

1 file changed

+46
-59
lines changed
 

‎game_api.txt

+46-59
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Minetest Game API
22
=================
33
GitHub Repo: https://github.com/minetest/minetest_game
44

5+
56
Introduction
67
------------
78

@@ -14,6 +15,7 @@ Please note:
1415
* [#ABC] refers to a section in this document
1516
* [pos] refers to a position table `{x = -5, y = 0, z = 200}`
1617

18+
1719
Bucket API
1820
----------
1921

@@ -34,6 +36,7 @@ The bucket API allows registering new types of buckets for non-default liquids.
3436
The filled bucket item is returned to the player that uses an empty bucket pointing to the given liquid source.
3537
When punching with an empty bucket pointing to an entity or a non-liquid node, the on_punch of the entity or node will be triggered.
3638

39+
3740
Beds API
3841
--------
3942

@@ -68,6 +71,7 @@ Beds API
6871
}
6972
}
7073

74+
7175
Bones API
7276
---------
7377

@@ -77,6 +81,7 @@ in `bones.player_inventory_lists`.
7781

7882
e.g. `table.insert(bones.player_inventory_lists, "backpack")`
7983

84+
8085
Creative API
8186
------------
8287

@@ -98,6 +103,7 @@ The contents of `creative.formspec_add` is appended to every creative inventory
98103
page. Mods can use it to add additional formspec elements onto the default
99104
creative inventory formspec to be drawn after each update.
100105

106+
101107
Chests API
102108
----------
103109

@@ -148,6 +154,7 @@ The chests API allows the creation of chests, which have their own inventories f
148154
groups = {choppy = 2, oddly_breakable_by_hand = 2},
149155
protected = false, -- If true, only placer can modify chest.
150156

157+
151158
Doors API
152159
---------
153160

@@ -221,6 +228,7 @@ The doors mod allows modders to register custom doors and trapdoors.
221228
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
222229
sounds = default.node_sound_wood_defaults(), -- optional
223230

231+
224232
Dungeon Loot API
225233
----------------
226234

@@ -253,6 +261,7 @@ The mod that places chests with loot in dungeons provides an API to register add
253261
-- supported types: "normal" (the cobble/mossycobble one), "sandstone", "desert"
254262
-- optional, defaults to no type restrictions
255263

264+
256265
Fence API
257266
---------
258267

@@ -274,6 +283,7 @@ Allows creation of new fences with "fencelike" drawtype.
274283
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
275284
sounds = default.node_sound_wood_defaults(),
276285

286+
277287
Walls API
278288
---------
279289

@@ -286,6 +296,7 @@ walls.register(name, desc, texture, mat, sounds)
286296
^ mat = "default:stone". Used to auto-generate crafting recipe.
287297
^ sounds = sounds: see [#Default sounds]
288298

299+
289300
Farming API
290301
-----------
291302

@@ -326,6 +337,7 @@ The farming API allows you to easily register plants and hoes.
326337
maxlight = default.LIGHT_MAX -- Maximum light to grow
327338
}
328339

340+
329341
Fire API
330342
--------
331343

@@ -653,6 +665,7 @@ And override this function to change the layout:
653665
return table.concat(tmp, "")
654666
end
655667

668+
656669
Stairs API
657670
----------
658671

@@ -686,6 +699,7 @@ delivered with Minetest Game, to keep them compatible with other mods.
686699
* `desc_stair`: Description for stair node
687700
* `desc_slab`: Description for slab node
688701

702+
689703
Xpanes API
690704
----------
691705

@@ -706,6 +720,7 @@ Creates panes that automatically connect to each other
706720
use_texture_alpha = true, -- Optional boolean (default: `false`) for colored glass panes
707721
}
708722

723+
709724
Raillike definitions
710725
--------------------
711726

@@ -739,6 +754,7 @@ Sounds inside the default table can be used within the sounds field of node defi
739754
* `default.node_sound_glass_defaults()`
740755
* `default.node_sound_metal_defaults()`
741756

757+
742758
Default constants
743759
-----------------
744760

@@ -818,70 +834,39 @@ callback overridden. All the nodes listed in `leaves` have their
818834
Dyes
819835
----
820836

821-
To make recipes that will work with any dye ever made by anybody, define
822-
them based on groups. You can select any group of groups, based on your need for
823-
amount of colors.
824-
825-
### Color groups
826-
827-
Base color groups:
828-
829-
* `basecolor_white`
830-
* `basecolor_grey`
831-
* `basecolor_black`
832-
* `basecolor_red`
833-
* `basecolor_yellow`
834-
* `basecolor_green`
835-
* `basecolor_cyan`
836-
* `basecolor_blue`
837-
* `basecolor_magenta`
838-
839-
Extended color groups ( * means also base color )
840-
841-
* `excolor_white` *
842-
* `excolor_lightgrey`
843-
* `excolor_grey` *
844-
* `excolor_darkgrey`
845-
* `excolor_black` *
846-
* `excolor_red` *
847-
* `excolor_orange`
848-
* `excolor_yellow` *
849-
* `excolor_lime`
850-
* `excolor_green` *
851-
* `excolor_aqua`
852-
* `excolor_cyan` *
853-
* `excolor_sky_blue`
854-
* `excolor_blue` *
855-
* `excolor_violet`
856-
* `excolor_magenta` *
857-
* `excolor_red_violet`
858-
859-
The whole unifieddyes palette as groups:
860-
861-
* `unicolor_<excolor>`
862-
863-
For the following, no white/grey/black is allowed:
864-
865-
* `unicolor_medium_<excolor>`
866-
* `unicolor_dark_<excolor>`
867-
* `unicolor_light_<excolor>`
868-
* `unicolor_<excolor>_s50`
869-
* `unicolor_medium_<excolor>_s50`
870-
* `unicolor_dark_<excolor>_s50`
871-
872-
Example of one shapeless recipe using a color group:
837+
Minetest Game dyes are registered with:
838+
839+
groups = {dye = 1, color_<color> = 1},
840+
841+
To make recipes that will work with dyes from many mods, define them using the
842+
dye group and the color groups.
843+
844+
Dye color groups:
845+
846+
* `color_white`
847+
* `color_grey`
848+
* `color_dark_grey`
849+
* `color_black`
850+
* `color_red`
851+
* `color_pink`
852+
* `color_orange`
853+
* `color_brown`
854+
* `color_yellow`
855+
* `color_green`
856+
* `color_dark_green`
857+
* `color_blue`
858+
* `color_cyan`
859+
* `color_violet`
860+
* `color_magenta`
861+
862+
Example of one shapeless recipe using the dye group and a color group:
873863

874864
minetest.register_craft({
875865
type = "shapeless",
876-
output = '<mod>:item_yellow',
877-
recipe = {'<mod>:item_no_color', 'group:basecolor_yellow'},
866+
output = "<mod>:item_yellow",
867+
recipe = {"<mod>:item_no_color", "group:dye,color_yellow"},
878868
})
879869

880-
### Color lists
881-
882-
* `dye.basecolors` are an array containing the names of available base colors
883-
884-
* `dye.excolors` are an array containing the names of the available extended colors
885870

886871
Trees
887872
-----
@@ -922,6 +907,7 @@ Trees
922907
* `default.grow_pine_bush(pos)`
923908
* Grows a pine bush at pos
924909

910+
925911
Carts
926912
-----
927913

@@ -944,6 +930,7 @@ Carts
944930
likely be called many times per second, so the function needs
945931
to make sure that the event is handled properly.
946932

933+
947934
Key API
948935
-------
949936

0 commit comments

Comments
 (0)
Please sign in to comment.