From e88cf467702939aeec6aef9c146980b4892370e6 Mon Sep 17 00:00:00 2001 From: LeMagnesium Date: Sat, 20 Jun 2015 21:17:29 +0200 Subject: [PATCH] Updated riesenpilz --- mods/riesenpilz/README.md | 2 +- mods/riesenpilz/init.lua | 307 ++++++++++-------- mods/riesenpilz/mapgen.lua | 123 +++---- mods/riesenpilz/rest/old_mapgen.lua | 14 +- mods/riesenpilz/textures/3apple_apple.png | Bin 254 -> 252 bytes .../riesenpilz_mush45_meal.png} | Bin 6 files changed, 239 insertions(+), 207 deletions(-) rename mods/riesenpilz/{rest/mush45_meal.png => textures/riesenpilz_mush45_meal.png} (100%) diff --git a/mods/riesenpilz/README.md b/mods/riesenpilz/README.md index d88b3ac9..8bc39dba 100755 --- a/mods/riesenpilz/README.md +++ b/mods/riesenpilz/README.md @@ -10,5 +10,5 @@ If you got ideas or found bugs, please tell them to me. TODO: -— add giant nethershroom +— add more giant mushrooms — finish supporting the mushrooms mod diff --git a/mods/riesenpilz/init.lua b/mods/riesenpilz/init.lua index 39774775..e023575d 100755 --- a/mods/riesenpilz/init.lua +++ b/mods/riesenpilz/init.lua @@ -5,6 +5,9 @@ riesenpilz = {} dofile(minetest.get_modpath("riesenpilz").."/settings.lua") dofile(minetest.get_modpath("riesenpilz").."/functions.lua") + +--Growing Functions + local function r_area(manip, width, height, pos) local emerged_pos1, emerged_pos2 = manip:read_from_map( {x=pos.x-width, y=pos.y, z=pos.z-width}, @@ -13,105 +16,104 @@ local function r_area(manip, width, height, pos) return VoxelArea:new({MinEdge=emerged_pos1, MaxEdge=emerged_pos2}) end -riesenpilz.vm_update = true local function set_vm_data(manip, nodes, pos, t1, name) manip:set_data(nodes) manip:write_to_map() riesenpilz.inform("a "..name.." mushroom grew at ("..pos.x.."|"..pos.y.."|"..pos.z..")", 3, t1) - if riesenpilz.vm_update then - local t1 = os.clock() - manip:update_map() - riesenpilz.inform("map updated", 3, t1) - end + local t1 = os.clock() + manip:update_map() + riesenpilz.inform("map updated", 3, t1) end ---Growing Functions - local c -function riesenpilz_hybridpilz(pos) +function riesenpilz.red(pos, nodes, area, w) + local w = w or math.random(MAX_SIZE) + local h = w+2 - local t1 = os.clock() - local manip = minetest.get_voxel_manip() - local area = r_area(manip, MAX_SIZE+1, MAX_SIZE+3, pos) - local nodes = manip:get_data() - - local breite = math.random(MAX_SIZE) - local br = breite+1 - local height = breite+2 - - for i = 0, height do + for i = 0, h do nodes[area:index(pos.x, pos.y+i, pos.z)] = c.stem end - for l = -br+1, br do - for k = -1, 1, 2 do - nodes[area:index(pos.x+br*k, pos.y+height, pos.z-l*k)] = c.head_red - nodes[area:index(pos.x+l*k, pos.y+height, pos.z+br*k)] = c.head_red + local br = w+1 + for k = -1, 1, 2 do + for l = -br+1, br do + nodes[area:index(pos.x+br*k, pos.y+h, pos.z-l*k)] = c.head_red + nodes[area:index(pos.x+l*k, pos.y+h, pos.z+br*k)] = c.head_red end end - for k = -breite, breite do - for l = -breite, breite do - nodes[area:index(pos.x+l, pos.y+height+1, pos.z+k)] = c.head_red - nodes[area:index(pos.x+l, pos.y+height, pos.z+k)] = c.lamellas + for k = -w, w do + for l = -w, w do + nodes[area:index(pos.x+l, pos.y+h+1, pos.z+k)] = c.head_red + nodes[area:index(pos.x+l, pos.y+h, pos.z+k)] = c.lamellas end end +end + +local function riesenpilz_hybridpilz(pos) + local t1 = os.clock() + + local w = math.random(MAX_SIZE) + + local manip = minetest.get_voxel_manip() + local area = r_area(manip, w+1, w+3, pos) + local nodes = manip:get_data() + + riesenpilz.red(pos, nodes, area, w) set_vm_data(manip, nodes, pos, t1, "red") end -function riesenpilz_brauner_minecraftpilz(pos) +function riesenpilz.brown(pos, nodes, area, br) + local br = br or math.random(MAX_SIZE-1)+1 + local h = br+2 - local t1 = os.clock() - local manip = minetest.get_voxel_manip() - local area = r_area(manip, MAX_SIZE+1, MAX_SIZE+2, pos) - local nodes = manip:get_data() - - local random = math.random(MAX_SIZE-1) - local br = random+1 - local breite = br+1 - local height = br+2 - - for i in area:iterp(pos, {x=pos.x, y=pos.y+height, z=pos.z}) do + for i in area:iterp(pos, {x=pos.x, y=pos.y+h, z=pos.z}) do nodes[i] = c.stem end + local w = br+1 for l = -br, br do - for k = -breite, breite, breite*2 do - nodes[area:index(pos.x+k, pos.y+height+1, pos.z+l)] = c.head_brown - nodes[area:index(pos.x+l, pos.y+height+1, pos.z+k)] = c.head_brown + for k = -w, w, w*2 do + nodes[area:index(pos.x+k, pos.y+h+1, pos.z+l)] = c.head_brown + nodes[area:index(pos.x+l, pos.y+h+1, pos.z+k)] = c.head_brown end for k = -br, br do - nodes[area:index(pos.x+l, pos.y+height+1, pos.z+k)] = c.head_brown + nodes[area:index(pos.x+l, pos.y+h+1, pos.z+k)] = c.head_brown end end +end + +local function riesenpilz_brauner_minecraftpilz(pos) + local t1 = os.clock() + + local br = math.random(MAX_SIZE-1)+1 + + local manip = minetest.get_voxel_manip() + local area = r_area(manip, br+1, br+3, pos) + local nodes = manip:get_data() + + riesenpilz.brown(pos, nodes, area, br) set_vm_data(manip, nodes, pos, t1, "brown") end -function riesenpilz_minecraft_fliegenpilz(pos) +function riesenpilz.fly_agaric(pos, nodes, area, param2s) + local h = 3 - local t1 = os.clock() - local manip = minetest.get_voxel_manip() - local area = r_area(manip, 2, 4, pos) - local nodes = manip:get_data() - local param2s = manip:get_param2_data() - - local height = 3 - - for i = 0, height do + for i = 0, h do nodes[area:index(pos.x, pos.y+i, pos.z)] = c.stem end for j = -1, 1 do for k = -1, 1 do - nodes[area:index(pos.x+j, pos.y+height+1, pos.z+k)] = c.head_red + nodes[area:index(pos.x+j, pos.y+h+1, pos.z+k)] = c.head_red end - for l = 1, height do + for l = 1, h do local y = pos.y+l for _,p in pairs({ {area:index(pos.x+j, y, pos.z+2), 0}, @@ -125,6 +127,17 @@ function riesenpilz_minecraft_fliegenpilz(pos) end end end +end + +local function riesenpilz_minecraft_fliegenpilz(pos) + local t1 = os.clock() + + local manip = minetest.get_voxel_manip() + local area = r_area(manip, 2, 4, pos) + local nodes = manip:get_data() + local param2s = manip:get_param2_data() + + riesenpilz.fly_agaric(pos, nodes, area, param2s) manip:set_data(nodes) manip:set_param2_data(param2s) @@ -141,52 +154,48 @@ local function ran_node(a, b, ran) return b end -function riesenpilz_lavashroom(pos) +function riesenpilz.lavashroom(pos, nodes, area, h) + local h = h or 3+math.random(MAX_SIZE-2) - local t1 = os.clock() - local manip = minetest.get_voxel_manip() - local area = r_area(manip, 4, MAX_SIZE+7, pos) - local nodes = manip:get_data() - - local height = 3+math.random(MAX_SIZE-2) - nodes[area:index(pos.x, pos.y, pos.z)] = c.air + -- remove the mushroom + nodes[area:indexp(pos)] = c.air for i = -1, 1, 2 do - local o = 2*i - - for n = 0, height do + -- set the stem + for n = 0, h do nodes[area:index(pos.x+i, pos.y+n, pos.z)] = c.stem_brown nodes[area:index(pos.x, pos.y+n, pos.z+i)] = c.stem_brown end + local o = 2*i for l = -1, 1 do for k = 2, 3 do - nodes[area:index(pos.x+k*i, pos.y+height+2, pos.z+l)] = c.head_brown_full - nodes[area:index(pos.x+l, pos.y+height+2, pos.z+k*i)] = c.head_brown_full + nodes[area:index(pos.x+k*i, pos.y+h+2, pos.z+l)] = c.head_brown_full + nodes[area:index(pos.x+l, pos.y+h+2, pos.z+k*i)] = c.head_brown_full end - nodes[area:index(pos.x+l, pos.y+height+1, pos.z+o)] = c.head_brown_full - nodes[area:index(pos.x+o, pos.y+height+1, pos.z+l)] = c.head_brown_full + nodes[area:index(pos.x+l, pos.y+h+1, pos.z+o)] = c.head_brown_full + nodes[area:index(pos.x+o, pos.y+h+1, pos.z+l)] = c.head_brown_full end for m = -1, 1, 2 do for k = 2, 3 do for j = 2, 3 do - nodes[area:index(pos.x+j*i, pos.y+height+2, pos.z+k*m)] = ran_node(c.head_yellow, c.head_orange, 7) + nodes[area:index(pos.x+j*i, pos.y+h+2, pos.z+k*m)] = ran_node(c.head_yellow, c.head_orange, 7) end end - nodes[area:index(pos.x+i, pos.y+height+1, pos.z+m)] = c.head_brown_full - nodes[area:index(pos.x+m*2, pos.y+height+1, pos.z+o)] = c.head_brown_full + nodes[area:index(pos.x+i, pos.y+h+1, pos.z+m)] = c.head_brown_full + nodes[area:index(pos.x+m*2, pos.y+h+1, pos.z+o)] = c.head_brown_full end for l = -3+1, 3 do - nodes[area:index(pos.x+3*i, pos.y+height+5, pos.z-l*i)] = ran_node(c.head_yellow, c.head_orange, 5) - nodes[area:index(pos.x+l*i, pos.y+height+5, pos.z+3*i)] = ran_node(c.head_yellow, c.head_orange, 5) + nodes[area:index(pos.x+3*i, pos.y+h+5, pos.z-l*i)] = ran_node(c.head_yellow, c.head_orange, 5) + nodes[area:index(pos.x+l*i, pos.y+h+5, pos.z+3*i)] = ran_node(c.head_yellow, c.head_orange, 5) end for j = 0, 1 do for l = -3, 3 do - nodes[area:index(pos.x+i*4, pos.y+height+3+j, pos.z+l)] = ran_node(c.head_yellow, c.head_orange, 6) - nodes[area:index(pos.x+l, pos.y+height+3+j, pos.z+i*4)] = ran_node(c.head_yellow, c.head_orange, 6) + nodes[area:index(pos.x+i*4, pos.y+h+3+j, pos.z+l)] = ran_node(c.head_yellow, c.head_orange, 6) + nodes[area:index(pos.x+l, pos.y+h+3+j, pos.z+i*4)] = ran_node(c.head_yellow, c.head_orange, 6) end end @@ -194,40 +203,46 @@ function riesenpilz_lavashroom(pos) for k = -2, 2 do for l = -2, 2 do - nodes[area:index(pos.x+k, pos.y+height+6, pos.z+l)] = ran_node(c.head_yellow, c.head_orange, 4) + nodes[area:index(pos.x+k, pos.y+h+6, pos.z+l)] = ran_node(c.head_yellow, c.head_orange, 4) end end +end + +local function riesenpilz_lavashroom(pos) + local t1 = os.clock() + + local h = 3+math.random(MAX_SIZE-2) + + local manip = minetest.get_voxel_manip() + local area = r_area(manip, 4, h+6, pos) + local nodes = manip:get_data() + + riesenpilz.lavashroom(pos, nodes, area, h) set_vm_data(manip, nodes, pos, t1, "lavashroom") end -function riesenpilz_glowshroom(pos) +function riesenpilz.glowshroom(pos, nodes, area, h) + local h = h or 2+math.random(MAX_SIZE) - local t1 = os.clock() - local manip = minetest.get_voxel_manip() - local area = r_area(manip, 2, MAX_SIZE+5, pos) - local nodes = manip:get_data() - - local height = 2+math.random(MAX_SIZE) - local br = 2 - - for i = 0, height do + for i = 0, h do nodes[area:index(pos.x, pos.y+i, pos.z)] = c.stem_blue end + local br = 2 for i = -1, 1, 2 do for k = -br, br, 2*br do - for l = 2, height do + for l = 2, h do nodes[area:index(pos.x+i*br, pos.y+l, pos.z+k)] = c.head_blue end nodes[area:index(pos.x+i*br, pos.y+1, pos.z+k)] = c.head_blue_bright end for l = -br+1, br do - nodes[area:index(pos.x+i*br, pos.y+height, pos.z-l*i)] = c.head_blue - nodes[area:index(pos.x+l*i, pos.y+height, pos.z+br*i)] = c.head_blue + nodes[area:index(pos.x+i*br, pos.y+h, pos.z-l*i)] = c.head_blue + nodes[area:index(pos.x+l*i, pos.y+h, pos.z+br*i)] = c.head_blue end end @@ -235,69 +250,83 @@ function riesenpilz_glowshroom(pos) for l = 0, br do for i = -br+l, br-l do for k = -br+l, br-l do - nodes[area:index(pos.x+i, pos.y+height+1+l, pos.z+k)] = c.head_blue + nodes[area:index(pos.x+i, pos.y+h+1+l, pos.z+k)] = c.head_blue end end end +end + +local function riesenpilz_glowshroom(pos) + local t1 = os.clock() + + local h = 2+math.random(MAX_SIZE) + + local manip = minetest.get_voxel_manip() + local area = r_area(manip, 2, h+3, pos) + local nodes = manip:get_data() + + riesenpilz.glowshroom(pos, nodes, area, h) + set_vm_data(manip, nodes, pos, t1, "glowshroom") end -function riesenpilz_parasol(pos) - local t1 = os.clock() - - local height = 6+math.random(MAX_SIZE) - local br = math.random(MAX_SIZE+1,MAX_SIZE+2) - - local manip = minetest.get_voxel_manip() - local area = r_area(manip, br, height, pos) - local nodes = manip:get_data() - - local rh = math.random(2,3) - local bhead1 = br-1 - local bhead2 = math.random(1,br-2) +function riesenpilz.parasol(pos, nodes, area, w, h) + local h = h or 6+math.random(MAX_SIZE) --stem - for i in area:iterp(pos, {x=pos.x, y=pos.y+height-2, z=pos.z}) do + for i in area:iterp(pos, {x=pos.x, y=pos.y+h-2, z=pos.z}) do nodes[i] = c.stem end + local w = w or math.random(MAX_SIZE+1,MAX_SIZE+2) + local bhead1 = w-1 + local bhead2 = math.random(1,w-2) + for _,j in pairs({ {bhead2, 0, c.head_brown_bright}, {bhead1, -1, c.head_binge} }) do - for i in area:iter(pos.x-j[1], pos.y+height+j[2], pos.z-j[1], pos.x+j[1], pos.y+height+j[2], pos.z+j[1]) do + for i in area:iter(pos.x-j[1], pos.y+h+j[2], pos.z-j[1], pos.x+j[1], pos.y+h+j[2], pos.z+j[1]) do nodes[i] = j[3] end end + local rh = math.random(2,3) for k = -1, 1, 2 do for l = 0, 1 do nodes[area:index(pos.x+k, pos.y+rh, pos.z-l*k)] = c.head_white nodes[area:index(pos.x+l*k, pos.y+rh, pos.z+k)] = c.head_white end - for l = -br+1, br do - nodes[area:index(pos.x+br*k, pos.y+height-2, pos.z-l*k)] = c.head_binge - nodes[area:index(pos.x+l*k, pos.y+height-2, pos.z+br*k)] = c.head_binge + for l = -w+1, w do + nodes[area:index(pos.x+w*k, pos.y+h-2, pos.z-l*k)] = c.head_binge + nodes[area:index(pos.x+l*k, pos.y+h-2, pos.z+w*k)] = c.head_binge end for l = -bhead1+1, bhead1 do - nodes[area:index(pos.x+bhead1*k, pos.y+height-2, pos.z-l*k)] = c.head_white - nodes[area:index(pos.x+l*k, pos.y+height-2, pos.z+bhead1*k)] = c.head_white + nodes[area:index(pos.x+bhead1*k, pos.y+h-2, pos.z-l*k)] = c.head_white + nodes[area:index(pos.x+l*k, pos.y+h-2, pos.z+bhead1*k)] = c.head_white end end +end + +local function riesenpilz_parasol(pos) + local t1 = os.clock() + + local w = math.random(MAX_SIZE+1,MAX_SIZE+2) + local h = 6+math.random(MAX_SIZE) + + local manip = minetest.get_voxel_manip() + local area = r_area(manip, w, h, pos) + local nodes = manip:get_data() + + riesenpilz.parasol(pos, nodes, area, w, h) set_vm_data(manip, nodes, pos, t1, "parasol") end -function riesenpilz_apple(pos) - - local t1 = os.clock() - local manip = minetest.get_voxel_manip() - local area = r_area(manip, 5, 14, pos) - local nodes = manip:get_data() - +function riesenpilz.apple(pos, nodes, area) local size = 5 local a = size*2 local b = size-1 @@ -329,6 +358,16 @@ function riesenpilz_apple(pos) end nodes[area:index(pos.x+1, c, pos.z)] = c.brown nodes[area:index(pos.x-3, c+1, pos.z+1)] = c.brown +end + +local function riesenpilz_apple(pos) + + local t1 = os.clock() + local manip = minetest.get_voxel_manip() + local area = r_area(manip, 5, 14, pos) + local nodes = manip:get_data() + + riesenpilz.apple(pos, nodes, area) manip:set_data(nodes) manip:write_to_map() @@ -427,7 +466,7 @@ local mushrooms_list = { r = {min=5, max=6}, grounds = {cracky=3}, neighbours = {"default:lava_source"}, - light = {min=10, max=14}, + light = {min=10, max=12}, interval = 1010, chance = 60, }, @@ -642,19 +681,29 @@ for name,i in pairs(mushrooms_list) do local f = minetest.get_node({x=p.x, y=p.y+y-1, z=p.z}).name if f ~= "air" then - -- they grown on walkable, cubic nodes + -- they grown on specific nodes local data = minetest.registered_nodes[f] if data and data.walkable + and data.groups and (not data.drawtype or data.drawtype == "normal" ) then + local ground_disallowed + for n,i in pairs(grounds) do + if data.groups[n] ~= i then + ground_disallowed = true + break + end + end + if not ground_disallowed then - -- they also need specific light strengths - local light = minetest.get_node_light(pos, 0.5) - if light >= lmin - and light <= lmax then - table.insert(ps, pos) + -- they also need specific light strengths + local light = minetest.get_node_light(pos, 0.5) + if light >= lmin + and light <= lmax then + table.insert(ps, pos) + end end end break @@ -688,7 +737,7 @@ end) ---Mushroom Blocks +--Mushroom Nodes local pilznode_list = { @@ -821,7 +870,7 @@ for _,i in pairs(pilznode_list) do minetest.register_node(nodename, { description = desctiption, tiles = textures, - groups = {oddly_breakable_by_hand=3}, + groups = {oddly_breakable_by_hand=3, fall_damage_add_percent=-80}, drop = drop, sounds = sounds, }) @@ -832,7 +881,7 @@ minetest.register_node("riesenpilz:head_red_side", { tiles = {"riesenpilz_head.png", "riesenpilz_lamellas.png", "riesenpilz_head.png", "riesenpilz_head.png", "riesenpilz_head.png", "riesenpilz_lamellas.png"}, paramtype2 = "facedir", - groups = {oddly_breakable_by_hand=3}, + groups = {oddly_breakable_by_hand=3, fall_damage_add_percent=-80}, drop = {max_items = 1, items = {{items = {"riesenpilz:fly_agaric"},rarity = 20,}, {items = {"riesenpilz:head_red"},rarity = 1,}}}, diff --git a/mods/riesenpilz/mapgen.lua b/mods/riesenpilz/mapgen.lua index 4738c12d..21434087 100755 --- a/mods/riesenpilz/mapgen.lua +++ b/mods/riesenpilz/mapgen.lua @@ -1,7 +1,9 @@ local c local function define_contents() c = { + ignore = minetest.get_content_id("ignore"), air = minetest.get_content_id("air"), + stone = minetest.get_content_id("default:stone"), dirt = minetest.get_content_id("default:dirt"), desert_sand = minetest.get_content_id("default:desert_sand"), @@ -43,8 +45,8 @@ end local function find_ground(a,list) - for _,nam in ipairs(list) do - if a == nam then + for i = 1,#list do + if a == list[i] then return true end end @@ -52,25 +54,14 @@ local function find_ground(a,list) end -local function fix_light(minp, maxp) - local manip = minetest.get_voxel_manip() - local emerged_pos1, emerged_pos2 = manip:read_from_map(minp, maxp) - local area = VoxelArea:new({MinEdge=emerged_pos1, MaxEdge=emerged_pos2}) - local nodes = manip:get_data() - - manip:set_data(nodes) - manip:write_to_map() - manip:update_map() -end - local data, area function riesenpilz_circle(nam, pos, radius, chance) 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 + if (data[p_p] == c.air or data[p_p] == c.ignore) + and find_ground(data[area:index(p.x, p.y-1, p.z)], c.GROUND) then data[p_p] = nam end end @@ -115,6 +106,9 @@ minetest.register_on_generated(function(minp, maxp, seed) break end end + if biome_allowed then + break + end end if not biome_allowed then return @@ -198,36 +192,29 @@ minetest.register_on_generated(function(minp, maxp, seed) if in_biome then - for b = minp.y,maxp.y,1 do --remove usual stuff - local p_pos = area:index(x, b, z) - local d_p_pos = data[p_pos] - for _,nam in ipairs(c.USUAL_STUFF) do - if d_p_pos == nam then - data[p_pos] = c.air - break - end - end - end - local ground_y = nil --Definition des Bodens: -- for y=maxp.y,0,-1 do for y=maxp.y,1,-1 do - if find_ground(data[area:index(x, y, z)], c.GROUND) then + local p_pos = area:index(x, y, z) + local d_p_pos = data[p_pos] + for _,nam in pairs(c.USUAL_STUFF) do --remove usual stuff + if d_p_pos == nam then + data[p_pos] = c.air + p_pos = nil + break + end + end + if p_pos --else search ground_y + and find_ground(d_p_pos, c.GROUND) then ground_y = y break end end if ground_y then - local p_ground = area:index(x, ground_y, z) - local p_boden = area:index(x, ground_y+1, z) - local d_p_ground = data[p_ground] - local d_p_boden = data[p_boden] - - data[p_ground] = c.ground + data[area:index(x, ground_y, z)] = c.ground for i = -1,-5,-1 do local p_pos = area:index(x, ground_y+i, z) - local d_p_pos = data[p_pos] - if d_p_pos == c.desert_sand then + if data[p_pos] == c.desert_sand then data[p_pos] = c.dirt else break @@ -235,7 +222,7 @@ minetest.register_on_generated(function(minp, maxp, seed) end local boden = {x=x,y=ground_y+1,z=z} if pr:next(1,15) == 1 then - data[p_boden] = c.dry_shrub + data[area:index(x, ground_y+1, z)] = 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 @@ -248,16 +235,6 @@ minetest.register_on_generated(function(minp, maxp, seed) riesenpilz_circle(c.riesenpilz_lavashroom, boden, pr:next(5,6), 3) elseif pr:next(1,5000) == 1 then riesenpilz_circle(c.riesenpilz_glowshroom, boden, 3, 3) - --[[elseif pr:next(1,80) == 1 then - env:add_node(boden, {name="riesenpilz:brown"}) - elseif pr:next(1,90) == 1 then - env:add_node(boden, {name="riesenpilz:red"}) - elseif pr:next(1,100) == 1 then - env:add_node(boden, {name="riesenpilz:fly_agaric"}) - elseif pr:next(1,4000) == 1 then - env:add_node(boden, {name="riesenpilz:lavashroom"}) - elseif pr:next(1,5000) == 1 then - env:add_node(boden, {name="riesenpilz:glowshroom"})]] elseif pr:next(1,380) == 1 then tab[num] = {1, boden} num = num+1 @@ -278,35 +255,41 @@ minetest.register_on_generated(function(minp, maxp, seed) end end end - vm:set_data(data) - vm:write_to_map() riesenpilz.inform("ground finished", 2, t1) - local t2 = os.clock() - local single_map_update = #tab > 3 - if single_map_update then - riesenpilz.vm_update = false - end - for _,v in pairs(tab) do - local p = v[2] - local m = v[1] - if m == 1 then - riesenpilz_hybridpilz(p) - elseif m == 2 then - riesenpilz_brauner_minecraftpilz(p) - elseif m == 3 then - riesenpilz_minecraft_fliegenpilz(p) - elseif m == 4 then - riesenpilz_lavashroom(p) - elseif m == 5 then - riesenpilz_parasol(p) + local param2s + if num ~= 1 then + local t2 = os.clock() + for _,v in pairs(tab) do + local p = v[2] + local m = v[1] + if m == 1 then + riesenpilz.red(p, data, area) + elseif m == 2 then + riesenpilz.brown(p, data, area) + elseif m == 3 then + if not param2s then + param2s = vm:get_param2_data() + end + riesenpilz.fly_agaric(p, data, area, param2s) + elseif m == 4 then + riesenpilz.lavashroom(p, data, area) + elseif m == 5 then + riesenpilz.parasol(p, data, area) + end end + riesenpilz.inform("giant shrooms generated", 2, t2) end - if single_map_update then - riesenpilz.vm_update = true - fix_light(minp, maxp) + + local t2 = os.clock() + vm:set_data(data) + if param2s then + vm:set_param2_data(param2s) end - riesenpilz.inform("giant shrooms generated", 2, t2) + vm:set_lighting({day=0, night=0}) + vm:calc_lighting() + vm:write_to_map() + riesenpilz.inform("data set", 2, t2) riesenpilz.inform("done", 1, t1) end) diff --git a/mods/riesenpilz/rest/old_mapgen.lua b/mods/riesenpilz/rest/old_mapgen.lua index 67661469..c2f38d2b 100755 --- a/mods/riesenpilz/rest/old_mapgen.lua +++ b/mods/riesenpilz/rest/old_mapgen.lua @@ -6,10 +6,10 @@ function riesenpilz_circle(nam, pos, radius, rand, seed) if math.floor( math.sqrt(i^2+j^2) +0.5) == radius then random = PseudoRandom(ra) p={x=pos.x+i, y=pos.y, z=pos.z+j} - if minetest.env:get_node(p).name == "air" + if minetest.get_node(p).name == "air" and random:next(1,rand) == 1 - and minetest.env:get_node({x=pos.x+i, y=pos.y-1, z=pos.z+j}).name ~= "air" then - minetest.env:add_node(p, {name=nam}) + and minetest.get_node({x=pos.x+i, y=pos.y-1, z=pos.z+j}).name ~= "air" then + minetest.add_node(p, {name=nam}) end ra = ra+1 end @@ -32,10 +32,10 @@ function riesenpilz_circle(nam, pos, radius, chance) for i = -radius, radius, 1 do for j = -radius, radius, 1 do if math.floor( math.sqrt(i^2+j^2) +0.5) == radius - and minetest.env:get_node({x=pos.x+i, y=pos.y, z=pos.z+j}).name == "air" + and minetest.get_node({x=pos.x+i, y=pos.y, z=pos.z+j}).name == "air" and math.random(1,chance) == 1 - and minetest.env:get_node({x=pos.x+i, y=pos.y-1, z=pos.z+j}).name == "riesenpilz:ground" then - minetest.env:add_node({x=pos.x+i, y=pos.y, z=pos.z+j}, {name=nam}) + and minetest.get_node({x=pos.x+i, y=pos.y-1, z=pos.z+j}).name == "riesenpilz:ground" then + minetest.add_node({x=pos.x+i, y=pos.y, z=pos.z+j}, {name=nam}) end end end @@ -43,7 +43,7 @@ end local function find_ground(pos, nodes) for _, evground in ipairs(nodes) do - if minetest.env:get_node(pos).name == evground then + if minetest.get_node(pos).name == evground then return true end end diff --git a/mods/riesenpilz/textures/3apple_apple.png b/mods/riesenpilz/textures/3apple_apple.png index 10d20073f1e4d061e8ff38dcd11aeec4533fcf4d..81ce4721a3c9990b5bca0337b034fa8708f78268 100755 GIT binary patch delta 235 zcmV3iM6GjqL9MOwUUzm$kJKfdrs$`bA<^%LE%3Hy=AGtE`MD4AE&2F z;(PLggYTh^W96;ZL4?94Ap>m>jA-n37(^7HE;N;v(h(ZMbY$etpimKNN?XW72wP)u zcROT-suDigfv`6)x8P_Lh1`>^5Wpp+rK@qU7kd?RHm)guI2rRBg$%ox0M5obCQPrj lJ0t-G1rI`)O;QD4@c@C#FL+3;f=K`X002ovPDHLkV1jCaX0ZSO delta 237 zcmVYm&A{(G+cTg^qSm;&0Btahup-vffY zuZ?2nL$rPY+1F;t91vIE5sjcAqGg!5;CvxZVTm+)p0`QS6=wayHH1V@`QVA3Qlb~Q z!jXQMFa(T|w+x@(a-|uy!m@ nxEp|2s?J~lb!b3nm%pzE3R|8PHegu{00000NkvXXu0mjf&(UfQ diff --git a/mods/riesenpilz/rest/mush45_meal.png b/mods/riesenpilz/textures/riesenpilz_mush45_meal.png similarity index 100% rename from mods/riesenpilz/rest/mush45_meal.png rename to mods/riesenpilz/textures/riesenpilz_mush45_meal.png