Skip to content

Commit 2199be5

Browse files
sofarparamat
authored andcommittedJun 14, 2016
Stairs: Add mossy cobble slab and stair
Allow water to turn cobble slab and stairs to turn into mossy versions. There is no crafting recipe for mossy stairs and mossy slabs, the stair/slab API has been modified to allow for a recipeitem that is `nil`, which will omit adding a crafting recipe for these two items. The API documentation is updated. The slabs and stairs will turn mossy when water is adjacent, just like cobblestone. You can either farm mossy versions by placing them in water for a while, then collecting them, or run water over your craft.
1 parent b5ea7d1 commit 2199be5

File tree

3 files changed

+43
-26
lines changed

3 files changed

+43
-26
lines changed
 

Diff for: ‎game_api.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ delivered with Minetest Game, to keep them compatible with other mods.
343343

344344
* Registers a stair.
345345
* `subname`: Basically the material name (e.g. cobble) used for the stair name. Nodename pattern: "stairs:stair_subname"
346-
* `recipeitem`: Item used in the craft recipe, e.g. "default:cobble"
346+
* `recipeitem`: Item used in the craft recipe, e.g. "default:cobble", may be `nil`
347347
* `groups`: see [Known damage and digging time defining groups]
348348
* `images`: see [Tile definition]
349349
* `description`: used for the description field in the stair's definition

Diff for: ‎mods/default/functions.lua

+8-2
Original file line numberDiff line numberDiff line change
@@ -466,12 +466,18 @@ minetest.register_abm({
466466
--
467467

468468
minetest.register_abm({
469-
nodenames = {"default:cobble"},
469+
nodenames = {"default:cobble", "stairs:slab_cobble", "stairs:stair_cobble"},
470470
neighbors = {"group:water"},
471471
interval = 16,
472472
chance = 200,
473473
catch_up = false,
474474
action = function(pos, node)
475-
minetest.set_node(pos, {name = "default:mossycobble"})
475+
if node.name == "default:cobble" then
476+
minetest.set_node(pos, {name = "default:mossycobble"})
477+
elseif node.name == "stairs:slab_cobble" then
478+
minetest.set_node(pos, {name = "stairs:slab_mossycobble", param2 = node.param2})
479+
elseif node.name == "stairs:stair_cobble" then
480+
minetest.set_node(pos, {name = "stairs:stair_mossycobble", param2 = node.param2})
481+
end
476482
end
477483
})

Diff for: ‎mods/stairs/init.lua

+34-23
Original file line numberDiff line numberDiff line change
@@ -87,24 +87,26 @@ function stairs.register_stair(subname, recipeitem, groups, images, description,
8787
})
8888
end
8989

90-
minetest.register_craft({
91-
output = 'stairs:stair_' .. subname .. ' 6',
92-
recipe = {
93-
{recipeitem, "", ""},
94-
{recipeitem, recipeitem, ""},
95-
{recipeitem, recipeitem, recipeitem},
96-
},
97-
})
90+
if recipeitem then
91+
minetest.register_craft({
92+
output = 'stairs:stair_' .. subname .. ' 6',
93+
recipe = {
94+
{recipeitem, "", ""},
95+
{recipeitem, recipeitem, ""},
96+
{recipeitem, recipeitem, recipeitem},
97+
},
98+
})
9899

99-
-- Flipped recipe for the silly minecrafters
100-
minetest.register_craft({
101-
output = 'stairs:stair_' .. subname .. ' 6',
102-
recipe = {
103-
{"", "", recipeitem},
104-
{"", recipeitem, recipeitem},
105-
{recipeitem, recipeitem, recipeitem},
106-
},
107-
})
100+
-- Flipped recipe for the silly minecrafters
101+
minetest.register_craft({
102+
output = 'stairs:stair_' .. subname .. ' 6',
103+
recipe = {
104+
{"", "", recipeitem},
105+
{"", recipeitem, recipeitem},
106+
{recipeitem, recipeitem, recipeitem},
107+
},
108+
})
109+
end
108110
end
109111

110112

@@ -218,12 +220,14 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
218220
})
219221
end
220222

221-
minetest.register_craft({
222-
output = 'stairs:slab_' .. subname .. ' 6',
223-
recipe = {
224-
{recipeitem, recipeitem, recipeitem},
225-
},
226-
})
223+
if recipeitem then
224+
minetest.register_craft({
225+
output = 'stairs:slab_' .. subname .. ' 6',
226+
recipe = {
227+
{recipeitem, recipeitem, recipeitem},
228+
},
229+
})
230+
end
227231
end
228232

229233

@@ -310,6 +314,13 @@ stairs.register_stair_and_slab("cobble", "default:cobble",
310314
"Cobblestone Slab",
311315
default.node_sound_stone_defaults())
312316

317+
stairs.register_stair_and_slab("mossycobble", nil,
318+
{cracky = 3},
319+
{"default_mossycobble.png"},
320+
"Mossy Cobblestone Stair",
321+
"Mossy Cobblestone Slab",
322+
default.node_sound_stone_defaults())
323+
313324
stairs.register_stair_and_slab("stonebrick", "default:stonebrick",
314325
{cracky = 3},
315326
{"default_stone_brick.png"},

0 commit comments

Comments
 (0)
Please sign in to comment.