diff --git a/README.txt b/README.txt index 066b5eb..a1d77ac 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,5 @@ -watershed 0.3.5 by paramat +watershed 0.3.6 by paramat For latest stable Minetest back to 0.4.8 -Depends default -Licenses: code WTFPL \ No newline at end of file +Depends default bucket +Licenses: code WTFPL, textures CC BY-SA +watershed:redcobble texture CC BY-SA by brunob.santos minetestbr.blogspot.com \ No newline at end of file diff --git a/functions.lua b/functions.lua index 81a2601..bab07e8 100644 --- a/functions.lua +++ b/functions.lua @@ -212,11 +212,11 @@ end -- Register buckets, lava fuel bucket.register_liquid( - "watershed:water", - "watershed:waterflow", - "watershed:bucket_water", - "watershed_bucketwater.png", - "WS Water Bucket" + "watershed:freshwater", + "watershed:freshwaterflow", + "watershed:bucket_freshwater", + "watershed_bucketfreshwater.png", + "WS Fresh Water Bucket" ) bucket.register_liquid( @@ -234,11 +234,11 @@ minetest.register_craft({ replacements = {{"watershed:bucket_lava", "bucket:bucket_empty"}}, }) --- Singlenode mapgen option +-- Singlenode option -local SINGLENODE = true +local SINODE = true -if SINGLENODE then +if SINODE then -- Set mapgen parameters minetest.register_on_mapgen_init(function(mgparams) @@ -322,21 +322,21 @@ if SINGLENODE then local x1 = x0 + 79 local z1 = z0 + 79 local y1 = 47 - + local sidelen = 80 local chulens = {x=sidelen, y=sidelen, z=sidelen} local minposxyz = {x=x0, y=y0, z=z0} local minposxz = {x=x0, y=z0} - + 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) - + local nixz = 1 local nixyz = 1 for z = z0, z1 do diff --git a/init.lua b/init.lua index 3ebf40a..f83f9dd 100644 --- a/init.lua +++ b/init.lua @@ -1,7 +1,13 @@ --- watershed 0.3.5 by paramat +-- watershed 0.3.6 by paramat -- For latest stable Minetest and back to 0.4.8 -- Depends default bucket --- License: code WTFPL +-- License: code WTFPL, textures CC BY-SA +-- Red cobble texture CC BY-SA by brunob.santos minetestbr.blogspot.com + +-- added turquoise fresh ice node +-- bugfix: stone drops default:cobble +-- add red cobble, texture by brunob.santos +-- redo clouds using fissure and humid noises, new texture -- Parameters @@ -9,8 +15,8 @@ local YMIN = -33000 -- Approximate base of realm stone local YMAX = 33000 -- Approximate top of atmosphere / mountains / floatlands local TERCEN = -160 -- Terrain 'centre', average seabed level local YWAT = 1 -- Sea surface y -local YCLOUD = 256 -- Cloud level -local CLOUDS = true +local YCLOMIN = 287 -- Minimum height of mod clouds +local CLOUDS = true -- Mod clouds? local TERSCA = 512 -- Vertical terrain scale local XLSAMP = 0.2 -- Extra large scale height variation amplitude @@ -26,15 +32,13 @@ local TLAVA = 2.3 -- Maximum densitybase threshold for lava, small because grad local FIST = 0 -- Fissure threshold at surface, controls size of fissure entrances at surface local FISEXP = 0.02 -- Fissure expansion rate under surface local ORETHI = 0.001 -- Ore seam thickness tuner -local ORET = 0.02 -- Ore threshold for seam -local TCLOUD = 0.5 -- Cloud threshold +local SEAMT = 0.02 -- Seam threshold local HITET = 0.35 -- High temperature threshold local LOTET = -0.35 -- Low .. local ICETET = -0.7 -- Ice .. local HIHUT = 0.35 -- High humidity threshold local LOHUT = -0.35 -- Low .. -local CLOHUT = 0.35 -- Cloud humidity threshold local PINCHA = 36 -- Pine tree 1/x chance per node local APTCHA = 36 -- Appletree @@ -115,9 +119,9 @@ local np_humid = { persist = 0.5 } --- 3D noise for ore seams +-- 3D noise for ore seam networks -local np_ore = { +local np_seam = { offset = 0, scale = 1, spread = {x=512, y=128, z=512}, @@ -126,7 +130,7 @@ local np_ore = { persist = 0.5 } --- 3D noise for rock strata +-- 3D noise for rock strata inclination local np_strata = { offset = 0, @@ -159,17 +163,6 @@ 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.7 -} - -- 2D noise for magma surface local np_magma = { @@ -236,16 +229,17 @@ minetest.register_on_generated(function(minp, maxp, seed) local c_grass5 = minetest.get_content_id("default:grass_5") local c_obsidian = minetest.get_content_id("default:obsidian") - local c_wswater = minetest.get_content_id("watershed:water") + local c_wsfreshwater = minetest.get_content_id("watershed:freshwater") local c_wsstone = minetest.get_content_id("watershed:stone") local c_wsredstone = minetest.get_content_id("watershed:redstone") local c_wsgrass = minetest.get_content_id("watershed:grass") local c_wsdrygrass = minetest.get_content_id("watershed:drygrass") - local c_wsgoldgrass = minetest.get_content_id("watershed:goldengrass") + local c_wsgoldengrass = minetest.get_content_id("watershed:goldengrass") local c_wsdirt = minetest.get_content_id("watershed:dirt") - local c_wscloud = minetest.get_content_id("watershed:cloud") local c_wspermafrost = minetest.get_content_id("watershed:permafrost") local c_wslava = minetest.get_content_id("watershed:lava") + local c_wsfreshice = minetest.get_content_id("watershed:freshice") + local c_wscloud = minetest.get_content_id("watershed:cloud") -- perlinmap stuff local sidelen = x1 - x0 + 1 local chulens = {x=sidelen, y=sidelen+2, z=sidelen} @@ -258,12 +252,11 @@ minetest.register_on_generated(function(minp, maxp, seed) local nvals_fissure = minetest.get_perlin_map(np_fissure, 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_ore = minetest.get_perlin_map(np_ore, chulens):get3dMap_flat(minposxyz) + local nvals_seam = minetest.get_perlin_map(np_seam, chulens):get3dMap_flat(minposxyz) local nvals_strata = minetest.get_perlin_map(np_strata, 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) - local nvals_cloud = minetest.get_perlin_map(np_cloud, chulens):get2dMap_flat(minposxz) local nvals_magma = minetest.get_perlin_map(np_magma, chulens):get2dMap_flat(minposxz) local ungen = false -- ungenerated chunk below? @@ -303,11 +296,10 @@ minetest.register_on_generated(function(minp, maxp, seed) local tsand = TSAND * (1 - terblen) local tstone = TSTONE * (1 + grad * 0.5) local tlava = TLAVA * (1 - nvals_magma[nixz] ^ 4 * terblen ^ 16 * 0.5) - local nofis = false - if density >= 0 then -- if terrain set fissure flag - if math.abs(nvals_fissure[nixyz]) > FIST + math.sqrt(density) * FISEXP then - nofis = true - end + + local nofis = false -- set fissure bool + if math.abs(nvals_fissure[nixyz]) > FIST + math.sqrt(density) * FISEXP then + nofis = true end -- overgeneration and in-chunk generation if y == y0 - 1 then -- node layer below chunk @@ -317,7 +309,7 @@ minetest.register_on_generated(function(minp, maxp, seed) else stable[si] = 0 end - else + else -- scan top layer of chunk below local nodename = minetest.get_node({x=x,y=y,z=z}).name if nodename == "watershed:stone" or nodename == "watershed:redstone" @@ -385,7 +377,7 @@ minetest.register_on_generated(function(minp, maxp, seed) data[vi] = c_sandstone elseif biome == 7 and density < TSTONE * 3 then -- desert stone data[vi] = c_wsredstone - elseif math.abs(nvals_ore[nixyz]) < ORET then -- if seam + elseif math.abs(nvals_seam[nixyz]) < SEAMT then -- if seam if densityper >= 0.9 and densityper <= 0.9 + ORETHI and math.random(23) == 2 then data[vi] = c_stodiam @@ -466,22 +458,19 @@ minetest.register_on_generated(function(minp, maxp, seed) under[si] = 0 elseif densitybase >= triv and density < tstone then -- river water, not in fissures if n_temp < ICETET then - data[vi] = c_ice + data[vi] = c_wsfreshice else - data[vi] = c_wswater + data[vi] = c_wsfreshwater end stable[si] = 0 under[si] = 0 - elseif CLOUDS and y == YCLOUD then -- clouds + elseif CLOUDS and y == y1 and y >= YCLOMIN then -- clouds at chunk top local xrq = 16 * math.floor((x - x0) / 16) -- quantise to 16x16 lattice local zrq = 16 * math.floor((z - z0) / 16) - local qixz = zrq * 80 + xrq + 1 -- quantised index - if nvals_cloud[qixz] > TCLOUD then - local yrq = 16 * math.floor((y - y0) / 16) - local qixyz = zrq * 6400 + yrq * 80 + xrq + 1 - if nvals_humid[qixyz] > CLOHUT then - data[vi] = c_wscloud - end + local yrq = 79 + local qixyz = zrq * 6400 + yrq * 80 + xrq + 1 -- quantised 3D index + if math.abs(nvals_fissure[qixyz]) < nvals_humid[qixyz] * 0.1 then + data[vi] = c_wscloud end stable[si] = 0 under[si] = 0 @@ -490,7 +479,7 @@ minetest.register_on_generated(function(minp, maxp, seed) local fnoise = nvals_fissure[nixyz] if under[si] == 1 then if math.random(121) == 2 then - data[viu] = c_dirtsnow + data[viu] = c_snowblock elseif math.random(121) == 2 then data[viu] = c_ice else @@ -513,7 +502,7 @@ minetest.register_on_generated(function(minp, maxp, seed) data[viu] = c_wsdrygrass if math.random(GRACHA) == 2 then if math.random(5) == 2 then - data[vi] = c_wsgoldgrass + data[vi] = c_wsgoldengrass else data[vi] = c_dryshrub end @@ -550,7 +539,7 @@ minetest.register_on_generated(function(minp, maxp, seed) else data[viu] = c_wsdrygrass if math.random(GOGCHA) == 2 then - data[vi] = c_wsgoldgrass + data[vi] = c_wsgoldengrass end end elseif under[si] == 9 then diff --git a/nodes.lua b/nodes.lua index 1262624..022a25a 100644 --- a/nodes.lua +++ b/nodes.lua @@ -67,6 +67,15 @@ minetest.register_node("watershed:redstone", { tiles = {"default_desert_stone.png"}, is_ground_content = false, groups = {cracky=3}, + drop = "watershed:redcobble", + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("watershed:redcobble", { + description = "WS Red Cobblestone", + tiles = {"watershed_redcobble.png"}, + is_ground_content = false, + groups = {cracky=3, stone=2}, sounds = default.node_sound_stone_defaults(), }) @@ -75,24 +84,10 @@ minetest.register_node("watershed:stone", { tiles = {"default_stone.png"}, is_ground_content = false, groups = {cracky=3}, + drop = "default:cobble", 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"}, @@ -146,7 +141,6 @@ minetest.register_node("watershed:vine", { description = "WS Jungletree Vine", drawtype = "airlike", paramtype = "light", - sunlight_propagates = true, walkable = false, climbable = true, pointable = false, @@ -156,20 +150,42 @@ minetest.register_node("watershed:vine", { groups = {not_in_creative_inventory=1}, }) -minetest.register_node("watershed:water", { - description = "WS Water Source", - inventory_image = minetest.inventorycube("watershed_water.png"), +minetest.register_node("watershed:freshice", { + description = "WS Fresh Ice", + tiles = {"watershed_freshice.png"}, + is_ground_content = false, + paramtype = "light", + groups = {cracky=3}, + sounds = default.node_sound_glass_defaults(), +}) + +minetest.register_node("watershed:cloud", { + description = "WS Cloud", + drawtype = "glasslike", + tiles = {"watershed_cloud.png"}, + paramtype = "light", + sunlight_propagates = true, + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + post_effect_color = {a=23, r=241, g=248, b=255}, +}) + +minetest.register_node("watershed:freshwater", { + description = "WS Fresh Water Source", + inventory_image = minetest.inventorycube("watershed_freshwater.png"), drawtype = "liquid", tiles = { { - name="watershed_wateranim.png", + name="watershed_freshwateranim.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0} } }, special_tiles = { { - name="watershed_wateranim.png", + name="watershed_freshwateranim.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.0}, backface_culling = false, @@ -185,8 +201,8 @@ minetest.register_node("watershed:water", { drop = "", drowning = 1, liquidtype = "source", - liquid_alternative_flowing = "watershed:waterflow", - liquid_alternative_source = "watershed:water", + liquid_alternative_flowing = "watershed:freshwaterflow", + liquid_alternative_source = "watershed:freshwater", liquid_viscosity = WATER_VISC, liquid_renewable = false, liquid_range = 2, @@ -194,19 +210,19 @@ minetest.register_node("watershed:water", { groups = {water=3, liquid=3, puts_out_fire=1}, }) -minetest.register_node("watershed:waterflow", { - description = "WS Flowing Water", - inventory_image = minetest.inventorycube("watershed_water.png"), +minetest.register_node("watershed:freshwaterflow", { + description = "WS Fresh Flowing Water", + inventory_image = minetest.inventorycube("watershed_freshwater.png"), drawtype = "flowingliquid", - tiles = {"default_water.png"}, + tiles = {"watershed_freshwater.png"}, special_tiles = { { - image="watershed_waterflowanim.png", + image="watershed_freshwaterflowanim.png", backface_culling=false, animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.8} }, { - image="watershed_waterflowanim.png", + image="watershed_freshwaterflowanim.png", backface_culling=true, animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.8} }, @@ -222,8 +238,8 @@ minetest.register_node("watershed:waterflow", { drop = "", drowning = 1, liquidtype = "flowing", - liquid_alternative_flowing = "watershed:waterflow", - liquid_alternative_source = "watershed:water", + liquid_alternative_flowing = "watershed:freshwaterflow", + liquid_alternative_source = "watershed:freshwater", liquid_viscosity = WATER_VISC, liquid_renewable = false, liquid_range = 2, diff --git a/textures/watershed_bucketwater.png b/textures/watershed_bucketfreshwater.png similarity index 100% rename from textures/watershed_bucketwater.png rename to textures/watershed_bucketfreshwater.png diff --git a/textures/watershed_cloud.png b/textures/watershed_cloud.png index 348c78c..239dede 100644 Binary files a/textures/watershed_cloud.png and b/textures/watershed_cloud.png differ diff --git a/textures/watershed_darkcloud.png b/textures/watershed_darkcloud.png deleted file mode 100644 index 192f9c8..0000000 Binary files a/textures/watershed_darkcloud.png and /dev/null differ diff --git a/textures/watershed_freshice.png b/textures/watershed_freshice.png new file mode 100644 index 0000000..bc1c285 Binary files /dev/null and b/textures/watershed_freshice.png differ diff --git a/textures/watershed_water.png b/textures/watershed_freshwater.png similarity index 100% rename from textures/watershed_water.png rename to textures/watershed_freshwater.png diff --git a/textures/watershed_wateranim.png b/textures/watershed_freshwateranim.png similarity index 100% rename from textures/watershed_wateranim.png rename to textures/watershed_freshwateranim.png diff --git a/textures/watershed_waterflowanim.png b/textures/watershed_freshwaterflowanim.png similarity index 100% rename from textures/watershed_waterflowanim.png rename to textures/watershed_freshwaterflowanim.png diff --git a/textures/watershed_goldengrass.png b/textures/watershed_goldengrass.png index 4b96f76..50f6a66 100644 Binary files a/textures/watershed_goldengrass.png and b/textures/watershed_goldengrass.png differ diff --git a/textures/watershed_redcobble.png b/textures/watershed_redcobble.png new file mode 100644 index 0000000..c09665f Binary files /dev/null and b/textures/watershed_redcobble.png differ