From e1641d4eef7865a5b4789a70106847f4991cbc4d Mon Sep 17 00:00:00 2001 From: HybridDog Date: Fri, 5 Dec 2014 23:52:55 +0100 Subject: [PATCH] =?UTF-8?q?=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- depends.txt | 2 +- init.lua | 73 +++++++++++++++++++++---- mapgen.lua | 18 +++--- textures/riesenpilz_brown45_bottom.png | Bin 105 -> 119 bytes textures/riesenpilz_brown45_top.png | Bin 105 -> 113 bytes 5 files changed, 73 insertions(+), 20 deletions(-) diff --git a/depends.txt b/depends.txt index 3a7daa1..c24e6b1 100644 --- a/depends.txt +++ b/depends.txt @@ -1,2 +1,2 @@ default - +vector_extras diff --git a/init.lua b/init.lua index 3d44786..448ad64 100644 --- a/init.lua +++ b/init.lua @@ -443,41 +443,94 @@ local mushrooms_list = { description = "brown mushroom", box = BOX.BROWN, growing = { - - } + r = {min=3, max=4}, + grounds = {soil=1, crumbly=3}, + neighbours = {"default:tree"}, + light = {min=1, max=4}, + interval = 100, + chance = 18, + }, }, ["red"] = { description = "red mushroom", - box = BOX.RED + box = BOX.RED, + growing = { + r = {min=4, max=5}, + grounds = {soil=2}, + neighbours = {"default:water_flowing"}, + light = {min=3, max=10}, + interval = 50, + chance = 30, + }, }, ["fly_agaric"] = { description = "fly agaric", - box = BOX.FLY_AGARIC + box = BOX.FLY_AGARIC, + growing = { + r = 4, + grounds = {soil=1, crumbly=3}, + neighbours = {"default:pinetree"}, + light = {min=2, max=7}, + interval = 101, + chance = 30, + }, }, ["lavashroom"] = { description = "Lavashroom", - box = BOX.LAVASHROOM + box = BOX.LAVASHROOM, + growing = { + r = {min=5, max=6}, + grounds = {cracky=3}, + neighbours = {"default:lava_source"}, + light = {min=10, max=14}, + interval = 1010, + chance = 60, + }, }, ["glowshroom"] = { description = "Glowshroom", - box = BOX.GLOWSHROOM + box = BOX.GLOWSHROOM, + growing = { + r = 3, + grounds = {soil=1, crumbly=3}, + neighbours = {"default:stone"}, + light = 0, + }, }, ["nether_shroom"] = { description = "Nether mushroom", box = BOX.NETHER_SHROOM, - burntime = 6 + burntime = 6, }, ["parasol"] = { description = "white parasol mushroom", - box = BOX.PARASOL + box = BOX.PARASOL, + growing = { + r = {min=3, max=5}, + grounds = {soil=1, crumbly=3}, + neighbours = {"default:pinetree"}, + light = {min=1, max=7}, + }, }, ["red45"] = { description = "45 red mushroom", - box = BOX.RED45 + box = BOX.RED45, + growing = { + r = {min=3, max=4}, + grounds = {soil=2}, + neighbours = {"default:water_source"}, + light = {min=2, max=3}, + }, }, ["brown45"] = { description = "45 brown mushroom", - box = BOX.BROWN45 + box = BOX.BROWN45, + growing = { + r = {min=2, max=3}, + grounds = {tree=1}, + neighbours = {"default:water_flowing"}, + light = {min=7, max=11}, + }, }, } diff --git a/mapgen.lua b/mapgen.lua index 5ce6b45..0efc2ee 100644 --- a/mapgen.lua +++ b/mapgen.lua @@ -42,7 +42,7 @@ local function define_contents() end -local function find_grond(a,list) +local function find_ground(a,list) for _,nam in ipairs(list) do if a == nam then return true @@ -53,13 +53,13 @@ end function riesenpilz_circle(nam, pos, radius, chance) - for i = -radius, radius do - for j = -radius, radius do - if math.floor( math.sqrt(i^2+j^2) +0.5) == radius - and data[area:index(pos.x+i, pos.y, pos.z+j)] == c.air - and pr:next(1,chance) == 1 - and data[area:index(pos.x+i, pos.y-1, pos.z+j)] == c.ground then - data[area:index(pos.x+i, pos.y, pos.z+j)] = nam + for _,p in pairs(vector.circle(radius)) do + if pr:next(1,chance) == 1 then + local p = vector.add(pos, p) + local p_p = area:indexp(p) + if data[p_p] == c.air + and data[area:index(p.x, p.y-1, p.z)] == c.ground then + data[p_p] = nam end end end @@ -184,7 +184,7 @@ minetest.register_on_generated(function(minp, maxp, seed) local ground_y = nil --Definition des Bodens: -- for y=maxp.y,0,-1 do for y=maxp.y,1,-1 do - if find_grond(data[area:index(x, y, z)], c.GROUND) then + if find_ground(data[area:index(x, y, z)], c.GROUND) then ground_y = y break end diff --git a/textures/riesenpilz_brown45_bottom.png b/textures/riesenpilz_brown45_bottom.png index 573d5c29e053322934a8702dc7c6ad3e0efe8fc9..a0284e3c47d44f411a9d798060c47c825eda9443 100644 GIT binary patch delta 100 zcmc~SpCA#>#LU3JkTh5P6OiHz@Ck8EGiI2XW_)I5+E*)IXP}^_r;B3<$Mxh0Ru&$C zB(XVLvs8Pw3VG;6FJw(wd*M`)LlBSJw1rx1ObofVHI*`+AI$-3V(@hJb6Mw<&;$U; C`X2EB delta 86 zcmXTVoFEa%!N$PAApiM)B9Johba4!+U`&>9dvNB=mj6o<*33#@Cb?KcNu}>-*TW{22WQ%mvv4FO#n-3AAkS= diff --git a/textures/riesenpilz_brown45_top.png b/textures/riesenpilz_brown45_top.png index 573d5c29e053322934a8702dc7c6ad3e0efe8fc9..1d142964aa1f21751c497d22fff43a2ce7e82bb0 100644 GIT binary patch delta 94 zcmc~SoFEa&$jrdNplX||1fs0AOGh+{9fPo vKj90XM_v1-|M$}?fFk-Wf9F254&i0^vQWN>ult1rPzQsjtDnm{r-UW|a?&N% delta 86 zcmXTSoFEa%!N$PAApiM)B9Johba4!+U`&>9dvNB=mj6o<*33#@Cb?KcNu}>-*TW{22WQ%mvv4FO#n$|A9?@)