1
0
mirror of https://github.com/HybridDog/riesenpilz.git synced 2024-11-15 15:00:24 +01:00
This commit is contained in:
HybridDog 2014-02-16 15:04:49 +01:00
parent 58be4076b0
commit f473da9683
2 changed files with 20 additions and 23 deletions

View File

@ -1,5 +1,14 @@
local load_time_start = os.clock()
local MAX_SIZE = 3 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) local function set_vm_data(manip, nodes, pos, t1, name)
manip:set_data(nodes) manip:set_data(nodes)
manip:write_to_map() 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)) print(string.format("[riesenpilz] map updated after ca. %.2fs", os.clock() - t1))
end 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 --Growing Functions
function riesenpilz_hybridpilz(pos) function riesenpilz_hybridpilz(pos)
@ -64,8 +65,8 @@ function riesenpilz_brauner_minecraftpilz(pos)
local breite = br+1 local breite = br+1
local height = br+2 local height = br+2
for i = 0, height, 1 do for i in area:iterp(pos, {x=pos.x, y=pos.y+height, z=pos.z}) do
nodes[area:index(pos.x, pos.y+i, pos.z)] = riesenpilz_c_stem nodes[i] = riesenpilz_c_stem
end end
for l = -br, br, 1 do for l = -br, br, 1 do
@ -246,18 +247,16 @@ function riesenpilz_parasol(pos)
local bhead2 = math.random(1,br-2) local bhead2 = math.random(1,br-2)
--stem --stem
for i = 0, height-2 do for i in area:iterp(pos, {x=pos.x, y=pos.y+height-2, z=pos.z}) do
nodes[area:index(pos.x, pos.y+i, pos.z)] = riesenpilz_c_stem nodes[i] = riesenpilz_c_stem
end end
for i = -bhead2,bhead2 do for _,j in ipairs({
for j = -bhead2,bhead2 do {bhead2, 0, riesenpilz_c_head_brown_bright},
nodes[area:index(pos.x+i, pos.y+height, pos.z+j)] = riesenpilz_c_head_brown_bright {bhead1, -1, riesenpilz_c_head_binge}
end }) do
end 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 = -bhead1,bhead1 do nodes[i] = j[3]
for j = -bhead1,bhead1 do
nodes[area:index(pos.x+i, pos.y+height-1, pos.z+j)] = riesenpilz_c_head_binge
end end
end end
@ -584,4 +583,4 @@ if riesenpilz.enable_mapgen then
dofile(minetest.get_modpath("riesenpilz") .. "/mapgen.lua") dofile(minetest.get_modpath("riesenpilz") .. "/mapgen.lua")
end end
print("[riesenpilz] Loaded!") print(string.format("[riesenpilz] loaded after ca. %.2fs", os.clock() - load_time_start))

View File

@ -229,8 +229,6 @@ minetest.register_on_generated(function(minp, maxp, seed)
end end
end end
vm:set_data(data) vm:set_data(data)
--vm:set_lighting({day=0, night=0})
vm:calc_lighting()
vm:update_liquids() vm:update_liquids()
vm:write_to_map() vm:write_to_map()
if riesenpilz.info then if riesenpilz.info then