diff options
author | Kahrl <kahrl@gmx.net> | 2012-03-19 04:25:09 +0100 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2012-06-17 16:34:39 +0300 |
commit | 1575448b1a71dd029a8d135d2aff9096483a9953 (patch) | |
tree | 3e4c7a68abbcf630484615e6ee202f2f0d83ade2 /games/minimal | |
parent | 9f031a67594162a53b07acbfbc65faf8c4938e99 (diff) | |
download | minetest-1575448b1a71dd029a8d135d2aff9096483a9953.tar.gz minetest-1575448b1a71dd029a8d135d2aff9096483a9953.tar.bz2 minetest-1575448b1a71dd029a8d135d2aff9096483a9953.zip |
Custom boxy nodes (stairs, slabs) and collision changes
Diffstat (limited to 'games/minimal')
-rw-r--r-- | games/minimal/mods/default/init.lua | 2 | ||||
-rw-r--r-- | games/minimal/mods/stairs/depends.txt | 1 | ||||
-rw-r--r-- | games/minimal/mods/stairs/init.lua | 93 |
3 files changed, 95 insertions, 1 deletions
diff --git a/games/minimal/mods/default/init.lua b/games/minimal/mods/default/init.lua index 64dcbbdfe..cb424cb5b 100644 --- a/games/minimal/mods/default/init.lua +++ b/games/minimal/mods/default/init.lua @@ -926,7 +926,7 @@ minetest.register_node("default:rail", { walkable = false, selection_box = { type = "fixed", - --fixed = <default> + fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, }, groups = {bendy=2,snappy=1,dig_immediate=2}, }) diff --git a/games/minimal/mods/stairs/depends.txt b/games/minimal/mods/stairs/depends.txt new file mode 100644 index 000000000..4ad96d515 --- /dev/null +++ b/games/minimal/mods/stairs/depends.txt @@ -0,0 +1 @@ +default diff --git a/games/minimal/mods/stairs/init.lua b/games/minimal/mods/stairs/init.lua new file mode 100644 index 000000000..4929d1370 --- /dev/null +++ b/games/minimal/mods/stairs/init.lua @@ -0,0 +1,93 @@ +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", + tile_images = 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", + tile_images = 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") |