From ea77ac32eac527b7900032c52f172464bd797174 Mon Sep 17 00:00:00 2001 From: Jat15 Date: Wed, 27 Sep 2017 15:44:33 +0200 Subject: [PATCH] Building Blocks Create file node_stairs --- building_blocks/init.lua | 228 +------------------------------ building_blocks/node_stairs.lua | 231 ++++++++++++++++++++++++++++++++ 2 files changed, 233 insertions(+), 226 deletions(-) create mode 100644 building_blocks/node_stairs.lua diff --git a/building_blocks/init.lua b/building_blocks/init.lua index 8fae22dd..88b75a5c 100644 --- a/building_blocks/init.lua +++ b/building_blocks/init.lua @@ -2,62 +2,10 @@ local S = homedecor_i18n.gettext local modpath = minetest.get_modpath("building_blocks") dofile(modpath.."/alias.lua") - -local function building_blocks_stairs(nodename, def) - minetest.register_node(nodename, def) - if minetest.get_modpath("moreblocks") or minetest.get_modpath("stairs") then - local mod, name = nodename:match("(.*):(.*)") - minetest.register_alias(mod .. ":slab_" .. name, "stairs:slab_" .. name) - minetest.register_alias(mod .. ":stair_" .. name, "stairs:stair_" .. name) - for groupname,value in pairs(def.groups) do - if groupname ~= "cracky" and - groupname ~= "choppy" and - groupname ~="flammable" and - groupname ~="crumbly" and - groupname ~="snappy" - then - def.groups.groupname = nil - end - end - - if minetest.get_modpath("moreblocks") then - stairsplus:register_all( - mod, - name, - nodename, - { - description = def.description, - tiles = def.tiles, - groups = def.groups, - sounds = def.sounds, - } - ) - else - stairs.register_stair_and_slab(name,nodename, - def.groups, - def.tiles, - ("%s Stair"):format(def.description), - ("%s Slab"):format(def.description), - def.sounds - ) - end - end -end +dofile(modpath.."/node_stairs.lua") + -building_blocks_stairs("building_blocks:Adobe", { - tiles = {"building_blocks_Adobe.png"}, - description = S("Adobe"), - is_ground_content = true, - groups = {crumbly=3}, - sounds = default.node_sound_stone_defaults(), -}) -building_blocks_stairs("building_blocks:Roofing", { - tiles = {"building_blocks_Roofing.png"}, - is_ground_content = true, - description = S("Roof block"), - groups = {snappy=3}, -}) minetest.register_craft({ output = 'building_blocks:terrycloth_towel 2', recipe = { @@ -195,155 +143,7 @@ minetest.register_craft({ output = "building_blocks:smoothglass", recipe = "default:glass" }) -minetest.register_node("building_blocks:smoothglass", { - drawtype = "glasslike", - description = S("Streak Free Glass"), - tiles = {"building_blocks_sglass.png"}, - inventory_image = minetest.inventorycube("building_blocks_sglass.png"), - paramtype = "light", - sunlight_propagates = true, - is_ground_content = true, - groups = {snappy=3,cracky=3,oddly_breakable_by_hand=3}, - sounds = default.node_sound_glass_defaults(), -}) -building_blocks_stairs("building_blocks:grate", { - drawtype = "glasslike", - description = S("Grate"), - tiles = {"building_blocks_grate.png"}, - inventory_image = minetest.inventorycube("building_blocks_grate.png"), - paramtype = "light", - sunlight_propagates = true, - is_ground_content = true, - groups = {cracky=1}, -}) -minetest.register_node("building_blocks:Fireplace", { - description = S("Fireplace"), - tiles = { - "building_blocks_cast_iron.png", - "building_blocks_cast_iron.png", - "building_blocks_cast_iron.png", - "building_blocks_cast_iron_fireplace.png" - }, - paramtype = "light", - paramtype2 = "facedir", - light_source = default.LIGHT_MAX, - sunlight_propagates = true, - is_ground_content = true, - groups = {cracky=2}, -}) - -minetest.register_node("building_blocks:woodglass", { - drawtype = "glasslike", - description = S("Wood Framed Glass"), - tiles = {"building_blocks_wglass.png"}, - inventory_image = minetest.inventorycube("building_blocks_wglass.png"), - paramtype = "light", - sunlight_propagates = true, - is_ground_content = true, - groups = {snappy=3,cracky=3,oddly_breakable_by_hand=3}, - sounds = default.node_sound_glass_defaults(), -}) -minetest.register_node("building_blocks:terrycloth_towel", { - drawtype = "raillike", - description = S("Terrycloth towel"), - tiles = {"building_blocks_towel.png"}, - inventory_image = "building_blocks_towel_inv.png", - paramtype = "light", - walkable = false, - selection_box = { - type = "fixed", - -- but how to specify the dimensions for curved and sideways rails? - fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, - }, - sunlight_propagates = true, - is_ground_content = true, - groups = {crumbly=3}, -}) -minetest.register_node("building_blocks:Tarmac_spread", { - drawtype = "raillike", - description = S("Tarmac Spread"), - tiles = {"building_blocks_tar.png"}, - inventory_image = "building_blocks_tar_spread_inv.png", - paramtype = "light", - walkable = false, - selection_box = { - type = "fixed", - -- but how to specify the dimensions for curved and sideways rails? - fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, - }, - sunlight_propagates = true, - is_ground_content = true, - groups = {cracky=3}, - sounds = default.node_sound_dirt_defaults(), -}) -minetest.register_node("building_blocks:BWtile", { - drawtype = "nodebox", - description = S("Chess board tiling"), - tiles = { - "building_blocks_BWtile.png", - "building_blocks_BWtile.png^[transformR90", - "building_blocks_BWtile.png^[transformR90", - "building_blocks_BWtile.png^[transformR90", - "building_blocks_BWtile.png", - "building_blocks_BWtile.png" - }, - inventory_image = "building_blocks_bwtile_inv.png", - paramtype = "light", - walkable = false, - node_box = { - type = "fixed", - fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, - }, - sunlight_propagates = true, - is_ground_content = true, - groups = {crumbly=3}, -}) -minetest.register_node("building_blocks:brobble_spread", { - drawtype = "raillike", - -- Translators: "Brobble" is a portmanteau of "Brick" and "Cobble". - -- Translate however you see fit. - description = S("Brobble Spread"), - tiles = {"building_blocks_brobble.png"}, - inventory_image = "building_blocks_brobble_spread_inv.png", - paramtype = "light", - walkable = false, - selection_box = { - type = "fixed", - -- but how to specify the dimensions for curved and sideways rails? - fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, - }, - sunlight_propagates = true, - is_ground_content = true, - groups = {crumbly=3}, -}) -minetest.register_node("building_blocks:gravel_spread", { - drawtype = "raillike", - description = S("Gravel Spread"), - tiles = {"default_gravel.png"}, - inventory_image = "building_blocks_gravel_spread_inv.png", - paramtype = "light", - walkable = false, - selection_box = { - type = "fixed", - -- but how to specify the dimensions for curved and sideways rails? - fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, - }, - sunlight_propagates = true, - is_ground_content = true, - groups = {crumbly=2}, - sounds = default.node_sound_dirt_defaults({ - footstep = {name="default_gravel_footstep", gain=0.5}, - dug = {name="default_gravel_footstep", gain=1.0}, - }), -}) -building_blocks_stairs("building_blocks:hardwood", { - tiles = {"building_blocks_hardwood.png"}, - is_ground_content = true, - description = S("Hardwood"), - groups = {choppy=1,flammable=1}, - sounds = default.node_sound_wood_defaults(), -}) @@ -354,16 +154,6 @@ minetest.register_craft({ burntime = 28, }) -building_blocks_stairs("building_blocks:fakegrass", { - tiles = {"default_grass.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"}, - description = S("Fake Grass"), - is_ground_content = true, - groups = {crumbly=3}, - sounds = default.node_sound_dirt_defaults({ - footstep = {name="default_grass_footstep", gain=0.4}, - }), -}) - minetest.register_craftitem("building_blocks:sticks", { description = S("Small bundle of sticks"), image = "building_blocks_sticks.png", @@ -385,20 +175,6 @@ minetest.register_craft({ }) -building_blocks_stairs("building_blocks:Tar", { - description = S("Tar"), - tiles = {"building_blocks_tar.png"}, - is_ground_content = true, - groups = {crumbly=1, tar_block = 1}, - sounds = default.node_sound_stone_defaults(), -}) -building_blocks_stairs("building_blocks:Marble", { - description = S("Marble"), - tiles = {"building_blocks_marble.png"}, - is_ground_content = true, - groups = {cracky=3, marble = 1}, - sounds = default.node_sound_stone_defaults(), -}) minetest.register_craft({ type = "fuel", recipe = "building_blocks:sticks", diff --git a/building_blocks/node_stairs.lua b/building_blocks/node_stairs.lua new file mode 100644 index 00000000..0a007cca --- /dev/null +++ b/building_blocks/node_stairs.lua @@ -0,0 +1,231 @@ +local S = homedecor_i18n.gettext + +local function building_blocks_stairs(nodename, def) + minetest.register_node(nodename, def) + if minetest.get_modpath("moreblocks") or minetest.get_modpath("stairs") then + local mod, name = nodename:match("(.*):(.*)") + minetest.register_alias(mod .. ":slab_" .. name, "stairs:slab_" .. name) + minetest.register_alias(mod .. ":stair_" .. name, "stairs:stair_" .. name) + for groupname,value in pairs(def.groups) do + if groupname ~= "cracky" and + groupname ~= "choppy" and + groupname ~="flammable" and + groupname ~="crumbly" and + groupname ~="snappy" + then + def.groups.groupname = nil + end + end + + if minetest.get_modpath("moreblocks") then + stairsplus:register_all( + mod, + name, + nodename, + { + description = def.description, + tiles = def.tiles, + groups = def.groups, + sounds = def.sounds, + } + ) + else + stairs.register_stair_and_slab(name,nodename, + def.groups, + def.tiles, + ("%s Stair"):format(def.description), + ("%s Slab"):format(def.description), + def.sounds + ) + end + end +end + +building_blocks_stairs("building_blocks:Adobe", { + tiles = {"building_blocks_Adobe.png"}, + description = S("Adobe"), + is_ground_content = true, + groups = {crumbly=3}, + sounds = default.node_sound_stone_defaults(), +}) +building_blocks_stairs("building_blocks:Roofing", { + tiles = {"building_blocks_Roofing.png"}, + is_ground_content = true, + description = S("Roof block"), + groups = {snappy=3}, +}) + +minetest.register_node("building_blocks:smoothglass", { + drawtype = "glasslike", + description = S("Streak Free Glass"), + tiles = {"building_blocks_sglass.png"}, + inventory_image = minetest.inventorycube("building_blocks_sglass.png"), + paramtype = "light", + sunlight_propagates = true, + is_ground_content = true, + groups = {snappy=3,cracky=3,oddly_breakable_by_hand=3}, + sounds = default.node_sound_glass_defaults(), +}) +building_blocks_stairs("building_blocks:grate", { + drawtype = "glasslike", + description = S("Grate"), + tiles = {"building_blocks_grate.png"}, + inventory_image = minetest.inventorycube("building_blocks_grate.png"), + paramtype = "light", + sunlight_propagates = true, + is_ground_content = true, + groups = {cracky=1}, +}) + +minetest.register_node("building_blocks:Fireplace", { + description = S("Fireplace"), + tiles = { + "building_blocks_cast_iron.png", + "building_blocks_cast_iron.png", + "building_blocks_cast_iron.png", + "building_blocks_cast_iron_fireplace.png" + }, + paramtype = "light", + paramtype2 = "facedir", + light_source = default.LIGHT_MAX, + sunlight_propagates = true, + is_ground_content = true, + groups = {cracky=2}, +}) + +minetest.register_node("building_blocks:woodglass", { + drawtype = "glasslike", + description = S("Wood Framed Glass"), + tiles = {"building_blocks_wglass.png"}, + inventory_image = minetest.inventorycube("building_blocks_wglass.png"), + paramtype = "light", + sunlight_propagates = true, + is_ground_content = true, + groups = {snappy=3,cracky=3,oddly_breakable_by_hand=3}, + sounds = default.node_sound_glass_defaults(), +}) +minetest.register_node("building_blocks:terrycloth_towel", { + drawtype = "raillike", + description = S("Terrycloth towel"), + tiles = {"building_blocks_towel.png"}, + inventory_image = "building_blocks_towel_inv.png", + paramtype = "light", + walkable = false, + selection_box = { + type = "fixed", + -- but how to specify the dimensions for curved and sideways rails? + fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, + }, + sunlight_propagates = true, + is_ground_content = true, + groups = {crumbly=3}, +}) +minetest.register_node("building_blocks:Tarmac_spread", { + drawtype = "raillike", + description = S("Tarmac Spread"), + tiles = {"building_blocks_tar.png"}, + inventory_image = "building_blocks_tar_spread_inv.png", + paramtype = "light", + walkable = false, + selection_box = { + type = "fixed", + -- but how to specify the dimensions for curved and sideways rails? + fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, + }, + sunlight_propagates = true, + is_ground_content = true, + groups = {cracky=3}, + sounds = default.node_sound_dirt_defaults(), +}) +minetest.register_node("building_blocks:BWtile", { + drawtype = "nodebox", + description = S("Chess board tiling"), + tiles = { + "building_blocks_BWtile.png", + "building_blocks_BWtile.png^[transformR90", + "building_blocks_BWtile.png^[transformR90", + "building_blocks_BWtile.png^[transformR90", + "building_blocks_BWtile.png", + "building_blocks_BWtile.png" + }, + inventory_image = "building_blocks_bwtile_inv.png", + paramtype = "light", + walkable = false, + node_box = { + type = "fixed", + fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, + }, + sunlight_propagates = true, + is_ground_content = true, + groups = {crumbly=3}, +}) +minetest.register_node("building_blocks:brobble_spread", { + drawtype = "raillike", + -- Translators: "Brobble" is a portmanteau of "Brick" and "Cobble". + -- Translate however you see fit. + description = S("Brobble Spread"), + tiles = {"building_blocks_brobble.png"}, + inventory_image = "building_blocks_brobble_spread_inv.png", + paramtype = "light", + walkable = false, + selection_box = { + type = "fixed", + -- but how to specify the dimensions for curved and sideways rails? + fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, + }, + sunlight_propagates = true, + is_ground_content = true, + groups = {crumbly=3}, +}) +minetest.register_node("building_blocks:gravel_spread", { + drawtype = "raillike", + description = S("Gravel Spread"), + tiles = {"default_gravel.png"}, + inventory_image = "building_blocks_gravel_spread_inv.png", + paramtype = "light", + walkable = false, + selection_box = { + type = "fixed", + -- but how to specify the dimensions for curved and sideways rails? + fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, + }, + sunlight_propagates = true, + is_ground_content = true, + groups = {crumbly=2}, + sounds = default.node_sound_dirt_defaults({ + footstep = {name="default_gravel_footstep", gain=0.5}, + dug = {name="default_gravel_footstep", gain=1.0}, + }), +}) +building_blocks_stairs("building_blocks:hardwood", { + tiles = {"building_blocks_hardwood.png"}, + is_ground_content = true, + description = S("Hardwood"), + groups = {choppy=1,flammable=1}, + sounds = default.node_sound_wood_defaults(), +}) + +building_blocks_stairs("building_blocks:fakegrass", { + tiles = {"default_grass.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"}, + description = S("Fake Grass"), + is_ground_content = true, + groups = {crumbly=3}, + sounds = default.node_sound_dirt_defaults({ + footstep = {name="default_grass_footstep", gain=0.4}, + }), +}) + +building_blocks_stairs("building_blocks:Tar", { + description = S("Tar"), + tiles = {"building_blocks_tar.png"}, + is_ground_content = true, + groups = {crumbly=1, tar_block = 1}, + sounds = default.node_sound_stone_defaults(), +}) +building_blocks_stairs("building_blocks:Marble", { + description = S("Marble"), + tiles = {"building_blocks_marble.png"}, + is_ground_content = true, + groups = {cracky=3, marble = 1}, + sounds = default.node_sound_stone_defaults(), +}) \ No newline at end of file