diff --git a/crafts.lua b/crafts.lua new file mode 100644 index 0000000..2398049 --- /dev/null +++ b/crafts.lua @@ -0,0 +1,28 @@ +minetest.register_craft({ + output = "cg_decor:fence_bronze 16", + recipe = { + {"default:bronze_ingot", "", "default:bronze_ingot"}, + {"default:bronze_ingot", "default:bronze_ingot", "default:bronze_ingot"}, + {"default:bronze_ingot", "", "default:bronze_ingot"} + } + +}) + +minetest.register_craft({ +output = "cg_decor:fence_copper 16", + recipe = { + {"default:copper_ingot", "", "default:copper_ingot"}, + {"default:copper_ingot", "default:copper_ingot", "default:copper_ingot"}, + {"default:copper_ingot", "", "default:copper_ingot"} + } +}) + +minetest.register_craft({ +output = "cg_decor:fence_diamond 16", + recipe = { + {"default:diamond", "", "default:diamond"}, + {"default:diamond", "default:diamond", "default:diamond"}, + {"default:dimond", "", "default:diamond"} + } +}) + diff --git a/decoration.lua b/decoration.lua new file mode 100644 index 0000000..8d2e6fb --- /dev/null +++ b/decoration.lua @@ -0,0 +1,233 @@ +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_coniferous_litter"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.001, + spread = {x = 100, y = 100, z = 100}, + seed = 777, + octaves = 3, + persists = 0.6, + }, + --biomes = {"coniferous_forest"}, + y_max = 50, + y_min = 1, + decoration = "cg_decor:hydrangea_bush1", +}) + +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_coniferous_litter"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.001, + spread = {x = 100, y = 100, z = 100}, + seed = 778, + octaves = 3, + persists = 0.6, + }, + --biomes = {"coniferous_forest"}, + y_max = 50, + y_min = 1, + decoration = "cg_decor:hydrangea_bush2", +}) + +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_coniferous_litter"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.001, + spread = {x = 100, y = 100, z = 100}, + seed = 779, + octaves = 3, + persists = 0.6, + }, + --biomes = {"coniferous_forest"}, + y_max = 50, + y_min = 1, + decoration = "cg_decor:hydrangea_bush3", +}) + +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_coniferous_litter"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.001, + spread = {x = 100, y = 100, z = 100}, + seed = 7770, + octaves = 3, + persists = 0.6, + }, + --biomes = {"coniferous_forest"}, + y_max = 50, + y_min = 1, + decoration = "cg_decor:hydrangea_bush4", +}) + +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_coniferous_litter"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.001, + spread = {x = 100, y = 100, z = 100}, + seed = 7779, + octaves = 3, + persists = 0.6, + }, + --biomes = {"coniferous_forest"}, + y_max = 50, + y_min = 1, + decoration = "cg_decor:hydrangea_bush5", +}) + +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_coniferous_litter"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.001, + spread = {x = 100, y = 100, z = 100}, + seed = 7778, + octaves = 3, + persists = 0.6, + }, + --biomes = {"coniferous_forest"}, + y_max = 50, + y_min = 1, + decoration = "cg_decor:hydrangea_bush6", +}) + +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_coniferous_litter"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.001, + spread = {x = 100, y = 100, z = 100}, + seed = 7777, + octaves = 3, + persists = 0.6, + }, + --biomes = {"coniferous_forest"}, + y_max = 50, + y_min = 1, + decoration = "cg_decor:hydrangea_bush7", +}) + +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_coniferous_litter"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.001, + spread = {x = 100, y = 100, z = 100}, + seed = 7775, + octaves = 3, + persists = 0.6, + }, + --biomes = {"coniferous_forest"}, + y_max = 50, + y_min = 1, + decoration = "cg_decor:hydrangea_bush8", +}) + +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_coniferous_litter"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.001, + spread = {x = 100, y = 100, z = 100}, + seed = 7774, + octaves = 3, + persists = 0.6, + }, + --biomes = {"coniferous_forest"}, + y_max = 50, + y_min = 1, + decoration = "cg_decor:hydrangea_bush9", +}) + +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_coniferous_litter"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.001, + spread = {x = 100, y = 100, z = 100}, + seed = 7773, + octaves = 3, + persists = 0.6, + }, + --biomes = {"coniferous_forest"}, + y_max = 50, + y_min = 1, + decoration = "cg_decor:hydrangea_bush10", +}) + +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_coniferous_litter"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.001, + spread = {x = 100, y = 100, z = 100}, + seed = 7772, + octaves = 3, + persists = 0.6, + }, + --biomes = {"coniferous_forest"}, + y_max = 50, + y_min = 1, + decoration = "cg_decor:hydrangea_bush11", +}) + +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_coniferous_litter"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.001, + spread = {x = 100, y = 100, z = 100}, + seed = 7771, + octaves = 3, + persists = 0.6, + }, + --biomes = {"coniferous_forest"}, + y_max = 50, + y_min = 1, + decoration = "cg_decor:hydrangea_bush12", +}) + +minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_coniferous_litter"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.001, + spread = {x = 100, y = 100, z = 100}, + seed = 77777, + octaves = 3, + persists = 0.6, + }, + --biomes = {"coniferous_forest"}, + y_max = 50, + y_min = 1, + decoration = "cg_decor:hydrangea_bush13", +}) \ No newline at end of file diff --git a/init.lua b/init.lua index ab683d4..eca9026 100644 --- a/init.lua +++ b/init.lua @@ -1,10 +1,12 @@ cg_decor = {} - +local path = minetest.get_modpath("cg_decor") +dofile(path.."/crafts.lua") +dofile(path.."/decoration.lua") -------------------------------------------------------------------------------------------- -- Mulch ----------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------- -minetest.register_node("cg_decor:mulch", { +--[[minetest.register_node("cg_decor:mulch", { description = "Dirt with Mulch", tiles = {"cg_decor_mulch.png", "default_dirt.png", "default_dirt.png"}, is_ground_content = true, @@ -14,7 +16,7 @@ minetest.register_node("cg_decor:mulch", { footstep = {name="default_grass_footstep", gain=0.25}, }), }) - +]] -------------------------------------------------------------------------------------------- @@ -99,7 +101,7 @@ minetest.register_node("cg_decor:wall", { -- Blocks ---------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------- -if minetest.get_modpath("homedecor") then +--[[if minetest.get_modpath("homedecor") then end @@ -239,7 +241,7 @@ minetest.register_node("cg_decor:metal_roof_"..color.."_flat", { }) end - +]] minetest.register_craft({ output = 'cg_decor:floor_block_white 4', recipe = { @@ -270,11 +272,11 @@ local color_list = { } local ore_list = { - {"coal"}, - {"iron"}, - {"copper"}, - {"mese"}, - {"gold"}, + {"coal"}, + {"iron"}, + {"copper"}, + {"mese"}, + {"gold"}, {"diamond"} } @@ -395,7 +397,7 @@ for i in ipairs(color_list) do minetest.register_node("cg_decor:siding_"..color, { description = "Siding "..desc, tiles = {"cg_decor_siding_top.png^[colorize:"..value, "cg_decor_siding_top.png^[colorize:"..value.."^[transformR180", - "cg_decor_siding.png^[colorize:"..value, "cg_decor_siding.png^[colorize:"..value, + "cg_decor_siding.png^[colorize:"..value, "cg_decor_siding.png^[colorize:"..value, "cg_decor_siding_wall.png", "cg_decor_siding.png^[colorize:"..value}, paramtype = "light", paramtype2 = "facedir", @@ -417,7 +419,7 @@ for i in ipairs(color_list) do minetest.register_node("cg_decor:siding_"..color.."_insidecorner", { description = "Siding inside corner"..desc, - tiles = {"cg_decor_siding.png^[colorize:"..value, "cg_decor_siding.png^[colorize:"..value, + tiles = {"cg_decor_siding.png^[colorize:"..value, "cg_decor_siding.png^[colorize:"..value, "cg_decor_siding_wall.png", "cg_decor_siding.png^[colorize:"..value.."^(cg_decor_corner_overlay.png^[transformR180)", "cg_decor_siding_wall.png", "cg_decor_siding.png^[colorize:"..value.."^cg_decor_corner_overlay.png"}, paramtype = "light", @@ -428,8 +430,8 @@ for i in ipairs(color_list) do minetest.register_node("cg_decor:siding_"..color.."_corner", { description = "Siding corner "..desc, - tiles = {"cg_decor_siding_corner_top.png^[colorize:"..value, "cg_decor_siding_corner_top.png^[colorize:"..value.."^[transformR270", - "cg_decor_siding.png^[colorize:"..value.."^cg_decor_corner_overlay2.png", "cg_decor_siding.png^[colorize:"..value.."^(cg_decor_corner_overlay.png^[transformR180)", + tiles = {"cg_decor_siding_corner_top.png^[colorize:"..value, "cg_decor_siding_corner_top.png^[colorize:"..value.."^[transformR270", + "cg_decor_siding.png^[colorize:"..value.."^cg_decor_corner_overlay2.png", "cg_decor_siding.png^[colorize:"..value.."^(cg_decor_corner_overlay.png^[transformR180)", "cg_decor_siding.png^[colorize:"..value.."^(cg_decor_corner_overlay2.png^[transformR180)", "cg_decor_siding.png^[colorize:"..value.."^cg_decor_corner_overlay.png"}, paramtype = "light", paramtype2 = "facedir", @@ -443,7 +445,7 @@ for i in ipairs(color_list) do {-0.4375, 0.203899, -0.4375, -0.375, 0.5, 0.5}, {-0.4375, -0.12803, -0.4375, -0.375, 0.165964, 0.5}, {-0.4375, -0.456797, -0.4375, -0.375, -0.172287, 0.5}, - {-0.5, -0.5, -0.5, -0.3125, 0.5, -0.375}, + {-0.5, -0.5, -0.5, -0.3125, 0.5, -0.375}, {-0.5, -0.5, -0.5, -0.375, 0.5, -0.3125}, }}, selection_box = { @@ -546,8 +548,8 @@ local material_list = { {"Diamond", "default_diamond_block.png", "default:diamondblock"}, {"Mese", "default_mese_block.png", "default:mese" }, {"Bronze", "default_bronze_block.png", "default:bronzeblock" }, - {"Jungle_wood", "default_junglewood.png", "default:junglewood" }, - {"Acacia_wood", "default_acacia_wood.png", "default:acaciawood" }, + --{"Jungle_wood", "default_junglewood.png", "default:junglewood" }, + --{"Acacia_wood", "default_acacia_wood.png", "default:acaciawood" }, {"Obsidian", "default_obsidian.png", "default:obsidian" }, } @@ -623,7 +625,7 @@ function cg_decor.register_tree(treename, tree_image, drop) --global tree regist }) end - if not drop then + if not drop then drop_sm = "cg_decor:"..treename.."_tree" drop_lg = "cg_decor:"..treename.."_tree_large" else @@ -777,7 +779,7 @@ function cg_decor.register_tree(treename, tree_image, drop) --global tree regist minetest.spawn_item(pos, "cg_decor:"..treename.."_tree_large") return end - if (node2.name == "air" or node2.name == "ignore") and (node3.name == "air" or node3.name == "ignore") + if (node2.name == "air" or node2.name == "ignore") and (node3.name == "air" or node3.name == "ignore") and (node4.name == "air" or node4.name == "ignore") and (node5.name == "air" or node5.name == "ignore") then minetest.add_node(pos, { name = "cg_decor:tree_trunk_base" }) minetest.add_node({x = pos.x, y = pos.y+1, z = pos.z}, { name = "cg_decor:tree_trunk" }) @@ -807,8 +809,8 @@ function cg_decor.register_tree(treename, tree_image, drop) --global tree regist minetest.spawn_item(pos, "cg_decor:"..treename.."_tree_extralarge") return end - if (node2.name == "air" or node2.name == "ignore") and (node3.name == "air" or node3.name == "ignore") - and (node4.name == "air" or node4.name == "ignore") and (node5.name == "air" or node5.name == "ignore") + if (node2.name == "air" or node2.name == "ignore") and (node3.name == "air" or node3.name == "ignore") + and (node4.name == "air" or node4.name == "ignore") and (node5.name == "air" or node5.name == "ignore") and (node6.name == "air" or node6.name == "ignore") then minetest.add_node(pos, { name = "cg_decor:tree_trunk_base" }) minetest.add_node({x = pos.x, y = pos.y+1, z = pos.z}, { name = "cg_decor:tree_trunk" }) @@ -848,7 +850,7 @@ function cg_decor.register_bush(name, scale, drop) --global bush register }) end - if not drop then + if not drop then drop = "cg_decor:"..name.."_bush" else drop = "cg_decor:"..drop.." 2" @@ -914,12 +916,12 @@ local hydrangea_list = { --some colors are listed more than once to create a mor for i in ipairs(hydrangea_list) do local value = hydrangea_list[i][2] local desc,desc_sm - if i == 1 then + if i == 1 then desc = "Hydrangea" desc_sm = "Hydrangea small" - else + else desc = "" - desc_sm = "" + desc_sm = "" end minetest.register_node("cg_decor:hydrangea_bush"..i, { description = desc, @@ -1256,61 +1258,61 @@ local apple_node = minetest.get_content_id("default:apple") function cg_decor.grow_tree(data, a, pos, is_apple_tree) local height = math.random(8, 14) - if is_apple_tree == true then height = 5 end + if is_apple_tree == true then height = 5 end for x_area = -3, 3 do for y_area = -2, 3 do for z_area = -3, 3 do - if math.random(1,30) < 23 and math.abs(x_area) + math.abs(z_area) < 5 - and math.abs(x_area) + math.abs(y_area) < 5 and math.abs(z_area) + math.abs(y_area) < 5 then - local area_l = a:index(pos.x+x_area, pos.y+height+y_area-1, pos.z+z_area) - if data[area_l] == air_node or data[area_l] == ignore_node then - if is_apple_tree and math.random(1, 50) <= 10 then - data[area_l] = apple_node - else - data[area_l] = leaf_node + if math.random(1,30) < 23 and math.abs(x_area) + math.abs(z_area) < 5 + and math.abs(x_area) + math.abs(y_area) < 5 and math.abs(z_area) + math.abs(y_area) < 5 then + local area_l = a:index(pos.x+x_area, pos.y+height+y_area-1, pos.z+z_area) + if data[area_l] == air_node or data[area_l] == ignore_node then + if is_apple_tree and math.random(1, 50) <= 10 then + data[area_l] = apple_node + else + data[area_l] = leaf_node end end - end + end end end end - for tree_h = 0, height-1 do - local area_t = a:index(pos.x, pos.y+tree_h, pos.z) + for tree_h = 0, height-1 do + local area_t = a:index(pos.x, pos.y+tree_h, pos.z) if data[area_t] == air_node or data[area_t] == rleaf_node or data[area_t] == ignore_node - or data[area_t] == leaf_node or data[area_t] == jleaf_node or data[area_t] == dleaf_node + or data[area_t] == leaf_node or data[area_t] == jleaf_node or data[area_t] == dleaf_node or data[area_t] == djleaf_node or data[area_t] == apple_node then - data[area_t] = tree_node + data[area_t] = tree_node end end end function cg_decor.grow_jungletree(data, a, pos) - + local height = math.random(11, 20) for x_area = -5, 5 do for y_area = -4, 4 do for z_area = -5, 5 do - if math.random(1,30) < 23 and math.abs(x_area) + math.abs(z_area) < 8 - and math.abs(x_area) + math.abs(y_area) < 8 and math.abs(z_area) + math.abs(y_area) < 8 then - local area_l = a:index(pos.x+x_area, pos.y+height+y_area-1, pos.z+z_area) - if data[area_l] == air_node or data[area_l] == ignore_node then - data[area_l] = jleaf_node - end - end + if math.random(1,30) < 23 and math.abs(x_area) + math.abs(z_area) < 8 + and math.abs(x_area) + math.abs(y_area) < 8 and math.abs(z_area) + math.abs(y_area) < 8 then + local area_l = a:index(pos.x+x_area, pos.y+height+y_area-1, pos.z+z_area) + if data[area_l] == air_node or data[area_l] == ignore_node then + data[area_l] = jleaf_node + end + end end end end - for tree_h = 0, height-1 do - local area_t = a:index(pos.x, pos.y+tree_h, pos.z) + for tree_h = 0, height-1 do + local area_t = a:index(pos.x, pos.y+tree_h, pos.z) if data[area_t] == air_node or data[area_t] == rleaf_node or data[area_t] == ignore_node - or data[area_t] == leaf_node or data[area_t] == jleaf_node or data[area_t] == dleaf_node - or data[area_t] == djleaf_node then - data[area_t] = jtree_node + or data[area_t] == leaf_node or data[area_t] == jleaf_node or data[area_t] == dleaf_node + or data[area_t] == djleaf_node then + data[area_t] = jtree_node end end for roots_x = -1, 1 do for roots_z = -1, 1 do - if math.random(1, 3) >= 2 then + if math.random(1, 3) >= 2 then if a:contains(pos.x+roots_x, pos.y-1, pos.z+roots_z) and data[a:index(pos.x+roots_x, pos.y-1, pos.z+roots_z)] == air_node then data[a:index(pos.x+roots_x, pos.y-1, pos.z+roots_z)] = jtree_node elseif a:contains(pos.x+roots_x, pos.y, pos.z+roots_z) and data[a:index(pos.x+roots_x, pos.y, pos.z+roots_z)] == air_node then @@ -1324,50 +1326,50 @@ end function cg_decor.grow_redwood(data, a, pos) local rtree_node = minetest.get_content_id("cg_decor:redwood_tree") - local rleaf_node = minetest.get_content_id("cg_decor:redwood_leaves") + local rleaf_node = minetest.get_content_id("cg_decor:redwood_leaves") local height = math.random(40, 60) local giant = math.random(1,72) if giant == (15 or 28) then --random giant redwoods - height = math.random(70, 90) - elseif giant == 36 then + height = math.random(70, 90) + elseif giant == 36 then height = math.random(90, 120) - end + end for x_area = -8, 8 do for y_area = -12, 12 do for z_area = -8, 8 do - if math.random(1,30) < 20 and math.abs(x_area) + math.abs(z_area) < 14 - and math.abs(x_area) + math.abs(y_area) < 17 and math.abs(z_area) + math.abs(y_area) < 17 then - local area_l = a:index(pos.x+x_area, pos.y+height+y_area-5, pos.z+z_area) - if data[area_l] == air_node or data[area_l] == ignore_node then - if math.random(1, 30) >= 28 and math.abs(x_area) < 5 + if math.random(1,30) < 20 and math.abs(x_area) + math.abs(z_area) < 14 + and math.abs(x_area) + math.abs(y_area) < 17 and math.abs(z_area) + math.abs(y_area) < 17 then + local area_l = a:index(pos.x+x_area, pos.y+height+y_area-5, pos.z+z_area) + if data[area_l] == air_node or data[area_l] == ignore_node then + if math.random(1, 30) >= 28 and math.abs(x_area) < 5 and math.abs(z_area) < 5 and math.abs(y_area) < 9 then - data[area_l] = rtree_node + data[area_l] = rtree_node else - data[area_l] = rleaf_node + data[area_l] = rleaf_node end - end - end + end + end end end end - for tree_h = -5, height-1 do + for tree_h = -5, height-1 do for x_dir = -1, 1 do for z_dir = -1, 1 do - if math.abs(x_dir) + math.abs(z_dir) == 1 then - local area_t = a:index(pos.x+x_dir, pos.y+tree_h, pos.z+z_dir) + if math.abs(x_dir) + math.abs(z_dir) == 1 then + local area_t = a:index(pos.x+x_dir, pos.y+tree_h, pos.z+z_dir) if data[area_t] == air_node or data[area_t] == rleaf_node or data[area_t] == ignore_node - or data[area_t] == leaf_node or data[area_t] == jleaf_node or data[area_t] == dleaf_node - or data[area_t] == djleaf_node then - data[area_t] = rtree_node + or data[area_t] == leaf_node or data[area_t] == jleaf_node or data[area_t] == dleaf_node + or data[area_t] == djleaf_node then + data[area_t] = rtree_node end elseif x_dir == 0 and z_dir == 0 and tree_h > 0 then - local area_a = a:index(pos.x+x_dir, pos.y+tree_h, pos.z+z_dir) + local area_a = a:index(pos.x+x_dir, pos.y+tree_h, pos.z+z_dir) data[area_a] = air_node end end end end - local area_tt = a:index(pos.x, pos.y+height, pos.z) + local area_tt = a:index(pos.x, pos.y+height, pos.z) data[area_tt] = rtree_node end @@ -1376,7 +1378,7 @@ function cg_decor.can_grow_on(pos, type) local is_type = minetest.get_item_group(nu, type) if is_type == 0 then return true - end + end end function cg_decor.add_tree_to_map(vm, data)