2014-02-16 15:04:49 +01:00
|
|
|
local load_time_start = os.clock()
|
2013-01-29 18:38:49 +01:00
|
|
|
local MAX_SIZE = 3
|
2013-04-04 18:44:35 +02:00
|
|
|
|
2014-02-16 15:04:49 +01:00
|
|
|
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
|
|
|
|
|
2013-11-05 20:31:44 +01:00
|
|
|
local function set_vm_data(manip, nodes, pos, t1, name)
|
|
|
|
manip:set_data(nodes)
|
|
|
|
manip:write_to_map()
|
|
|
|
print(string.format("[riesenpilz] a "..name.." mushroom grew at ("..pos.x.."|"..pos.y.."|"..pos.z..") after ca. %.2fs", os.clock() - t1))
|
|
|
|
local t1 = os.clock()
|
|
|
|
manip:update_map()
|
|
|
|
print(string.format("[riesenpilz] map updated after ca. %.2fs", os.clock() - t1))
|
|
|
|
end
|
|
|
|
|
2013-08-23 16:32:27 +02:00
|
|
|
--Growing Functions
|
2013-04-04 18:44:35 +02:00
|
|
|
|
2013-04-24 20:53:20 +02:00
|
|
|
function riesenpilz_hybridpilz(pos)
|
2013-08-23 16:32:27 +02:00
|
|
|
|
|
|
|
local t1 = os.clock()
|
|
|
|
local manip = minetest.get_voxel_manip()
|
2013-11-05 20:31:44 +01:00
|
|
|
local area = r_area(manip, MAX_SIZE+1, MAX_SIZE+2, pos)
|
2013-08-23 16:32:27 +02:00
|
|
|
local nodes = manip:get_data()
|
|
|
|
|
2013-05-01 16:46:31 +02:00
|
|
|
local breite = math.random(MAX_SIZE)
|
2013-01-29 18:38:49 +01:00
|
|
|
local br = breite+1
|
2013-05-01 16:46:31 +02:00
|
|
|
local height = breite+2
|
2013-01-29 18:38:49 +01:00
|
|
|
|
2013-04-04 18:44:35 +02:00
|
|
|
for i = 0, height, 1 do
|
2013-08-23 16:32:27 +02:00
|
|
|
nodes[area:index(pos.x, pos.y+i, pos.z)] = riesenpilz_c_stem
|
2013-01-29 18:38:49 +01:00
|
|
|
end
|
|
|
|
|
2013-05-01 16:46:31 +02:00
|
|
|
for l = -br+1, br, 1 do
|
|
|
|
for k = -1, 1, 2 do
|
2013-08-23 16:32:27 +02:00
|
|
|
nodes[area:index(pos.x+br*k, pos.y+height, pos.z-l*k)] = riesenpilz_c_head_red
|
|
|
|
nodes[area:index(pos.x+l*k, pos.y+height, pos.z+br*k)] = riesenpilz_c_head_red
|
2013-01-29 18:38:49 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-05-01 16:46:31 +02:00
|
|
|
for k = -breite, breite, 1 do
|
|
|
|
for l = -breite, breite, 1 do
|
2013-08-23 16:32:27 +02:00
|
|
|
nodes[area:index(pos.x+l, pos.y+height+1, pos.z+k)] = riesenpilz_c_head_red
|
|
|
|
nodes[area:index(pos.x+l, pos.y+height, pos.z+k)] = riesenpilz_c_lamellas
|
2013-01-29 18:38:49 +01:00
|
|
|
end
|
|
|
|
end
|
2013-08-23 16:32:27 +02:00
|
|
|
|
2013-11-05 20:31:44 +01:00
|
|
|
set_vm_data(manip, nodes, pos, t1, "red")
|
2013-01-29 18:38:49 +01:00
|
|
|
end
|
|
|
|
|
2013-04-04 18:44:35 +02:00
|
|
|
|
2013-04-24 20:53:20 +02:00
|
|
|
function riesenpilz_brauner_minecraftpilz(pos)
|
2013-08-23 16:32:27 +02:00
|
|
|
|
|
|
|
local t1 = os.clock()
|
|
|
|
local manip = minetest.get_voxel_manip()
|
2013-11-05 20:31:44 +01:00
|
|
|
local area = r_area(manip, MAX_SIZE+1, MAX_SIZE+2, pos)
|
2013-08-23 16:32:27 +02:00
|
|
|
local nodes = manip:get_data()
|
|
|
|
|
2013-01-29 18:38:49 +01:00
|
|
|
local random = math.random(MAX_SIZE-1)
|
2013-04-25 20:34:00 +02:00
|
|
|
local br = random+1
|
|
|
|
local breite = br+1
|
|
|
|
local height = br+2
|
2013-01-29 18:38:49 +01:00
|
|
|
|
2014-02-16 15:04:49 +01:00
|
|
|
for i in area:iterp(pos, {x=pos.x, y=pos.y+height, z=pos.z}) do
|
|
|
|
nodes[i] = riesenpilz_c_stem
|
2013-01-29 18:38:49 +01:00
|
|
|
end
|
|
|
|
|
2013-05-01 16:46:31 +02:00
|
|
|
for l = -br, br, 1 do
|
|
|
|
for k = -breite, breite, breite*2 do
|
2013-08-23 16:32:27 +02:00
|
|
|
nodes[area:index(pos.x+k, pos.y+height+1, pos.z+l)] = riesenpilz_c_head_brown
|
|
|
|
nodes[area:index(pos.x+l, pos.y+height+1, pos.z+k)] = riesenpilz_c_head_brown
|
2013-04-25 20:34:00 +02:00
|
|
|
end
|
|
|
|
for k = -br, br, 1 do
|
2013-08-23 16:32:27 +02:00
|
|
|
nodes[area:index(pos.x+l, pos.y+height+1, pos.z+k)] = riesenpilz_c_head_brown
|
2013-01-29 18:38:49 +01:00
|
|
|
end
|
|
|
|
end
|
2013-08-23 16:32:27 +02:00
|
|
|
|
2013-11-05 20:31:44 +01:00
|
|
|
set_vm_data(manip, nodes, pos, t1, "brown")
|
2013-01-29 18:38:49 +01:00
|
|
|
end
|
|
|
|
|
2013-04-04 18:44:35 +02:00
|
|
|
|
2013-04-24 20:53:20 +02:00
|
|
|
function riesenpilz_minecraft_fliegenpilz(pos)
|
2013-08-23 16:32:27 +02:00
|
|
|
|
|
|
|
local t1 = os.clock()
|
|
|
|
local manip = minetest.get_voxel_manip()
|
2013-11-05 20:31:44 +01:00
|
|
|
local area = r_area(manip, 1, 4, pos)
|
2013-08-23 16:32:27 +02:00
|
|
|
local nodes = manip:get_data()
|
2014-04-03 20:17:18 +02:00
|
|
|
local param2s = manip:get_param2_data()
|
2013-08-23 16:32:27 +02:00
|
|
|
|
2013-01-29 18:38:49 +01:00
|
|
|
local height = 3
|
|
|
|
|
2013-04-04 18:44:35 +02:00
|
|
|
for i = 0, height, 1 do
|
2013-08-23 16:32:27 +02:00
|
|
|
nodes[area:index(pos.x, pos.y+i, pos.z)] = riesenpilz_c_stem
|
2013-01-29 18:38:49 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
for j = -1, 1, 1 do
|
|
|
|
for k = -1, 1, 1 do
|
2013-08-23 16:32:27 +02:00
|
|
|
nodes[area:index(pos.x+j, pos.y+height+1, pos.z+k)] = riesenpilz_c_head_red
|
2013-01-29 18:38:49 +01:00
|
|
|
end
|
|
|
|
for l = 1, height, 1 do
|
2014-04-03 20:17:18 +02:00
|
|
|
local y = pos.y+l
|
|
|
|
for _,p in ipairs({
|
|
|
|
{area:index(pos.x+j, y, pos.z+2), 0},
|
|
|
|
{area:index(pos.x+j, y, pos.z-2), 2},
|
|
|
|
{area:index(pos.x+2, y, pos.z+j), 1},
|
|
|
|
{area:index(pos.x-2, y, pos.z+j), 3},
|
|
|
|
}) do
|
|
|
|
local tmp = p[1]
|
|
|
|
nodes[tmp] = riesenpilz_c_head_red_side
|
|
|
|
param2s[tmp] = p[2]
|
|
|
|
end
|
2013-01-29 18:38:49 +01:00
|
|
|
end
|
|
|
|
end
|
2013-08-23 16:32:27 +02:00
|
|
|
|
|
|
|
manip:set_data(nodes)
|
2014-04-03 20:17:18 +02:00
|
|
|
manip:set_param2_data(param2s)
|
2013-08-23 16:32:27 +02:00
|
|
|
manip:write_to_map()
|
|
|
|
manip:update_map()
|
|
|
|
print(string.format("[riesenpilz] a fly agaric grew at ("..pos.x.."|"..pos.y.."|"..pos.z..") in: %.2fs", os.clock() - t1))
|
2013-01-29 18:38:49 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-08-23 16:32:27 +02:00
|
|
|
local function ran_node(a, b, ran)
|
2013-04-21 13:45:30 +02:00
|
|
|
if math.random(ran) == 1 then
|
2013-08-23 16:32:27 +02:00
|
|
|
return a
|
2013-04-21 13:45:30 +02:00
|
|
|
end
|
2013-08-23 16:32:27 +02:00
|
|
|
return b
|
2013-04-21 13:45:30 +02:00
|
|
|
end
|
|
|
|
|
2013-04-25 20:34:00 +02:00
|
|
|
function riesenpilz_lavashroom(pos)
|
2013-08-23 16:32:27 +02:00
|
|
|
|
|
|
|
local t1 = os.clock()
|
|
|
|
local manip = minetest.get_voxel_manip()
|
2013-11-05 20:31:44 +01:00
|
|
|
local area = r_area(manip, 4, MAX_SIZE+7, pos)
|
2013-08-23 16:32:27 +02:00
|
|
|
local nodes = manip:get_data()
|
|
|
|
|
2013-04-21 13:45:30 +02:00
|
|
|
local height = 3+math.random(MAX_SIZE-2)
|
2013-08-23 16:32:27 +02:00
|
|
|
nodes[area:index(pos.x, pos.y, pos.z)] = riesenpilz_c_air
|
2013-04-21 13:45:30 +02:00
|
|
|
|
2013-06-15 00:11:35 +02:00
|
|
|
for i = -1, 1, 2 do
|
|
|
|
local o = 2*i
|
|
|
|
|
|
|
|
for n = 0, height, 1 do
|
2013-08-23 16:32:27 +02:00
|
|
|
nodes[area:index(pos.x+i, pos.y+n, pos.z)] = riesenpilz_c_stem_brown
|
|
|
|
nodes[area:index(pos.x, pos.y+n, pos.z+i)] = riesenpilz_c_stem_brown
|
2013-04-21 13:45:30 +02:00
|
|
|
end
|
|
|
|
|
2013-06-15 00:11:35 +02:00
|
|
|
for l = -1, 1, 1 do
|
|
|
|
for k = 2, 3, 1 do
|
2013-08-23 16:32:27 +02:00
|
|
|
nodes[area:index(pos.x+k*i, pos.y+height+2, pos.z+l)] = riesenpilz_c_head_brown_full
|
|
|
|
nodes[area:index(pos.x+l, pos.y+height+2, pos.z+k*i)] = riesenpilz_c_head_brown_full
|
2013-04-21 13:45:30 +02:00
|
|
|
end
|
2013-08-23 16:32:27 +02:00
|
|
|
nodes[area:index(pos.x+l, pos.y+height+1, pos.z+o)] = riesenpilz_c_head_brown_full
|
|
|
|
nodes[area:index(pos.x+o, pos.y+height+1, pos.z+l)] = riesenpilz_c_head_brown_full
|
2013-04-21 13:45:30 +02:00
|
|
|
end
|
|
|
|
|
2013-06-15 00:11:35 +02:00
|
|
|
for m = -1, 1, 2 do
|
|
|
|
for k = 2, 3, 1 do
|
|
|
|
for j = 2, 3, 1 do
|
2013-08-23 16:32:27 +02:00
|
|
|
nodes[area:index(pos.x+j*i, pos.y+height+2, pos.z+k*m)] = ran_node(riesenpilz_c_head_yellow, riesenpilz_c_head_orange, 7)
|
2013-06-15 00:11:35 +02:00
|
|
|
end
|
|
|
|
end
|
2013-08-23 16:32:27 +02:00
|
|
|
nodes[area:index(pos.x+i, pos.y+height+1, pos.z+m)] = riesenpilz_c_head_brown_full
|
|
|
|
nodes[area:index(pos.x+m*2, pos.y+height+1, pos.z+o)] = riesenpilz_c_head_brown_full
|
2013-04-21 13:45:30 +02:00
|
|
|
end
|
|
|
|
|
2013-05-01 16:46:31 +02:00
|
|
|
for l = -3+1, 3, 1 do
|
2013-08-23 16:32:27 +02:00
|
|
|
nodes[area:index(pos.x+3*i, pos.y+height+5, pos.z-l*i)] = ran_node(riesenpilz_c_head_yellow, riesenpilz_c_head_orange, 5)
|
|
|
|
nodes[area:index(pos.x+l*i, pos.y+height+5, pos.z+3*i)] = ran_node(riesenpilz_c_head_yellow, riesenpilz_c_head_orange, 5)
|
2013-05-01 16:46:31 +02:00
|
|
|
end
|
2013-04-25 20:34:00 +02:00
|
|
|
|
2013-06-15 00:11:35 +02:00
|
|
|
for j = 0, 1, 1 do
|
2013-04-25 20:34:00 +02:00
|
|
|
for l = -3, 3, 1 do
|
2013-08-23 16:32:27 +02:00
|
|
|
nodes[area:index(pos.x+i*4, pos.y+height+3+j, pos.z+l)] = ran_node(riesenpilz_c_head_yellow, riesenpilz_c_head_orange, 6)
|
|
|
|
nodes[area:index(pos.x+l, pos.y+height+3+j, pos.z+i*4)] = ran_node(riesenpilz_c_head_yellow, riesenpilz_c_head_orange, 6)
|
2013-04-21 13:45:30 +02:00
|
|
|
end
|
|
|
|
end
|
2013-06-15 00:11:35 +02:00
|
|
|
|
2013-04-21 13:45:30 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
for k = -2, 2, 1 do
|
|
|
|
for l = -2, 2, 1 do
|
2013-08-23 16:32:27 +02:00
|
|
|
nodes[area:index(pos.x+k, pos.y+height+6, pos.z+l)] = ran_node(riesenpilz_c_head_yellow, riesenpilz_c_head_orange, 4)
|
2013-04-21 13:45:30 +02:00
|
|
|
end
|
|
|
|
end
|
2013-08-23 16:32:27 +02:00
|
|
|
|
2013-11-05 20:31:44 +01:00
|
|
|
set_vm_data(manip, nodes, pos, t1, "lavashroom")
|
2013-04-21 13:45:30 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-05-01 18:00:02 +02:00
|
|
|
function riesenpilz_glowshroom(pos)
|
2013-08-23 16:32:27 +02:00
|
|
|
|
|
|
|
local t1 = os.clock()
|
|
|
|
local manip = minetest.get_voxel_manip()
|
2013-11-05 20:31:44 +01:00
|
|
|
local area = r_area(manip, 2, MAX_SIZE+5, pos)
|
2013-08-23 16:32:27 +02:00
|
|
|
local nodes = manip:get_data()
|
|
|
|
|
2013-05-01 18:00:02 +02:00
|
|
|
local height = 2+math.random(MAX_SIZE)
|
|
|
|
local br = 2
|
|
|
|
|
|
|
|
for i = 0, height, 1 do
|
2013-08-23 16:32:27 +02:00
|
|
|
nodes[area:index(pos.x, pos.y+i, pos.z)] = riesenpilz_c_stem_blue
|
2013-05-01 18:00:02 +02:00
|
|
|
end
|
|
|
|
|
2013-06-15 00:11:35 +02:00
|
|
|
for i = -1, 1, 2 do
|
2013-05-01 18:00:02 +02:00
|
|
|
|
2013-06-15 00:11:35 +02:00
|
|
|
for k = -br, br, 2*br do
|
|
|
|
for l = 2, height, 1 do
|
2013-08-23 16:32:27 +02:00
|
|
|
nodes[area:index(pos.x+i*br, pos.y+l, pos.z+k)] = riesenpilz_c_head_blue
|
2013-06-15 00:11:35 +02:00
|
|
|
end
|
2013-08-23 16:32:27 +02:00
|
|
|
nodes[area:index(pos.x+i*br, pos.y+1, pos.z+k)] = riesenpilz_c_head_blue_bright
|
2013-05-01 18:00:02 +02:00
|
|
|
end
|
|
|
|
|
2013-06-15 00:11:35 +02:00
|
|
|
for l = -br+1, br, 1 do
|
2013-08-23 16:32:27 +02:00
|
|
|
nodes[area:index(pos.x+i*br, pos.y+height, pos.z-l*i)] = riesenpilz_c_head_blue
|
|
|
|
nodes[area:index(pos.x+l*i, pos.y+height, pos.z+br*i)] = riesenpilz_c_head_blue
|
2013-05-01 18:00:02 +02:00
|
|
|
end
|
|
|
|
|
2013-06-15 00:11:35 +02:00
|
|
|
end
|
2013-05-01 18:00:02 +02:00
|
|
|
|
|
|
|
for l = 0, br, 1 do
|
|
|
|
for i = -br+l, br-l, 1 do
|
|
|
|
for k = -br+l, br-l, 1 do
|
2013-08-23 16:32:27 +02:00
|
|
|
nodes[area:index(pos.x+i, pos.y+height+1+l, pos.z+k)] = riesenpilz_c_head_blue
|
2013-05-01 18:00:02 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-11-05 20:31:44 +01:00
|
|
|
set_vm_data(manip, nodes, pos, t1, "glowshroom")
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function riesenpilz_parasol(pos)
|
|
|
|
local t1 = os.clock()
|
2013-11-10 11:06:24 +01:00
|
|
|
|
|
|
|
local height = 6+math.random(MAX_SIZE)
|
|
|
|
local br = math.random(MAX_SIZE+1,MAX_SIZE+2)
|
|
|
|
|
2013-11-05 20:31:44 +01:00
|
|
|
local manip = minetest.get_voxel_manip()
|
2013-11-10 11:06:24 +01:00
|
|
|
local area = r_area(manip, br, height, pos)
|
2013-11-05 20:31:44 +01:00
|
|
|
local nodes = manip:get_data()
|
|
|
|
|
|
|
|
local rh = math.random(2,3)
|
2013-11-10 11:06:24 +01:00
|
|
|
local bhead1 = br-1
|
|
|
|
local bhead2 = math.random(1,br-2)
|
2013-11-05 20:31:44 +01:00
|
|
|
|
|
|
|
--stem
|
2014-02-16 15:04:49 +01:00
|
|
|
for i in area:iterp(pos, {x=pos.x, y=pos.y+height-2, z=pos.z}) do
|
|
|
|
nodes[i] = riesenpilz_c_stem
|
2013-11-05 20:31:44 +01:00
|
|
|
end
|
|
|
|
|
2014-02-16 15:04:49 +01:00
|
|
|
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]
|
2013-11-05 20:31:44 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-11-10 11:06:24 +01:00
|
|
|
for k = -1, 1, 2 do
|
|
|
|
for l = 0, 1 do
|
|
|
|
nodes[area:index(pos.x+k, pos.y+rh, pos.z-l*k)] = riesenpilz_c_head_white
|
|
|
|
nodes[area:index(pos.x+l*k, pos.y+rh, pos.z+k)] = riesenpilz_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)] = riesenpilz_c_head_binge
|
|
|
|
nodes[area:index(pos.x+l*k, pos.y+height-2, pos.z+br*k)] = riesenpilz_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)] = riesenpilz_c_head_white
|
|
|
|
nodes[area:index(pos.x+l*k, pos.y+height-2, pos.z+bhead1*k)] = riesenpilz_c_head_white
|
2013-11-05 20:31:44 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
set_vm_data(manip, nodes, pos, t1, "parasol")
|
2013-05-01 18:00:02 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-05-10 20:08:50 +02:00
|
|
|
function riesenpilz_apple(pos)
|
2013-08-23 16:32:27 +02:00
|
|
|
|
|
|
|
local t1 = os.clock()
|
|
|
|
local manip = minetest.get_voxel_manip()
|
2013-11-05 20:31:44 +01:00
|
|
|
local area = r_area(manip, 5, 14, pos)
|
2013-08-23 16:32:27 +02:00
|
|
|
local nodes = manip:get_data()
|
|
|
|
|
2013-05-10 20:08:50 +02:00
|
|
|
local size = 5
|
|
|
|
local a = size*2
|
|
|
|
local b = size-1
|
2013-08-23 16:32:27 +02:00
|
|
|
|
2013-05-10 20:08:50 +02:00
|
|
|
for l = -b, b, 1 do
|
|
|
|
for j = 1, a-1, 1 do
|
|
|
|
for k = -size, size, a do
|
2013-08-23 16:32:27 +02:00
|
|
|
nodes[area:index(pos.x+k, pos.y+j, pos.z+l)] = riesenpilz_c_red
|
|
|
|
nodes[area:index(pos.x+l, pos.y+j, pos.z+k)] = riesenpilz_c_red
|
2013-05-10 20:08:50 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
for i = -b, b, 1 do
|
2013-08-23 16:32:27 +02:00
|
|
|
nodes[area:index(pos.x+i, pos.y, pos.z+l)] = riesenpilz_c_red
|
|
|
|
nodes[area:index(pos.x+i, pos.y+a, pos.z+l)] = riesenpilz_c_red
|
2013-05-10 20:08:50 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
for i = a+1, a+b, 1 do
|
2013-08-23 16:32:27 +02:00
|
|
|
nodes[area:index(pos.x, pos.y+i, pos.z)] = riesenpilz_c_tree
|
2013-05-10 20:08:50 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
local c = pos.y+1
|
|
|
|
for i = -3,1,1 do
|
2013-08-23 16:32:27 +02:00
|
|
|
nodes[area:index(pos.x+i, c, pos.z+1)] = riesenpilz_c_brown
|
2013-05-10 20:08:50 +02:00
|
|
|
end
|
|
|
|
for i = 0,1,1 do
|
2013-08-23 16:32:27 +02:00
|
|
|
nodes[area:index(pos.x+i+1, c, pos.z-1-i)] = riesenpilz_c_brown
|
|
|
|
nodes[area:index(pos.x+i+2, c, pos.z-1-i)] = riesenpilz_c_brown
|
2013-05-10 20:08:50 +02:00
|
|
|
end
|
2013-08-23 16:32:27 +02:00
|
|
|
nodes[area:index(pos.x+1, c, pos.z)] = riesenpilz_c_brown
|
|
|
|
nodes[area:index(pos.x-3, c+1, pos.z+1)] = riesenpilz_c_brown
|
|
|
|
|
|
|
|
manip:set_data(nodes)
|
|
|
|
manip:write_to_map()
|
2013-11-05 20:31:44 +01:00
|
|
|
print(string.format("[riesenpilz] an apple grew at ("..pos.x.."|"..pos.y.."|"..pos.z..") after ca. %.2fs", os.clock() - t1))
|
2013-08-23 16:32:27 +02:00
|
|
|
manip:update_map()
|
2013-05-10 20:08:50 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--3D apple [3apple]
|
|
|
|
|
|
|
|
|
2013-11-05 20:31:44 +01:00
|
|
|
local tmp = minetest.registered_nodes["default:apple"]
|
2013-05-10 20:08:50 +02:00
|
|
|
minetest.register_node(":default:apple", {
|
2013-11-05 20:31:44 +01:00
|
|
|
description = tmp.description,
|
2013-05-10 20:08:50 +02:00
|
|
|
drawtype = "nodebox",
|
2013-11-05 20:31:44 +01:00
|
|
|
visual_scale = tmp.visual_scale,
|
2013-05-10 20:08:50 +02:00
|
|
|
tiles = {"3apple_apple_top.png","3apple_apple_bottom.png","3apple_apple.png"},
|
2013-11-05 20:31:44 +01:00
|
|
|
inventory_image = tmp.inventory_image,
|
|
|
|
sunlight_propagates = tmp.sunlight_propagates,
|
|
|
|
walkable = tmp.walkable,
|
|
|
|
paramtype = tmp.paramtype,
|
2013-05-10 20:08:50 +02:00
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {
|
2013-10-18 22:05:21 +02:00
|
|
|
{-3/16, -7/16, -3/16, 3/16, 1/16, 3/16},
|
|
|
|
{-4/16, -6/16, -3/16, 4/16, 0, 3/16},
|
|
|
|
{-3/16, -6/16, -4/16, 3/16, 0, 4/16},
|
|
|
|
{-1/32, 1/16, -1/32, 1/32, 4/16, 1/32},
|
|
|
|
{-1/16, 1.6/16, 0, 1/16, 1.8/16, 1/16},
|
|
|
|
{-2/16, 1.4/16, 1/16, 1/16, 1.6/16, 2/16},
|
|
|
|
{-2/16, 1.2/16, 2/16, 0, 1.4/16, 3/16},
|
|
|
|
{-1.5/16, 1/16, .5/16, 0.5/16, 1.2/16, 2.5/16},
|
2013-05-10 20:08:50 +02:00
|
|
|
}
|
|
|
|
},
|
2013-11-05 20:31:44 +01:00
|
|
|
groups = tmp.groups,
|
|
|
|
on_use = tmp.on_use,
|
|
|
|
sounds = tmp.sounds,
|
|
|
|
after_place_node = tmp.after_place_node,
|
2013-05-10 20:08:50 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
|
2013-01-29 18:38:49 +01:00
|
|
|
|
2013-04-04 18:44:35 +02:00
|
|
|
--Mushroom Nodes
|
|
|
|
|
|
|
|
|
2013-11-05 20:31:44 +01:00
|
|
|
local function pilz(name, desc, b)
|
|
|
|
local box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = b
|
|
|
|
}
|
|
|
|
minetest.register_node("riesenpilz:"..name, {
|
|
|
|
description = desc,
|
|
|
|
tiles = {"riesenpilz_"..name.."_top.png", "riesenpilz_"..name.."_bottom.png", "riesenpilz_"..name.."_side.png"},
|
|
|
|
inventory_image = "riesenpilz_"..name.."_side.png",
|
|
|
|
walkable = false,
|
|
|
|
buildable_to = true,
|
|
|
|
drawtype = "nodebox",
|
|
|
|
paramtype = "light",
|
|
|
|
groups = {snappy=3,flammable=2,attached_node=1},
|
|
|
|
sounds = default.node_sound_leaves_defaults(),
|
|
|
|
node_box = box,
|
|
|
|
selection_box = box
|
|
|
|
})
|
2013-01-29 18:38:49 +01:00
|
|
|
end
|
|
|
|
|
2013-11-05 20:31:44 +01:00
|
|
|
local BOX = {
|
|
|
|
RED = {
|
2013-04-04 18:44:35 +02:00
|
|
|
{-1/16, -8/16, -1/16, 1/16, -6/16, 1/16},
|
|
|
|
{-3/16, -6/16, -3/16, 3/16, -5/16, 3/16},
|
|
|
|
{-4/16, -5/16, -4/16, 4/16, -4/16, 4/16},
|
|
|
|
{-3/16, -4/16, -3/16, 3/16, -3/16, 3/16},
|
2013-11-05 20:31:44 +01:00
|
|
|
{-2/16, -3/16, -2/16, 2/16, -2/16, 2/16}
|
2013-04-04 18:44:35 +02:00
|
|
|
},
|
2013-11-05 20:31:44 +01:00
|
|
|
BROWN = {
|
2013-04-04 18:44:35 +02:00
|
|
|
{-0.15, -0.2, -0.15, 0.15, -0.1, 0.15},
|
|
|
|
{-0.2, -0.3, -0.2, 0.2, -0.2, 0.2},
|
2013-04-07 18:12:06 +02:00
|
|
|
{-0.05, -0.5, -0.05, 0.05, -0.3, 0.05}
|
|
|
|
},
|
2013-11-05 20:31:44 +01:00
|
|
|
FLY_AGARIC = {
|
2013-04-07 18:12:06 +02:00
|
|
|
{-0.05, -0.5, -0.05, 0.05, 1/20, 0.05},
|
|
|
|
{-3/20, -6/20, -3/20, 3/20, 0, 3/20},
|
2013-11-05 20:31:44 +01:00
|
|
|
{-4/20, -2/20, -4/20, 4/20, -4/20, 4/20}
|
2013-04-04 18:44:35 +02:00
|
|
|
},
|
2013-11-05 20:31:44 +01:00
|
|
|
LAVASHROOM = {
|
2013-04-21 13:45:30 +02:00
|
|
|
{-1/16, -8/16, -1/16, 1/16, -6/16, 1/16},
|
|
|
|
{-2/16, -6/16, -2/16, 2/16, 0, 2/16},
|
|
|
|
{-3/16, -5/16, -3/16, 3/16, -1/16, 3/16},
|
2013-11-05 20:31:44 +01:00
|
|
|
{-4/16, -4/16, -4/16, 4/16, -2/16, 4/16}
|
2013-04-21 13:45:30 +02:00
|
|
|
},
|
2013-11-05 20:31:44 +01:00
|
|
|
GLOWSHROOM = {
|
2013-04-21 13:45:30 +02:00
|
|
|
{-1/16, -8/16, -1/16, 1/16, -1/16, 1/16},
|
|
|
|
{-2/16, -3/16, -2/16, 2/16, -2/16, 2/16},
|
|
|
|
{-3/16, -5/16, -3/16, 3/16, -3/16, 3/16},
|
|
|
|
{-3/16, -7/16, -3/16, -2/16, -5/16, -2/16},
|
|
|
|
{3/16, -7/16, -3/16, 2/16, -5/16, -2/16},
|
|
|
|
{-3/16, -7/16, 3/16, -2/16, -5/16, 2/16},
|
2013-11-05 20:31:44 +01:00
|
|
|
{3/16, -7/16, 3/16, 2/16, -5/16, 2/16}
|
2013-04-21 13:45:30 +02:00
|
|
|
},
|
2013-11-05 20:31:44 +01:00
|
|
|
NETHER_SHROOM = {
|
2013-08-23 16:32:27 +02:00
|
|
|
{-1/16, -8/16, -1/16, 1/16, -2/16, 1/16},
|
|
|
|
{-2/16, -6/16, -2/16, 2/16, -5/16, 2/16},
|
|
|
|
{-3/16, -2/16, -3/16, 3/16, 0, 3/16},
|
|
|
|
{-4/16, -1/16, -4/16, 4/16, 1/16,-2/16},
|
|
|
|
{-4/16, -1/16, 2/16, 4/16, 1/16, 4/16},
|
|
|
|
{-4/16, -1/16, -2/16,-2/16, 1/16, 2/16},
|
2013-11-05 20:31:44 +01:00
|
|
|
{ 2/16, -1/16, -2/16, 4/16, 1/16, 2/16}
|
2013-08-23 16:32:27 +02:00
|
|
|
},
|
2013-11-05 20:31:44 +01:00
|
|
|
PARASOL = {
|
2013-11-05 20:35:29 +01:00
|
|
|
{-1/16, -8/16, -1/16, 1/16, 0, 1/16},
|
2013-10-11 13:36:24 +02:00
|
|
|
{-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},
|
2013-11-05 20:31:44 +01:00
|
|
|
{-3/16, -2/16, -3/16, 3/16, -1/16, 3/16}
|
|
|
|
}
|
2013-10-11 13:36:24 +02:00
|
|
|
}
|
|
|
|
|
2013-10-18 22:05:21 +02:00
|
|
|
|
2013-10-11 13:36:24 +02:00
|
|
|
local mushrooms_list = {
|
2013-11-05 20:31:44 +01:00
|
|
|
{"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},
|
2013-10-11 13:36:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
for _,i in ipairs(mushrooms_list) do
|
|
|
|
pilz(i[1], i[2], i[3])
|
|
|
|
end
|
2013-01-29 18:38:49 +01:00
|
|
|
|
2013-04-04 18:44:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
--Mushroom Blocks
|
|
|
|
|
|
|
|
|
2013-01-29 18:38:49 +01:00
|
|
|
local function pilznode(name, desc, textures, sapling)
|
|
|
|
minetest.register_node("riesenpilz:"..name, {
|
|
|
|
description = desc,
|
2013-08-23 16:32:27 +02:00
|
|
|
tiles = textures,
|
2013-01-29 18:38:49 +01:00
|
|
|
groups = {oddly_breakable_by_hand=3},
|
|
|
|
drop = {max_items = 1,
|
|
|
|
items = {{items = {"riesenpilz:"..sapling},rarity = 20,},
|
|
|
|
{items = {"riesenpilz:"..name},rarity = 1,}}},
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
2013-10-18 22:05:21 +02:00
|
|
|
|
|
|
|
local r = "riesenpilz_"
|
|
|
|
local h = "head_"
|
|
|
|
local s = "stem_"
|
|
|
|
local rh = r..h
|
|
|
|
local rs = r..s
|
|
|
|
|
|
|
|
local GS = "Giant Mushroom "
|
|
|
|
local GSH = GS.."Head "
|
|
|
|
local GSS = GS.."Stem "
|
|
|
|
|
|
|
|
local pilznode_list = {
|
|
|
|
{"stem", GSS.."Beige", {rs.."top.png", rs.."top.png", "riesenpilz_stem.png"}, "stem"},
|
|
|
|
{s.."brown", GSS.."Brown", {rs.."top.png", rs.."top.png", rs.."brown.png"}, s.."brown"},
|
2013-11-10 11:06:24 +01:00
|
|
|
{s.."blue", GSS.."Blue", {rs.."top.png",rs.."top.png",rs.."blue.png"}, s.."blue"},
|
2013-10-18 22:05:21 +02:00
|
|
|
{"lamellas", "Giant Mushroom Lamella", {"riesenpilz_lamellas.png"}, "lamellas"},
|
|
|
|
{h.."red", GSH.."Red", {"riesenpilz_head.png", "riesenpilz_lamellas.png", "riesenpilz_head.png"}, "red"},
|
|
|
|
{h.."orange", GSH.."Orange", {rh.."orange.png"}, "lavashroom"},
|
|
|
|
{h.."yellow", GSH.."Yellow", {rh.."yellow.png"}, "lavashroom"},
|
|
|
|
{h.."brown", GSH.."Brown", {r.."brown_top.png", r.."lamellas.png", r.."brown_top.png"}, "brown"},
|
|
|
|
{h.."brown_full", GSH.."Full Brown", {r.."brown_top.png"},"brown"},
|
|
|
|
{h.."blue_bright", GSH.."Blue Bright", {rh.."blue_bright.png"},"glowshroom"},
|
|
|
|
{h.."blue", GSH.."Blue", {rh.."blue.png"},"glowshroom"},
|
2013-11-10 11:06:24 +01:00
|
|
|
{h.."white", GSH.."White", {rh.."white.png"},"parasol"},
|
|
|
|
{h.."binge", GSH.."Binge", {rh.."binge.png", rh.."white.png", rh.."binge.png"},"parasol"},
|
|
|
|
{h.."brown_bright", GSH.."Brown Bright", {rh.."brown_bright.png", rh.."white.png", rh.."brown_bright.png"},"parasol"},
|
2013-10-18 22:05:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
for _,i in ipairs(pilznode_list) do
|
|
|
|
pilznode(i[1], i[2], i[3], i[4])
|
|
|
|
end
|
|
|
|
|
2013-01-29 18:38:49 +01:00
|
|
|
|
2013-04-04 18:44:35 +02:00
|
|
|
minetest.register_node("riesenpilz:head_red_side", {
|
2013-01-29 18:38:49 +01:00
|
|
|
description = "Giant Mushroom Head Side",
|
2013-08-23 16:32:27 +02:00
|
|
|
tiles = {"riesenpilz_head.png", "riesenpilz_lamellas.png", "riesenpilz_head.png",
|
2013-04-04 18:44:35 +02:00
|
|
|
"riesenpilz_head.png", "riesenpilz_head.png", "riesenpilz_lamellas.png"},
|
2013-01-29 18:38:49 +01:00
|
|
|
paramtype2 = "facedir",
|
|
|
|
groups = {oddly_breakable_by_hand=3},
|
|
|
|
drop = {max_items = 1,
|
2013-04-04 18:44:35 +02:00
|
|
|
items = {{items = {"riesenpilz:fly_agaric"},rarity = 20,},
|
|
|
|
{items = {"riesenpilz:head_red"},rarity = 1,}}},
|
2013-01-29 18:38:49 +01:00
|
|
|
})
|
|
|
|
|
2013-04-24 20:53:20 +02:00
|
|
|
minetest.register_node("riesenpilz:ground", {
|
|
|
|
description = "Grass?",
|
2013-08-23 16:32:27 +02:00
|
|
|
tiles = {"riesenpilz_ground_top.png","default_dirt.png","default_dirt.png^riesenpilz_ground_side.png"},
|
2013-04-24 20:53:20 +02:00
|
|
|
groups = {crumbly=3},
|
|
|
|
sounds = default.node_sound_dirt_defaults(),
|
|
|
|
drop = 'default:dirt'
|
|
|
|
})
|
|
|
|
|
2013-01-29 18:38:49 +01:00
|
|
|
|
2013-08-23 16:32:27 +02:00
|
|
|
riesenpilz_c_air = minetest.get_content_id("air")
|
|
|
|
|
|
|
|
riesenpilz_c_stem = minetest.get_content_id("riesenpilz:stem")
|
|
|
|
riesenpilz_c_head_red = minetest.get_content_id("riesenpilz:head_red")
|
|
|
|
riesenpilz_c_lamellas = minetest.get_content_id("riesenpilz:lamellas")
|
|
|
|
|
|
|
|
riesenpilz_c_head_brown = minetest.get_content_id("riesenpilz:head_brown")
|
|
|
|
|
2014-04-03 20:17:18 +02:00
|
|
|
riesenpilz_c_head_red_side = minetest.get_content_id("riesenpilz:head_red_side")
|
|
|
|
|
2013-08-23 16:32:27 +02:00
|
|
|
riesenpilz_c_stem_brown = minetest.get_content_id("riesenpilz:stem_brown")
|
|
|
|
riesenpilz_c_head_brown_full = minetest.get_content_id("riesenpilz:head_brown_full")
|
|
|
|
riesenpilz_c_head_orange = minetest.get_content_id("riesenpilz:head_orange")
|
|
|
|
riesenpilz_c_head_yellow = minetest.get_content_id("riesenpilz:head_yellow")
|
|
|
|
|
|
|
|
riesenpilz_c_stem_blue = minetest.get_content_id("riesenpilz:stem_blue")
|
|
|
|
riesenpilz_c_head_blue = minetest.get_content_id("riesenpilz:head_blue")
|
|
|
|
riesenpilz_c_head_blue_bright = minetest.get_content_id("riesenpilz:head_blue_bright")
|
|
|
|
|
2013-11-10 11:06:24 +01:00
|
|
|
riesenpilz_c_head_white = minetest.get_content_id("riesenpilz:head_white")
|
|
|
|
riesenpilz_c_head_binge = minetest.get_content_id("riesenpilz:head_binge")
|
|
|
|
riesenpilz_c_head_brown_bright = minetest.get_content_id("riesenpilz:head_brown_bright")
|
|
|
|
|
2013-08-23 16:32:27 +02:00
|
|
|
riesenpilz_c_red = minetest.get_content_id("default:copperblock")
|
|
|
|
riesenpilz_c_brown = minetest.get_content_id("default:desert_stone")
|
|
|
|
riesenpilz_c_tree = minetest.get_content_id("default:tree")
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-04-04 18:44:35 +02:00
|
|
|
|
2013-01-29 18:38:49 +01:00
|
|
|
--Growing
|
|
|
|
|
|
|
|
|
2013-04-04 18:44:35 +02:00
|
|
|
minetest.register_tool("riesenpilz:growingtool", {
|
|
|
|
description = "Growingtool",
|
|
|
|
inventory_image = "riesenpilz_growingtool.png",
|
2013-01-29 18:38:49 +01:00
|
|
|
})
|
|
|
|
|
2013-04-04 18:44:35 +02:00
|
|
|
minetest.register_on_punchnode(function(pos, node, puncher)
|
|
|
|
if puncher:get_wielded_item():get_name() == "riesenpilz:growingtool" then
|
2013-08-23 16:32:27 +02:00
|
|
|
local name = node.name
|
|
|
|
if name == "riesenpilz:red" then
|
2013-04-24 20:53:20 +02:00
|
|
|
riesenpilz_hybridpilz(pos)
|
2013-08-23 16:32:27 +02:00
|
|
|
elseif name == "riesenpilz:fly_agaric" then
|
2013-04-24 20:53:20 +02:00
|
|
|
riesenpilz_minecraft_fliegenpilz(pos)
|
2013-08-23 16:32:27 +02:00
|
|
|
elseif name == "riesenpilz:brown" then
|
2013-04-24 20:53:20 +02:00
|
|
|
riesenpilz_brauner_minecraftpilz(pos)
|
2013-08-23 16:32:27 +02:00
|
|
|
elseif name == "riesenpilz:lavashroom" then
|
2013-04-25 20:34:00 +02:00
|
|
|
riesenpilz_lavashroom(pos)
|
2013-08-23 16:32:27 +02:00
|
|
|
elseif name == "riesenpilz:glowshroom" then
|
2013-05-01 18:00:02 +02:00
|
|
|
riesenpilz_glowshroom(pos)
|
2013-11-05 20:31:44 +01:00
|
|
|
elseif name == "riesenpilz:parasol" then
|
|
|
|
riesenpilz_parasol(pos)
|
2013-08-23 16:32:27 +02:00
|
|
|
elseif name == "default:apple" then
|
2013-05-10 20:08:50 +02:00
|
|
|
riesenpilz_apple(pos)
|
2013-04-04 18:44:35 +02:00
|
|
|
end
|
2013-01-29 18:38:49 +01:00
|
|
|
end
|
2013-04-04 18:44:35 +02:00
|
|
|
end)
|
2013-04-24 20:53:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
riesenpilz = {}
|
|
|
|
dofile(minetest.get_modpath("riesenpilz").."/settings.lua")
|
|
|
|
if riesenpilz.enable_mapgen then
|
|
|
|
dofile(minetest.get_modpath("riesenpilz") .. "/mapgen.lua")
|
|
|
|
end
|
|
|
|
|
2014-02-16 15:04:49 +01:00
|
|
|
print(string.format("[riesenpilz] loaded after ca. %.2fs", os.clock() - load_time_start))
|