From f473da9683d98e9bc7ce1522a33503674e8ea734 Mon Sep 17 00:00:00 2001 From: HybridDog Date: Sun, 16 Feb 2014 15:04:49 +0100 Subject: [PATCH] update --- init.lua | 41 ++++++++++++++++++++--------------------- mapgen.lua | 2 -- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/init.lua b/init.lua index 1937f8d..ff7d81d 100644 --- a/init.lua +++ b/init.lua @@ -1,5 +1,14 @@ +local load_time_start = os.clock() local MAX_SIZE = 3 +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}, + {x=pos.x+width, y=pos.y+height, z=pos.z+width} + ) + return VoxelArea:new({MinEdge=emerged_pos1, MaxEdge=emerged_pos2}) +end + local function set_vm_data(manip, nodes, pos, t1, name) manip:set_data(nodes) manip:write_to_map() @@ -9,14 +18,6 @@ local function set_vm_data(manip, nodes, pos, t1, name) print(string.format("[riesenpilz] map updated after ca. %.2fs", os.clock() - t1)) end -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}, - {x=pos.x+width, y=pos.y+height, z=pos.z+width} - ) - return VoxelArea:new({MinEdge=emerged_pos1, MaxEdge=emerged_pos2}) -end - --Growing Functions function riesenpilz_hybridpilz(pos) @@ -64,8 +65,8 @@ function riesenpilz_brauner_minecraftpilz(pos) local breite = br+1 local height = br+2 - for i = 0, height, 1 do - nodes[area:index(pos.x, pos.y+i, pos.z)] = riesenpilz_c_stem + for i in area:iterp(pos, {x=pos.x, y=pos.y+height, z=pos.z}) do + nodes[i] = riesenpilz_c_stem end for l = -br, br, 1 do @@ -246,18 +247,16 @@ function riesenpilz_parasol(pos) local bhead2 = math.random(1,br-2) --stem - for i = 0, height-2 do - nodes[area:index(pos.x, pos.y+i, pos.z)] = riesenpilz_c_stem + for i in area:iterp(pos, {x=pos.x, y=pos.y+height-2, z=pos.z}) do + nodes[i] = riesenpilz_c_stem end - for i = -bhead2,bhead2 do - for j = -bhead2,bhead2 do - nodes[area:index(pos.x+i, pos.y+height, pos.z+j)] = riesenpilz_c_head_brown_bright - end - end - for i = -bhead1,bhead1 do - for j = -bhead1,bhead1 do - nodes[area:index(pos.x+i, pos.y+height-1, pos.z+j)] = riesenpilz_c_head_binge + for _,j in ipairs({ + {bhead2, 0, riesenpilz_c_head_brown_bright}, + {bhead1, -1, riesenpilz_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 + nodes[i] = j[3] end end @@ -584,4 +583,4 @@ if riesenpilz.enable_mapgen then dofile(minetest.get_modpath("riesenpilz") .. "/mapgen.lua") end -print("[riesenpilz] Loaded!") +print(string.format("[riesenpilz] loaded after ca. %.2fs", os.clock() - load_time_start)) diff --git a/mapgen.lua b/mapgen.lua index cc88410..c741a90 100644 --- a/mapgen.lua +++ b/mapgen.lua @@ -229,8 +229,6 @@ minetest.register_on_generated(function(minp, maxp, seed) end end vm:set_data(data) - --vm:set_lighting({day=0, night=0}) - vm:calc_lighting() vm:update_liquids() vm:write_to_map() if riesenpilz.info then