Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stairs: Add stairs.register_stair_type() to reduce duplicated code. #2641

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 12 additions & 20 deletions game_api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -719,16 +719,24 @@ Stairs API
The stairs API lets you register stairs and slabs and ensures that they are registered the same way as those
delivered with Minetest Game, to keep them compatible with other mods.

`stairs.register_stair(subname, recipeitem, groups, images, description, sounds, worldaligntex)`
`stairs.register_stair_type(subname, recipeitem, groups, images, description, sounds, worldaligntex, full_description, stairtype)`

* Registers a stair
* `subname`: Basically the material name (e.g. cobble) used for the stair name. Nodename pattern: "stairs:stair_subname"
* `subname`: Basically the material name (e.g. cobble) used for the stair name.
Nodename pattern: "stairs:stair_subname", "stairs:stair_inner_subname", stairs:stair_outer_subname
* `recipeitem`: Item used in the craft recipe, e.g. "default:cobble", may be `nil`
* `groups`: See [Known damage and digging time defining groups]
* `images`: See [Tile definition]
* `description`: Used for the description field in the stair's definition
* `sounds`: See [#Default sounds]
* `worldaligntex`: A bool to set all textures world-aligned. Default false. See [Tile definition]
* `full_description`: Overrides the description, bypassing string concatenation. This is useful for translation. (optional)
* Note: Only for inner and outer stairs.
* `stairtype`: Sets the type of stair, e.g. "inner" for inner corner stair and "outer" for outer corner stair, otherwise `nil`

`stairs.register_stair(subname, recipeitem, groups, images, description, sounds, worldaligntex)`

* Deprecated, remove from mods.

`stairs.register_slab(subname, recipeitem, groups, images, description, sounds, worldaligntex)`

Expand All @@ -743,27 +751,11 @@ delivered with Minetest Game, to keep them compatible with other mods.

`stairs.register_stair_inner(subname, recipeitem, groups, images, description, sounds, worldaligntex, full_description)`

* Registers an inner corner stair
* `subname`: Basically the material name (e.g. cobble) used for the stair name. Nodename pattern: "stairs:stair_inner_subname"
* `recipeitem`: Item used in the craft recipe, e.g. "default:cobble", may be `nil`
* `groups`: See [Known damage and digging time defining groups]
* `images`: See [Tile definition]
* `description`: Used for the description field in the stair's definition with "Inner" prepended
* `sounds`: See [#Default sounds]
* `worldaligntex`: A bool to set all textures world-aligned. Default false. See [Tile definition]
* `full_description`: Overrides the description, bypassing string concatenation. This is useful for translation. (optional)
* Deprecated, remove from mods.

`stairs.register_stair_outer(subname, recipeitem, groups, images, description, sounds, worldaligntex, full_description)`

* Registers an outer corner stair
* `subname`: Basically the material name (e.g. cobble) used for the stair name. Nodename pattern: "stairs:stair_outer_subname"
* `recipeitem`: Item used in the craft recipe, e.g. "default:cobble", may be `nil`
* `groups`: See [Known damage and digging time defining groups]
* `images`: See [Tile definition]
* `description`: Used for the description field in the stair's definition with "Outer" prepended
* `sounds`: See [#Default sounds]
* `worldaligntex`: A bool to set all textures world-aligned. Default false. See [Tile definition]
* `full_description`: Overrides the description, bypassing string concatenation. This is useful for translation. (optional)
* Deprecated, remove from mods.

`stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab, sounds, worldaligntex)`

Expand Down
10 changes: 5 additions & 5 deletions mods/farming/nodes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,12 @@ do
local images = {"farming_straw.png"}
local sounds = default.node_sound_leaves_defaults()

stairs.register_stair("straw", recipe, groups, images, S("Straw Stair"),
stairs.register_stair_type("straw", recipe, groups, images, S("Straw Stair"),
sounds, true)
stairs.register_stair_inner("straw", recipe, groups, images, "",
sounds, true, S("Inner Straw Stair"))
stairs.register_stair_outer("straw", recipe, groups, images, "",
sounds, true, S("Outer Straw Stair"))
stairs.register_stair_type("straw", recipe, groups, images, "",
sounds, true, S("Inner Straw Stair"), "inner")
stairs.register_stair_type("straw", recipe, groups, images, "",
sounds, true, S("Outer Straw Stair"), "outer")
stairs.register_slab("straw", recipe, groups, images, S("Straw Slab"),
sounds, true)
end
Expand Down
Loading