diff --git a/trunks/crafting.lua b/trunks/crafting.lua index cd2ce51..7aa5c09 100644 --- a/trunks/crafting.lua +++ b/trunks/crafting.lua @@ -1,4 +1,4 @@ minetest.register_craft({ output = "default:stick", - recipe = {{"trunks:twig"}} + recipe = {{"trunks:twig_1"}} }) \ No newline at end of file diff --git a/trunks/generating.lua b/trunks/generating.lua index 9cba4f2..c02f57c 100644 --- a/trunks/generating.lua +++ b/trunks/generating.lua @@ -3,13 +3,14 @@ ----------------------------------------------------------------------------------------------- abstract_trunks.place_twig = function(pos) local right_here = {x=pos.x, y=pos.y+1, z=pos.z} - minetest.add_node(right_here, {name="trunks:twig", param2=math.random(0,3)}) + minetest.add_node(right_here, {name="trunks:twig_"..math.random(1,3), param2=math.random(0,3)}) end +if Twigs_on_ground == true then plantslib:register_generate_plant({ surface = {"default:dirt_with_grass"}, - max_count = Twigs_Max_Count, - rarity = Twigs_Rarity, + max_count = Twigs_on_ground_Max_Count, + rarity = Twigs_on_ground_Rarity, min_elevation = 1, max_elevation = 40, near_nodes = {"group:tree","ferns:fern_03","ferns:fern_02","ferns:fern_01"}, @@ -20,6 +21,24 @@ plantslib:register_generate_plant({ }, "abstract_trunks.place_twig" ) +end + +if Twigs_on_water == true then +plantslib:register_generate_plant({ + surface = {"default:water_source"}, + max_count = Twigs_on_water_Max_Count, + rarity = Twigs_on_water_Rarity, + min_elevation = 1, + max_elevation = 40, + near_nodes = {"group:tree"}, + near_nodes_size = 3, + near_nodes_vertical = 1, + near_nodes_count = 1, + plantlife_limit = -0.9, + }, + "abstract_trunks.place_twig" +) +end ----------------------------------------------------------------------------------------------- -- TRuNKS @@ -170,6 +189,7 @@ plantslib:register_generate_plant({ ----------------------------------------------------------------------------------------------- -- MoSS & FuNGuS -- on ground ----------------------------------------------------------------------------------------------- +if Moss_on_ground == true then 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) @@ -201,10 +221,12 @@ plantslib:register_generate_plant({ }, "abstract_trunks.grow_moss_on_ground" ) +end ----------------------------------------------------------------------------------------------- -- MoSS & FuNGuS -- on trunks ----------------------------------------------------------------------------------------------- +if Moss_on_trunk == true then 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} @@ -298,4 +320,5 @@ plantslib:register_generate_plant({ check_air = false, }, "abstract_trunks.grow_moss_on_trunk" -) \ No newline at end of file +) +end \ No newline at end of file diff --git a/trunks/init.lua b/trunks/init.lua index c8961ab..85e4c82 100644 --- a/trunks/init.lua +++ b/trunks/init.lua @@ -1,6 +1,6 @@ ----------------------------------------------------------------------------------------------- local title = "Trunks" -local version = "0.0.5" +local version = "0.0.6" local mname = "trunks" ----------------------------------------------------------------------------------------------- diff --git a/trunks/nodes.lua b/trunks/nodes.lua index 54966ff..6dda080 100644 --- a/trunks/nodes.lua +++ b/trunks/nodes.lua @@ -1,25 +1,48 @@ ----------------------------------------------------------------------------------------------- --- TWiG +-- TWiGS ----------------------------------------------------------------------------------------------- -local flat_stick = {-1/2, -1/2, -1/2, 1/2, -7/16, 1/2} +-- For compatibility with older stuff +minetest.register_alias("trunks:twig", "trunks:twig_1") -minetest.register_node("trunks:twig", { - description = "Twig", - inventory_image = "trunks_twig.png", - wield_image = "trunks_twig.png", - drawtype = "nodebox", - tiles = { "trunks_twig.png" }, - paramtype = "light", - paramtype2 = "facedir", - sunlight_propagates = true, - buildable_to = true, - node_box = {type = "fixed", fixed = flat_stick}, - groups = { - dig_immediate=3, -- almost literally immediate, like just picking up - attached_node=1 - }, - sounds = default.node_sound_leaves_defaults(), -}) +local flat_stick = {-1/2, -1/2, -1/2, 1/2, -7/16, 1/2} +local NoDe = { {1}, {2}, {3} } + +for i in pairs(NoDe) do + local NR = NoDe[i][1] + local iNV = NR - 1 + minetest.register_node("trunks:twig_"..NR, { + description = "Twig", + inventory_image = "trunks_twig_"..NR..".png", + wield_image = "trunks_twig_"..NR..".png", + drawtype = "nodebox", + tiles = { "trunks_twig_"..NR..".png" }, + paramtype = "light", + paramtype2 = "facedir", + walkable = false, + sunlight_propagates = true, + buildable_to = true, + node_box = {type = "fixed", fixed = flat_stick}, + groups = { + dig_immediate=3, -- almost literally immediate, like just picking up + attached_node=1, + not_in_creative_inventory=iNV + }, + drop = "trunks:twig_1", + sounds = default.node_sound_leaves_defaults(), + liquids_pointable = true, + on_place = function(itemstack, placer, pointed_thing) + local pt = pointed_thing + local direction = minetest.dir_to_facedir(placer:get_look_dir()) + if minetest.get_node(pt.above).name=="air" then + minetest.set_node(pt.above, {name="trunks:twig_"..math.random(1,3), param2=direction}) + if not minetest.setting_getbool("creative_mode") then + itemstack:take_item() + end + return itemstack + end + end, + }) +end ----------------------------------------------------------------------------------------------- -- MoSS @@ -36,7 +59,6 @@ minetest.register_node("trunks:moss", { walkable = false, selection_box = {type = "wallmounted"}, groups = {dig_immediate=2,attached_node=1}, - --legacy_wallmounted = true, sounds = default.node_sound_leaves_defaults(), }) @@ -55,6 +77,5 @@ minetest.register_node("trunks:moss_fungus", { walkable = false, selection_box = {type = "wallmounted"}, groups = {dig_immediate=2,attached_node=1}, - --legacy_wallmounted = true, sounds = default.node_sound_leaves_defaults(), }) diff --git a/trunks/textures/trunks_twig.png b/trunks/textures/trunks_twig.png deleted file mode 100644 index deb84bd..0000000 Binary files a/trunks/textures/trunks_twig.png and /dev/null differ diff --git a/trunks/textures/trunks_twig_1.png b/trunks/textures/trunks_twig_1.png new file mode 100644 index 0000000..bebb38b Binary files /dev/null and b/trunks/textures/trunks_twig_1.png differ diff --git a/trunks/textures/trunks_twig_2.png b/trunks/textures/trunks_twig_2.png new file mode 100644 index 0000000..4700b65 Binary files /dev/null and b/trunks/textures/trunks_twig_2.png differ diff --git a/trunks/textures/trunks_twig_3.png b/trunks/textures/trunks_twig_3.png new file mode 100644 index 0000000..045c3c2 Binary files /dev/null and b/trunks/textures/trunks_twig_3.png differ diff --git a/trunks/trunks_settings.txt b/trunks/trunks_settings.txt index b5e0d97..92b4bf7 100644 --- a/trunks/trunks_settings.txt +++ b/trunks/trunks_settings.txt @@ -1,15 +1,48 @@ --- Settings for generation of trunks (at map-generation time) +-- Settings for generation of stuff (at map-generation time) -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 %) -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 %) + +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 %) + + + + +Twigs_on_ground = true + + +Twigs_on_ground_Max_Count = 640 -- absolute maximum number in an area of 80x80x80 nodes +Twigs_on_ground_Rarity = 66 -- larger values make twigs more rare (100 means chance of 0 %) + + + + +Twigs_on_water = true + + +Twigs_on_water_Max_Count = 320 -- absolute maximum number in an area of 80x80x80 nodes + +Twigs_on_water_Rarity = 33 -- larger values make twigs more rare (100 means chance of 0 %) + + + + +Moss_on_ground = true + 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 = true + + 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