From 47c8eac79ceb64d30f0cc04092c70abe7ef60e5a Mon Sep 17 00:00:00 2001 From: Mossmanikin Date: Wed, 2 Oct 2013 05:47:16 +0200 Subject: [PATCH] 3 different twigs, twigs on water, more settings --- trunks/crafting.lua | 2 +- trunks/generating.lua | 31 +++++++++++++-- trunks/init.lua | 2 +- trunks/nodes.lua | 63 ++++++++++++++++++++---------- trunks/textures/trunks_twig.png | Bin 277 -> 0 bytes trunks/textures/trunks_twig_1.png | Bin 0 -> 244 bytes trunks/textures/trunks_twig_2.png | Bin 0 -> 251 bytes trunks/textures/trunks_twig_3.png | Bin 0 -> 262 bytes trunks/trunks_settings.txt | 45 ++++++++++++++++++--- 9 files changed, 110 insertions(+), 33 deletions(-) delete mode 100644 trunks/textures/trunks_twig.png create mode 100644 trunks/textures/trunks_twig_1.png create mode 100644 trunks/textures/trunks_twig_2.png create mode 100644 trunks/textures/trunks_twig_3.png 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 deb84bde4a4f8da16bb34fceaee8b4df9e8ed43d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 277 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1qucL8%hgh?3y^w370~qEv=}#LT=BJwMkFg)(D3 zQ$0figD*u3fvQ?OT^vI!{F8tD|8LK{aR#HbLYT3SY?yOG(-Dcb>kKKLt0dTrk9c+p zpJ-_bU9PAuvQ)3cb&3=NgWXh?xaT6X{d diff --git a/trunks/textures/trunks_twig_1.png b/trunks/textures/trunks_twig_1.png new file mode 100644 index 0000000000000000000000000000000000000000..bebb38b3291385e8c1a29316a3a902311fb8cbda GIT binary patch literal 244 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmSN`?>!lvI6;>1s;*b z3=DjSK$uZf!>a)(C{^MbQ4*Y=R#Ki=l*$m0n3-3i=jR%tP-d)Ws%L2E{@KYKsH(uz z#WBRfKl#W1|MtwPGnCFMbhmdf`gzT9xbAdF>sr`Td!zXp`VwA+f7&x$uK9#WG?+B; zI9%r_7W5NWxZR~ct5B-pU3g4ef@wp<*@(jpB4;JoCajV?$`Fy!%+x<+Port!gd7G< isS8(yrV4$GWMEiv;yN#Tr%W)=ZU#?RKbLh*2~7b1v`o$b literal 0 HcmV?d00001 diff --git a/trunks/textures/trunks_twig_2.png b/trunks/textures/trunks_twig_2.png new file mode 100644 index 0000000000000000000000000000000000000000..4700b65ed817494da2fb537c0da161991e3263c4 GIT binary patch literal 251 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmSN`?>!lvI6;>1s;*b z3=DjSK$uZf!>a)(C{^MbQ4*Y=R#Ki=l*$m0n3-3i=jR%tP-d)Ws%L2E{@KYKsH)u4 z#WBRfKl#W1|MtwPGgQuQ+@|HQJ3v?E7Q=)zb=7nK+k#{?+5~bL%+4xY7f59|QC2cL zF;4Lm!-TgAJ-Qn>r5HY2ubZKCiXrBlx)zT{8KcgZlU&Rxw@;ce-28uo=b&`QjvUuM q!8vRXylq^h9enguXYg@IGBGeXT~ezs;hGF|0)wZkpUXO@geCyh2uzp& literal 0 HcmV?d00001 diff --git a/trunks/textures/trunks_twig_3.png b/trunks/textures/trunks_twig_3.png new file mode 100644 index 0000000000000000000000000000000000000000..045c3c2ba28277bbe29350e5005697e0244b2908 GIT binary patch literal 262 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1qucL8%hgh?3y^w370~qEv=}#LT=BJwMkFg)(D3 zQ$0gN_s>q|KvkulE{-7<{>eZ7|F>sWm015QB3g98%^$i8<}xbWo;$@tvzYM&gR>^z zo;CpJ;&7BHS*>^vLI!YufVH|E~KYz8ym7jcI&8E$T5;F3u)Z5EQe!)oBW zB%@85;j)X*AxHmPEQ=>D+T-A1>?I+vSYoymgV6Rf^CE)k6@U(4@O1TaS?83{1OR%= BQHcNm literal 0 HcmV?d00001 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