diff --git a/models/feldweg_45.b3d b/models/feldweg_45.b3d new file mode 100644 index 0000000..3a0be88 Binary files /dev/null and b/models/feldweg_45.b3d differ diff --git a/models/feldweg_d_45.b3d b/models/feldweg_d_45.b3d new file mode 100644 index 0000000..241ef48 Binary files /dev/null and b/models/feldweg_d_45.b3d differ diff --git a/models/feldweg_l_45_curve.b3d b/models/feldweg_l_45_curve.b3d new file mode 100644 index 0000000..0b913c0 Binary files /dev/null and b/models/feldweg_l_45_curve.b3d differ diff --git a/models/feldweg_r_45_curve.b3d b/models/feldweg_r_45_curve.b3d new file mode 100644 index 0000000..37119c3 Binary files /dev/null and b/models/feldweg_r_45_curve.b3d differ diff --git a/models/feldweg_s_45.b3d b/models/feldweg_s_45.b3d new file mode 100644 index 0000000..b080d1a Binary files /dev/null and b/models/feldweg_s_45.b3d differ diff --git a/nodes_feldweg.lua b/nodes_feldweg.lua index 9205952..b86b937 100644 --- a/nodes_feldweg.lua +++ b/nodes_feldweg.lua @@ -19,53 +19,301 @@ local cottages_feldweg_mode = minetest.settings:get("cottages_feldweg_mode") if( cottages_feldweg_mode ~= "mesh" and cottages_feldweg_mode ~= "flat" and cottages_feldweg_mode ~= "nodebox" - and cottages_feldweg_mode ~= "flat") then + and cottages_feldweg_mode ~= "mesh_incl_45") then cottages_feldweg_mode = "mesh"; -- add the setting to the minetest.conf so that the player can set it there minetest.settings:set("cottages_feldweg_mode", "mesh") end -local function register_recipes(include_end) + +local function register_recipes(include_end, postfix, base_craftitem) + if(not(postfix)) then + postfix = "" + end + if(not(base_craftitem)) then + base_craftitem = cottages.craftitem_dirt + end + local base_node = "cottages:feldweg"..postfix + + -- run a wagon wheel over dirt :-) minetest.register_craft({ - output = "cottages:feldweg_crossing 5", + output = "cottages:feldweg"..postfix.." 4", recipe = { - {"", "cottages:feldweg", "" }, - {"cottages:feldweg", "cottages:feldweg", "cottages:feldweg"}, - {"", "cottages:feldweg", "" }, + {"", "cottages:wagon_wheel", "" }, + {base_craftitem, base_craftitem, base_craftitem} + }, + replacements = { {'cottages:wagon_wheel', 'cottages:wagon_wheel'}, } + }) + + + minetest.register_craft({ + output = "cottages:feldweg_crossing"..postfix.." 5", + recipe = { + {"", base_node, "" }, + {base_node, base_node, base_node}, + {"", base_node, "" }, }, }) minetest.register_craft({ - output = "cottages:feldweg_t_junction 5", + output = "cottages:feldweg_t_junction"..postfix.." 5", recipe = { - {"", "cottages:feldweg", "" }, - {"", "cottages:feldweg", "" }, - {"cottages:feldweg", "cottages:feldweg", "cottages:feldweg"} + {"", base_node, "" }, + {"", base_node, "" }, + {base_node, base_node, base_node} }, }) minetest.register_craft({ - output = "cottages:feldweg_curve 5", + output = "cottages:feldweg_curve"..postfix.." 5", recipe = { - {"cottages:feldweg", "", "" }, - {"cottages:feldweg", "", ""}, - {"cottages:feldweg", "cottages:feldweg", "cottages:feldweg"} + {base_node, "", "" }, + {base_node, "", ""}, + {base_node, base_node, base_node} }, }) if include_end then minetest.register_craft({ - output = "cottages:feldweg_end 5", + output = "cottages:feldweg_end"..postfix.." 5", recipe = { - {"cottages:feldweg", "", "cottages:feldweg" }, - {"cottages:feldweg", "cottages:feldweg", "cottages:feldweg"} + {base_node, "", base_node }, + {base_node, base_node, base_node} }, }) end + + -- if the 45 degree version is loaded + if(minetest.registered_nodes["cottages:feldweg_45"..postfix]) then + minetest.register_craft({ + output = "cottages:feldweg_45"..postfix, + recipe = {{base_node}} + }) + minetest.register_craft({ + output = "cottages:feldweg_l_curve"..postfix, + recipe = {{"cottages:feldweg_45"..postfix}} + }) + minetest.register_craft({ + output = "cottages:feldweg_r_curve"..postfix, + recipe = {{"cottages:feldweg_l_curve"..postfix}} + }) + minetest.register_craft({ + output = "cottages:feldweg_s_45"..postfix, + recipe = {{"cottages:feldweg_r_curve"..postfix}} + }) + minetest.register_craft({ + output = "cottages:feldweg_d_45"..postfix, + recipe = {{"cottages:feldweg_s_45"..postfix}} + }) + minetest.register_craft({ + output = "cottages:feldweg"..postfix, + recipe = {{"cottages:feldweg_d_45"..postfix}} + }) + end end + +-- those can be offered in diffrent variants... +cottages.register_nodes_mesh = function(postfix, texture_top, texture_bottom, texture_side, cottages_feldweg_mode, name_postfix) + -- a nice dirt road for small villages or paths to fields + minetest.register_node("cottages:feldweg"..postfix, { + description = S("dirt road"..name_postfix), + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + groups = {crumbly=3}, + sounds = cottages.sounds.dirt, + is_ground_content = false, + tiles = {"cottages_feldweg_end.png", + -- "default_dirt.png^default_grass_side.png", "default_dirt.png", "default_grass.png", + texture_side, texture_bottom, texture_top, + "cottages_feldweg_surface.png", + "cottages_feldweg_surface.png^cottages_feldweg_edges.png"}, + paramtype = "light", + drawtype = "mesh", + mesh = "feldweg.obj", + }) + + + minetest.register_node("cottages:feldweg_crossing"..postfix, { + description = S("dirt road crossing"..name_postfix), + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + groups = {crumbly=3}, + sounds = cottages.sounds.dirt, + is_ground_content = false, + tiles = {"cottages_feldweg_end.png", + --"default_dirt.png", "default_grass.png", + texture_bottom, texture_top, + "cottages_feldweg_surface.png", + "cottages_feldweg_surface.png^cottages_feldweg_edges.png"}, + paramtype = "light", + drawtype = "mesh", + mesh = "feldweg-crossing.obj", + }) + + minetest.register_node("cottages:feldweg_t_junction"..postfix, { + description = S("dirt road t junction"..name_postfix), + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + groups = {crumbly=3}, + sounds = cottages.sounds.dirt, + is_ground_content = false, + tiles = {"cottages_feldweg_end.png", + -- "default_dirt.png^default_grass_side.png", "default_dirt.png", "default_grass.png", + texture_side, texture_bottom, texture_top, + "cottages_feldweg_surface.png", + "cottages_feldweg_surface.png^cottages_feldweg_edges.png"}, + paramtype = "light", + drawtype = "mesh", + mesh = "feldweg-T-junction.obj", + }) + + minetest.register_node("cottages:feldweg_curve"..postfix, { + description = S("dirt road curve"..name_postfix), + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + groups = {crumbly=3}, + sounds = cottages.sounds.dirt, + is_ground_content = false, + tiles = { + -- "default_dirt.png^default_grass_side.png","default_grass.png", + texture_side, texture_top, + -- "default_dirt.png^default_grass_side.png", + texture_side, + "cottages_feldweg_surface.png", + -- "default_dirt.png", + texture_bottom, + "cottages_feldweg_surface.png^cottages_feldweg_edges.png"}, + -- "default_dirt.png^default_grass_side.png", "default_dirt.png", "default_grass.png", + texture_side, texture_bottom, texture_top, + paramtype = "light", + drawtype = "mesh", + mesh = "feldweg-curve.obj", + }) + + minetest.register_node("cottages:feldweg_end"..postfix, { + description = S("dirt road end"..name_postfix), + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + groups = {crumbly=3}, + sounds = cottages.sounds.dirt, + is_ground_content = false, + tiles = {"cottages_feldweg_end.png", + -- "default_dirt.png^default_grass_side.png", "default_dirt.png", "default_grass.png", + texture_side, texture_bottom, texture_top, + "cottages_feldweg_surface.png^cottages_feldweg_edges.png", + "cottages_feldweg_surface.png"}, + paramtype = "light", + drawtype = "mesh", + mesh = "feldweg_end.obj", + }) + + if( cottages_feldweg_mode ~= "mesh_incl_45" ) then + return + end + + -- new feldweg + minetest.register_node("cottages:feldweg_45"..postfix, { + description = S("dirt road 45º"..name_postfix), + tiles = { + "cottages_feldweg_surface.png", + "cottages_feldweg_surface.png^cottages_feldweg_edges.png", + -- "default_dirt.png^default_grass_side.png", "default_dirt.png", "default_grass.png", + texture_side, texture_bottom, texture_top, + }, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,crumbly=3}, + drawtype = "mesh", + mesh = "feldweg_45.b3d", + paramtype = "light", + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + is_ground_content = true, + }) + + minetest.register_node("cottages:feldweg_s_45"..postfix, { + description = S("dirt road 45º edge"..name_postfix), + tiles = { + -- "default_grass.png", "default_dirt.png^default_grass_side.png", "default_dirt.png", + texture_top, texture_side, texture_bottom, + "cottages_feldweg_surface.png", + "cottages_feldweg_surface.png^cottages_feldweg_edges.png", + }, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,crumbly=3}, + drawtype = "mesh", + mesh = "feldweg_s_45.b3d", + paramtype = "light", + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + is_ground_content = true, + }) + + minetest.register_node("cottages:feldweg_d_45"..postfix, { + description = S("dirt road 45º double edge"..name_postfix), + tiles = { + -- "default_dirt.png^default_grass_side.png", "default_dirt.png", "default_grass.png", + texture_side, texture_bottom, texture_top, + "cottages_feldweg_surface.png^cottages_feldweg_edges.png", + "cottages_feldweg_surface.png", + }, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,crumbly=3}, + drawtype = "mesh", + mesh = "feldweg_d_45.b3d", + paramtype = "light", + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + is_ground_content = true, + }) + + minetest.register_node("cottages:feldweg_l_curve"..postfix, { + description = S("dirt road left curve"..name_postfix), + tiles = { + -- "default_dirt.png^default_grass_side.png", "default_dirt.png", "default_grass.png", + texture_side, texture_bottom, texture_top, + "cottages_feldweg_surface.png^cottages_feldweg_edges.png", + "cottages_feldweg_surface.png", + }, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,crumbly=3}, + drawtype = "mesh", + mesh = "feldweg_l_45_curve.b3d", + paramtype = "light", + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + is_ground_content = true, + }) + + minetest.register_node("cottages:feldweg_r_curve"..postfix, { + description = S("dirt road right curve"..name_postfix), + tiles = { + -- "default_dirt.png^default_grass_side.png", "default_dirt.png", "default_grass.png", + texture_side, texture_bottom, texture_top, + "cottages_feldweg_surface.png^cottages_feldweg_edges.png", + "cottages_feldweg_surface.png", + }, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,crumbly=3}, + drawtype = "mesh", + mesh = "feldweg_r_45_curve.b3d", + paramtype = "light", + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + is_ground_content = true, + }) +end + + + + --- a nice dirt road for small villages or paths to fields if( cottages_feldweg_mode == "simple" or cottages_feldweg_mode == "flat" ) then minetest.register_node("cottages:feldweg", { @@ -297,105 +545,67 @@ elseif( cottages_feldweg_mode == "nodebox" ) then -- -- the mesh version (rounded); provided and created by VanessaE -- -elseif( cottages_feldweg_mode == "mesh" ) then - - -- a nice dirt road for small villages or paths to fields - minetest.register_node("cottages:feldweg", { - description = S("dirt road"), - paramtype2 = "facedir", - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, - legacy_facedir_simple = true, - groups = {crumbly=3}, - sounds = cottages.sounds.dirt, - is_ground_content = false, - tiles = {"cottages_feldweg_end.png","default_dirt.png^default_grass_side.png", - "default_dirt.png", "default_grass.png", - "cottages_feldweg_surface.png", - "cottages_feldweg_surface.png^cottages_feldweg_edges.png"}, - paramtype = "light", - drawtype = "mesh", - mesh = "feldweg.obj", - }) +elseif( cottages_feldweg_mode == "mesh" + or cottages_feldweg_mode == "mesh_incl_45" ) then - minetest.register_node("cottages:feldweg_crossing", { - description = S("dirt road crossing"), - paramtype2 = "facedir", - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, - legacy_facedir_simple = true, - groups = {crumbly=3}, - sounds = cottages.sounds.dirt, - is_ground_content = false, - tiles = {"cottages_feldweg_end.png","default_dirt.png", - "default_grass.png","cottages_feldweg_surface.png", - "cottages_feldweg_surface.png^cottages_feldweg_edges.png"}, - paramtype = "light", - drawtype = "mesh", - mesh = "feldweg-crossing.obj", - }) + local variants = {} + variants["grass"] = { + "default_grass.png", -- grass top + "default_dirt.png", -- bottom + "default_dirt.png^default_grass_side.png", -- side + "", + "default:dirt", + "" + } + variants["gravel"] = { + "default_gravel.png", -- grass top + "default_gravel.png", -- bottom + "default_gravel.png", -- side + "_gravel", + "default:gravel", + " on gravel", + } + variants["coniferous"] = { + "default_coniferous_litter.png", -- grass top + "default_dirt.png", -- bottom + "default_dirt.png^default_coniferous_litter_side.png", -- side + "_coniferous", + "default:dirt_with_coniferous_litter", + " on coniferious litter", + } + variants["snow"] = { + "default_snow.png", -- grass top + "default_dirt.png", -- bottom + "default_dirt.png^default_snow_side.png", -- side + "_snow", + "default:dirt_with_snow", + " on snow", } + variants["dry"] = { + "default_dry_grass.png", -- grass top + "default_dirt.png", -- bottom + "default_dirt.png^default_dry_grass_side.png", -- side + "_dry", + "default:dry_dirt", + " on dry dirt", + } + variants["bamboo"] = { + "ethereal_grass_bamboo_top.png", -- grass top + "default_dirt.png", -- bottom + "default_dirt.png^ethereal_grass_bamboo_side.png", -- side + "_bamboo", + "ethereal:bamboo_dirt", + " on bamboo dirt", + } - - - minetest.register_node("cottages:feldweg_t_junction", { - description = S("dirt road t junction"), - paramtype2 = "facedir", - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, - legacy_facedir_simple = true, - groups = {crumbly=3}, - sounds = cottages.sounds.dirt, - is_ground_content = false, - tiles = {"cottages_feldweg_end.png","default_dirt.png^default_grass_side.png", "default_dirt.png", - "default_grass.png","cottages_feldweg_surface.png", - "cottages_feldweg_surface.png^cottages_feldweg_edges.png"}, - paramtype = "light", - drawtype = "mesh", - mesh = "feldweg-T-junction.obj", - }) - - - - minetest.register_node("cottages:feldweg_curve", { - description = S("dirt road curve"), - paramtype2 = "facedir", - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, - legacy_facedir_simple = true, - groups = {crumbly=3}, - sounds = cottages.sounds.dirt, - is_ground_content = false, - tiles = {"default_dirt.png^default_grass_side.png","default_grass.png", - "default_dirt.png^default_grass_side.png","cottages_feldweg_surface.png", - "default_dirt.png","cottages_feldweg_surface.png^cottages_feldweg_edges.png"}, - paramtype = "light", - drawtype = "mesh", - mesh = "feldweg-curve.obj", - }) - - - - minetest.register_node("cottages:feldweg_end", { - description = S("dirt road end"), - paramtype2 = "facedir", - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, - legacy_facedir_simple = true, - groups = {crumbly=3}, - sounds = cottages.sounds.dirt, - is_ground_content = false, - tiles = {"cottages_feldweg_end.png","default_dirt.png^default_grass_side.png", - "default_dirt.png", "default_grass.png", - "cottages_feldweg_surface.png^cottages_feldweg_edges.png", - "cottages_feldweg_surface.png"}, - paramtype = "light", - drawtype = "mesh", - mesh = "feldweg_end.obj", - }) - - - register_recipes(true) - - + for k, v in pairs(variants) do + cottages.register_nodes_mesh(v[4], v[1], v[2], v[3], cottages_feldweg_mode, v[6]) + register_recipes(true, v[4], v[5]) + end end + -- create stairs if possible if( minetest.get_modpath("stairs") and stairs and stairs.register_stair_and_slab) then stairs.register_stair_and_slab("feldweg", "cottages:feldweg", @@ -406,7 +616,9 @@ if( minetest.get_modpath("stairs") and stairs and stairs.register_stair_and_slab cottages.sounds.dirt) end -if( cottages_feldweg_mode == "nodebox" or cottages_feldweg_mode == "mesh" ) then +if( cottages_feldweg_mode == "nodebox" + or cottages_feldweg_mode == "mesh" + or cottages_feldweg_mode == "mesh_incl_45") then local box_slope = { type = "fixed", fixed = { diff --git a/nodes_historic.lua b/nodes_historic.lua index d3b2403..f88703f 100644 --- a/nodes_historic.lua +++ b/nodes_historic.lua @@ -204,16 +204,6 @@ minetest.register_craft({ } }) --- run a wagon wheel over dirt :-) -minetest.register_craft({ - output = "cottages:feldweg 4", - recipe = { - {"", "cottages:wagon_wheel", "" }, - {cottages.craftitem_dirt,cottages.craftitem_dirt,cottages.craftitem_dirt } - }, - replacements = { {'cottages:wagon_wheel', 'cottages:wagon_wheel'}, } -}) - minetest.register_craft({ output = "cottages:loam 4", recipe = {