From 2d1f1b2e4d26b8d2d9441b902a235d3414a66704 Mon Sep 17 00:00:00 2001 From: Shad MOrdre Date: Wed, 4 Sep 2019 09:56:07 -0700 Subject: [PATCH] Delete deco_conifer.lua --- valleys_c/deco_conifer.lua | 193 ------------------------------------- 1 file changed, 193 deletions(-) delete mode 100644 valleys_c/deco_conifer.lua diff --git a/valleys_c/deco_conifer.lua b/valleys_c/deco_conifer.lua deleted file mode 100644 index d2228ee..0000000 --- a/valleys_c/deco_conifer.lua +++ /dev/null @@ -1,193 +0,0 @@ -------------------- --- Conifer Trees -- -------------------- - --- Create different colored needles with the same properties. -newnode = lib_ecology.clone_node("default:pine_needles") -if lib_ecology.noleafdecay then - newnode.groups.leafdecay = 0 -end -newnode.tiles = {"default_pine_needles.png^[colorize:#FF0000:20"} -minetest.register_node("lib_ecology:pine_needles2", newnode) -newnode.tiles = {"default_pine_needles.png^[colorize:#FFFF00:20"} -minetest.register_node("lib_ecology:pine_needles3", newnode) -newnode.tiles = {"default_pine_needles.png^[colorize:#00FF00:20"} -minetest.register_node("lib_ecology:pine_needles4", newnode) - -if lib_ecology.glow then - minetest.register_node("lib_ecology:pine_tree_glowing_moss", { - description = "Pine tree with glowing moss", - tiles = {"default_pine_tree_top.png", "default_pine_tree_top.png", - "default_pine_tree.png^trunks_moss.png"}, - paramtype2 = "facedir", - is_ground_content = false, - light_source = 4, - drop = 'default:pine_tree', - groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2}, - sounds = default.node_sound_wood_defaults(), - - on_place = minetest.rotate_node - }) -end - - --- similar to the general tree schematic, but basically vertical -function lib_ecology.generate_conifer_schematic(trunk_height, radius, trunk, leaf) - local height = trunk_height + radius * 3 + 2 - local width = 2 * radius + 1 - local trunk_top = height - radius - 1 - local s = lib_ecology.schematic_array(width, height, width) - - -- the main trunk - local probs = {200,150,100,75,50,25} - for z = -radius,radius do - for y = 1,trunk_top do - -- Gives it a vaguely conical shape. - local r1 = math.ceil((height - y) / 4) - -- But rounded at the bottom. - if y == trunk_height + 1 then - r1 = r1 -1 - end - - for x = -radius,radius do - local i = (z+radius)*width*height + y*width + (x+radius) + 1 - local dist = math.round(math.sqrt(x^2 + z^2)) - if x == 0 and z == 0 then - if trunk == "default:pine_tree" and lib_ecology.glow and math.random(1,10) == 1 then - s.data[i].name = "lib_ecology:pine_tree_glowing_moss" - else - s.data[i].name = trunk - end - s.data[i].param1 = 255 - s.data[i].force_place = true - elseif y > trunk_height and dist <= r1 then - s.data[i].name = leaf - s.data[i].param1 = probs[dist] - end - end - end - end - - -- leaves at the top - for z = -1,1 do - for y = trunk_top, height-1 do - for x = -1,1 do - local i = (z+radius)*width*height + y*width + (x+radius) + 1 - if (x == 0 and z == 0) or y < height - 1 then - s.data[i].name = leaf - if x == 0 and z == 0 then - s.data[i].param1 = 255 - else - s.data[i].param1 = 200 - end - end - end - end - end - - return s -end - - --- the default pine schematic -function lib_ecology.generate_default_conifer_schematic(trunk, leaf) - local height = 13 + 1 - local width = 5 - local s = lib_ecology.schematic_array(width, height, width) - - -- the main trunk - local probs = {255,220,190} - - for p = 0,2 do - local c = math.floor(width / 2) - local y = height - p * 3 - 1 - for r = 0,2 do - for z = c-r,c+r do - for x = c-r,c+r do - local i = z*width*height + (y-r)*width + x + 1 - s.data[i].name = leaf - s.data[i].param1 = probs[r] - end - end - end - - s.yslice_prob = {} - for y = 1,height-3 do - local i = 2*width*height + y*width + 2 + 1 - if trunk == "default:pine_tree" and lib_ecology.glow and math.random(1,10) == 1 then - s.data[i].name = "lib_ecology:pine_tree_glowing_moss" - else - s.data[i].name = trunk - end - - s.data[i].param1 = 255 - s.data[i].force_place = true - - local j = (height - y - 1) / 3 - if j == 0 or j == 1 or j == 2 or y <= height - 11 then - s.yslice_prob[#s.yslice_prob+1] = {ypos=y,prob=170} - end - end - end - - return s -end - - --- generic conifers -lib_ecology.schematics.conifer_trees = {} -leaves = {"default:pine_needles", "lib_ecology:pine_needles2", "lib_ecology:pine_needles3", "lib_ecology:pine_needles4"} -for i = 1,#leaves do - local max_r = 4 - for r = 2,max_r do - local schem = lib_ecology.generate_conifer_schematic(2, r, "default:pine_tree", leaves[i]) - - push(lib_ecology.schematics.conifer_trees, schem) - - minetest.register_decoration({ - deco_type = "schematic", - sidelen = 80, - place_on = {"default:dirt_with_snow", "default:dirt_with_grass", "dirt_with_rainforest_litter"}, - fill_ratio = (max_r-r+1)/500, - biomes = {"lib_ecology_coniferous_forest", "lib_ecology_taiga",}, - schematic = schem, - flags = "place_center_x, place_center_z", - y_min = 2, - rotation = "random", - }) - end -end - - -if false then - -- generic conifers - lib_ecology.schematics.conifer_trees = {} - leaves = {"default:pine_needles", "lib_ecology:pine_needles2", "lib_ecology:pine_needles3", "lib_ecology:pine_needles4"} - for i = 1,#leaves do - local schem = lib_ecology.generate_default_conifer_schematic("default:pine_tree", leaves[i]) - - push(lib_ecology.schematics.conifer_trees, schem) - - minetest.register_decoration({ - deco_type = "schematic", - sidelen = 80, - place_on = {"default:dirt_with_snow", "default:dirt_with_grass"}, - fill_ratio = 6/500, - biomes = {"lib_ecology_coniferous_forest", "lib_ecology_taiga",}, - schematic = schem, - flags = "place_center_x, place_center_z", - y_min = 2, - rotation = "random", - }) - end -end - --- Place the schematic when a sapling grows. -function default.grow_new_pine_tree(pos, bad) - local schem = lib_ecology.schematics.conifer_trees[math.random(1,#lib_ecology.schematics.conifer_trees)] - local adj = {x = pos.x - math.floor(schem.size.x / 2), - y = pos.y - 1, - z = pos.z - math.floor(schem.size.z / 2)} - minetest.place_schematic(adj, schem, 'random', nil, true) -end -