diff --git a/README.txt b/README.txt index ba97c84..1d6b201 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -watershed 0.2.13 by paramat +watershed 0.2.14 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 ba81ceb..cdc6b8b 100644 --- a/functions.lua +++ b/functions.lua @@ -24,7 +24,7 @@ function watershed_pinetree(x, y, z, area, data) local c_tree = minetest.get_content_id("default:tree") local c_wsneedles = minetest.get_content_id("watershed:needles") local c_snowblock = minetest.get_content_id("default:snowblock") - for j = -4, 13 do + for j = -4, 14 do if j == 3 or j == 6 or j == 9 or j == 12 then for i = -2, 2 do for k = -2, 2 do @@ -38,7 +38,7 @@ function watershed_pinetree(x, y, z, area, data) end end end - elseif j == 4 or j == 7 or j == 10 or j == 13 then + elseif j == 4 or j == 7 or j == 10 then for i = -1, 1 do for k = -1, 1 do if not (i == 0 and j == 0) then @@ -51,13 +51,28 @@ function watershed_pinetree(x, y, z, area, data) end end end + elseif j == 13 then + for i = -1, 1 do + for k = -1, 1 do + if not (i == 0 and j == 0) then + if math.random(7) ~= 2 then + local vil = area:index(x + i, y + j, z + k) + data[vil] = c_wsneedles + local vil = area:index(x + i, y + j + 1, z + k) + data[vil] = c_wsneedles + local vila = area:index(x + i, y + j + 2, z + k) + data[vila] = c_snowblock + end + end + end + end end local vit = area:index(x, y + j, z) data[vit] = c_tree end - local vil = area:index(x, y + 14, z) - local vila = area:index(x, y + 15, z) - local vilaa = area:index(x, y + 16, z) + local vil = area:index(x, y + 15, z) + local vila = area:index(x, y + 16, z) + local vilaa = area:index(x, y + 17, z) data[vil] = c_wsneedles data[vila] = c_wsneedles data[vilaa] = c_snowblock @@ -205,4 +220,28 @@ function watershed_papyrus(x, y, z, area, data) local vip = area:index(x, y + j, z) data[vip] = c_papyrus end -end \ No newline at end of file +end + +-- ABMs + +minetest.register_abm({ + nodenames = {"watershed:lavaflow"}, + neighbors = {"group:water"}, + interval = 1, + chance = 11, + action = function(pos, node, active_object_count, active_object_count_wider) + minetest.set_node(pos, {name="watershed:stone"}) + minetest.sound_play("default_cool_lava", {pos = pos, gain = 0.25}) + end, +}) + +minetest.register_abm({ + nodenames = {"watershed:lava"}, + neighbors = {"group:water"}, + interval = 1, + chance = 11, + action = function(pos, node, active_object_count, active_object_count_wider) + minetest.set_node(pos, {name="default:obsidian"}) + minetest.sound_play("default_cool_lava", {pos = pos, gain = 0.25}) + end, +}) \ No newline at end of file diff --git a/init.lua b/init.lua index be621f5..32903cb 100644 --- a/init.lua +++ b/init.lua @@ -1,18 +1,21 @@ --- watershed 0.2.13 by paramat +-- watershed 0.2.14 by paramat -- For latest stable Minetest and back to 0.4.8 -- Depends default -- License: code WTFPL --- bugfix missing surface node in tundra +-- new pine tree +-- magma rises to surface along ridges +-- lavacooling abms -- TODO +-- all tree heights vary -- fog --- singlenode y = 0 realm option, on spawnplayer teleport to surface --- magma +-- register bucket water lava +-- singlenode option -- Parameters -local YMIN = 6000 -- Approximate base of realm stone -local YMAX = 8000 -- Approximate top of atmosphere / mountains / floatlands +local YMIN = 5000 -- Approximate base of realm stone +local YMAX = 9000 -- Approximate top of atmosphere / mountains / floatlands local TERCEN = 6856 -- Terrain 'centre', average seabed level local YWAT = 7016 -- Sea level local YCLOUD = 7144 -- Cloud level @@ -24,9 +27,10 @@ local CANAMP = 0.4 -- Canyon terrain amplitude local CANEXP = 1.33 -- Canyon shape exponent local ATANAMP = 1.2 -- Arctan function amplitude, smaller = more and larger floatlands above ridges -local TSTONE = 0.02-- 0.02 -- Density threshold for stone, depth of soil at TERCEN +local TSTONE = 0.01 -- Density threshold for stone, depth of soil at TERCEN local TRIV = -0.015 -- Maximum densitybase threshold for river water local TSAND = -0.018 -- Maximum densitybase threshold for river sand +local TLAVA = 2 -- Maximum densitybase threshold for lava 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 @@ -73,8 +77,8 @@ local np_smooth = { scale = 1, spread = {x=512, y=512, z=512}, seed = 593, - octaves = 5, - persist = 0.4 + octaves = 6, + persist = 0.3 } -- 3D noise for faults @@ -263,6 +267,7 @@ minetest.register_on_generated(function(minp, maxp, seed) local c_wscloud = minetest.get_content_id("watershed:cloud") local c_wsdarkcloud = minetest.get_content_id("watershed:darkcloud") local c_wspermafrost = minetest.get_content_id("watershed:permafrost") + local c_wslava = minetest.get_content_id("watershed:lava") local sidelen = x1 - x0 + 1 local chulens = {x=sidelen, y=sidelen+2, z=sidelen} @@ -306,6 +311,7 @@ minetest.register_on_generated(function(minp, maxp, seed) local triv = TRIV * (1 - altprop * 1.1) local tsand = TSAND * (1 - altprop * 1.1) local tstone = TSTONE * (1 - math.atan(altprop) * 0.6) -- 1 to 0.05 + local tlava = TLAVA * (1 - terblen ^ 10) local density if nvals_fault[nixyz] >= 0 then density = densitybase @@ -373,7 +379,11 @@ minetest.register_on_generated(function(minp, maxp, seed) end end - if density >= tstone and nofis -- stone cut by fissures + if density >= TSTONE and densitybase >= tlava then + data[vi] = c_wslava + stable[si] = 0 + under[si] = 0 + elseif density >= tstone and nofis -- stone cut by fissures or (density >= tstone and density < TSTONE * 3 and y <= YWAT) -- stone around water or (density >= tstone and density < TSTONE * 3 and densitybase >= triv ) then -- stone around river local densitystr = nvals_strata[nixyz] / 4 + (TERCEN - y) / TERSCA diff --git a/nodes.lua b/nodes.lua index 3d83cf3..35070ee 100644 --- a/nodes.lua +++ b/nodes.lua @@ -179,7 +179,7 @@ minetest.register_node("watershed:water", { liquid_alternative_source = "watershed:water", liquid_viscosity = WATER_VISC, liquid_renewable = false, - liquid_range = 3, + liquid_range = 2, post_effect_color = {a=64, r=100, g=100, b=200}, groups = {water=3, liquid=3, puts_out_fire=1}, }) @@ -216,7 +216,80 @@ minetest.register_node("watershed:waterflow", { liquid_alternative_source = "watershed:water", liquid_viscosity = WATER_VISC, liquid_renewable = false, - liquid_range = 3, + liquid_range = 2, post_effect_color = {a=64, r=100, g=100, b=200}, groups = {water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1}, +}) + +minetest.register_node("watershed:lava", { + description = "WS Lava Source", + inventory_image = minetest.inventorycube("default_lava.png"), + drawtype = "liquid", + tiles = { + {name="default_lava_source_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}} + }, + special_tiles = { + { + name="default_lava_source_animated.png", + animation={type="vertical_frames", + aspect_w=16, aspect_h=16, length=3.0}, + backface_culling = false, + } + }, + paramtype = "light", + light_source = 14, + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + drop = "", + drowning = 1, + liquidtype = "source", + liquid_alternative_flowing = "watershed:lavaflow", + liquid_alternative_source = "watershed:lava", + liquid_viscosity = LAVA_VISC, + liquid_renewable = false, + liquid_range = 0, + damage_per_second = 8, + post_effect_color = {a=192, r=255, g=64, b=0}, + groups = {lava=3, liquid=2, hot=3, igniter=1}, +}) + +minetest.register_node("watershed:lavaflow", { + description = "WS Flowing Lava", + inventory_image = minetest.inventorycube("default_lava.png"), + drawtype = "flowingliquid", + tiles = {"default_lava.png"}, + special_tiles = { + { + image="default_lava_flowing_animated.png", + backface_culling=false, + animation={type="vertical_frames", + aspect_w=16, aspect_h=16, length=3.3} + }, + { + image="default_lava_flowing_animated.png", + backface_culling=true, + animation={type="vertical_frames", + aspect_w=16, aspect_h=16, length=3.3} + }, + }, + paramtype = "light", + paramtype2 = "flowingliquid", + light_source = 14, + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + drop = "", + drowning = 1, + liquidtype = "flowing", + liquid_alternative_flowing = "watershed:lavaflow", + liquid_alternative_source = "watershed:lava", + liquid_viscosity = LAVA_VISC, + liquid_renewable = false, + liquid_range = 0, + damage_per_second = 8, + post_effect_color = {a=192, r=255, g=64, b=0}, + groups = {lava=3, liquid=2, hot=3, igniter=1, not_in_creative_inventory=1}, }) \ No newline at end of file diff --git a/textures/watershed_goldengrass.png b/textures/watershed_goldengrass.png index a4ddd78..4b96f76 100644 Binary files a/textures/watershed_goldengrass.png and b/textures/watershed_goldengrass.png differ