From 85aea72376f98a8fc17c3f109a4dd0d987c2b6eb Mon Sep 17 00:00:00 2001 From: Calinou Date: Thu, 11 Jul 2013 20:33:02 +0200 Subject: More Blocks --- stairsplus/aliases.lua | 61 +++++++++++ stairsplus/microblocks.lua | 43 ++++++++ stairsplus/panels.lua | 42 ++++++++ stairsplus/slabs.lua | 127 +++++++++++++++++++++++ stairsplus/stairs.lua | 248 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 521 insertions(+) create mode 100644 stairsplus/aliases.lua create mode 100644 stairsplus/microblocks.lua create mode 100644 stairsplus/panels.lua create mode 100644 stairsplus/slabs.lua create mode 100644 stairsplus/stairs.lua (limited to 'stairsplus') diff --git a/stairsplus/aliases.lua b/stairsplus/aliases.lua new file mode 100644 index 0000000..3fcd867 --- /dev/null +++ b/stairsplus/aliases.lua @@ -0,0 +1,61 @@ +function register_stairsplus_alias(modname, origname, newname) +minetest.register_alias(modname .. ":slab_" .. origname, "moreblocks:slab_" .. newname) +minetest.register_alias(modname .. ":slab_" .. origname .. "_inverted", "moreblocks:slab_" .. newname .. "_inverted") +minetest.register_alias(modname .. ":slab_" .. origname .. "_wall", "moreblocks:slab_" .. newname .. "_wall") +minetest.register_alias(modname .. ":slab_" .. origname .. "_quarter", "moreblocks:slab_" .. newname .. "_quarter") +minetest.register_alias(modname .. ":slab_" .. origname .. "_quarter_inverted", "moreblocks:slab_" .. newname .. "_quarter_inverted") +minetest.register_alias(modname .. ":slab_" .. origname .. "_quarter_wall", "moreblocks:slab_" .. newname .. "_quarter_wall") +minetest.register_alias(modname .. ":slab_" .. origname .. "_three_quarter", "moreblocks:slab_" .. newname .. "_three_quarter") +minetest.register_alias(modname .. ":slab_" .. origname .. "_three_quarter_inverted", "moreblocks:slab_" .. newname .. "_three_quarter_inverted") +minetest.register_alias(modname .. ":slab_" .. origname .. "_three_quarter_wall", "moreblocks:slab_" .. newname .. "_three_quarter_wall") +minetest.register_alias(modname .. ":stair_" .. origname, "moreblocks:stair_" .. newname) +minetest.register_alias(modname .. ":stair_" .. origname .. "_inverted", "moreblocks:stair_" .. newname .. "_inverted") +minetest.register_alias(modname .. ":stair_" .. origname .. "_wall", "moreblocks:stair_" .. newname .. "_wall") +minetest.register_alias(modname .. ":stair_" .. origname .. "_wall_half", "moreblocks:stair_" .. newname .. "_wall_half") +minetest.register_alias(modname .. ":stair_" .. origname .. "_wall_half_inverted", "moreblocks:stair_" .. newname .. "_wall_half_inverted") +minetest.register_alias(modname .. ":stair_" .. origname .. "_half", "moreblocks:stair_" .. newname .. "_half") +minetest.register_alias(modname .. ":stair_" .. origname .. "_half_inverted", "moreblocks:stair_" .. newname .. "_half_inverted") +minetest.register_alias(modname .. ":stair_" .. origname .. "_right_half", "moreblocks:stair_" .. newname .. "_right_half") +minetest.register_alias(modname .. ":stair_" .. origname .. "_right_half_inverted", "moreblocks:stair_" .. newname .. "_right_half_inverted") +minetest.register_alias(modname .. ":stair_" .. origname .. "_wall_half", "moreblocks:stair_" .. newname .. "_wall_half") +minetest.register_alias(modname .. ":stair_" .. origname .. "_wall_half_inverted", "moreblocks:stair_" .. newname .. "_wall_half_inverted") +minetest.register_alias(modname .. ":stair_" .. origname .. "_inner", "moreblocks:stair_" .. newname .. "_inner") +minetest.register_alias(modname .. ":stair_" .. origname .. "_inner_inverted", "moreblocks:stair_" .. newname .. "_inner_inverted") +minetest.register_alias(modname .. ":stair_" .. origname .. "_outer", "moreblocks:stair_" .. newname .. "_outer") +minetest.register_alias(modname .. ":stair_" .. origname .. "_outer_inverted", "moreblocks:stair_" .. newname .. "_outer_inverted") +minetest.register_alias(modname .. ":panel_" .. origname .. "_bottom", "moreblocks:panel_" .. newname .. "_bottom") +minetest.register_alias(modname .. ":panel_" .. origname .. "_top", "moreblocks:panel_" .. newname .. "_top") +minetest.register_alias(modname .. ":panel_" .. origname .. "_vertical", "moreblocks:panel_" .. newname .. "_vertical") +minetest.register_alias(modname .. ":micro_" .. origname .. "_bottom", "moreblocks:micro_" .. newname .. "_bottom") +minetest.register_alias(modname .. ":micro_" .. origname .. "_top", "moreblocks:micro_" .. newname .. "_top") +end + +register_stairsplus_alias("stairsplus", "stone", "stone") +register_stairsplus_alias("stairsplus", "wood", "wood") +register_stairsplus_alias("stairsplus", "cobble", "cobble") +register_stairsplus_alias("stairsplus", "brick", "brick") +register_stairsplus_alias("stairsplus", "sandstone", "sandstone") +register_stairsplus_alias("stairsplus", "glass", "glass") +register_stairsplus_alias("stairsplus", "tree", "tree") +register_stairsplus_alias("stairsplus", "jungletree", "jungletree") +register_stairsplus_alias("stairsplus", "desert_stone", "desert_stone") +register_stairsplus_alias("stairsplus", "steelblock", "steelblock") +register_stairsplus_alias("stairsplus", "mossycobble", "mossycobble") + +register_stairsplus_alias("moreblocks", "coalstone", "coal_stone") +register_stairsplus_alias("moreblocks", "junglewood", "jungle_wood") +register_stairsplus_alias("moreblocks", "circlestonebrick", "circle_stone_bricks") +register_stairsplus_alias("moreblocks", "ironstone", "iron_stone") +register_stairsplus_alias("moreblocks", "coalglass", "coal_glass") +register_stairsplus_alias("moreblocks", "ironglass", "iron_glass") +register_stairsplus_alias("moreblocks", "glowglass", "glow_glass") +register_stairsplus_alias("moreblocks", "superglowglass", "super_glow_glass") +register_stairsplus_alias("moreblocks", "coalchecker", "coal_checker") +register_stairsplus_alias("moreblocks", "ironchecker", "iron_checker") +register_stairsplus_alias("moreblocks", "cactuschecker", "cactus_checker") +register_stairsplus_alias("moreblocks", "ironstonebrick", "iron_stone_bricks") +register_stairsplus_alias("moreblocks", "stonesquare", "stone_tile") +register_stairsplus_alias("moreblocks", "splitstonesquare", "split_stone_tile") +register_stairsplus_alias("moreblocks", "woodtile", "wood_tile") +register_stairsplus_alias("moreblocks", "woodtile_centered", "wood_tile_centered") +register_stairsplus_alias("moreblocks", "woodtile_full", "wood_tile_full") diff --git a/stairsplus/microblocks.lua b/stairsplus/microblocks.lua new file mode 100644 index 0000000..2a1943a --- /dev/null +++ b/stairsplus/microblocks.lua @@ -0,0 +1,43 @@ +-- Load translation library if intllib is installed + +local S +if (minetest.get_modpath("intllib")) then + dofile(minetest.get_modpath("intllib").."/intllib.lua") + S = intllib.Getter(minetest.get_current_modname()) + else + S = function ( s ) return s end +end + +-- Node will be called micro_ + +function register_micro(modname, subname, recipeitem, groups, images, description, drop, light) + + minetest.register_node(":"..modname .. ":micro_" .. subname, { + description = S("%s Microblock"):format(S(description)), + drawtype = "nodebox", + tiles = images, + light_source = light, + drop = modname .. ":micro_" .. drop, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + groups = groups, + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0, 0, 0.5}, + }, + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0, 0, 0.5}, + }, + sounds = default.node_sound_stone_defaults(), + on_place = function(itemstack, placer, pointed_thing) + local keys=placer:get_player_control() + stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"]) + return itemstack + end + }) + + minetest.register_alias(modname..":micro_"..subname.."_bottom", modname..":micro_"..subname) +end + diff --git a/stairsplus/panels.lua b/stairsplus/panels.lua new file mode 100644 index 0000000..8a00b7f --- /dev/null +++ b/stairsplus/panels.lua @@ -0,0 +1,42 @@ +-- Load translation library if intllib is installed + +local S +if (minetest.get_modpath("intllib")) then + dofile(minetest.get_modpath("intllib").."/intllib.lua") + S = intllib.Getter(minetest.get_current_modname()) + else + S = function ( s ) return s end +end + +-- Node will be called panel_ + +function register_panel(modname, subname, recipeitem, groups, images, description, drop, light) + + minetest.register_node(":" .. modname .. ":panel_" .. subname, { + description = S("%s Panel"):format(S(description)), + drawtype = "nodebox", + tiles = images, + light_source = light, + drop = modname .. ":panel_" .. drop, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + groups = groups, + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0.5, 0, 0.5}, + }, + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0.5, 0, 0.5}, + }, + on_place = function(itemstack, placer, pointed_thing) + local keys=placer:get_player_control() + stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"]) + return itemstack + end + }) + + minetest.register_alias(modname..":panel_"..subname.."_bottom", modname..":panel_"..subname) +end + diff --git a/stairsplus/slabs.lua b/stairsplus/slabs.lua new file mode 100644 index 0000000..458c8b9 --- /dev/null +++ b/stairsplus/slabs.lua @@ -0,0 +1,127 @@ +-- Load translation library if intllib is installed + +local S +if (minetest.get_modpath("intllib")) then + dofile(minetest.get_modpath("intllib").."/intllib.lua") + S = intllib.Getter(minetest.get_current_modname()) + else + S = function ( s ) return s end +end + +-- Node will be called slab_ + +function register_slab(modname, subname, recipeitem, groups, images, description, drop, light) + + minetest.register_node(":" .. modname .. ":slab_" .. subname, { + description = S("%s Slab"):format(S(description)), + drawtype = "nodebox", + tiles = images, + light_source = light, + drop = modname .. ":slab_" .. drop, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = 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}, + }, + sounds = default.node_sound_stone_defaults(), + on_place = function(itemstack, placer, pointed_thing) + local keys=placer:get_player_control() + stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"]) + return itemstack + end + }) + + minetest.register_node(":stairs:slab_" .. subname, { + description = S("%s Slab"):format(S(description)), + drawtype = "nodebox", + tiles = images, + drop = modname .. ":slab_" .. drop, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = 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}, + }, + sounds = default.node_sound_stone_defaults(), + on_place = function(itemstack, placer, pointed_thing) + local keys=placer:get_player_control() + stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"]) + return itemstack + end + }) + + minetest.register_node(":"..modname .. ":slab_" .. subname .. "_quarter", { + description = S("%s Slab"):format(S(description)), + drawtype = "nodebox", + tiles = images, + light_source = light, + drop = modname .. ":slab_" .. drop .. "_quarter", + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + groups = groups, + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, + }, + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, + }, + sounds = default.node_sound_stone_defaults(), + on_place = function(itemstack, placer, pointed_thing) + local keys=placer:get_player_control() + stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"]) + return itemstack + end + }) + + minetest.register_node(":"..modname .. ":slab_" .. subname .. "_three_quarter", { + description = S("%s Slab"):format(S(description)), + drawtype = "nodebox", + tiles = images, + light_source = light, + drop = modname .. ":slab_" .. drop .. "_three_quarter", + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + groups = groups, + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, 0.25, 0.5}, + }, + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, 0.25, 0.5}, + }, + sounds = default.node_sound_stone_defaults(), + on_place = function(itemstack, placer, pointed_thing) + local keys=placer:get_player_control() + stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"]) + return itemstack + end + }) + + -- Unregister default recipes + + minetest.register_craft({ + output = "moreblocks:nothing 1", + recipe = { + {recipeitem, recipeitem, recipeitem}, + }, + }) +end + diff --git a/stairsplus/stairs.lua b/stairsplus/stairs.lua new file mode 100644 index 0000000..ae06e73 --- /dev/null +++ b/stairsplus/stairs.lua @@ -0,0 +1,248 @@ +-- Load translation library if intllib is installed + +local S +if (minetest.get_modpath("intllib")) then + dofile(minetest.get_modpath("intllib").."/intllib.lua") + S = intllib.Getter(minetest.get_current_modname()) + else + S = function ( s ) return s end +end + +-- Node will be called :stair_ + +function register_stair(modname, subname, recipeitem, groups, images, description, drop, light) + + minetest.register_node(":" .. modname .. ":stair_" .. subname, { + description = S("%s Stairs"):format(S(description)), + drawtype = "nodebox", + tiles = images, + light_source = light, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = 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}, + }, + }, + selection_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}, + }, + }, + sounds = default.node_sound_stone_defaults(), + on_place = function(itemstack, placer, pointed_thing) + local keys=placer:get_player_control() + stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"]) + return itemstack + end + }) + + minetest.register_node(":stairs:stair_" .. subname, { + description = S("%s Stairs"):format(S(description)), + drawtype = "nodebox", + tiles = images, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + groups = {cracky=3, not_in_creative_inventory=1}, + 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}, + }, + }, + selection_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}, + }, + }, + sounds = default.node_sound_stone_defaults(), + on_place = function(itemstack, placer, pointed_thing) + local keys=placer:get_player_control() + stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"]) + return itemstack + end + }) + + minetest.register_node(":" .. modname .. ":stair_" .. subname .. "_half", { + description = S("%s Stairs"):format(S(description)), + drawtype = "nodebox", + tiles = images, + light_source = light, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + groups = groups, + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0, 0, 0.5}, + {-0.5, 0, 0, 0, 0.5, 0.5}, + }, + }, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0, 0, 0.5}, + {-0.5, 0, 0, 0, 0.5, 0.5}, + }, + }, + sounds = default.node_sound_stone_defaults(), + on_place = function(itemstack, placer, pointed_thing) + local keys=placer:get_player_control() + stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"]) + return itemstack + end + }) + + minetest.register_node(":"..modname .. ":stair_" .. subname .. "_right_half", { + description = S("%s Stairs"):format(S(description)), + drawtype = "nodebox", + tiles = images, + light_source = light, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + groups = groups, + node_box = { + type = "fixed", + fixed = { + {0, -0.5, -0.5, 0.5, 0, 0.5}, + {0, 0, 0, 0.5, 0.5, 0.5}, + }, + }, + selection_box = { + type = "fixed", + fixed = { + {0, -0.5, -0.5, 0.5, 0, 0.5}, + {0, 0, 0, 0.5, 0.5, 0.5}, + }, + }, + sounds = default.node_sound_stone_defaults(), + on_place = function(itemstack, placer, pointed_thing) + local keys=placer:get_player_control() + stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"]) + return itemstack + end + }) + + minetest.register_node(":"..modname .. ":stair_" .. subname .. "_inner", { + description = S("%s Stairs"):format(S(description)), + drawtype = "nodebox", + tiles = images, + light_source = light, + drop = modname .. ":stair_" .. drop .. "_inner", + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = 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}, + {-0.5, 0, -0.5, 0, 0.5, 0}, + }, + }, + selection_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}, + {-0.5, 0, -0.5, 0, 0.5, 0}, + }, + }, + sounds = default.node_sound_stone_defaults(), + on_place = function(itemstack, placer, pointed_thing) + local keys=placer:get_player_control() + stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"]) + return itemstack + end + }) + + minetest.register_node(":"..modname .. ":stair_" .. subname .. "_outer", { + description = S("%s Stairs"):format(S(description)), + drawtype = "nodebox", + tiles = images, + light_source = light, + drop = modname .. ":stair_" .. drop .. "_outer", + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + groups = groups, + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + {-0.5, 0, 0, 0, 0.5, 0.5}, + }, + }, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + {-0.5, 0, 0, 0, 0.5, 0.5}, + }, + }, + sounds = default.node_sound_stone_defaults(), + on_place = function(itemstack, placer, pointed_thing) + local keys=placer:get_player_control() + stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"]) + return itemstack + end + }) + + minetest.register_node(":" .. modname .. ":stair_" .. subname .. "_alt", { + description = S("%s Stairs"):format(S(description)), + drawtype = "nodebox", + tiles = images, + light_source = light, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + groups = groups, + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, 0, 0}, + {-0.5, 0, 0, 0.5, 0.5, 0.5}, + }, + }, + sounds = default.node_sound_stone_defaults(), + on_place = function(itemstack, placer, pointed_thing) + local keys=placer:get_player_control() + stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"]) + return itemstack + end + }) + + -- Unregister default recipes + + minetest.register_craft({ + output = "moreblocks:nothing 1", + recipe = { + {recipeitem, "", ""}, + {recipeitem, recipeitem, ""}, + {recipeitem, recipeitem, recipeitem}, + }, + }) + + minetest.register_craft({ + output = "moreblocks:nothing 1", + recipe = { + {"", "", recipeitem}, + {"", recipeitem, recipeitem}, + {recipeitem, recipeitem, recipeitem}, + }, + }) +end + -- cgit v1.2.3