Stairs and slabs
authorPerttu Ahola <celeron55@gmail.com>
Sun, 17 Jun 2012 14:45:18 +0000 (17:45 +0300)
committerPerttu Ahola <celeron55@gmail.com>
Sun, 17 Jun 2012 14:46:36 +0000 (17:46 +0300)
mods/stairs/README.txt [new file with mode: 0644]
mods/stairs/depends.txt [new file with mode: 0644]
mods/stairs/init.lua [new file with mode: 0644]

diff --git a/mods/stairs/README.txt b/mods/stairs/README.txt
new file mode 100644 (file)
index 0000000..716a677
--- /dev/null
@@ -0,0 +1,26 @@
+Minetest 0.4 mod: stairs
+=========================
+
+License of source code:
+-----------------------
+Copyright (C) 2011-2012 Kahrl <kahrl@gmx.net>
+Copyright (C) 2011-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+http://www.gnu.org/licenses/lgpl-2.1.html
+
+License of media (textures and sounds)
+--------------------------------------
+Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)                                 
+http://creativecommons.org/licenses/by-sa/3.0/
+
+Authors of media files
+-----------------------
+Everything not listed in here:
+Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
+
+
diff --git a/mods/stairs/depends.txt b/mods/stairs/depends.txt
new file mode 100644 (file)
index 0000000..4ad96d5
--- /dev/null
@@ -0,0 +1 @@
+default
diff --git a/mods/stairs/init.lua b/mods/stairs/init.lua
new file mode 100644 (file)
index 0000000..d07c96e
--- /dev/null
@@ -0,0 +1,96 @@
+-- Minetest 0.4 mod: stairs
+-- See README.txt for licensing and other information.
+
+stairs = {}
+
+-- Node will be called stairs:stair_<subname>
+function stairs.register_stair(subname, recipeitem, groups, images, description)
+       minetest.register_node("stairs:stair_" .. subname, {
+               description = description,
+               drawtype = "nodebox",
+               tiles = images,
+               paramtype = "light",
+               paramtype2 = "facedir",
+               is_ground_content = true,
+               groups = groups,
+               node_box = {
+                       type = "fixed",
+                       fixed = {
+                               {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
+                               {-0.5, 0, 0, 0.5, 0.5, 0.5},
+                       },
+               },
+       })
+
+       minetest.register_craft({
+               output = 'stairs:stair_' .. subname .. ' 4',
+               recipe = {
+                       {recipeitem, "", ""},
+                       {recipeitem, recipeitem, ""},
+                       {recipeitem, recipeitem, recipeitem},
+               },
+       })
+end
+
+-- Node will be called stairs:slab_<subname>
+function stairs.register_slab(subname, recipeitem, groups, images, description)
+       minetest.register_node("stairs:slab_" .. subname, {
+               description = description,
+               drawtype = "nodebox",
+               tiles = images,
+               paramtype = "light",
+               is_ground_content = true,
+               groups = groups,
+               node_box = {
+                       type = "fixed",
+                       fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
+               },
+               selection_box = {
+                       type = "fixed",
+                       fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
+               },
+       })
+
+       minetest.register_craft({
+               output = 'stairs:slab_' .. subname .. ' 3',
+               recipe = {
+                       {recipeitem, recipeitem, recipeitem},
+               },
+       })
+end
+
+-- Nodes will be called stairs:{stair,slab}_<subname>
+function stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab)
+       stairs.register_stair(subname, recipeitem, groups, images, desc_stair)
+       stairs.register_slab(subname, recipeitem, groups, images, desc_slab)
+end
+
+stairs.register_stair_and_slab("wood", "default:wood",
+               {snappy=2,choppy=2,oddly_breakable_by_hand=2},
+               {"default_wood.png"},
+               "Wooden stair",
+               "Wooden slab")
+
+stairs.register_stair_and_slab("stone", "default:stone",
+               {cracky=3},
+               {"default_stone.png"},
+               "Stone stair",
+               "Stone slab")
+
+stairs.register_stair_and_slab("cobble", "default:cobble",
+               {cracky=3},
+               {"default_cobble.png"},
+               "Cobble stair",
+               "Cobble slab")
+
+stairs.register_stair_and_slab("brick", "default:brick",
+               {cracky=3},
+               {"default_brick.png"},
+               "Brick stair",
+               "Brick slab")
+
+stairs.register_stair_and_slab("sandstone", "default:sandstone",
+               {crumbly=2,cracky=2},
+               {"default_sandstone.png"},
+               "Sandstone stair",
+               "Sandstone slab")