diff --git a/init.lua b/init.lua index 9c99913..87054da 100644 --- a/init.lua +++ b/init.lua @@ -424,12 +424,30 @@ local BOX_NETHER_SHROOM = { }, } -pilz("brown", "Brown Mushroom", BOX_BROWN) -pilz("red", "Red Mushroom", BOX_RED) -pilz("fly_agaric", "Fly Agaric", BOX_FLY_AGARIC) -pilz("lavashroom", "Lavashroom", BOX_LAVASHROOM) -pilz("glowshroom", "Glowshroom", BOX_GLOWSHROOM) -pilz("nether_shroom", "Nether Mushroom", BOX_NETHER_SHROOM) +local BOX_PARASOL = { + type = "fixed", + fixed = { + {-1/16, -8/16, -1/16, 1/16, 0, 1/16}, + {-2/16, -6/16, -2/16, 2/16, -5/16, 2/16}, + {-5/16, -4/16, -5/16, 5/16, -3/16, 5/16}, + {-4/16, -3/16, -4/16, 4/16, -2/16, 4/16}, + {-3/16, -2/16, -3/16, 3/16, -1/16, 3/16}, + }, +} + +local mushrooms_list = { + {"brown", "Brown Mushroom", BOX_BROWN}, + {"red", "Red Mushroom", BOX_RED}, + {"fly_agaric", "Fly Agaric", BOX_FLY_AGARIC}, + {"lavashroom", "Lavashroom", BOX_LAVASHROOM}, + {"glowshroom", "Glowshroom", BOX_GLOWSHROOM}, + {"nether_shroom", "Nether Mushroom", BOX_NETHER_SHROOM}, + {"parasol", "Parasol Mushroom", BOX_PARASOL}, +} + +for _,i in ipairs(mushrooms_list) do + pilz(i[1], i[2], i[3]) +end diff --git a/mapgen.lua b/mapgen.lua index 7de1606..1c5d41d 100644 --- a/mapgen.lua +++ b/mapgen.lua @@ -8,6 +8,9 @@ local c_desert_sand = minetest.get_content_id("default:desert_sand") local c_tree = minetest.get_content_id("default:tree") local c_leaves = minetest.get_content_id("default:leaves") local c_apple = minetest.get_content_id("default:apple") +local c_jungletree = minetest.get_content_id("default:jungletree") +local c_jungleleaves = minetest.get_content_id("default:jungleleaves") +local c_junglegrass = minetest.get_content_id("default:junglegrass") local c_cactus = minetest.get_content_id("default:cactus") local c_papyrus = minetest.get_content_id("default:papyrus") local c_dry_shrub = minetest.get_content_id("default:dry_shrub") @@ -18,6 +21,7 @@ local c_riesenpilz_red = minetest.get_content_id("riesenpilz:red") local c_riesenpilz_fly_agaric = minetest.get_content_id("riesenpilz:fly_agaric") local c_riesenpilz_lavashroom = minetest.get_content_id("riesenpilz:lavashroom") local c_riesenpilz_glowshroom = minetest.get_content_id("riesenpilz:glowshroom") +local c_riesenpilz_parasol = minetest.get_content_id("riesenpilz:parasol") local function find_grond(a,list) @@ -49,6 +53,14 @@ local function say_info(info) minetest.chat_send_all(info) end +local riesenpilz_rarity = riesenpilz.mapgen_rarity +local riesenpilz_size = riesenpilz.mapgen_size + +local nosmooth_rarity = -(riesenpilz_rarity/50)+1 +local perlin_scale = riesenpilz_size*100/riesenpilz_rarity +local smooth_rarity_full = nosmooth_rarity+perlin_scale/(20*riesenpilz_size) +local smooth_rarity_ran = nosmooth_rarity-perlin_scale/(40*riesenpilz_size) +local smooth_rarity_dif = (smooth_rarity_full-smooth_rarity_ran)*100-1 local GROUND = {c_gr, c_sand, c_dirt, c_desert_sand} --local USUAL_STUFF = {"default:leaves","default:apple","default:tree","default:cactus","default:papyrus"} @@ -59,21 +71,21 @@ minetest.register_on_generated(function(minp, maxp, seed) end local x0,z0,x1,z1 = minp.x,minp.z,maxp.x,maxp.z -- Assume X and Z lengths are equal local env = minetest.env --Should make things a bit faster. - local perlin1 = env:get_perlin(51,3, 0.5, 200) --Get map specific perlin + local perlin1 = env:get_perlin(51,3, 0.5, perlin_scale) --Get map specific perlin --[[if not (perlin1:get2d({x=x0, y=z0}) > 0.53) and not (perlin1:get2d({x=x1, y=z1}) > 0.53) and not (perlin1:get2d({x=x0, y=z1}) > 0.53) and not (perlin1:get2d({x=x1, y=z0}) > 0.53) and not (perlin1:get2d({x=(x1-x0)/2, y=(z1-z0)/2}) > 0.53) then]] if not riesenpilz.always_generate - and not ( perlin1:get2d( {x=x0, y=z0} ) > 0.53 ) --top left - and not ( perlin1:get2d( { x = x0 + ( (x1-x0)/2), y=z0 } ) > 0.53 )--top middle - and not (perlin1:get2d({x=x1, y=z1}) > 0.53) --bottom right - and not (perlin1:get2d({x=x1, y=z0+((z1-z0)/2)}) > 0.53) --right middle - and not (perlin1:get2d({x=x0, y=z1}) > 0.53) --bottom left - and not (perlin1:get2d({x=x1, y=z0}) > 0.53) --top right - and not (perlin1:get2d({x=x0+((x1-x0)/2), y=z1}) > 0.53) --left middle - and not (perlin1:get2d({x=(x1-x0)/2, y=(z1-z0)/2}) > 0.53) --middle - and not (perlin1:get2d({x=x0, y=z1+((z1-z0)/2)}) > 0.53) then --bottom middle + and not ( perlin1:get2d( {x=x0, y=z0} ) > nosmooth_rarity ) --top left + and not ( perlin1:get2d( { x = x0 + ( (x1-x0)/2), y=z0 } ) > nosmooth_rarity )--top middle + and not (perlin1:get2d({x=x1, y=z1}) > nosmooth_rarity) --bottom right + and not (perlin1:get2d({x=x1, y=z0+((z1-z0)/2)}) > nosmooth_rarity) --right middle + and not (perlin1:get2d({x=x0, y=z1}) > nosmooth_rarity) --bottom left + and not (perlin1:get2d({x=x1, y=z0}) > nosmooth_rarity) --top right + and not (perlin1:get2d({x=x0+((x1-x0)/2), y=z1}) > nosmooth_rarity) --left middle + and not (perlin1:get2d({x=(x1-x0)/2, y=(z1-z0)/2}) > nosmooth_rarity) --middle + and not (perlin1:get2d({x=x0, y=z1+((z1-z0)/2)}) > nosmooth_rarity) then --bottom middle print("[riesenpilz] abort") return end @@ -94,7 +106,7 @@ minetest.register_on_generated(function(minp, maxp, seed) for p_pos in area:iterp(minp, maxp) do --remove tree stuff local d_p_pos = data[p_pos] - for _,nam in ipairs({c_tree, c_leaves, c_apple}) do + for _,nam in ipairs({c_tree, c_leaves, c_apple, c_jungletree, c_jungleleaves, c_junglegrass}) do if d_p_pos == nam then data[p_pos] = c_air break @@ -120,9 +132,17 @@ minetest.register_on_generated(function(minp, maxp, seed) --smooth mapgen if riesenpilz.always_generate then in_biome = true - elseif smooth and (test > 0.73 or (test > 0.43 and pr:next(0,29) > (0.73 - test) * 100 )) then + elseif smooth + and ( + test > smooth_rarity_full + or ( + test > smooth_rarity_ran + and pr:next(0,smooth_rarity_dif) > (smooth_rarity_full - test) * 100 + ) + ) then in_biome = true - elseif (not smooth) and test > 0.53 then + elseif (not smooth) + and test > nosmooth_rarity then in_biome = true end @@ -168,6 +188,8 @@ minetest.register_on_generated(function(minp, maxp, seed) data[p_boden] = c_dry_shrub elseif pr:next(1,80) == 1 then riesenpilz_circle(c_riesenpilz_brown, boden, pr:next(3,4), 3) + elseif pr:next(1,85) == 1 then + riesenpilz_circle(c_riesenpilz_parasol, boden, pr:next(3,5), 3) elseif pr:next(1,90) == 1 then riesenpilz_circle(c_riesenpilz_red, boden, pr:next(4,5), 3) elseif pr:next(1,100) == 1 then diff --git a/rest/mushrooms_mushroom_brown.png b/rest/mushrooms_mushroom_brown.png new file mode 100644 index 0000000..ca5ac55 Binary files /dev/null and b/rest/mushrooms_mushroom_brown.png differ diff --git a/rest/mushrooms_mushroom_red.png b/rest/mushrooms_mushroom_red.png new file mode 100644 index 0000000..c814cde Binary files /dev/null and b/rest/mushrooms_mushroom_red.png differ diff --git a/old_mapgen.lua b/rest/old_mapgen.lua similarity index 100% rename from old_mapgen.lua rename to rest/old_mapgen.lua diff --git a/rest/riesenpilz_head.png b/rest/riesenpilz_head.png new file mode 100644 index 0000000..a5f7b0d Binary files /dev/null and b/rest/riesenpilz_head.png differ diff --git a/settings.lua b/settings.lua index 973b5b4..18ffe35 100644 --- a/settings.lua +++ b/settings.lua @@ -1,11 +1,18 @@ --This file contains configuration options for riesenpilz mod. --Enables mapgen. -riesenpilz.enable_mapgen = false +riesenpilz.enable_mapgen = true riesenpilz.always_generate = false --Enables smooth transition of biomes. riesenpilz.smooth = false +--rarity in % +riesenpilz.mapgen_rarity = 0.1 + +--size of the generated... (has an effect to the rarity, too) +riesenpilz.mapgen_size = 50 + + riesenpilz.info = true diff --git a/textures/riesenpilz_head.png b/textures/riesenpilz_head.png index a5f7b0d..5b08aac 100644 Binary files a/textures/riesenpilz_head.png and b/textures/riesenpilz_head.png differ diff --git a/textures/riesenpilz_parasol_bottom.png b/textures/riesenpilz_parasol_bottom.png new file mode 100644 index 0000000..3232169 Binary files /dev/null and b/textures/riesenpilz_parasol_bottom.png differ diff --git a/textures/riesenpilz_parasol_side.png b/textures/riesenpilz_parasol_side.png new file mode 100644 index 0000000..7f43ed7 Binary files /dev/null and b/textures/riesenpilz_parasol_side.png differ diff --git a/textures/riesenpilz_parasol_top.png b/textures/riesenpilz_parasol_top.png new file mode 100644 index 0000000..b5cc146 Binary files /dev/null and b/textures/riesenpilz_parasol_top.png differ