From e1baf2018bf1faff14eaa83e65ba8fa029296e5d Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Thu, 14 Nov 2013 18:05:37 -0500 Subject: [PATCH] Made it possible via moretrees config to force all moretrees, default, and default jungle tree leaves to be plantlike drawtype. The default setting is now plantlike. Change moretres_settings.txt in your world folder if you don't like it. Rearranged a bit of code to accommodate this. --- default_settings.txt | 6 +++ init.lua | 13 +++++- leafdecay.lua | 17 ------- node_defs.lua | 44 +++++++++++++++--- textures/default_jungleleaves_plantlike.png | Bin 0 -> 387 bytes textures/default_leaves_plantlike.png | Bin 0 -> 401 bytes .../moretrees_apple_tree_leaves_plantlike.png | Bin 0 -> 336 bytes textures/moretrees_beech_leaves_plantlike.png | Bin 0 -> 401 bytes textures/moretrees_birch_leaves_plantlike.png | Bin 0 -> 429 bytes .../moretrees_fir_leaves_bright_plantlike.png | Bin 0 -> 208 bytes textures/moretrees_fir_leaves_plantlike.png | Bin 0 -> 208 bytes ...rees_jungletree_leaves_green_plantlike.png | Bin 0 -> 202 bytes ...etrees_jungletree_leaves_red_plantlike.png | Bin 0 -> 202 bytes ...ees_jungletree_leaves_yellow_plantlike.png | Bin 0 -> 202 bytes textures/moretrees_oak_leaves_plantlike.png | Bin 0 -> 621 bytes textures/moretrees_palm_leaves_plantlike.png | Bin 0 -> 762 bytes textures/moretrees_pine_leaves_plantlike.png | Bin 0 -> 208 bytes ...moretrees_rubber_tree_leaves_plantlike.png | Bin 0 -> 202 bytes .../moretrees_sequoia_leaves_plantlike.png | Bin 0 -> 208 bytes .../moretrees_spruce_leaves_plantlike.png | Bin 0 -> 208 bytes .../moretrees_willow_leaves_plantlike.png | Bin 0 -> 384 bytes 21 files changed, 56 insertions(+), 24 deletions(-) create mode 100644 textures/default_jungleleaves_plantlike.png create mode 100644 textures/default_leaves_plantlike.png create mode 100644 textures/moretrees_apple_tree_leaves_plantlike.png create mode 100644 textures/moretrees_beech_leaves_plantlike.png create mode 100644 textures/moretrees_birch_leaves_plantlike.png create mode 100644 textures/moretrees_fir_leaves_bright_plantlike.png create mode 100644 textures/moretrees_fir_leaves_plantlike.png create mode 100644 textures/moretrees_jungletree_leaves_green_plantlike.png create mode 100644 textures/moretrees_jungletree_leaves_red_plantlike.png create mode 100644 textures/moretrees_jungletree_leaves_yellow_plantlike.png create mode 100644 textures/moretrees_oak_leaves_plantlike.png create mode 100644 textures/moretrees_palm_leaves_plantlike.png create mode 100644 textures/moretrees_pine_leaves_plantlike.png create mode 100644 textures/moretrees_rubber_tree_leaves_plantlike.png create mode 100644 textures/moretrees_sequoia_leaves_plantlike.png create mode 100644 textures/moretrees_spruce_leaves_plantlike.png create mode 100644 textures/moretrees_willow_leaves_plantlike.png diff --git a/default_settings.txt b/default_settings.txt index 6b0a1c8..5b82a4e 100644 --- a/default_settings.txt +++ b/default_settings.txt @@ -26,6 +26,12 @@ moretrees.spawn_saplings = true moretrees.enable_stairsplus = true +-- Set this to false if you don't like the plantlike drawtype for leaves +-- (this is done to improve peoples' framerates without resorting to making +-- leaf nodes opaque). Affects default leaves and default jungle leaves also. + +moretrees.plantlike_leaves = true + -- Set this to true to enable leaf decay of all trees except the default ones. moretrees.enable_leafdecay = true diff --git a/init.lua b/init.lua index dc7d733..d9a5f6b 100644 --- a/init.lua +++ b/init.lua @@ -39,7 +39,7 @@ if io.open(worldpath.."/moretrees_settings.txt","r") == nil then end io.write(block) end - + io.close() else dofile(worldpath.."/moretrees_settings.txt") end @@ -63,6 +63,17 @@ else moretrees.expect_infinite_stacks = true end +-- node clone, for redefining stuff + +function moretrees:clone_node(name) + node2={} + node=minetest.registered_nodes[name] + for k,v in pairs(node) do + node2[k]=v + end + return node2 +end + -- tables, load other files moretrees.cutting_tools = { diff --git a/leafdecay.lua b/leafdecay.lua index f77f8dd..3bce131 100644 --- a/leafdecay.lua +++ b/leafdecay.lua @@ -1,14 +1,5 @@ -- leaf decay -function clone_node(name) - node2={} - node=minetest.registered_nodes[name] - for k,v in pairs(node) do - node2[k]=v - end - return node2 -end - -- this function is based on the default leafdecay code local process_drops = function(pos, name) local drops = minetest.get_node_drops(name) @@ -85,10 +76,6 @@ end if moretrees.enable_default_leafdecay then - new_default_leaves = clone_node("default:leaves") - new_default_leaves.groups = {snappy=3, flammable=2, leaves=1} - minetest.register_node(":default:leaves", new_default_leaves) - minetest.register_abm({ nodenames = "default:leaves", interval = moretrees.default_leafdecay_delay, @@ -105,10 +92,6 @@ end if moretrees.enable_default_jungle_leafdecay then - new_default_jungle_leaves = clone_node("default:jungleleaves") - new_default_jungle_leaves.groups = {snappy=3, flammable=2, leaves=1} - minetest.register_node(":default:jungleleaves", new_default_jungle_leaves) - minetest.register_abm({ nodenames = "default:jungleleaves", interval = moretrees.default_jungle_leafdecay_delay, diff --git a/node_defs.lua b/node_defs.lua index e0b231c..6d586e0 100644 --- a/node_defs.lua +++ b/node_defs.lua @@ -19,6 +19,35 @@ local dirs1 = { 21, 20, 23, 22, 21 } local dirs2 = { 12, 9, 18, 7, 12 } local dirs3 = { 14, 11, 16, 5, 14 } +moretrees_new_leaves_drawtype = "allfaces_optional" +moretrees_new_leaves_visual_scale = 1.0 +moretrees_new_leaves_extension = ".png" + +if moretrees.plantlike_leaves then + moretrees_new_leaves_drawtype = "plantlike" + moretrees_new_leaves_visual_scale = 1.189 + moretrees_new_leaves_extension = "_plantlike.png" +end + +new_default_leaves = moretrees:clone_node("default:leaves") + if moretrees.enable_default_leafdecay then + new_default_leaves.groups = {snappy=3, flammable=2, leaves=1} + end + new_default_leaves.drawtype = moretrees_new_leaves_drawtype + new_default_leaves.visual_scale = moretrees_new_leaves_visual_scale + new_default_leaves.tiles = {"default_leaves"..moretrees_new_leaves_extension} + minetest.register_node(":default:leaves", new_default_leaves) + +new_default_jungle_leaves = clone_node("default:jungleleaves") + if moretrees.enable_default_jungle_leafdecay then + new_default_jungle_leaves.groups = {snappy=3, flammable=2, leaves=1} + end + new_default_jungle_leaves = moretrees:clone_node("default:jungleleaves") + new_default_jungle_leaves.drawtype = moretrees_new_leaves_drawtype + new_default_jungle_leaves.visual_scale = moretrees_new_leaves_visual_scale + new_default_jungle_leaves.tiles = {"default_jungleleaves"..moretrees_new_leaves_extension} + minetest.register_node(":default:jungleleaves", new_default_jungle_leaves) + for i in ipairs(moretrees.treelist) do local treename = moretrees.treelist[i][1] local treedesc = moretrees.treelist[i][2] @@ -103,8 +132,9 @@ for i in ipairs(moretrees.treelist) do minetest.register_node("moretrees:"..treename.."_leaves", { description = treedesc.." Leaves", - drawtype = "allfaces_optional", - tiles = { "moretrees_"..treename.."_leaves.png" }, + drawtype = moretrees_new_leaves_drawtype, + visual_scale = moretrees_new_leaves_visual_scale, + tiles = { "moretrees_"..treename.."_leaves"..moretrees_new_leaves_extension }, paramtype = "light", groups = {snappy=3, flammable=2, leaves=1, moretrees_leaves=1}, sounds = default.node_sound_leaves_defaults(), @@ -308,8 +338,9 @@ for color = 1, 3 do local leave_name = "moretrees:jungletree_leaves_"..jungleleaves[color] minetest.register_node(leave_name, { description = "Jungle Tree Leaves ("..jungleleavesnames[color]..")", - drawtype = "allfaces_optional", - tiles = {"moretrees_jungletree_leaves_"..jungleleaves[color]..".png"}, + drawtype = moretrees_new_leaves_drawtype, + visual_scale = moretrees_new_leaves_visual_scale, + tiles = {"moretrees_jungletree_leaves_"..jungleleaves[color]..moretrees_new_leaves_extension}, paramtype = "light", groups = {snappy=3, flammable=2, leaves=1, moretrees_leaves=1}, drop = { @@ -326,9 +357,10 @@ end -- Extra needles for firs minetest.register_node("moretrees:fir_leaves_bright", { - drawtype = "allfaces_optional", + drawtype = moretrees_new_leaves_drawtype, + visual_scale = moretrees_new_leaves_visual_scale, description = "Douglas Fir Leaves (Bright)", - tile_images = { "moretrees_fir_leaves_bright.png" }, + tile_images = { "moretrees_fir_leaves_bright"..moretrees_new_leaves_extension }, paramtype = "light", groups = {snappy=3, flammable=2, leaves=1, moretrees_leaves=1 }, diff --git a/textures/default_jungleleaves_plantlike.png b/textures/default_jungleleaves_plantlike.png new file mode 100644 index 0000000000000000000000000000000000000000..d7cac732dea9e7e803377da828ca34c189e19ab5 GIT binary patch literal 387 zcmV-}0et?6P)Nkl z=IPsUQOsN>KjV1bKQ*y^HyG``sc)vN3UOI1w8T6JZPW4x5*o+zK6st{9ITM*yTMp0 zzVb{vIz)}KDkOvm04|G#U6~6-c{;@MG)7HmJE16xWgXu2a{rwIiC0sg@Y?2L3h(wj zKc&JvUhT-_XDo_c_VA~_S-jp#BGTdgC@;D=JVaQWpHk6cR=-5fmy4tqhJ13^LBHTg h@AW&d8-v!Fd;`LN9F8tFw4VR~002ovPDHLkV1m@or@R0F literal 0 HcmV?d00001 diff --git a/textures/default_leaves_plantlike.png b/textures/default_leaves_plantlike.png new file mode 100644 index 0000000000000000000000000000000000000000..6786a034c6e59705d6b6028d42542fd92d883be3 GIT binary patch literal 401 zcmV;C0dD?@P)=jx2Y-;22qC8+h}l50OYdQ+*-q3CEL)c$#dP;n zbp`mxAAkXX-C-*v&c};M^F-#G8Tw|xd@~zy%WQ$`>4vJP4FJT>TQP6u^Zx!3pN|)# zyR(V&R<5TT0H7^9R7Gu^w*mkW0LYib%WQ!(PsDjERZ*M18PGRFm;?ai0DukSw(P=F zr(khgcHuP|ZP_7WG0(Q_M#c1{Zw9RQtA`;`Rn$gnKOZl~c`Iq22qn=ELd%SJfrQ3- zzY1FWW(ZQqRYh$gc6_Fpa*@Bp z1rpD;z{XRVqb(!7Pg*UsLwWvDjVm^0y3>Rx}Bo%?o%UDsOC zsiN1`#zh|Gzp#^CF7>NrYHN#!(XZadTj|0XFU~8iGxdG=jx2Y-;22qC8+h}l50OYdQ+*-q3CEL)c$#dP;n zbp`mxAAkXX-C-*v&c};M^F-#G8Tw|xd@~zy%WQ$`>4vJP4FJT>TQP6u^Zx!3pN|)# zyR(V&R<5TT0H7^9R7Gu^w*mkW0LYib%WQ!(PsDjERZ*M18PGRFm;?ai0DukSw(P=F zr(khgcHuP|ZP_7WG0(Q_M#c1{Zw9RQtA`;`Rn$gnKOZl~c`Iq22qn=ELd%SJfrQ3- zzY1FWW(ZQqRYh$gc6_Fpa*@Bp z1rpD;z{XRVqbjj|W7)yfuf*Bm1-ADs+ z4tcsbhDcmK+TU4p$biRXx>Ix%*OzA=PVWTfZ~F3IKD_di;MX%%*EYHNbN{)0^E&h9 z!!M>U_g}Gg$%1cQ77w!LP5QNgDdNQ%GeP_96Ql!f-Yjjn6F;YW`Q+oZ=Jgrwht*1B zJSW~$@SPXM9BpD(k^Ag>>z7qUTGGbbu6BpaKmFWL!>mYV;T*g0W76}M7`4i#@GTbe zQWkzxpt#8UUZFy;*n#AxzkGp34cX^5rah58%Wqa-$-uqcRz+{g4~9vbUe{m!&*&;H V_E$e&athEl44$rjF6*2UngCpAh5rBm literal 0 HcmV?d00001 diff --git a/textures/moretrees_fir_leaves_bright_plantlike.png b/textures/moretrees_fir_leaves_bright_plantlike.png new file mode 100644 index 0000000000000000000000000000000000000000..96bab2f8d7eac4ca62c7901510ce414e9630569f GIT binary patch literal 208 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRz!VDxo+_>}#Nbv{wgt!7}>jVQib4e{P6>&|8 zdpoDM0EHM!g8YIR9G=}s19I{`T^vI=t}pF9$a~m;hdDBsnWL4RLx5L7MaH4;+x?a2 zc%FXd_|)(}NabwCgPsploR6Q4oBc)0)sAoS1@+F?Th{R~8r!~LFR3+qX&c`qxig^3 z-d`!Zw@5VXvnYq*lbQEpRo(fm=B*8Q#dc}J-y8fhq6D5S6^hgWTFv0;>gTe~DWM4f D`4&d~ literal 0 HcmV?d00001 diff --git a/textures/moretrees_fir_leaves_plantlike.png b/textures/moretrees_fir_leaves_plantlike.png new file mode 100644 index 0000000000000000000000000000000000000000..05c93eefd84e909ba166ed9be3b9232e5b2a7894 GIT binary patch literal 208 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRz!VDxo+_>}#Nbv{wgt!7}Nhf74IYB`^DGp)2 z6L;?90)-e$g8YIR9G=}s19I{`T^vI=t}pF9$a~m;hdDBsnWL4RLx5L7MaH4;+x?a2 zc%FXd_|)(}NabwCgPsploR6Q4oBc)0)sAoS1@+F?Th{R~8r!~LFR3+qX&c`qxig^3 z-d`!Zw@5VXvnYq*lbQEpRo(fm=B*8Q#dc}J-y8fhq6D5S6^hgWTFv0;>gTe~DWM4f DhH*wn literal 0 HcmV?d00001 diff --git a/textures/moretrees_jungletree_leaves_green_plantlike.png b/textures/moretrees_jungletree_leaves_green_plantlike.png new file mode 100644 index 0000000000000000000000000000000000000000..89da8c6625febd41994f62f3088235e01191de63 GIT binary patch literal 202 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRz!VDxo+_>}#Nbv{wgt!7}$0!rWaASQN4K*#L zL^bPvpb%q8kY6x^!?PP{Ku)Hoi(?4K^`*YId5;)yZ02ab(7_mRn1N%{f1j^s3p)67 z{xJNTU22jnQ{m+ApOdp)d%M)kFzsvuVTaELPHf#Sy3A?Lfi#D^B1^0ib6cV{HS~7f v`A~e+ij6hge`AQbXTW^DwT}+!W!gPvPU;n`uH5?;WGREEtDnm{r-UW|IPFA< literal 0 HcmV?d00001 diff --git a/textures/moretrees_jungletree_leaves_red_plantlike.png b/textures/moretrees_jungletree_leaves_red_plantlike.png new file mode 100644 index 0000000000000000000000000000000000000000..d13ce691000e69a968a5bb57bfcd867494bc227a GIT binary patch literal 202 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRz!VDxo+_>}#Nbv{wgt!9fIuC{? v=R@&PD>l|}|BWH$o&odq);>C@mudHyIjL8$x^nMZkfjWsu6{1-oD!M}#Nbv{wgt!9figx4j7NeMCLvLT> z3tdg$~Am!wejo{`-7AThPIu z^M~Qz>{63tnF=R=|D2rd+S{dOhG}OT2s?Z}aANCr(Pd6^4x~BU6-f-AWIoMUHx3vIVCg!0L2YQF8}}l literal 0 HcmV?d00001 diff --git a/textures/moretrees_oak_leaves_plantlike.png b/textures/moretrees_oak_leaves_plantlike.png new file mode 100644 index 0000000000000000000000000000000000000000..e86016675855532e75dcc56250e5d414badb1969 GIT binary patch literal 621 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRz!3-o#HSAwAFfdvN_=LDxcuD|~vL3&#wJ;DF zJB#VriYV#uNyu}_sPd>83jh(2D%W?vxfaU}>nk7r|8M+#t3P1nSxd{% z`;7n6GkDf4?ctcZCdzr41e?(O+ilL-8U`X)E5h`>Hn7jyvP?r?e)r?d#iylS^z`jy zk~{Z)zUn3MZ+8|}v*xWYC=}nzsJ7dfOMmgdvk$8N9hraNU*jaPbDD|&%zo!ts;8`7 zJtg=3UDZg1895&hHY(-MI@YpO)#XZ#*TMCT^IfjL5Y+rLb9L11iY-%kZ>_#;^LirInTzT2>iCZA%Nah0h{r1wLeqZ4&=5!wbz8 zor%sRCd)K(pEQ+_1KbVL)bG^WvP|% z4&zdUF@ihMHBnrTHiEW=+J0&_;>=@9qi<(vEABj%t+MX`qN*h_?MIWa!ju2w?2xUP$BRFy_>&Cem z?HcrLxRrYoVitWf-mM6A=z^5{aQ0H2LCjGRqB4rMks=SiFYx3k3u9Lth7i}Y#EGhb z!di+wtn5P{VbuoAQG8<<+9>gZlWGaCjQ&%EASNYD7-IxW0&@cEI_z1zBUqDY!l(l{ zdU5oj4YMML%8x6LA%eM+VmJO#JTmq)gJ%yql>Zg%kun=-do}a9Lf)og?K#V%>0_#B zVF7o}&z$OaeSLJ`2e)jaL{(7MK z{)H14=TnVhec$>YE=-+1*Kz35m9lx^*ct1>4n7&lA8e z>K#F0<>O^Di+|bswO{`1HJtt9@a(};k8U5AI)pc-kK1*T$P3HwQiDT!9_n~MHDLbJ uVJHm*ej5K~-uSNbhHiP+mU7L}fA`(}#Nbv{wgt!7}r3^tqGfoL_9$rnh z+r^y+fkKQWL4Lsu4$p3+0Xg}eE{-7_*O&GlbP0l+XkK DjvGc$ literal 0 HcmV?d00001 diff --git a/textures/moretrees_rubber_tree_leaves_plantlike.png b/textures/moretrees_rubber_tree_leaves_plantlike.png new file mode 100644 index 0000000000000000000000000000000000000000..0ac8a8b17a9b2cfe4ea9f091f7ba3964aa1a4a21 GIT binary patch literal 202 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRz!VDxo+_>}#Nbv{wgt!7}&+br<&JfS+0MAIT z8FIbffkKQWL4Lsu4$p3+0XdnTE{-7_*O&U<<~?G-v6-X!LI-2OVFr#(|9!rmE$HCS z`NQyUcBx6SOofxbe@@PJ?d?)C!?d#vgdIK~II(rR=rX4{2htqwiY&28%x#I*)X>{? v=R@&PD>l|}|BWH$o&odq);>C@mudHyIjL8$x^nMZkfjWsu6{1-oD!M}#Nbv{wgt!9fm~q~nN@*XzeVU7%D=4fT-5a3l%k#Xqzc7NqL zo~NHVJ~jLgQaPLPpy$IB=i_JNW`EIgwd0$7LA~?!mUTRg#}#Nbv{wgt!7}Nhf74IYB`^DGp)2 z6L;?90)-e$g8YIR9G=}s19I{`T^vI=t}pF9$a~m;hdDBsnWL4RLx5L7MaH4;+x?a2 zc%FXd_|)(}NabwCgPsploR6Q4oBc)0)sAoS1@+F?Th{R~8r!~LFR3+qX&c`qxig^3 z-d`!Zw@5VXvnYq*lbQEpRo(fm=B*8Q#dc}J-y8fhq6D5S6^hgWTFv0;>gTe~DWM4f DhH*wn literal 0 HcmV?d00001 diff --git a/textures/moretrees_willow_leaves_plantlike.png b/textures/moretrees_willow_leaves_plantlike.png new file mode 100644 index 0000000000000000000000000000000000000000..49ad83409ee128af7b1858688e23a45352690a88 GIT binary patch literal 384 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRz!3-o#HSAvlspY8p~WJ@plqcittG)C$snO6pIts;ijSGrNyAepyQ{b1 zLMmtOALBT)HT~+gI>+XC(FYw9ij0ip#g=YP-JQ3p@UgI=>L;d