From 047ed049780674c4a640bc4652355d32501c0a21 Mon Sep 17 00:00:00 2001 From: paramat Date: Thu, 20 Feb 2014 07:18:40 +0000 Subject: [PATCH] 16x16 clouds, cacti, papyrus, ice, dryshrubs --- README.txt | 2 +- functions.lua | 40 ++++++++++++++++ init.lua | 71 ++++++++++++++++++++++++----- nodes.lua | 44 ++++++++++++++++++ textures/watershed_cloud.png | Bin 0 -> 136 bytes textures/watershed_drygrass.png | Bin 0 -> 771 bytes textures/watershed_goldengrass.png | Bin 0 -> 606 bytes textures/watershed_pinesapling.png | Bin 0 -> 406 bytes 8 files changed, 145 insertions(+), 12 deletions(-) create mode 100644 textures/watershed_cloud.png create mode 100644 textures/watershed_drygrass.png create mode 100644 textures/watershed_goldengrass.png create mode 100644 textures/watershed_pinesapling.png diff --git a/README.txt b/README.txt index f469a87..5d9c7ff 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -watershed 0.2.2 by paramat +watershed 0.2.3 by paramat For latest stable Minetest back to 0.4.8 Depends default Licenses: code WTFPL \ No newline at end of file diff --git a/functions.lua b/functions.lua index 8fb327d..d326a48 100644 --- a/functions.lua +++ b/functions.lua @@ -82,6 +82,25 @@ function watershed_jungletree(x, y, z, area, data) end end +function watershed_savannatree(x, y, z, area, data) + local c_tree = minetest.get_content_id("default:tree") + local c_leaves = minetest.get_content_id("default:leaves") + for j = -3, 6 do + if j >= 5 then + for i = -3, 3 do + for k = -3, 3 do + local vil = area:index(x + i, y + j + 1, z + k) + if math.random(2) == 2 then + data[vil] = c_leaves + end + end + end + end + local vit = area:index(x, y + j, z) + data[vit] = c_tree + end +end + function watershed_grass(data, vi) local c_grass1 = minetest.get_content_id("default:grass_1") local c_grass2 = minetest.get_content_id("default:grass_2") @@ -123,4 +142,25 @@ function watershed_flower(data, vi) else data[vi] = c_viola end +end + +function watershed_cactus(x, y, z, area, data) + local c_wscactus = minetest.get_content_id("watershed:cactus") + for j = -2, 4 do + for i = -2, 2 do + if i == 0 or j == 2 or (j == 3 and math.abs(i) == 2) then + local vic = area:index(x + i, y + j, z) + data[vic] = c_wscactus + end + end + end +end + +function watershed_papyrus(x, y, z, area, data) + local c_papyrus = minetest.get_content_id("default:papyrus") + local ph = math.random(1, 4) + for j = 1, ph do + local vip = area:index(x, y + j, z) + data[vip] = c_papyrus + end end \ No newline at end of file diff --git a/init.lua b/init.lua index 01a2534..45aac47 100644 --- a/init.lua +++ b/init.lua @@ -1,22 +1,25 @@ --- watershed 0.2.2 by paramat +-- watershed 0.2.3 by paramat -- For latest stable Minetest and back to 0.4.8 -- Depends default -- License: code WTFPL +-- 0.2.3 clouds, cacti, ice, papyrus, dry shrub + -- Parameters -local YMIN = 6000 -local YMAX = 8000 -- Top of atmosphere / mountains / floatlands -local TERCEN = 7008 -- Terrain centre +local YMIN = 6000 -- Approximate base of realm stone +local YMAX = 8000 -- Approximate top of atmosphere / mountains / floatlands +local TERCEN = 7960 -- Terrain 'centre'. Approximate average seabed level local YWAT = 7024 -- Sea level +local CLOUDY = 7152 -- Cloud level local TERSCA = 384 -- Vertical terrain scale local XLSAMP = 0 -- Extra large scale height variation amplitude local BASAMP = 0.3 -- Base terrain amplitude local CANAMP = 0.7 -- Canyon terrain amplitude local CANEXP = 1.33 -- Canyon shape exponent local TSTONE = 0.015 -- Density threshold for stone -local TRIV = -0.027 -- Maximum densitybase threshold for river water -local TSAND = -0.03 -- Maximum densitybase threshold for sand +local TRIV = -0.017 -- Maximum densitybase threshold for river water +local TSAND = -0.02 -- Maximum densitybase threshold for sand local FIST = 0 -- Fissure threshold at surface. Controls size of fissure entrances at surface local FISEXP = 0.02 -- Fissure expansion rate under surface local ORECHA = 1 / (7 * 7 * 7) -- Ore chance per stone node @@ -25,9 +28,12 @@ local PINCHA = 47 -- Pine tree 1/x chance per node local APTCHA = 47 -- Appletree local FLOCHA = 36 -- Flower local FOGCHA = 9 -- Forest grass -local GRACHA = 5 -- Grassland grasses +local GRACHA = 3 -- Grassland grasses local JUTCHA = 16 -- Jungletree local JUGCHA = 9 -- Junglegrass +local CACCHA = 529 -- Cactus +local DRYCHA = 361 -- Dry shrub +local PAPCHA = 3 -- Papyrus -- 3D noise for rough terrain @@ -95,6 +101,17 @@ local np_xlscale = { persist = 0.4 } +-- 2D noise for clouds + +local np_cloud = { + offset = 0, + scale = 1, + spread = {x=207, y=207, z=207}, + seed = 2113, + octaves = 4, + persist = 0.8 +} + -- Stuff watershed = {} @@ -128,8 +145,10 @@ minetest.register_on_generated(function(minp, maxp, seed) local c_sand = minetest.get_content_id("default:sand") local c_desand = minetest.get_content_id("default:desert_sand") local c_snowblock = minetest.get_content_id("default:snowblock") + local c_ice = minetest.get_content_id("default:ice") local c_dirtsnow = minetest.get_content_id("default:dirt_with_snow") local c_jungrass = minetest.get_content_id("default:junglegrass") + local c_dryshrub = minetest.get_content_id("default:dry_shrub") local c_stodiam = minetest.get_content_id("default:stone_with_diamond") local c_stomese = minetest.get_content_id("default:stone_with_mese") local c_stogold = minetest.get_content_id("default:stone_with_gold") @@ -142,6 +161,7 @@ minetest.register_on_generated(function(minp, maxp, seed) local c_wsredstone = minetest.get_content_id("watershed:redstone") local c_wsgrass = minetest.get_content_id("watershed:grass") local c_wsdirt = minetest.get_content_id("watershed:dirt") + local c_wscloud = minetest.get_content_id("watershed:cloud") local sidelen = x1 - x0 + 1 local chulens = {x=sidelen, y=sidelen, z=sidelen} @@ -155,6 +175,7 @@ minetest.register_on_generated(function(minp, maxp, seed) local nvals_base = minetest.get_perlin_map(np_base, chulens):get2dMap_flat(minposxz) local nvals_biome = minetest.get_perlin_map(np_biome, chulens):get2dMap_flat(minposxz) local nvals_xlscale = minetest.get_perlin_map(np_xlscale, chulens):get2dMap_flat(minposxz) + local nvals_cloud = minetest.get_perlin_map(np_cloud, chulens):get2dMap_flat(minposxz) local nixyz = 1 local nixz = 1 @@ -196,7 +217,8 @@ minetest.register_on_generated(function(minp, maxp, seed) end if density >= tstone and nofis -- stone cut by fissures - or (density >= tstone and density < TSTONE * 2 and y <= YWAT) then -- or stone layer around water + or (density >= tstone and density < TSTONE * 3 and y <= YWAT) -- or stone layer around water + or (density >= tstone and density < TSTONE * 3 and densitybase >= triv ) then -- or stone layer around river if n_biome > 0.7 then data[vi] = c_wsredstone elseif math.random() < ORECHA then @@ -243,17 +265,38 @@ minetest.register_on_generated(function(minp, maxp, seed) under[si] = 0 end elseif y <= YWAT and density < tstone then -- sea water, not in fissures - data[vi] = c_water + if y == YWAT and n_biome < -1 then + data[vi] = c_ice + else + data[vi] = c_water + if y == YWAT and n_biome > 0.2 and stable[si] >= 1 + and math.random(PAPCHA) == 2 then -- papyrus in desert and rainforest + watershed_papyrus(x, y, z, area, data) + end + end stable[si] = 0 under[si] = 0 elseif densitybase >= triv and density < tstone then -- river water, not in fissures - data[vi] = c_wswater + if n_biome < -1 then + data[vi] = c_ice + else + data[vi] = c_wswater + end + stable[si] = 0 + under[si] = 0 + elseif y == CLOUDY then -- clouds + local xrq = 16 * math.floor((x - x0) / 16) + local zrq = 16 * math.floor((z - z0) / 16) + local qixz = zrq * sidelen + xrq + 1 + if nvals_cloud[qixz] > 0.5 then + data[vi] = c_wscloud + end stable[si] = 0 under[si] = 0 else -- possible above surface air node if y >= YWAT and under[si] ~= 0 then if under[si] == 1 then - if math.random(PINCHA) == 2 then + if n_biome > -1 and math.random(PINCHA) == 2 then watershed_pinetree(x, y, z, area, data) else data[viu] = c_dirtsnow @@ -290,6 +333,12 @@ minetest.register_on_generated(function(minp, maxp, seed) data[vi] = c_jungrass end end + elseif under[si] == 5 then + if n_biome < 0.8 and math.random(CACCHA) == 2 then + watershed_cactus(x, y, z, area, data) + elseif n_biome < 0.8 and math.random(DRYCHA) == 2 then + data[vi] = c_dryshrub + end end end stable[si] = 0 diff --git a/nodes.lua b/nodes.lua index 9b9c8f7..b26434d 100644 --- a/nodes.lua +++ b/nodes.lua @@ -51,6 +51,50 @@ minetest.register_node("watershed:stone", { sounds = default.node_sound_stone_defaults(), }) +minetest.register_node("watershed:cloud", { + description = "WS Cloud", + drawtype = "glasslike", + tiles = {"watershed_cloud.png"}, + paramtype = "light", + is_ground_content = false, + sunlight_propagates = true, + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + post_effect_color = {a=64, r=241, g=248, b=255}, + groups = {not_in_creative_inventory=1}, +}) + +minetest.register_node("watershed:cactus", { + description = "WS Cactus", + tiles = {"default_cactus_top.png", "default_cactus_top.png", "default_cactus_side.png"}, + paramtype2 = "facedir", + is_ground_content = false, + groups = {snappy=1,choppy=3,flammable=2}, + drop = "default:cactus", + sounds = default.node_sound_wood_defaults(), + on_place = minetest.rotate_node +}) + +minetest.register_node("watershed:goldengrass", { + description = "Golden Grass", + drawtype = "plantlike", + tiles = {"watershed_goldengrass.png"}, + inventory_image = "watershed_goldengrass.png", + wield_image = "watershed_goldengrass.png", + paramtype = "light", + walkable = false, + buildable_to = true, + is_ground_content = true, + groups = {snappy=3,flammable=3,flora=1,attached_node=1}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}, + }, +}) + minetest.register_node("watershed:water", { description = "WS Water Source", inventory_image = minetest.inventorycube("default_water.png"), diff --git a/textures/watershed_cloud.png b/textures/watershed_cloud.png new file mode 100644 index 0000000000000000000000000000000000000000..348c78c4842f8a47ab9a210199198100e4f4ea1b GIT binary patch literal 136 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|jKx9jP7LeL$-D$|I14-?iy0XB zj({-ZRBb+KpdfpRr>`sfT^3db6|Rlqzd=G$o-U3d8t0R1{(NF))@bP0l+XkKtDYmV literal 0 HcmV?d00001 diff --git a/textures/watershed_drygrass.png b/textures/watershed_drygrass.png new file mode 100644 index 0000000000000000000000000000000000000000..a2c553a3cb340199f92a9af4b4c7f109bb06a93a GIT binary patch literal 771 zcmV+e1N{7nP)Px#32;bRa{vGf6951U69E94oEQKA00(qQO+^RY2@w{Qg^QwIbI{ z&Kac?eog%R`4cG>uJ@T-GsnSkdOxGJ#I+3ogKN;!;`#B*6CoF#zkUND*;>ouBW5EL4ofN2O6W1QZP8jakC|t%=vO7mr83C zo$a{ID{{IA#_P=NJ$-99ZXH8s8K;@&uWxLfWet&eO&HzM+m4(wgKf}4BXg;oJ}zk0 zU>nEK4cwNM#Yc|YEmFYScqN2HPL-T1t{M2aE{Ix@)PhlllnX{HQc8UL7+F(fu$Ghy z$|!0T>^2>x7JLlUToFQ`_ijKbK^B7Bo+*t@G&jS!85cDzb0lMSbd~3io>pF zoIKjOhMQlZfX{`L5=PDlD)SofA@MLMHrB9&h*E;b{hm?^J_Pj3KO=o-u&v|h1hsZt zmW7wUU)eg#uRlB?wdC$2%m2{oBli%INOVO|s^q>bw5>r1$!_Rzwn0lt-x{O@StQfs z2_drP%o0~(%E;|7V6^XnV0?>9;X zJ0|>whJ^ZMiNp)IzHb zZKLR2$8A|TPj^C2^tQ#C23<3*v&fJFAp~;Cq>=!TQgRwE7-L8=QA*+Iu;XF3p^8l3 z8BC+tID`J_yCZ9ilv23OE7U^oTAa1KUnXLy?1qlsc7za6+Hturq?Bk|fwYaL(a;!; z5Q6>2G2SLh0bvwt%EX#M6z=Q7dAy*cpi)^v=3k1}dK(T07is_i002ovPDHLkV1m$b BUZMa1 literal 0 HcmV?d00001 diff --git a/textures/watershed_goldengrass.png b/textures/watershed_goldengrass.png new file mode 100644 index 0000000000000000000000000000000000000000..a4ddd78eba26d861c2047ea0e08362bd8f196cff GIT binary patch literal 606 zcmV-k0-^nhP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2i^h* z2_i9~DbeKs00G`fL_t(I%WadvZWA#SMUQPpQ$`7eG|hzecaX9~{Q#<{*`cmM`2d7K zNNm_9ipm0s4eOEeJ8eh_gv4P&6kM}-V|j$IWXbmPyYIexZ2*c9o_|I$mb3rG!kA9* zx)|YqEaTzT8%Zcj*_T`R@*#o*z)$b+&VlX?P_0%(Jb#I*SIO?n3~^&*-D*K^fYQYX zf4h)FyNL|KD7SF^Rn|9iaIU&*g^lhFP@Q&62n?Kq$!q-CCF-;*vGzl$3a}}qpauvG z_WKBA3^X!X&lm9dJ$_e2hE18^ERYu)FCh^OVFJoSlO5q zG%!Z`4>~-3j}d(f|Me07*qoM6N<$f*u0|P5=M^ literal 0 HcmV?d00001 diff --git a/textures/watershed_pinesapling.png b/textures/watershed_pinesapling.png new file mode 100644 index 0000000000000000000000000000000000000000..cd8167a25dd52a3c8d84417984165294e2962fa3 GIT binary patch literal 406 zcmV;H0crk;P)e-vd2O3fm9*zeI zmMTymd-}3FyF0V<0skI{YoG6$$ylE0hXe(-eFp&0_8p>}=g*l01)^fmcS>`cITtT{RREdB3zwEp~pWNQY**w$C$-K`jV-xOn?P_ z`J-{iBrcvrx+7k_2sCWsjnISwoQ@ltHgWPG7JZ^AnxVH&cm}a&F`bRacLMu15e