Skip to content

Commit

Permalink
Game_api.txt: Update and improve dye documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
paramat committed Aug 28, 2018
1 parent 02c4a05 commit 5673a71
Showing 1 changed file with 46 additions and 59 deletions.
105 changes: 46 additions & 59 deletions game_api.txt
Expand Up @@ -2,6 +2,7 @@ Minetest Game API
=================
GitHub Repo: https://github.com/minetest/minetest_game


Introduction
------------

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


Bucket API
----------

Expand All @@ -34,6 +36,7 @@ The bucket API allows registering new types of buckets for non-default liquids.
The filled bucket item is returned to the player that uses an empty bucket pointing to the given liquid source.
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.


Beds API
--------

Expand Down Expand Up @@ -68,6 +71,7 @@ Beds API
}
}


Bones API
---------

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

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


Creative API
------------

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


Chests API
----------

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


Doors API
---------

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


Dungeon Loot API
----------------

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


Fence API
---------

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


Walls API
---------

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


Farming API
-----------

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


Fire API
--------

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


Stairs API
----------

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


Xpanes API
----------

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


Raillike definitions
--------------------

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


Default constants
-----------------

Expand Down Expand Up @@ -818,70 +834,39 @@ callback overridden. All the nodes listed in `leaves` have their
Dyes
----

To make recipes that will work with any dye ever made by anybody, define
them based on groups. You can select any group of groups, based on your need for
amount of colors.

### Color groups

Base color groups:

* `basecolor_white`
* `basecolor_grey`
* `basecolor_black`
* `basecolor_red`
* `basecolor_yellow`
* `basecolor_green`
* `basecolor_cyan`
* `basecolor_blue`
* `basecolor_magenta`

Extended color groups ( * means also base color )

* `excolor_white` *
* `excolor_lightgrey`
* `excolor_grey` *
* `excolor_darkgrey`
* `excolor_black` *
* `excolor_red` *
* `excolor_orange`
* `excolor_yellow` *
* `excolor_lime`
* `excolor_green` *
* `excolor_aqua`
* `excolor_cyan` *
* `excolor_sky_blue`
* `excolor_blue` *
* `excolor_violet`
* `excolor_magenta` *
* `excolor_red_violet`

The whole unifieddyes palette as groups:

* `unicolor_<excolor>`

For the following, no white/grey/black is allowed:

* `unicolor_medium_<excolor>`
* `unicolor_dark_<excolor>`
* `unicolor_light_<excolor>`
* `unicolor_<excolor>_s50`
* `unicolor_medium_<excolor>_s50`
* `unicolor_dark_<excolor>_s50`

Example of one shapeless recipe using a color group:
Minetest Game dyes are registered with:

groups = {dye = 1, color_<color> = 1},

To make recipes that will work with dyes from many mods, define them using the
dye group and the color groups.

Dye color groups:

* `color_white`
* `color_grey`
* `color_dark_grey`
* `color_black`
* `color_red`
* `color_pink`
* `color_orange`
* `color_brown`
* `color_yellow`
* `color_green`
* `color_dark_green`
* `color_blue`
* `color_cyan`
* `color_violet`
* `color_magenta`

Example of one shapeless recipe using the dye group and a color group:

minetest.register_craft({
type = "shapeless",
output = '<mod>:item_yellow',
recipe = {'<mod>:item_no_color', 'group:basecolor_yellow'},
output = "<mod>:item_yellow",
recipe = {"<mod>:item_no_color", "group:dye,color_yellow"},
})

### Color lists

* `dye.basecolors` are an array containing the names of available base colors

* `dye.excolors` are an array containing the names of the available extended colors

Trees
-----
Expand Down Expand Up @@ -922,6 +907,7 @@ Trees
* `default.grow_pine_bush(pos)`
* Grows a pine bush at pos


Carts
-----

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


Key API
-------

Expand Down

0 comments on commit 5673a71

Please sign in to comment.