diff --git a/README.txt b/README.txt index 1d6b201..fe1c880 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -watershed 0.2.14 by paramat +watershed 0.2.15 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/depends.txt b/depends.txt index 4ad96d5..be1e6bc 100644 --- a/depends.txt +++ b/depends.txt @@ -1 +1,2 @@ default +bucket \ No newline at end of file diff --git a/functions.lua b/functions.lua index cdc6b8b..c88c604 100644 --- a/functions.lua +++ b/functions.lua @@ -1,7 +1,7 @@ function watershed_appletree(x, y, z, area, data) local c_tree = minetest.get_content_id("default:tree") local c_apple = minetest.get_content_id("default:apple") - local c_leaves = minetest.get_content_id("default:leaves") + local c_wsappleaf = minetest.get_content_id("watershed:appleleaf") for j = -2, 4 do if j >= 1 then for i = -2, 2 do @@ -9,8 +9,8 @@ function watershed_appletree(x, y, z, area, data) local vil = area:index(x + i, y + j + 1, z + k) if math.random(48) == 2 then data[vil] = c_apple - elseif math.random(3) ~= 2 then - data[vil] = c_leaves + elseif math.random(5) ~= 2 then + data[vil] = c_wsappleaf end end end @@ -124,8 +124,8 @@ end function watershed_acaciatree(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, 7 do - if j == 7 then + for j = -3, 6 do + if j == 6 then for i = -4, 4 do for k = -4, 4 do if not (i == 0 or k == 0) then @@ -136,14 +136,14 @@ function watershed_acaciatree(x, y, z, area, data) end end end - elseif j == 6 then + elseif j == 5 then 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 end end - elseif j == 5 then + elseif j == 4 then for i = -1, 1 do for k = -1, 1 do if math.abs(i) + math.abs(k) == 2 then @@ -159,26 +159,6 @@ function watershed_acaciatree(x, y, z, area, data) 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") - local c_grass3 = minetest.get_content_id("default:grass_3") - local c_grass4 = minetest.get_content_id("default:grass_4") - local c_grass5 = minetest.get_content_id("default:grass_5") - local ran = math.random(5) - if ran == 1 then - data[vi] = c_grass1 - elseif ran == 2 then - data[vi] = c_grass2 - elseif ran == 3 then - data[vi] = c_grass3 - elseif ran == 4 then - data[vi] = c_grass4 - else - data[vi] = c_grass5 - end -end - function watershed_flower(data, vi, noise) local c_danwhi = minetest.get_content_id("flowers:dandelion_white") local c_danyel = minetest.get_content_id("flowers:dandelion_yellow") @@ -222,26 +202,27 @@ function watershed_papyrus(x, y, z, area, data) end end --- ABMs +-- Register buckets, lava fuel -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, -}) +bucket.register_liquid( + "watershed:water", + "watershed:waterflow", + "watershed:bucket_water", + "bucket_water.png", + "WS Water Bucket" +) -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, +bucket.register_liquid( + "watershed:lava", + "watershed:lavaflow", + "watershed:bucket_lava", + "bucket_lava.png", + "WS Lava Bucket" +) + +minetest.register_craft({ + type = "fuel", + recipe = "watershed:bucket_lava", + burntime = 60, + replacements = {{"watershed:bucket_lava", "bucket:bucket_empty"}}, }) \ No newline at end of file diff --git a/init.lua b/init.lua index 32903cb..8a7ec06 100644 --- a/init.lua +++ b/init.lua @@ -1,15 +1,15 @@ --- watershed 0.2.14 by paramat +-- watershed 0.2.15 by paramat -- For latest stable Minetest and back to 0.4.8 -- Depends default -- License: code WTFPL --- new pine tree --- magma rises to surface along ridges --- lavacooling abms +-- register bucket water lava +-- remove leaves from leafdecay, grass function +-- appleleaf mod node -- TODO +-- magma rising at ridges -- all tree heights vary -- fog --- register bucket water lava -- singlenode option -- Parameters @@ -25,24 +25,23 @@ local XLSAMP = 0.2 -- Extra large scale height variation amplitude local BASAMP = 0.4 -- Base terrain amplitude 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 ATANAMP = 1.1 -- Arctan function amplitude, smaller = more and larger floatlands above ridges 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 local ORET = 0.02 -- Ore threshold for seam local TCLOUD = 0.5 -- Cloud threshold -local HITET = 0.5 -- High temperature threshold -local LOTET = -0.5 -- Low .. +local HITET = 0.4 -- High temperature threshold +local LOTET = -0.4 -- Low .. local ICETET = -0.8 -- Ice .. -local HIHUT = 0.5 -- High humidity threshold +local HIHUT = 0.4 -- High humidity threshold local MIDHUT = 0 -- Mid .. -local LOHUT = -0.5 -- Low .. +local LOHUT = -0.4 -- Low .. local CLOHUT = 0 -- Cloud humidity threshold local DCLOHUT = 1 -- Dark cloud .. @@ -256,6 +255,7 @@ minetest.register_on_generated(function(minp, maxp, seed) local c_sandstone = minetest.get_content_id("default:sandstone") local c_gravel = minetest.get_content_id("default:gravel") local c_clay = minetest.get_content_id("default:clay") + local c_grass5 = minetest.get_content_id("default:grass_5") local c_wswater = minetest.get_content_id("watershed:water") local c_wsstone = minetest.get_content_id("watershed:stone") @@ -311,7 +311,6 @@ 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 @@ -379,11 +378,7 @@ minetest.register_on_generated(function(minp, maxp, seed) end end - 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 + if 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 @@ -528,7 +523,7 @@ minetest.register_on_generated(function(minp, maxp, seed) watershed_flower(data, vi, fnoise) elseif math.random(FOGCHA) == 2 then data[viu] = c_wsgrass - watershed_grass(data, vi) + data[vi] = c_grass5 end end elseif under[si] == 3 then @@ -545,7 +540,7 @@ minetest.register_on_generated(function(minp, maxp, seed) if math.random(FLOCHA) == 2 then watershed_flower(data, vi, fnoise) elseif math.random(GRACHA) == 2 then - watershed_grass(data, vi) + data[vi] = c_grass5 end elseif under[si] == 8 then if math.random(JUTCHA) == 2 then diff --git a/nodes.lua b/nodes.lua index 35070ee..eb23933 100644 --- a/nodes.lua +++ b/nodes.lua @@ -1,8 +1,22 @@ +minetest.register_node("watershed:appleleaf", { + description = "WS Appletree Leaves", + drawtype = "allfaces_optional", + visual_scale = 1.3, + tiles = {"default_leaves.png"}, + paramtype = "light", + is_ground_content = false, + groups = {snappy=3, flammable=2, leaves=1}, + sounds = default.node_sound_leaves_defaults(), +}) + minetest.register_node("watershed:needles", { description = "WS Pine Needles", + drawtype = "allfaces_optional", + visual_scale = 1.3, tiles = {"watershed_needles.png"}, + paramtype = "light", is_ground_content = false, - groups = {snappy=3, leafdecay=3}, + groups = {snappy=3}, sounds = default.node_sound_leaves_defaults(), }) @@ -13,7 +27,7 @@ minetest.register_node("watershed:jungleleaf", { tiles = {"default_jungleleaves.png"}, paramtype = "light", is_ground_content = false, - groups = {snappy=3, leafdecay=4, flammable=2, leaves=1}, + groups = {snappy=3, flammable=2, leaves=1}, sounds = default.node_sound_leaves_defaults(), }) @@ -249,7 +263,7 @@ minetest.register_node("watershed:lava", { liquid_alternative_source = "watershed:lava", liquid_viscosity = LAVA_VISC, liquid_renewable = false, - liquid_range = 0, + liquid_range = 2, damage_per_second = 8, post_effect_color = {a=192, r=255, g=64, b=0}, groups = {lava=3, liquid=2, hot=3, igniter=1}, @@ -288,7 +302,7 @@ minetest.register_node("watershed:lavaflow", { liquid_alternative_source = "watershed:lava", liquid_viscosity = LAVA_VISC, liquid_renewable = false, - liquid_range = 0, + liquid_range = 2, 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},