From 903acd2ae08aca7334ea7062c7eae719838ea2ba Mon Sep 17 00:00:00 2001 From: paramat Date: Mon, 14 Apr 2014 06:01:05 +0100 Subject: [PATCH] acaciatree, pinetree nodes. bugix spawn function. biome blend --- README.txt | 2 +- functions.lua | 67 +++++++-------------------- init.lua | 35 ++++++++------ nodes.lua | 20 +++++++- textures/watershed_acacialeaf.png | Bin 0 -> 340 bytes textures/watershed_acaciatree.png | Bin 0 -> 682 bytes textures/watershed_acaciatreetop.png | Bin 0 -> 731 bytes textures/watershed_pinetree.png | Bin 0 -> 693 bytes textures/watershed_pinetreetop.png | Bin 0 -> 802 bytes 9 files changed, 56 insertions(+), 68 deletions(-) create mode 100644 textures/watershed_acacialeaf.png create mode 100644 textures/watershed_acaciatree.png create mode 100644 textures/watershed_acaciatreetop.png create mode 100644 textures/watershed_pinetree.png create mode 100644 textures/watershed_pinetreetop.png diff --git a/README.txt b/README.txt index 2f62f63..95e663a 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -watershed 0.3.7 by paramat +watershed 0.3.8 by paramat For latest stable Minetest back to 0.4.8 Depends default bucket Licenses: code WTFPL, textures CC BY-SA diff --git a/functions.lua b/functions.lua index 69657b1..9a0d454 100644 --- a/functions.lua +++ b/functions.lua @@ -30,7 +30,7 @@ function watershed_appletree(x, y, z, area, data) end function watershed_pinetree(x, y, z, area, data) - local c_tree = minetest.get_content_id("default:tree") + local c_wspitree = minetest.get_content_id("watershed:pinetree") local c_wsneedles = minetest.get_content_id("watershed:needles") local c_snowblock = minetest.get_content_id("default:snowblock") for j = -4, 14 do @@ -75,7 +75,7 @@ function watershed_pinetree(x, y, z, area, data) end end local vit = area:index(x, y + j, z) - data[vit] = c_tree + data[vit] = c_wspitree end local vil = area:index(x, y + 15, z) local vila = area:index(x, y + 16, z) @@ -129,8 +129,8 @@ function watershed_jungletree(x, y, z, area, data) end function watershed_acaciatree(x, y, z, area, data) - local c_tree = minetest.get_content_id("default:tree") - local c_wsaccleaf = minetest.get_content_id("watershed:acacialeaf") + local c_wsactree = minetest.get_content_id("watershed:acaciatree") + local c_wsacleaf = minetest.get_content_id("watershed:acacialeaf") for j = -3, 6 do if j == 6 then for i = -4, 4 do @@ -138,7 +138,7 @@ function watershed_acaciatree(x, y, z, area, data) if not (i == 0 or k == 0) then if math.random(7) ~= 2 then local vil = area:index(x + i, y + j, z + k) - data[vil] = c_wsaccleaf + data[vil] = c_wsacleaf end end end @@ -147,7 +147,7 @@ function watershed_acaciatree(x, y, z, area, data) for i = -2, 2, 4 do for k = -2, 2, 4 do local vit = area:index(x + i, y + j, z + k) - data[vit] = c_tree + data[vit] = c_wsactree end end elseif j == 4 then @@ -155,13 +155,13 @@ function watershed_acaciatree(x, y, z, area, data) for k = -1, 1 do if math.abs(i) + math.abs(k) == 2 then local vit = area:index(x + i, y + j, z + k) - data[vit] = c_tree + data[vit] = c_wsactree end end end else local vit = area:index(x, y + j, z) - data[vit] = c_tree + data[vit] = c_wsactree end end end @@ -247,15 +247,7 @@ if SINGLENODE then spread = {x=512, y=512, z=512}, seed = 593, octaves = 6, - persist = 0.3 - } - local np_fault = { - offset = 0, - scale = 1, - spread = {x=512, y=1024, z=512}, - seed = 14440002, - octaves = 6, - persist = 0.5 + persist = 0.4 } local np_base = { offset = 0, @@ -273,23 +265,7 @@ if SINGLENODE then octaves = 3, persist = 0.4 } - local np_temp = { - offset = 0, - scale = 1, - spread = {x=512, y=512, z=512}, - seed = 9130, - octaves = 2, - persist = 0.5 - } - local np_humid = { - offset = 0, - scale = 1, - spread = {x=512, y=512, z=512}, - seed = -55500, - octaves = 2, - persist = 0.5 - } - for chunk = 1, 32 do + for chunk = 1, 64 do print ("[watershed] searching for spawn "..chunk) local x0 = 80 * math.random(-24, 24) - 32 local z0 = 80 * math.random(-24, 24) - 32 @@ -305,9 +281,6 @@ if SINGLENODE then local nvals_rough = minetest.get_perlin_map(np_rough, chulens):get3dMap_flat(minposxyz) local nvals_smooth = minetest.get_perlin_map(np_smooth, chulens):get3dMap_flat(minposxyz) - local nvals_fault = minetest.get_perlin_map(np_fault, chulens):get3dMap_flat(minposxyz) - local nvals_temp = minetest.get_perlin_map(np_temp, chulens):get3dMap_flat(minposxyz) - local nvals_humid = minetest.get_perlin_map(np_humid, chulens):get3dMap_flat(minposxyz) local nvals_base = minetest.get_perlin_map(np_base, chulens):get2dMap_flat(minposxz) local nvals_xlscale = minetest.get_perlin_map(np_xlscale, chulens):get2dMap_flat(minposxz) @@ -317,22 +290,12 @@ if SINGLENODE then for z = z0, z1 do for y = y0, y1 do for x = x0, x1 do - local grad = math.atan((TERCEN - y) / TERSCA) * ATANAMP local n_base = nvals_base[nixz] + local grad = math.atan((TERCEN - y) / TERSCA) * ATANAMP local densitybase = (1 - math.abs(n_base)) * BASAMP + nvals_xlscale[nixz] * XLSAMP + grad local terblen = math.max(1 - math.abs(n_base), 0) - local n_temp = nvals_temp[nixyz] - local n_humid = nvals_humid[nixyz] - local density - if nvals_fault[nixyz] >= 0 then - density = densitybase - + math.abs(nvals_rough[nixyz] * terblen - + nvals_smooth[nixyz] * (1 - terblen)) ^ CANEXP * CANAMP * (1 + n_temp * 0.5) - else - density = densitybase - + math.abs(nvals_rough[nixyz] * terblen - + nvals_smooth[nixyz] * (1 - terblen)) ^ CANEXP * CANAMP * (1 + n_humid * 0.5) - end + local density = densitybase + + math.abs(nvals_rough[nixyz] * terblen + nvals_smooth[nixyz] * (1 - terblen)) ^ CANEXP * CANAMP if y >= 1 and density > -0.01 and density < 0 then ysp = y + 1 xsp = x @@ -372,9 +335,11 @@ end -- ABM +-- update luxore light + minetest.register_abm({ nodenames = {"watershed:luxoreoff"}, - interval = 7, + interval = 13, chance = 1, action = function(pos, node, active_object_count, active_object_count_wider) minetest.remove_node(pos) diff --git a/init.lua b/init.lua index 2321ef3..ca1e91d 100644 --- a/init.lua +++ b/init.lua @@ -1,12 +1,16 @@ --- watershed 0.3.7 by paramat +-- watershed 0.3.8 by paramat -- For latest stable Minetest and back to 0.4.8 -- Depends default bucket -- License: code WTFPL, textures CC BY-SA -- Red cobble texture CC BY-SA by brunob.santos minetestbr.blogspot.com --- thicker layer of redstone in deserts --- ice thicker with lower temperature --- papyrus on riverbank not beach +-- pine, acacia tree trunks +-- bugfix spawning function +-- temperature / humidity randomness for biome blend +-- TODO +-- pine wood +-- acacia wood +-- better appletree design with branches -- Parameters @@ -28,7 +32,7 @@ local TSTONE = 0.02 -- Density threshold for stone, depth of soil at TERCEN local TRIV = -0.02 -- Maximum densitybase threshold for river water local TSAND = -0.025 -- Maximum densitybase threshold for river sand local TLAVA = 2.3 -- Maximum densitybase threshold for lava, small because grad is non-linear -local FISEXP = 0.02 -- Fissure expansion rate under surface +local FISEXP = 0.03 -- Fissure expansion rate under surface local ORETHI = 0.002 -- Ore seam thickness tuner local SEAMT = 0.2 -- Seam threshold, width of seams local ICETHI = 32 -- Controls maximum ice thickness @@ -38,19 +42,20 @@ local LOTET = -0.35 -- Low .. local ICETET = -0.7 -- Ice .. local HIHUT = 0.35 -- High humidity threshold local LOHUT = -0.35 -- Low .. +local BLEND = 0.03 -- Biome blend randomness local PINCHA = 36 -- Pine tree 1/x chance per node local APTCHA = 36 -- Appletree local FLOCHA = 36 -- Flower local FOGCHA = 9 -- Forest grass -local GRACHA = 3 -- Grassland grasses +local GRACHA = 4 -- Grassland grasses local JUTCHA = 16 -- Jungletree local JUGCHA = 9 -- Junglegrass local CACCHA = 841 -- Cactus local DRYCHA = 169 -- Dry shrub local PAPCHA = 2 -- Papyrus local ACACHA = 529 -- Acacia tree -local GOGCHA = 3 -- Golden grass +local GOGCHA = 4 -- Golden grass -- 3D noise for rough terrain @@ -70,7 +75,7 @@ local np_smooth = { scale = 1, spread = {x=512, y=512, z=512}, seed = 593, - octaves = 5, + octaves = 6, persist = 0.4 } @@ -266,20 +271,20 @@ minetest.register_on_generated(function(minp, maxp, seed) local n_rough = nvals_rough[nixyz] -- noise values for node local n_smooth = nvals_smooth[nixyz] local n_fissure = nvals_fissure[nixyz] - local n_temp = nvals_temp[nixyz] - local n_humid = nvals_humid[nixyz] + local n_temp = nvals_temp[nixyz] + (math.random() - 0.5) * BLEND + local n_humid = nvals_humid[nixyz] + (math.random() - 0.5) * BLEND local n_seam = nvals_seam[nixyz] local n_strata = nvals_strata[nixyz] local n_base = nvals_base[nixz] local n_xlscale = nvals_xlscale[nixz] local n_magma = nvals_magma[nixz] - - local grad = math.atan((TERCEN - y) / TERSCA) * ATANAMP -- get densitybase and density - local densitybase = (1 - math.abs(n_base)) * BASAMP + n_xlscale * XLSAMP + grad - local terblen = math.max(1 - math.abs(n_base), 0) + -- get densitybase and density + local grad = math.atan((TERCEN - y) / TERSCA) * ATANAMP -- vertical density gradient + local densitybase = (1 - math.abs(n_base)) * BASAMP + n_xlscale * XLSAMP + grad -- base terrain or ridge networks + local terblen = math.max(1 - math.abs(n_base), 0) -- terrain blend rough and smooth local density = densitybase - + math.abs(n_rough * terblen + n_smooth * (1 - terblen)) ^ CANEXP * CANAMP + + math.abs(n_rough * terblen + n_smooth * (1 - terblen)) ^ CANEXP * CANAMP -- add canyon terrain local triv = TRIV * (1 - terblen) -- other values local tsand = TSAND * (1 - terblen) diff --git a/nodes.lua b/nodes.lua index 397719b..9622509 100644 --- a/nodes.lua +++ b/nodes.lua @@ -13,13 +13,22 @@ minetest.register_node("watershed:acacialeaf", { description = "WS Acacia Leaves", drawtype = "allfaces_optional", visual_scale = 1.3, - tiles = {"default_leaves.png"}, + tiles = {"watershed_acacialeaf.png"}, paramtype = "light", is_ground_content = false, groups = {snappy=3, flammable=2, leaves=1}, sounds = default.node_sound_leaves_defaults(), }) +minetest.register_node("watershed:acaciatree", { + description = "WS Acacia Tree", + tiles = {"watershed_acaciatreetop.png", "watershed_acaciatreetop.png", "watershed_acaciatree.png"}, + paramtype2 = "facedir", + groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2}, + sounds = default.node_sound_wood_defaults(), + on_place = minetest.rotate_node +}) + minetest.register_node("watershed:needles", { description = "WS Pine Needles", drawtype = "allfaces_optional", @@ -31,6 +40,15 @@ minetest.register_node("watershed:needles", { sounds = default.node_sound_leaves_defaults(), }) +minetest.register_node("watershed:pinetree", { + description = "WS Pine Tree", + tiles = {"watershed_pinetreetop.png", "watershed_pinetreetop.png", "watershed_pinetree.png"}, + paramtype2 = "facedir", + groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2}, + sounds = default.node_sound_wood_defaults(), + on_place = minetest.rotate_node +}) + minetest.register_node("watershed:jungleleaf", { description = "WS Jungletree Leaves", drawtype = "allfaces_optional", diff --git a/textures/watershed_acacialeaf.png b/textures/watershed_acacialeaf.png new file mode 100644 index 0000000000000000000000000000000000000000..08cf3998c0c8d47ae63ddcf51878b725faec497e GIT binary patch literal 340 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=85p>QL70(Y)*K0-AbW|YuPggK7CvSv7MGoE(}6-)JY5_^EKaYT zq$|{HAkZp5w`r}@W3A+()`T67MU&?&INtG?!?b|aN0qPlkkCfaxvjEY%GsaHZ~p!E z_O#UcjJZW$-cFEQzH*K7Gd=e}*AKQX63bWSx1V8iWhgj&bO&R@nG@-ecP)I6_ZLr3 zmJAkH6TB}~XH`e)9ZiOYlNGjEMROm_2y}Zas;e9j^6`Cdsh2V9%#VM6<+!Zj&n|JB z*ml6e*Gxm}b;YgaA^SgeEzw^mY*JUQ@ICYJ`Yzrsl~&#^x%0J7o*eJ?B(l$A{eC`g e>b@O5A6QpKmzL{@-S7eWkHOQ`&t;ucLK6V4LxIx( literal 0 HcmV?d00001 diff --git a/textures/watershed_acaciatree.png b/textures/watershed_acaciatree.png new file mode 100644 index 0000000000000000000000000000000000000000..169823d41612d29e16c7faa44baae5d51b842de3 GIT binary patch literal 682 zcmV;b0#*HqP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2i^n? z2^1X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SbN`SPeFe2{7$OQ*_lG0ljbT_+%fXORZ+vH4p-NWvDAVPAq0g1V+^_0*xXW%9OFW==X}ohBu;Cx zso|KJo2v1F3L~sB7;CAslC41pTT7OfBtc!X=^RRVqCQFf%f{nNk4?>^g3!i{96STMm$O!Ra#M1mO%vl4g{Vf#L``DbLvc& zR(~1i94~f8P4F5kKX`oSpCC1f+s78~U_Vq1iT9p7{cn^H$M|TR{{S1^LDaALQ)vJI N002ovPDHLkV1hvjGz9Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2i^n@ z11b`4D+M(G00K2hL_t(I%RQ4zjx1FS1;f7I%&h8uunnecfc>uoBqZpr%({OwNMLN~ zC>+O@-+ukY)JL{`BX~zjiJT&RPGZXZ`N!{k{`?c?>m=n3C&GE27{>WJ(FKGU=&jS| zWUWPQ9TCGj<^298$B1_x=NyRA$HY0o=0sH>B!@ahL@1@uduPtcvc)u`l*WGS*qU7B z0-*N^0&3!L?hXjfv4Ckt?~?_@5dRNtwXtjgV9Qtrsx0Q5Y&p^AWcH48j#3)ER`%xy z*LmTcQfgt@!aJqb4uF~&wM`IZj>$qvG0^J8XpLjvK$KD%qc)DbQEJ211p9Y|1s|bP$sM-Rj)Kan8S#zMyvmXx(!$dGM<}y-F04y6U zTP(P1Oet`lZ{oJoS_2kN9Wh2;*F`Ih7$e7i<3FFDEE_1Gf?;BuuWugvjyfzMtK)h73Tvn`nv@M zuCtJigRj58cz!%N&o@4JFeM!a0HwBDE=GA@Y}%0gdkaMQBL96X{U>Iu*+PkpUqSwlt6I3xXQV56$wN_G0j4_yfGR^K41jENn zX@j(FU`oyz?;@(oyHt+jKvkJ$_bljt4d4;IHJTBEC#Q%4$FX5z1aY*{Q0H$lz^lK1 b!YTg%;Xz=CmniwT00000NkvXXu0mjfhT1f1 literal 0 HcmV?d00001 diff --git a/textures/watershed_pinetreetop.png b/textures/watershed_pinetreetop.png new file mode 100644 index 0000000000000000000000000000000000000000..9e2f8647645e47ea52f0014e6d638b7751cc6f8f GIT binary patch literal 802 zcmV+-1Ks?IP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2i^n@ z11bUQl|<_R00N>(L_t(I%WacSYb#Y8hMzO%%uFW9}?gu4*D{=o}UTkMr2ZSKiTCUa)a9~VI@>brawKc3$MulV$n4u z7*p}@{MBn+{@p2nkKUg1)7tP(p%|Q8;?o>GKc%fZ5Dxpwu)Mw|goMp-#Lc#0Tqy4P z3}sA3x7U39!Mhwiy~4E}-tG`8Mdmrd2b5Bz@_j^>lTOaKd;W~iKl=h>DwNhGqiWCb zTUWH(n%#OuR!*SX(=OKtC6Refo1{pUlJ^PoH?BCJYo0IL1A%;fK|rzlW5xL5f^=9y zfOzat#gs&5BvKJ$r2hS91QX6K&e1o`!NGRdfOkX@iN2@0`;GDZ0#|SGoh1<&-dl>J zGlUQadu{vpf=?yUd-`g}epu1BJ!2HZ#hV}!Y<-X0Y;d-QBmo>@-vW>rQ!&yduC2*W zG{e~pr4-J#tbh5A=HU+4Y;m?l2tjZy-g!nRbF?l=0A$}|o1V?GqHAhoCb88$!8;yq zex=*jL}vl;y(RjH&r*!34hQZZ3~45rPKTsfjx`mDfP7LiT`Z6?1(6Y4OZ1)?Ji;AZ zD6LCOd%*KukN2L?HTXWqS6jMWhpl$Zo?H?`Pv2Mu8oWOcDPt;Ldr}g-BY20md&cJr zVi2gokhFA+&t^!au$5sjn?i8-c8}KOf#B<9%X^(=cs#}JTdLca$WcK$C=f~_Lc}!< z#gV2sJw=X2*!$JNfiV@kR`Bf0ZwO68=sHI8V+yTNnLp!9^GhD2*gd_(U%QA)baD}G!(AYJmf#%((0_PXMQ78tYo g-#Pzx%7+7g0#Pt$?Q?}=djJ3c07*qoM6N<$f-zxgssI20 literal 0 HcmV?d00001