diff --git a/trunks/generating.lua b/trunks/generating.lua index 9d61aba..9cba4f2 100644 --- a/trunks/generating.lua +++ b/trunks/generating.lua @@ -86,7 +86,8 @@ abstract_trunks.place_trunk = function(pos) local north = {x=pos.x, y=pos.y+1, z=pos.z+1} local south = {x=pos.x, y=pos.y+1, z=pos.z-1} local west = {x=pos.x-1, y=pos.y+1, z=pos.z} - local east = {x=pos.x+1, y=pos.y+1, z=pos.z } + local east = {x=pos.x+1, y=pos.y+1, z=pos.z} + local node_here = minetest.get_node(right_here) local node_north = minetest.get_node(north) local node_south = minetest.get_node(south) @@ -165,3 +166,136 @@ plantslib:register_generate_plant({ }, "abstract_trunks.place_trunk" ) + +----------------------------------------------------------------------------------------------- +-- MoSS & FuNGuS -- on ground +----------------------------------------------------------------------------------------------- +abstract_trunks.grow_moss_on_ground = function(pos) + local on_ground = {x=pos.x, y=pos.y+1, z=pos.z} + local moss_type = math.random(1,21) + + if moss_type == 1 then + minetest.add_node(on_ground, {name="trunks:moss_fungus", param2= 1}) + else + minetest.add_node(on_ground, {name="trunks:moss", param2= 1}) + end + +end + +plantslib:register_generate_plant({ + surface = {"default:dirt_with_grass"}, + max_count = Moss_on_ground_Max_Count, + rarity = Moss_on_ground_Rarity, + min_elevation = 1, + max_elevation = 40, + near_nodes = { + "group:tree", + "ferns:fern_03", + "ferns:fern_02", + "ferns:fern_01" + }, + near_nodes_size = 2, + near_nodes_vertical = 1, + near_nodes_count = 1, + plantlife_limit = -0.9, + }, + "abstract_trunks.grow_moss_on_ground" +) + +----------------------------------------------------------------------------------------------- +-- MoSS & FuNGuS -- on trunks +----------------------------------------------------------------------------------------------- +abstract_trunks.grow_moss_on_trunk = function(pos) + local on_ground = {x=pos.x, y=pos.y+1, z=pos.z} + local at_side_n = {x=pos.x, y=pos.y, z=pos.z+1} + local at_side_e = {x=pos.x+1, y=pos.y, z=pos.z} + local at_side_s = {x=pos.x, y=pos.y, z=pos.z-1} + local at_side_w = {x=pos.x-1, y=pos.y, z=pos.z} + local undrneath = {x=pos.x, y=pos.y-1, z=pos.z} + + local node_here = minetest.get_node(on_ground) + local node_north = minetest.get_node(at_side_n) + local node_east = minetest.get_node(at_side_e) + local node_south = minetest.get_node(at_side_s) + local node_west = minetest.get_node(at_side_w) + local node_under = minetest.get_node(undrneath) + + if minetest.get_item_group(node_under.name, "tree") < 1 then + local moss_type = math.random(1,41) + if minetest.registered_nodes[node_here.name].buildable_to then -- instead of check_air = true, + if moss_type == 1 then + minetest.add_node(on_ground, {name="trunks:moss_fungus", param2= 1}) + elseif moss_type < 22 then + minetest.add_node(on_ground, {name="trunks:moss", param2= 1}) + end + end + local moss_type = math.random(1,31) + if minetest.registered_nodes[node_north.name].buildable_to then -- instead of check_air = true, + if moss_type == 1 then + minetest.add_node(at_side_n, {name="trunks:moss_fungus", param2= 5}) + elseif moss_type < 22 then + minetest.add_node(at_side_n, {name="trunks:moss", param2= 5}) + end + end + local moss_type = math.random(1,41) + if minetest.registered_nodes[node_east.name].buildable_to then -- instead of check_air = true, + if moss_type == 1 then + minetest.add_node(at_side_e, {name="trunks:moss_fungus", param2= 3}) + elseif moss_type < 22 then + minetest.add_node(at_side_e, {name="trunks:moss", param2= 3}) + end + end + local moss_type = math.random(1,41) + if minetest.registered_nodes[node_south.name].buildable_to then -- instead of check_air = true, + if moss_type == 1 then + minetest.add_node(at_side_s, {name="trunks:moss_fungus", param2= 4}) + elseif moss_type < 22 then + minetest.add_node(at_side_s, {name="trunks:moss", param2= 4}) + end + end + local moss_type = math.random(1,41) + if minetest.registered_nodes[node_west.name].buildable_to then -- instead of check_air = true, + if moss_type == 1 then + minetest.add_node(at_side_w, {name="trunks:moss_fungus", param2= 2}) + elseif moss_type < 22 then + minetest.add_node(at_side_w, {name="trunks:moss", param2= 2}) + end + end + end + + --minetest.add_node(on_ground, {name="trunks:moss", param2=math.random(0,3)}) +end + +plantslib:register_generate_plant({ + surface = { + "default:tree", + "default:jungletree", + "trees:tree_conifer", + "trees:tree_mangrove", + --"trees:tree_palm", + "moretrees:apple_tree_trunk", + "moretrees:beech_trunk", + "moretrees:birch_trunk", + "moretrees:fir_trunk", + "moretrees:oak_trunk", + --"moretrees:palm_trunk", + "moretrees:pine_trunk", + "moretrees:rubber_tree_trunk", + "moretrees:rubber_tree_trunk_empty", + "moretrees:sequoia_trunk", + "moretrees:spruce_trunk", + "moretrees:willow_trunk" + }, + max_count = Moss_on_trunk_Max_Count, + rarity = Moss_on_trunk_Rarity, + min_elevation = 1, + max_elevation = 40, + near_nodes = {"default:dirt_with_grass"}, + near_nodes_size = 1, + near_nodes_vertical = 1, + near_nodes_count = 1, + plantlife_limit = -0.9, + check_air = false, + }, + "abstract_trunks.grow_moss_on_trunk" +) \ No newline at end of file diff --git a/trunks/init.lua b/trunks/init.lua index a376949..c8961ab 100644 --- a/trunks/init.lua +++ b/trunks/init.lua @@ -1,6 +1,6 @@ ----------------------------------------------------------------------------------------------- local title = "Trunks" -local version = "0.0.3" +local version = "0.0.5" local mname = "trunks" ----------------------------------------------------------------------------------------------- diff --git a/trunks/nodes.lua b/trunks/nodes.lua index 2386085..54966ff 100644 --- a/trunks/nodes.lua +++ b/trunks/nodes.lua @@ -1,3 +1,6 @@ +----------------------------------------------------------------------------------------------- +-- TWiG +----------------------------------------------------------------------------------------------- local flat_stick = {-1/2, -1/2, -1/2, 1/2, -7/16, 1/2} minetest.register_node("trunks:twig", { @@ -18,44 +21,40 @@ minetest.register_node("trunks:twig", { sounds = default.node_sound_leaves_defaults(), }) +----------------------------------------------------------------------------------------------- +-- MoSS +----------------------------------------------------------------------------------------------- minetest.register_node("trunks:moss", { - description = "moss", + description = "Moss", drawtype = "signlike", tiles = {"trunks_moss.png"}, inventory_image = "trunks_moss.png", wield_image = "trunks_moss.png", paramtype = "light", paramtype2 = "wallmounted", + sunlight_propagates = true, walkable = false, - --climbable = true, - selection_box = { - type = "wallmounted", - --wall_top = = - --wall_bottom = = - --wall_side = = - }, - groups = {choppy=2,oddly_breakable_by_hand=3,flammable=2}, - legacy_wallmounted = true, + selection_box = {type = "wallmounted"}, + groups = {dig_immediate=2,attached_node=1}, + --legacy_wallmounted = true, sounds = default.node_sound_leaves_defaults(), }) +----------------------------------------------------------------------------------------------- +-- MoSS & FuNGuS +----------------------------------------------------------------------------------------------- minetest.register_node("trunks:moss_fungus", { - description = "moss & fungus", + description = "Moss & Fungus", drawtype = "signlike", tiles = {"trunks_moss_fungus.png"}, inventory_image = "trunks_moss_fungus.png", wield_image = "trunks_moss_fungus.png", paramtype = "light", paramtype2 = "wallmounted", + sunlight_propagates = true, walkable = false, - --climbable = true, - selection_box = { - type = "wallmounted", - --wall_top = = - --wall_bottom = = - --wall_side = = - }, - groups = {choppy=2,oddly_breakable_by_hand=3,flammable=2}, - legacy_wallmounted = true, + selection_box = {type = "wallmounted"}, + groups = {dig_immediate=2,attached_node=1}, + --legacy_wallmounted = true, sounds = default.node_sound_leaves_defaults(), }) diff --git a/trunks/trunks_settings.txt b/trunks/trunks_settings.txt index 79a2ad3..b5e0d97 100644 --- a/trunks/trunks_settings.txt +++ b/trunks/trunks_settings.txt @@ -1,9 +1,15 @@ -- Settings for generation of trunks (at map-generation time) -Horizontal_Trunks = true +Horizontal_Trunks = true -Trunks_Max_Count = 320 -- absolute maximum number in an area of 80x80x80 nodes -Trunks_Rarity = 99 -- larger values make trunks more rare (100 means chance of 0 %) +Trunks_Max_Count = 320 -- absolute maximum number in an area of 80x80x80 nodes +Trunks_Rarity = 99 -- larger values make trunks more rare (100 means chance of 0 %) -Twigs_Max_Count = 640 -- absolute maximum number in an area of 80x80x80 nodes -Twigs_Rarity = 66 -- larger values make trunks more rare (100 means chance of 0 %) \ No newline at end of file +Twigs_Max_Count = 640 -- absolute maximum number in an area of 80x80x80 nodes +Twigs_Rarity = 66 -- larger values make twigs more rare (100 means chance of 0 %) + +Moss_on_ground_Max_Count = 400 -- absolute maximum number in an area of 80x80x80 nodes +Moss_on_ground_Rarity = 79 -- larger values makes moss more rare (100 means chance of 0 %) + +Moss_on_trunk_Max_Count = 640 -- absolute maximum number in an area of 80x80x80 nodes +Moss_on_trunk_Rarity = 24 -- larger values makes moss more rare (100 means chance of 0 %) \ No newline at end of file