From 474148c0f563259edef82c475aeb8deb43a2ec2d Mon Sep 17 00:00:00 2001 From: h-v-smacker Date: Thu, 22 Nov 2018 23:11:50 +0300 Subject: shingle roof and storage barrel --- init.lua | 33 +++ nodes_furniture.lua | 71 +++++++ nodes_historic.lua | 52 +---- nodes_roof.lua | 224 ++++----------------- nodes_straw.lua | 65 ++---- textures/cottages_barrel_storage.png | Bin 0 -> 3619 bytes textures/cottages_homedecor_shingles_misc_wood.png | Bin 0 -> 690 bytes textures/cottages_loam_old.png | Bin 5743 -> 0 bytes textures/cottages_wagonwheel.png | Bin 357 -> 1964 bytes 9 files changed, 156 insertions(+), 289 deletions(-) create mode 100644 textures/cottages_barrel_storage.png create mode 100644 textures/cottages_homedecor_shingles_misc_wood.png delete mode 100644 textures/cottages_loam_old.png diff --git a/init.lua b/init.lua index 4bd9b5e..df738ca 100644 --- a/init.lua +++ b/init.lua @@ -58,6 +58,39 @@ cottages.handmill_product[ 'default:coal_lump'] = 'dye:black 6'; cottages.handmill_max_per_turn = 20; cottages.handmill_min_per_turn = 0; +-- generalized function to register microblocks/stairs +cottages.derive_blocks = function( modname, nodename, nodedesc, tile, groups ) + + if stairs and stairs.mod and stairs.mod == "redo" then + + stairs.register_all(nodename, modname .. ":" .. nodename, + {snappy = 3, choppy = 3, oddly_breakable_by_hand = 3, flammable = 3}, + {tile}, + cottages.S(nodedesc .. " stair"), + cottages.S(nodedesc .. " slab"), + default.node_sound_wood_defaults()) + + elseif minetest.global_exists("stairsplus") then + + stairsplus:register_all(modname, nodename, modname .. ":" .. nodename, { + description = cottages.S(nodedesc), + tiles = {tile}, + groups = {snappy = 3, choppy = 3, oddly_breakable_by_hand = 3, flammable = 3}, + sounds = default.node_sound_wood_defaults(), + }) + + else + + stairs.register_stair_and_slab(nodename, modname .. ":" .. nodename, + {snappy = 3, choppy = 3, oddly_breakable_by_hand = 3, flammable = 3}, + {tile}, + cottages.S(nodedesc .. " stair"), + cottages.S(nodedesc .. " slab"), + default.node_sound_wood_defaults()) + + end + +end -- uncomment parts you do not want dofile(minetest.get_modpath("cottages").."/nodes_furniture.lua"); diff --git a/nodes_furniture.lua b/nodes_furniture.lua index fa3e24b..e14003d 100644 --- a/nodes_furniture.lua +++ b/nodes_furniture.lua @@ -602,6 +602,68 @@ minetest.register_node("cottages:washing", { }) +-- barrel for dry storage (think apples etc) + +minetest.register_node("cottages:storage_barrel", { + description = S("Storage barrel"), + paramtype = "light", + paramtype2 = "facedir", + drawtype = "mesh", + mesh = "cottages_barrel_closed.obj", + tiles = {"cottages_barrel_storage.png" }, + groups = { tree = 1, snappy = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2 }, + drop = "cottages:storage_barrel", + + on_construct = function(pos) + local meta = minetest.get_meta(pos); + meta:set_string("formspec", + "size[8,8]".. + "list[context;main;1.5,0;5,4;]".. + "list[current_player;main;0,4;8,4;]") + meta:set_string("infotext", S("Storage barrel")) + local inv = meta:get_inventory(); + inv:set_size("main", 24); + end, + + on_place = minetest.rotate_node, + + can_dig = function(pos, player) + if minetest.is_protected(pos, player:get_player_name()) then + return false + end + local meta = minetest.get_meta( pos ); + local inv = meta:get_inventory(); + return inv:is_empty("main"); + end, + + allow_metadata_inventory_put = function(pos, listname, index, stack, player) + if minetest.is_protected(pos, player:get_player_name()) then + return 0 + end + return stack:get_count() + end, + allow_metadata_inventory_take = function(pos, listname, index, stack, player) + if minetest.is_protected(pos, player:get_player_name()) then + return 0 + end + return stack:get_count() + end, + + on_metadata_inventory_put = function(pos, listname, index, stack, player) + local meta = minetest.get_meta( pos ); + meta:set_string('infotext', S('Storage barrel (in use)')); + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + local meta = minetest.get_meta( pos ); + local inv = meta:get_inventory(); + if( inv:is_empty("main")) then + meta:set_string('infotext', S('Storage barrel (empty)')); + end + end, + + is_ground_content = false, +}) + --------------------------------------------------------------------------------------- -- functions for sitting or sleeping --------------------------------------------------------------------------------------- @@ -909,3 +971,12 @@ minetest.register_craft({ {cottages.craftitem_steel, '', cottages.craftitem_steel}, } }) + +minetest.register_craft({ + output = "cottages:storage_barrel", + recipe = { + { cottages.craftitem_wood, "", cottages.craftitem_wood }, + { cottages.craftitem_steel, cottages.craftitem_chest, cottages.craftitem_steel}, + { cottages.craftitem_wood, cottages.craftitem_wood, cottages.craftitem_wood }, + }, +}) \ No newline at end of file diff --git a/nodes_historic.lua b/nodes_historic.lua index 44086e4..d8bb648 100644 --- a/nodes_historic.lua +++ b/nodes_historic.lua @@ -42,57 +42,9 @@ minetest.register_node("cottages:loam", { is_ground_content = false, }) --- create stairs if possible +-- register derivative blocks (stairs etc) - -if stairs and stairs.mod and stairs.mod == "redo" then - - stairs.register_all("loam", "cottages:loam", - {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2}, - {"cottages_loam.png"}, - S("Loam stair"), - S("Loam slab"), - default.node_sound_dirt_defaults()) - -elseif minetest.global_exists("stairsplus") then - - stairsplus:register_all("cottages", "loam", "cottages:loam", { - description = S("Loam"), - tiles = {"cottages_loam.png"}, - groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2}, - sounds = default.node_sound_dirt_defaults(), - }) - -else - - stairs.register_stair_and_slab("loam", "cottages:loam", - {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2}, - {"cottages_loam.png"}, - S("Loam stair"), - S("Loam slab"), - default.node_sound_dirt_defaults()) - - -end ---[[ -if( minetest.get_modpath("stairs") and stairs and stairs.register_stair_and_slab) then - - stairs.register_stair_and_slab("loam", "cottages:loam", - {snappy=2,choppy=2,oddly_breakable_by_hand=2}, - {"cottages_loam.png"}, - S("Loam stairs"), - S("Loam slab"), - default.node_sound_dirt_defaults()) - - if( minetest.registered_nodes["default:clay"]) then - stairs.register_stair_and_slab("clay", "default:clay", - {crumbly=3}, - {"cottages_clay.png"}, - S("Clay stairs"), - S("Clay slab"), - default.node_sound_dirt_defaults()) - end -end]] +cottages.derive_blocks( "cottages", "loam", "Loam", "cottages_loam.png", {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2} ) -- straw is a common material for places where animals are kept indoors diff --git a/nodes_roof.lua b/nodes_roof.lua index 13a6f0e..f865b6d 100644 --- a/nodes_roof.lua +++ b/nodes_roof.lua @@ -7,6 +7,7 @@ local S = cottages.S -- a better roof than the normal stairs; can be replaced by stairs:stair_wood + -- create the three basic roof parts plus receipes for them; cottages.register_roof = function( name, tiles, basic_material, homedecor_alternative ) @@ -182,6 +183,11 @@ cottages.register_roof( 'slate', cottages.texture_roof_sides,"cottages_slate.png"}, cottages.craftitem_stone, nil); +cottages.register_roof( 'shingle', + {"cottages_homedecor_shingles_misc_wood.png", cottages.texture_roof_sides, + cottages.texture_roof_sides, cottages.texture_roof_sides, + cottages.texture_roof_sides, "cottages_homedecor_shingles_misc_wood.png"}, + 'cottages:wood_flat', nil); --------------------------------------------------------------------------------------- -- slate roofs are sometimes on vertical fronts of houses @@ -200,44 +206,13 @@ minetest.register_node("cottages:slate_vertical", { is_ground_content = false, }) - minetest.register_craft({ output = "cottages:slate_vertical 2", recipe = { {cottages.craftitem_stone, cottages.craftitem_wood, '' } } }); - - -if stairs and stairs.mod and stairs.mod == "redo" then - - stairs.register_all("slate_vertical", "cottages:slate_vertical", - {cracky = 2, stone = 1}, - {"cottages_slate.png"}, - S("Slate stair"), - S("Slate slab"), - default.node_sound_dirt_defaults()) - -elseif minetest.global_exists("stairsplus") then - - stairsplus:register_all("cottages", "slate_vertical", "cottages:slate_vertical", { - description = S("Slate"), - tiles = {"cottages_slate.png"}, - groups = {cracky = 2, stone = 1}, - sounds = default.node_sound_dirt_defaults(), - }) - -else - - stairs.register_stair_and_slab("slate_vertical", "cottages:slate_vertical", - {cracky = 2, stone = 1}, - {"cottages_slate.png"}, - S("Slate stair"), - S("Slate slab"), - default.node_sound_dirt_defaults()) - - -end +cottages.derive_blocks( "cottages", "slate_vertical", "Slate", "cottages_slate.png", {cracky = 2, stone = 1} ) --------------------------------------------------------------------------------------- @@ -254,44 +229,14 @@ minetest.register_node("cottages:roof_vertical_asphalt", { is_ground_content = false, }) - minetest.register_craft({ output = "cottages:roof_vertical_asphalt 3", recipe = { {cottages.craftitem_stone, cottages.craftitem_wood, cottages.craftitem_coal_lump } } }); +cottages.derive_blocks( "cottages", "roof_vertical_asphalt", "Asphalt", "cottages_homedecor_shingles_asphalt.png", {cracky = 2, stone = 1} ) - -if stairs and stairs.mod and stairs.mod == "redo" then - - stairs.register_all("roof_vertical_asphalt", "cottages:roof_vertical_asphalt", - {cracky = 2, stone = 1}, - {"cottages_homedecor_shingles_asphalt.png"}, - S("Asphalt stair"), - S("Asphalt slab"), - default.node_sound_dirt_defaults()) - -elseif minetest.global_exists("stairsplus") then - - stairsplus:register_all("cottages", "roof_vertical_asphalt", "cottages:roof_vertical_asphalt", { - description = S("Asphalt"), - tiles = {"cottages_homedecor_shingles_asphalt.png"}, - groups = {cracky = 2, stone = 1}, - sounds = default.node_sound_dirt_defaults(), - }) - -else - - stairs.register_stair_and_slab("roof_vertical_asphalt", "cottages:roof_vertical_asphalt", - {cracky = 2, stone = 1}, - {"cottages_homedecor_shingles_asphalt.png"}, - S("Asphalt stair"), - S("Asphalt slab"), - default.node_sound_dirt_defaults()) - - -end --------------------------------------------------------------------------------------- @@ -308,44 +253,13 @@ minetest.register_node("cottages:roof_vertical_terracotta", { is_ground_content = false, }) - minetest.register_craft({ output = "cottages:roof_vertical_terracotta 3", recipe = { {cottages.craftitem_stone, cottages.craftitem_wood, cottages.craftitem_clay_brick } } }); - - -if stairs and stairs.mod and stairs.mod == "redo" then - - stairs.register_all("roof_vertical_terracotta", "cottages:roof_vertical_terracotta", - {cracky = 2, stone = 1}, - {"cottages_homedecor_shingles_terracotta.png"}, - S("Terracotta stair"), - S("Terracotta slab"), - default.node_sound_dirt_defaults()) - -elseif minetest.global_exists("stairsplus") then - - stairsplus:register_all("cottages", "roof_vertical_terracotta", "cottages:roof_vertical_terracotta", { - description = S("Terracotta"), - tiles = {"cottages_homedecor_shingles_terracotta.png"}, - groups = {cracky = 2, stone = 1}, - sounds = default.node_sound_dirt_defaults(), - }) - -else - - stairs.register_stair_and_slab("roof_vertical_terracotta", "cottages:roof_vertical_terracotta", - {cracky = 2, stone = 1}, - {"cottages_homedecor_shingles_terracotta.png"}, - S("Terracotta stair"), - S("Terracotta slab"), - default.node_sound_dirt_defaults()) - - -end +cottages.derive_blocks( "cottages", "roof_vertical_terracotta", "Terracotta", "cottages_homedecor_shingles_terracotta.png", {cracky = 2, stone = 1} ) @@ -363,44 +277,15 @@ minetest.register_node("cottages:roof_vertical_wood", { is_ground_content = false, }) - minetest.register_craft({ output = "cottages:roof_vertical_wood 3", recipe = { {cottages.craftitem_stone, cottages.craftitem_wood, "default:tree" } } }); +cottages.derive_blocks( "cottages", "roof_vertical_wood", "Wooden", cottages.textures_roof_wood, {cracky = 2, stone = 1} ) + - -if stairs and stairs.mod and stairs.mod == "redo" then - - stairs.register_all("roof_vertical_wood", "cottages:roof_vertical_wood", - {cracky = 2, stone = 1}, - {cottages.textures_roof_wood}, - S("Wooden roof stair"), - S("Wooden roof slab"), - default.node_sound_dirt_defaults()) - -elseif minetest.global_exists("stairsplus") then - - stairsplus:register_all("cottages", "roof_vertical_wood", "cottages:roof_vertical_wood", { - description = S("Wooden roof"), - tiles = {cottages.textures_roof_wood}, - groups = {cracky = 2, stone = 1}, - sounds = default.node_sound_dirt_defaults(), - }) - -else - - stairs.register_stair_and_slab("roof_vertical_wood", "cottages:roof_vertical_wood", - {cracky = 2, stone = 1}, - {cottages.textures_roof_wood}, - S("Wooden roof stair"), - S("Wooden roof slab"), - default.node_sound_dirt_defaults()) - - -end --------------------------------------------------------------------------------------- -- brown shingles roof: sawable block @@ -416,44 +301,38 @@ minetest.register_node("cottages:roof_vertical_brown", { is_ground_content = false, }) - minetest.register_craft({ output = "cottages:roof_vertical_brown 3", recipe = { {cottages.craftitem_stone, cottages.craftitem_wood, cottages.craftitem_dirt } } }); +cottages.derive_blocks( "cottages", "roof_vertical_brown", "Shingles", "cottages_homedecor_shingles_wood.png", {cracky = 2, stone = 1} ) - -if stairs and stairs.mod and stairs.mod == "redo" then - - stairs.register_all("roof_vertical_brown", "cottages:roof_vertical_brown", - {cracky = 2, stone = 1}, - {"cottages_homedecor_shingles_wood.png"}, - S("Shingles stair"), - S("Shingles slab"), - default.node_sound_dirt_defaults()) - -elseif minetest.global_exists("stairsplus") then - - stairsplus:register_all("cottages", "roof_vertical_brown", "cottages:roof_vertical_brown", { - description = S("Shingles"), - tiles = {"cottages_homedecor_shingles_wood.png"}, - groups = {cracky = 2, stone = 1}, - sounds = default.node_sound_dirt_defaults(), - }) - -else - stairs.register_stair_and_slab("roof_vertical_brown", "cottages:roof_vertical_brown", - {cracky = 2, stone = 1}, - {"cottages_homedecor_shingles_wood.png"}, - S("Shingles stair"), - S("Shingles slab"), - default.node_sound_dirt_defaults()) - - -end + +--------------------------------------------------------------------------------------- +-- assorted shingles roof: sawable block +--------------------------------------------------------------------------------------- +minetest.register_node("cottages:roof_vertical_shingle", { + description = S("Vertical misc shingle roof"), + tiles = {"cottages_homedecor_shingles_misc_wood.png", cottages.texture_roof_sides, + "cottages_homedecor_shingles_misc_wood.png", "cottages_homedecor_shingles_misc_wood.png", + cottages.texture_roof_sides, "cottages_homedecor_shingles_misc_wood.png"}, + paramtype2 = "facedir", + groups = {cracky=2, stone=1}, + sounds = default.node_sound_stone_defaults, + is_ground_content = false, +}) + +minetest.register_craft({ + output = "cottages:roof_vertical_shingle", + recipe = { {"cottages:wood_flat", "cottages:wood_flat"}, + {"cottages:wood_flat", "cottages:wood_flat"}, + }, +}) + +cottages.derive_blocks( "cottages", "roof_vertical_shingle", "Misc shingles", "cottages_homedecor_shingles_misc_wood.png", {cracky = 2, stone = 1} ) --------------------------------------------------------------------------------------- @@ -467,7 +346,6 @@ minetest.register_node("cottages:reet", { is_ground_content = false, }) - minetest.register_craft({ output = "cottages:reet", recipe = { {cottages.craftitem_papyrus, cottages.craftitem_papyrus}, @@ -475,34 +353,4 @@ minetest.register_craft({ }, }) - - -if stairs and stairs.mod and stairs.mod == "redo" then - - stairs.register_all("reet", "cottages:reet", - {snappy = 3, choppy = 3, oddly_breakable_by_hand = 3, flammable = 3}, - {"cottages_reet.png"}, - S("Reet stair"), - S("Reet slab"), - default.node_sound_wood_defaults()) - -elseif minetest.global_exists("stairsplus") then - - stairsplus:register_all("cottages", "reet", "cottages:reet", { - description = S("Reet"), - tiles = {"cottages_reet.png"}, - groups = {snappy = 3, choppy = 3, oddly_breakable_by_hand = 3, flammable = 3}, - sounds = default.node_sound_wood_defaults(), - }) - -else - - stairs.register_stair_and_slab("reet", "cottages:reet", - {snappy = 3, choppy = 3, oddly_breakable_by_hand = 3, flammable = 3}, - {"cottages_reet.png"}, - S("Reet stair"), - S("Reet slab"), - default.node_sound_wood_defaults()) - - -end \ No newline at end of file +cottages.derive_blocks( "cottages", "reet", "Reet", "cottages_reet.png", {snappy = 3, choppy = 3, oddly_breakable_by_hand = 3, flammable = 3} ) diff --git a/nodes_straw.lua b/nodes_straw.lua index 6a520fc..9d9a8e3 100644 --- a/nodes_straw.lua +++ b/nodes_straw.lua @@ -588,54 +588,17 @@ minetest.register_craft({ ----- -- Derivative blocks for straw blocks (bale and regular) ----- - -if stairs and stairs.mod and stairs.mod == "redo" then - - stairs.register_all("straw_bale", "cottages:straw_bale", - {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3}, - {"cottages_darkage_straw_bale.png"}, - S("Straw bale stair"), - S("Straw bale slab"), - default.node_sound_wood_defaults()) - - stairs.register_all("straw", "cottages:straw", - {snappy = 3, choppy = 3, oddly_breakable_by_hand = 3, flammable = 3}, - {"cottages_darkage_straw.png"}, - S("Straw block stair"), - S("Straw block slab"), - default.node_sound_wood_defaults()) - -elseif minetest.global_exists("stairsplus") then - - stairsplus:register_all("cottages", "straw_bale", "cottages:straw_bale", { - description = S("Straw bale"), - tiles = {"cottages_darkage_straw_bale.png"}, - groups = {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3}, - sounds = default.node_sound_wood_defaults(), - }) - - stairsplus:register_all("cottages", "straw", "cottages:straw", { - description = S("Straw block"), - tiles = {"cottages_darkage_straw.png"}, - groups = {snappy = 3, choppy = 3, oddly_breakable_by_hand = 3, flammable = 3}, - sounds = default.node_sound_wood_defaults(), - }) - -else - - stairs.register_stair_and_slab("straw_bale", "cottages:straw_bale", - {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3}, - {"cottages_darkage_straw_bale.png"}, - S("Straw bale stair"), - S("Straw bale slab"), - default.node_sound_wood_defaults()) - - stairs.register_stair_and_slab("straw", "cottages:straw", - {snappy = 3, choppy = 3, oddly_breakable_by_hand = 3, flammable = 3}, - {"cottages_darkage_straw.png"}, - S("Straw block stair"), - S("Straw block slab"), - default.node_sound_wood_defaults()) - - -end \ No newline at end of file + +cottages.derive_blocks( "cottages", + "straw_bale", + "Straw bale", + "cottages_darkage_straw_bale.png", + {snappy = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 3} ) + + +cottages.derive_blocks( "cottages", + "straw", + "Straw block", + "cottages_darkage_straw.png", + {snappy = 3, choppy = 3, oddly_breakable_by_hand = 3, flammable = 3} ) + diff --git a/textures/cottages_barrel_storage.png b/textures/cottages_barrel_storage.png new file mode 100644 index 0000000..d5bed69 Binary files /dev/null and b/textures/cottages_barrel_storage.png differ diff --git a/textures/cottages_homedecor_shingles_misc_wood.png b/textures/cottages_homedecor_shingles_misc_wood.png new file mode 100644 index 0000000..0f57462 Binary files /dev/null and b/textures/cottages_homedecor_shingles_misc_wood.png differ diff --git a/textures/cottages_loam_old.png b/textures/cottages_loam_old.png deleted file mode 100644 index bdf058f..0000000 Binary files a/textures/cottages_loam_old.png and /dev/null differ diff --git a/textures/cottages_wagonwheel.png b/textures/cottages_wagonwheel.png index 6175bba..3ef5f0f 100644 Binary files a/textures/cottages_wagonwheel.png and b/textures/cottages_wagonwheel.png differ -- cgit v1.2.3