diff --git a/README.md b/README.md deleted file mode 100644 index 8167be4..0000000 --- a/README.md +++ /dev/null @@ -1,11 +0,0 @@ -This mod adds swamps to minetest. -If you have got some ideas, tell them to me. - -**Depends:** [jungletree, habitat,](http://minetest.net/forum/viewtopic.php?pid=39943#p39943) default -**License:** GPL *(sounds)*, WTFPL *(code, textures except birch)* - -*Delete following lines of the jungletree mod:* -`--function anti_generate(node, surfaces, minp, maxp, height_min, height_max, spread, habitat_size, habitat_nodes)` -`minetest.register_on_generated(function(minp, maxp, seed)` -` generate("jungletree:sapling", {"default:dirt_with_grass"}, minp, maxp, 0, 20, 10, 50, {"default:water_source"}, 30, {"default:desert_sand"})` -`end)` diff --git a/birke.lua b/birke.lua index 637fe89..b7b7870 100644 --- a/birke.lua +++ b/birke.lua @@ -137,7 +137,5 @@ minetest.register_abm({ end ,}) ---function anti_generate(node, surfaces, minp, maxp, height_min, height_max, spread, habitat_size, habitat_nodes) -minetest.register_on_generated(function(minp, maxp, seed) - generate("sumpf:birk", {"default:dirt_with_grass"}, minp, maxp, 20, 25, 100, 500, {"default:water_source"},30,{"default:desert_sand"}) -end) +--function anti_generate(node, surfaces, minp, maxp, height_min, height_max, spread, habitat_size, habitat_nodes) +--habitat:generate("sumpf:birk", {"default:dirt_with_grass"}, minp, maxp, 20, 25, 100, 500, {"default:water_source"},30,{"default:desert_sand"}) diff --git a/init.lua b/init.lua index f14119f..e934f24 100644 --- a/init.lua +++ b/init.lua @@ -6,28 +6,6 @@ I looked at snow mod for mapgen and at the jungletree mod for birches. ]] -local MUSH = { - type = "fixed", - fixed = { - {-0.15, -0.2, -0.15, 0.15, -0.1, 0.15}, - {-0.2, -0.3, -0.2, 0.2, -0.2, 0.2}, - {-0.05, -0.5, -0.05, 0.05, -0.3, 0.05}, - }, - } - -minetest.register_node("sumpf:pilz", { - description = "Mushroom", - tile_images = {"sumpf_pilz_oben.png","sumpf_pilz_unten.png","sumpf_pilz_seite.png"}, - inventory_image = "sumpf_pilz_item.png", - drawtype = "nodebox", - paramtype = "light", - node_box = MUSH, - selection_box = MUSH, - walkable = false, - groups = {snappy=3,flammable=2}, - sounds = default.node_sound_leaves_defaults(), -}) - minetest.register_node("sumpf:gras", { description = "Swamp Grass", tile_images = {"sumpfgrass.png"}, diff --git a/mapgen.lua b/mapgen.lua index f3be140..8488574 100644 --- a/mapgen.lua +++ b/mapgen.lua @@ -1,4 +1,4 @@ -local function generate_kohle(minp, maxp, seed, chunks_per_volume, chunk_size, ore_per_chunk, height_min, height_max) +--[[local function generate_kohle(minp, maxp, seed, chunks_per_volume, chunk_size, ore_per_chunk, height_min, height_max) default.generate_ore( "sumpf:kohle", "sumpf:junglestone", minp, maxp, seed, chunks_per_volume, chunk_size, ore_per_chunk, height_min, height_max ) @@ -9,7 +9,8 @@ local function generate_eisen(minp, maxp, seed, chunks_per_volume, chunk_size, o "sumpf:eisen", "sumpf:junglestone", minp, maxp, seed, chunks_per_volume, chunk_size, ore_per_chunk, height_min, height_max ) end - +]] +minetest.register_alias("sumpf:pilz", "riesenpilz:brown") SUMPFGROUND = {"default:dirt_with_grass","default:dirt","default:sand","default:desert_sand"} EVSUMPFGROUND = {"default:dirt_with_grass","default:dirt","default:sand","default:desert_sand", "default:water_source"} @@ -52,97 +53,93 @@ minetest.register_on_generated(function(minp, maxp, seed) local bi = pr:next(1,2) == 1 for j=0,divs do - for i=0,divs do - local x,z = x0+i,z0+j + for i=0,divs do + local x,z = x0+i,z0+j - --Check if we are in a "Swamp biome" - local in_biome = false - local test = perlin1:get2d({x=x, y=z}) - --smooth mapgen - if smooth and (test > 0.73 or (test > 0.43 and pr:next(0,29) > (0.73 - test) * 100 )) then - in_biome = true - elseif (not smooth) and test > 0.53 then - in_biome = true - end - - if in_biome then - - local ground_y = nil --Definition des Bodens: - for _, ground in ipairs(SUMPFGROUND) do - for _, evground in ipairs(EVSUMPFGROUND) do - for y=maxp.y,0,-1 do - if env:get_node({x=x,y=y,z=z}).name == evground then - ground_y = y - break - end + --Check if we are in a "Swamp biome" + local in_biome = false + local test = perlin1:get2d({x=x, y=z}) + --smooth mapgen + if smooth and (test > 0.73 or (test > 0.43 and pr:next(0,29) > (0.73 - test) * 100 )) then + in_biome = true + elseif (not smooth) and test > 0.53 then + in_biome = true end - if ground_y - and env:get_node({x=x,y=ground_y,z=z}).name == ground then - if bi then --Pflanzen (und Pilz): - if pr:next(1,40) == 1 then - mache_birke({x=x,y=ground_y+1,z=z}) - elseif pr:next(1,10) == 1 then - env:add_node({x=x,y=ground_y+1,z=z}, {name="jungletree:sapling"}) - elseif pr:next(1,25) == 1 then - env:add_node({x=x,y=ground_y+1,z=z}, {name="sumpf:pilz"}) - elseif pr:next(1,2) == 1 then - env:add_node({x=x,y=ground_y+1,z=z}, {name="sumpf:gras"}) - elseif pr:next(1,3) == 1 then - env:add_node({x=x,y=ground_y+1,z=z}, {name="default:junglegrass"}) - end - end --Sumpfwasser: not tested yet - if pr:next(1,4) == 1 then - local notnod = "air" - local notnoe = "group:snappy" - if env:get_node({x=x+1,y=ground_y,z=z}).name ~= notnod - and env:get_node({x=x-1,y=ground_y,z=z}).name ~= notnod - and env:get_node({x=x,y=ground_y,z=z+1}).name ~= notnod - and env:get_node({x=x,y=ground_y,z=z-1}).name ~= notnod - and env:get_node({x=x+1,y=ground_y,z=z}).name ~= notnoe - and env:get_node({x=x-1,y=ground_y,z=z}).name ~= notnoe - and env:get_node({x=x,y=ground_y,z=z+1}).name ~= notnoe - and env:get_node({x=x,y=ground_y,z=z-1}).name ~= notnoe then - for s=0,-30,-1 do - env:add_node({x=x,y=ground_y+s,z=z}, {name="sumpf:dirtywater_source"}) - env:add_node({x=x,y=ground_y+1,z=z}, {name="air"}) --because of the plants + if in_biome then + + local ground_y = nil --Definition des Bodens: + for _, evground in ipairs(EVSUMPFGROUND) do + for y=maxp.y,0,-1 do + if env:get_node({x=x,y=y,z=z}).name == evground then + ground_y = y + break end end - else --Sumpfboden: - for i=-3,-30,-1 do - for l=-1,0,1 do - if env:get_node({x=x,y=ground_y+i,z=z}).name ~= "air" then - env:add_node({x=x,y=ground_y+l,z=z}, {name="sumpf:sumpf"}) - env:add_node({x=x,y=ground_y-2,z=z}, {name="sumpf:sumpf2"}) - env:add_node({x=x,y=ground_y+i,z=z}, {name="sumpf:junglestone"}) - else break + for _, ground in ipairs(SUMPFGROUND) do + if ground_y + and env:get_node({x=x,y=ground_y,z=z}).name == ground then + if bi then --Pflanzen (und Pilz): + if pr:next(1,40) == 1 then + mache_birke({x=x,y=ground_y+1,z=z}) + elseif pr:next(1,10) == 1 then + env:add_node({x=x,y=ground_y+1,z=z}, {name="jungletree:sapling"}) + elseif pr:next(1,25) == 1 then + env:add_node({x=x,y=ground_y+1,z=z}, {name="riesenpilz:brown"}) + elseif pr:next(1,50) == 1 then + env:add_node({x=x,y=ground_y+1,z=z}, {name="riesenpilz:red"}) + elseif pr:next(1,100) == 1 then + env:add_node({x=x,y=ground_y+1,z=z}, {name="riesenpilz:fly_agaric"}) + elseif pr:next(1,2) == 1 then + env:add_node({x=x,y=ground_y+1,z=z}, {name="sumpf:gras"}) + elseif pr:next(1,3) == 1 then + env:add_node({x=x,y=ground_y+1,z=z}, {name="default:junglegrass"}) + end + end --Sumpfwasser: + if pr:next(1,4) == 1 + and env:get_node({x=x+1,y=ground_y,z=z}).name ~= "air" + and env:get_node({x=x-1,y=ground_y,z=z}).name ~= "air" + and env:get_node({x=x,y=ground_y,z=z+1}).name ~= "air" + and env:get_node({x=x,y=ground_y,z=z-1}).name ~= "air" then + for s=0,-30,-1 do + env:add_node({x=x,y=ground_y+s,z=z}, {name="sumpf:dirtywater_source"}) + env:add_node({x=x,y=ground_y+1,z=z}, {name="air"}) --because of the plants + end + else --Sumpfboden: + for i=-3,-30,-1 do + for l=-1,0,1 do + if env:get_node({x=x,y=ground_y+i,z=z}).name ~= "air" then + env:add_node({x=x,y=ground_y+l,z=z}, {name="sumpf:sumpf"}) + env:add_node({x=x,y=ground_y-2,z=z}, {name="sumpf:sumpf2"}) + env:add_node({x=x,y=ground_y+i,z=z}, {name="sumpf:junglestone"}) + else break + end + end + end + end --Dreckseen: + elseif ground_y + and env:get_node({x=x,y=ground_y,z=z}).name == "default:water_source" + and env:find_node_near({x=x,y=ground_y,z=z}, 2+math.random(3), "group:crumbly") then + for y=0,-30,-1 do + if env:get_node({x=x,y=ground_y+y,z=z}).name == "default:water_source" then + env:add_node({x=x,y=ground_y+y,z=z}, {name="sumpf:dirtywater_source"}) + else + env:add_node({x=x,y=ground_y+y,z=z}, {name="sumpf:peat"}) + end + end end end end - end --Dreckseen: - elseif ground_y - and env:get_node({x=x,y=ground_y,z=z}).name == "default:water_source" - and env:find_node_near({x=x,y=ground_y,z=z}, 2+math.random(3), "group:crumbly") then - for y=0,-30,-1 do - if env:get_node({x=x,y=ground_y+y,z=z}).name == "default:water_source" then - env:add_node({x=x,y=ground_y+y,z=z}, {name="sumpf:dirtywater_source"}) - else - env:add_node({x=x,y=ground_y+y,z=z}, {name="sumpf:peat"}) - end - end - end - end end end end - end end - -- Generate ores + --[[ Generate ores generate_kohle(minp, maxp, seed+0, 1/8/8/8, 3, 8, -31000, 64) generate_eisen(minp, maxp, seed+1, 1/12/12/12, 2, 3, -15, 2) generate_eisen(minp, maxp, seed+2, 1/9/9/9, 3, 5, -63, -16) generate_eisen(minp, maxp, seed+3, 1/7/7/7, 3, 5, -31000, -64) generate_kohle(minp, maxp, seed+7, 1/24/24/24, 6,27, -31000, 0) - generate_eisen(minp, maxp, seed+6, 1/24/24/24, 6,27, -31000, -64) + generate_eisen(minp, maxp, seed+6, 1/24/24/24, 6,27, -31000, -64)]] end) diff --git a/settings.lua b/settings.lua index 91f02e8..119ff3a 100644 --- a/settings.lua +++ b/settings.lua @@ -1,7 +1,7 @@ --This file contains configuration options for swamp mod. --Enables mapgen. -sumpf.enable_mapgen = false +sumpf.enable_mapgen = true --Enables smooth transition of biomes. sumpf.smooth = true diff --git a/shjrzgt.ogg b/shjrzgt.ogg new file mode 100644 index 0000000..81a8a33 Binary files /dev/null and b/shjrzgt.ogg differ diff --git a/textures/sumpf_pilz_item.png b/textures/sumpf_pilz_item.png deleted file mode 100644 index 0b3b44c..0000000 Binary files a/textures/sumpf_pilz_item.png and /dev/null differ diff --git a/textures_alternative/sumpf_pilz_item.png b/textures_alternative/sumpf_pilz_item.png index b18db0b..0b3b44c 100644 Binary files a/textures_alternative/sumpf_pilz_item.png and b/textures_alternative/sumpf_pilz_item.png differ diff --git a/textures_alternative/sumpf_pilz_item2.png b/textures_alternative/sumpf_pilz_item2.png new file mode 100644 index 0000000..b18db0b Binary files /dev/null and b/textures_alternative/sumpf_pilz_item2.png differ diff --git a/textures/sumpf_pilz_oben.png b/textures_alternative/sumpf_pilz_oben.png similarity index 100% rename from textures/sumpf_pilz_oben.png rename to textures_alternative/sumpf_pilz_oben.png diff --git a/textures/sumpf_pilz_seite.png b/textures_alternative/sumpf_pilz_seite.png similarity index 100% rename from textures/sumpf_pilz_seite.png rename to textures_alternative/sumpf_pilz_seite.png diff --git a/textures/sumpf_pilz_unten.png b/textures_alternative/sumpf_pilz_unten.png similarity index 100% rename from textures/sumpf_pilz_unten.png rename to textures_alternative/sumpf_pilz_unten.png