add nether shroom

This commit is contained in:
HybridDog 2013-08-23 16:32:27 +02:00
parent 598f5a94c8
commit e7547e6652
5 changed files with 460 additions and 72 deletions

273
init.lua
View File

@ -1,135 +1,193 @@
---------------------------------------------------riesenpilz 12.12-------------------------------------------------- ---------------------------------------------------riesenpilz 12.12--------------------------------------------------
--Textures (edited with gimp) from gamiano.de and minecraft --Textures (edited with gimp) from gamiano.de
local MAX_SIZE = 3 local MAX_SIZE = 3
--Growing Functions --Growing Functions
function riesenpilz_hybridpilz(pos) function riesenpilz_hybridpilz(pos)
local t1 = os.clock()
local manip = minetest.get_voxel_manip()
local vwidth = MAX_SIZE + 1
local vheight = vwidth + 1
local emerged_pos1, emerged_pos2 = manip:read_from_map({x=pos.x-vwidth, y=pos.y, z=pos.z-vwidth},
{x=pos.x+vwidth, y=pos.y+vheight, z=pos.z+vwidth})
local area = VoxelArea:new({MinEdge=emerged_pos1, MaxEdge=emerged_pos2})
local nodes = manip:get_data()
local breite = math.random(MAX_SIZE) local breite = math.random(MAX_SIZE)
local br = breite+1 local br = breite+1
local height = breite+2 local height = breite+2
local head = "riesenpilz:head_red"
for i = 0, height, 1 do for i = 0, height, 1 do
minetest.env:add_node({x=pos.x, y=pos.y+i, z=pos.z}, {name="riesenpilz:stem"}) nodes[area:index(pos.x, pos.y+i, pos.z)] = riesenpilz_c_stem
end end
for l = -br+1, br, 1 do for l = -br+1, br, 1 do
for k = -1, 1, 2 do for k = -1, 1, 2 do
minetest.env:add_node({x=pos.x+br*k, y=pos.y+height, z=pos.z-l*k}, {name=head}) nodes[area:index(pos.x+br*k, pos.y+height, pos.z-l*k)] = riesenpilz_c_head_red
minetest.env:add_node({x=pos.x+l*k, y=pos.y+height, z=pos.z+br*k}, {name=head}) nodes[area:index(pos.x+l*k, pos.y+height, pos.z+br*k)] = riesenpilz_c_head_red
end end
end end
for k = -breite, breite, 1 do for k = -breite, breite, 1 do
for l = -breite, breite, 1 do for l = -breite, breite, 1 do
minetest.env:add_node({x=pos.x+l, y=pos.y+height+1, z=pos.z+k}, {name=head}) nodes[area:index(pos.x+l, pos.y+height+1, pos.z+k)] = riesenpilz_c_head_red
minetest.env:add_node({x=pos.x+l, y=pos.y+height, z=pos.z+k}, {name="riesenpilz:lamellas"}) nodes[area:index(pos.x+l, pos.y+height, pos.z+k)] = riesenpilz_c_lamellas
end end
end end
manip:set_data(nodes)
manip:write_to_map()
print(string.format("[riesenpilz] a red mushroom grew at ("..pos.x.."|"..pos.y.."|"..pos.z..") in: %.2fs", os.clock() - t1))
manip:update_map()
end end
function riesenpilz_brauner_minecraftpilz(pos) function riesenpilz_brauner_minecraftpilz(pos)
local head = "riesenpilz:head_brown"
local t1 = os.clock()
local manip = minetest.get_voxel_manip()
local vwidth = MAX_SIZE + 1
local vheight = vwidth + 1
local emerged_pos1, emerged_pos2 = manip:read_from_map({x=pos.x-vwidth, y=pos.y, z=pos.z-vwidth},
{x=pos.x+vwidth, y=pos.y+vheight, z=pos.z+vwidth})
local area = VoxelArea:new({MinEdge=emerged_pos1, MaxEdge=emerged_pos2})
local nodes = manip:get_data()
local random = math.random(MAX_SIZE-1) local random = math.random(MAX_SIZE-1)
local br = random+1 local br = random+1
local breite = br+1 local breite = br+1
local height = br+2 local height = br+2
for i = 0, height, 1 do for i = 0, height, 1 do
minetest.env:add_node({x=pos.x, y=pos.y+i, z=pos.z}, {name="riesenpilz:stem"}) nodes[area:index(pos.x, pos.y+i, pos.z)] = riesenpilz_c_stem
end end
for l = -br, br, 1 do for l = -br, br, 1 do
for k = -breite, breite, breite*2 do for k = -breite, breite, breite*2 do
minetest.env:add_node({x=pos.x+k, y=pos.y+height+1, z=pos.z+l}, {name=head}) nodes[area:index(pos.x+k, pos.y+height+1, pos.z+l)] = riesenpilz_c_head_brown
minetest.env:add_node({x=pos.x+l, y=pos.y+height+1, z=pos.z+k}, {name=head}) nodes[area:index(pos.x+l, pos.y+height+1, pos.z+k)] = riesenpilz_c_head_brown
end end
for k = -br, br, 1 do for k = -br, br, 1 do
minetest.env:add_node({x=pos.x+l, y=pos.y+height+1, z=pos.z+k}, {name=head}) nodes[area:index(pos.x+l, pos.y+height+1, pos.z+k)] = riesenpilz_c_head_brown
end end
end end
manip:set_data(nodes)
manip:write_to_map()
print(string.format("[riesenpilz] a brown mushroom grew at ("..pos.x.."|"..pos.y.."|"..pos.z..") in: %.2fs", os.clock() - t1))
manip:update_map()
end end
function riesenpilz_minecraft_fliegenpilz(pos) function riesenpilz_minecraft_fliegenpilz(pos)
local t1 = os.clock()
local manip = minetest.get_voxel_manip()
local vwidth = 1
local vheight = 4
local emerged_pos1, emerged_pos2 = manip:read_from_map({x=pos.x-vwidth, y=pos.y, z=pos.z-vwidth},
{x=pos.x+vwidth, y=pos.y+vheight, z=pos.z+vwidth})
local area = VoxelArea:new({MinEdge=emerged_pos1, MaxEdge=emerged_pos2})
local nodes = manip:get_data()
local height = 3 local height = 3
local tab = {}
local num = 1
for i = 0, height, 1 do for i = 0, height, 1 do
minetest.env:add_node({x=pos.x, y=pos.y+i, z=pos.z}, {name="riesenpilz:stem"}) nodes[area:index(pos.x, pos.y+i, pos.z)] = riesenpilz_c_stem
end end
for j = -1, 1, 1 do for j = -1, 1, 1 do
for k = -1, 1, 1 do for k = -1, 1, 1 do
minetest.env:add_node({x=pos.x+j, y=pos.y+height+1, z=pos.z+k}, {name="riesenpilz:head_red"}) nodes[area:index(pos.x+j, pos.y+height+1, pos.z+k)] = riesenpilz_c_head_red
end end
for l = 1, height, 1 do for l = 1, height, 1 do
minetest.env:set_node({x=pos.x+j, y=pos.y+l, z=pos.z+2}, {name="riesenpilz:head_red_side", param2=0}) tab[num] = {{x=pos.x+j, y=pos.y+l, z=pos.z+2}, {name="riesenpilz:head_red_side", param2=0}}
minetest.env:set_node({x=pos.x+j, y=pos.y+l, z=pos.z-2}, {name="riesenpilz:head_red_side", param2=2}) tab[num+1] = {{x=pos.x+j, y=pos.y+l, z=pos.z-2}, {name="riesenpilz:head_red_side", param2=2}}
minetest.env:set_node({x=pos.x+2, y=pos.y+l, z=pos.z+j}, {name="riesenpilz:head_red_side", param2=1}) tab[num+2] = {{x=pos.x+2, y=pos.y+l, z=pos.z+j}, {name="riesenpilz:head_red_side", param2=1}}
minetest.env:set_node({x=pos.x-2, y=pos.y+l, z=pos.z+j}, {name="riesenpilz:head_red_side", param2=3}) tab[num+3] = {{x=pos.x-2, y=pos.y+l, z=pos.z+j}, {name="riesenpilz:head_red_side", param2=3}}
num = num+4
end end
end end
manip:set_data(nodes)
manip:write_to_map()
manip:update_map()
for _,v in ipairs(tab) do
minetest.env:set_node(v[1], v[2])
end
print(string.format("[riesenpilz] a fly agaric grew at ("..pos.x.."|"..pos.y.."|"..pos.z..") in: %.2fs", os.clock() - t1))
end end
local function add_head_lavashroom(pos, ran) local function ran_node(a, b, ran)
local head = "riesenpilz:head_orange"
if math.random(ran) == 1 then if math.random(ran) == 1 then
head = "riesenpilz:head_yellow" return a
else
head = "riesenpilz:head_orange"
end end
minetest.env:add_node(pos, {name=head}) return b
end end
function riesenpilz_lavashroom(pos) function riesenpilz_lavashroom(pos)
local stem = "riesenpilz:stem_brown"
local brown = "riesenpilz:head_brown_full" local t1 = os.clock()
local manip = minetest.get_voxel_manip()
local vwidth = 4
local vheight = MAX_SIZE+7
local emerged_pos1, emerged_pos2 = manip:read_from_map({x=pos.x-vwidth, y=pos.y, z=pos.z-vwidth},
{x=pos.x+vwidth, y=pos.y+vheight, z=pos.z+vwidth})
local area = VoxelArea:new({MinEdge=emerged_pos1, MaxEdge=emerged_pos2})
local nodes = manip:get_data()
local height = 3+math.random(MAX_SIZE-2) local height = 3+math.random(MAX_SIZE-2)
minetest.env:remove_node(pos) nodes[area:index(pos.x, pos.y, pos.z)] = riesenpilz_c_air
for i = -1, 1, 2 do for i = -1, 1, 2 do
local o = 2*i local o = 2*i
for n = 0, height, 1 do for n = 0, height, 1 do
minetest.env:add_node({x=pos.x+i, y=pos.y+n, z=pos.z}, {name=stem}) nodes[area:index(pos.x+i, pos.y+n, pos.z)] = riesenpilz_c_stem_brown
minetest.env:add_node({x=pos.x, y=pos.y+n, z=pos.z+i}, {name=stem}) nodes[area:index(pos.x, pos.y+n, pos.z+i)] = riesenpilz_c_stem_brown
end end
for l = -1, 1, 1 do for l = -1, 1, 1 do
for k = 2, 3, 1 do for k = 2, 3, 1 do
minetest.env:add_node({x=pos.x+k*i, y=pos.y+height+2, z=pos.z+l}, {name=brown}) nodes[area:index(pos.x+k*i, pos.y+height+2, pos.z+l)] = riesenpilz_c_head_brown_full
minetest.env:add_node({x=pos.x+l, y=pos.y+height+2, z=pos.z+k*i}, {name=brown}) nodes[area:index(pos.x+l, pos.y+height+2, pos.z+k*i)] = riesenpilz_c_head_brown_full
end end
minetest.env:add_node({x=pos.x+l, y=pos.y+height+1, z=pos.z+o}, {name=brown}) nodes[area:index(pos.x+l, pos.y+height+1, pos.z+o)] = riesenpilz_c_head_brown_full
minetest.env:add_node({x=pos.x+o, y=pos.y+height+1, z=pos.z+l}, {name=brown}) nodes[area:index(pos.x+o, pos.y+height+1, pos.z+l)] = riesenpilz_c_head_brown_full
end end
for m = -1, 1, 2 do for m = -1, 1, 2 do
for k = 2, 3, 1 do for k = 2, 3, 1 do
for j = 2, 3, 1 do for j = 2, 3, 1 do
add_head_lavashroom({x=pos.x+j*i, y=pos.y+height+2, z=pos.z+k*m}, 7) 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)
end end
end end
minetest.env:add_node({x=pos.x+i, y=pos.y+height+1, z=pos.z+m}, {name=brown}) nodes[area:index(pos.x+i, pos.y+height+1, pos.z+m)] = riesenpilz_c_head_brown_full
minetest.env:add_node({x=pos.x+m*2, y=pos.y+height+1, z=pos.z+o}, {name=brown}) nodes[area:index(pos.x+m*2, pos.y+height+1, pos.z+o)] = riesenpilz_c_head_brown_full
end end
for l = -3+1, 3, 1 do for l = -3+1, 3, 1 do
add_head_lavashroom({x=pos.x+3*i, y=pos.y+height+5, z=pos.z-l*i}, 5) 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)
add_head_lavashroom({x=pos.x+l*i, y=pos.y+height+5, z=pos.z+3*i}, 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)
end end
for j = 0, 1, 1 do for j = 0, 1, 1 do
for l = -3, 3, 1 do for l = -3, 3, 1 do
add_head_lavashroom({x=pos.x+i*4, y=pos.y+height+3+j, z=pos.z+l}, 6) 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)
add_head_lavashroom({x=pos.x+l, y=pos.y+height+3+j, z=pos.z+i*4}, 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)
end end
end end
@ -137,34 +195,48 @@ function riesenpilz_lavashroom(pos)
for k = -2, 2, 1 do for k = -2, 2, 1 do
for l = -2, 2, 1 do for l = -2, 2, 1 do
add_head_lavashroom({x=pos.x+k, y=pos.y+height+6, z=pos.z+l}, 4) nodes[area:index(pos.x+k, pos.y+height+6, pos.z+l)] = ran_node(riesenpilz_c_head_yellow, riesenpilz_c_head_orange, 4)
end end
end end
manip:set_data(nodes)
manip:write_to_map()
print(string.format("[riesenpilz] a lavashroom grew at ("..pos.x.."|"..pos.y.."|"..pos.z..") in: %.2fs", os.clock() - t1))
manip:update_map()
end end
function riesenpilz_glowshroom(pos) function riesenpilz_glowshroom(pos)
local stem = "riesenpilz:stem_blue"
local head = "riesenpilz:head_blue" local t1 = os.clock()
local manip = minetest.get_voxel_manip()
local vwidth = 2
local vheight = 5+MAX_SIZE
local emerged_pos1, emerged_pos2 = manip:read_from_map({x=pos.x-vwidth, y=pos.y, z=pos.z-vwidth},
{x=pos.x+vwidth, y=pos.y+vheight, z=pos.z+vwidth})
local area = VoxelArea:new({MinEdge=emerged_pos1, MaxEdge=emerged_pos2})
local nodes = manip:get_data()
local height = 2+math.random(MAX_SIZE) local height = 2+math.random(MAX_SIZE)
local br = 2 local br = 2
for i = 0, height, 1 do for i = 0, height, 1 do
minetest.env:add_node({x=pos.x, y=pos.y+i, z=pos.z}, {name=stem}) nodes[area:index(pos.x, pos.y+i, pos.z)] = riesenpilz_c_stem_blue
end end
for i = -1, 1, 2 do for i = -1, 1, 2 do
for k = -br, br, 2*br do for k = -br, br, 2*br do
for l = 2, height, 1 do for l = 2, height, 1 do
minetest.env:add_node({x=pos.x+i*br, y=pos.y+l, z=pos.z+k}, {name=head}) nodes[area:index(pos.x+i*br, pos.y+l, pos.z+k)] = riesenpilz_c_head_blue
end end
minetest.env:add_node({x=pos.x+i*br, y=pos.y+1, z=pos.z+k}, {name="riesenpilz:head_blue_bright"}) nodes[area:index(pos.x+i*br, pos.y+1, pos.z+k)] = riesenpilz_c_head_blue_bright
end end
for l = -br+1, br, 1 do for l = -br+1, br, 1 do
minetest.env:add_node({x=pos.x+br*i, y=pos.y+height, z=pos.z-l*i}, {name=head}) nodes[area:index(pos.x+i*br, pos.y+height, pos.z-l*i)] = riesenpilz_c_head_blue
minetest.env:add_node({x=pos.x+l*i, y=pos.y+height, z=pos.z+br*i}, {name=head}) nodes[area:index(pos.x+l*i, pos.y+height, pos.z+br*i)] = riesenpilz_c_head_blue
end end
end end
@ -172,47 +244,66 @@ function riesenpilz_glowshroom(pos)
for l = 0, br, 1 do for l = 0, br, 1 do
for i = -br+l, br-l, 1 do for i = -br+l, br-l, 1 do
for k = -br+l, br-l, 1 do for k = -br+l, br-l, 1 do
minetest.env:add_node({x=pos.x+i, y=pos.y+height+1+l, z=pos.z+k}, {name=head}) nodes[area:index(pos.x+i, pos.y+height+1+l, pos.z+k)] = riesenpilz_c_head_blue
end end
end end
end end
manip:set_data(nodes)
manip:write_to_map()
print(string.format("[riesenpilz] a glowshroom grew at ("..pos.x.."|"..pos.y.."|"..pos.z..") in: %.2fs", os.clock() - t1))
manip:update_map()
end end
function riesenpilz_apple(pos) function riesenpilz_apple(pos)
local t1 = os.clock()
local manip = minetest.get_voxel_manip()
local vwidth = 5
local vheight = 14
local emerged_pos1, emerged_pos2 = manip:read_from_map({x=pos.x-vwidth, y=pos.y, z=pos.z-vwidth},
{x=pos.x+vwidth, y=pos.y+vheight, z=pos.z+vwidth})
local area = VoxelArea:new({MinEdge=emerged_pos1, MaxEdge=emerged_pos2})
local nodes = manip:get_data()
local size = 5 local size = 5
local a = size*2 local a = size*2
local b = size-1 local b = size-1
local red = "default:copperblock"
local brown = "default:desert_stone"
for l = -b, b, 1 do for l = -b, b, 1 do
for j = 1, a-1, 1 do for j = 1, a-1, 1 do
for k = -size, size, a do for k = -size, size, a do
minetest.env:add_node({x=pos.x+k, y=pos.y+j, z=pos.z+l}, {name=red}) nodes[area:index(pos.x+k, pos.y+j, pos.z+l)] = riesenpilz_c_red
minetest.env:add_node({x=pos.x+l, y=pos.y+j, z=pos.z+k}, {name=red}) nodes[area:index(pos.x+l, pos.y+j, pos.z+k)] = riesenpilz_c_red
end end
end end
for i = -b, b, 1 do for i = -b, b, 1 do
minetest.env:add_node({x=pos.x+i, y=pos.y, z=pos.z+l}, {name=red}) nodes[area:index(pos.x+i, pos.y, pos.z+l)] = riesenpilz_c_red
minetest.env:add_node({x=pos.x+i, y=pos.y+a, z=pos.z+l}, {name=red}) nodes[area:index(pos.x+i, pos.y+a, pos.z+l)] = riesenpilz_c_red
end end
end end
for i = a+1, a+b, 1 do for i = a+1, a+b, 1 do
minetest.env:add_node({x=pos.x, y=pos.y+i, z=pos.z}, {name="default:tree"}) nodes[area:index(pos.x, pos.y+i, pos.z)] = riesenpilz_c_tree
end end
local c = pos.y+1 local c = pos.y+1
for i = -3,1,1 do for i = -3,1,1 do
minetest.env:add_node({x=pos.x+i, y=c, z=pos.z+1}, {name=brown}) nodes[area:index(pos.x+i, c, pos.z+1)] = riesenpilz_c_brown
end end
for i = 0,1,1 do for i = 0,1,1 do
minetest.env:add_node({x=pos.x+1+i, y=c, z=pos.z-1-i}, {name=brown}) nodes[area:index(pos.x+i+1, c, pos.z-1-i)] = riesenpilz_c_brown
minetest.env:add_node({x=pos.x+2+i, y=c, z=pos.z-1-i}, {name=brown}) nodes[area:index(pos.x+i+2, c, pos.z-1-i)] = riesenpilz_c_brown
end end
minetest.env:add_node({x=pos.x+1, y=c, z=pos.z}, {name=brown}) nodes[area:index(pos.x+1, c, pos.z)] = riesenpilz_c_brown
minetest.env:add_node({x=pos.x-3, y=c+1, z=pos.z+1}, {name=brown}) nodes[area:index(pos.x-3, c+1, pos.z+1)] = riesenpilz_c_brown
manip:set_data(nodes)
manip:write_to_map()
print(string.format("[riesenpilz] an apple grew at ("..pos.x.."|"..pos.y.."|"..pos.z..") in: %.2fs", os.clock() - t1))
manip:update_map()
end end
@ -260,7 +351,7 @@ minetest.register_node(":default:apple", {
local function pilz(name, desc, box) local function pilz(name, desc, box)
minetest.register_node("riesenpilz:"..name, { minetest.register_node("riesenpilz:"..name, {
description = desc, description = desc,
tile_images = {"riesenpilz_"..name.."_top.png", "riesenpilz_"..name.."_bottom.png", "riesenpilz_"..name.."_side.png"}, tiles = {"riesenpilz_"..name.."_top.png", "riesenpilz_"..name.."_bottom.png", "riesenpilz_"..name.."_side.png"},
inventory_image = "riesenpilz_"..name.."_side.png", inventory_image = "riesenpilz_"..name.."_side.png",
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
@ -325,11 +416,25 @@ local BOX_GLOWSHROOM = {
}, },
} }
local BOX_NETHER_SHROOM = {
type = "fixed",
fixed = {
{-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},
{ 2/16, -1/16, -2/16, 4/16, 1/16, 2/16},
},
}
pilz("brown", "Brown Mushroom", BOX_BROWN) pilz("brown", "Brown Mushroom", BOX_BROWN)
pilz("red", "Red Mushroom", BOX_RED) pilz("red", "Red Mushroom", BOX_RED)
pilz("fly_agaric", "Fly Agaric", BOX_FLY_AGARIC) pilz("fly_agaric", "Fly Agaric", BOX_FLY_AGARIC)
pilz("lavashroom", "Lavashroom", BOX_LAVASHROOM) pilz("lavashroom", "Lavashroom", BOX_LAVASHROOM)
pilz("glowshroom", "Glowshroom", BOX_GLOWSHROOM) pilz("glowshroom", "Glowshroom", BOX_GLOWSHROOM)
pilz("nether_shroom", "Nether Mushroom", BOX_NETHER_SHROOM)
@ -339,7 +444,7 @@ pilz("glowshroom", "Glowshroom", BOX_GLOWSHROOM)
local function pilznode(name, desc, textures, sapling) local function pilznode(name, desc, textures, sapling)
minetest.register_node("riesenpilz:"..name, { minetest.register_node("riesenpilz:"..name, {
description = desc, description = desc,
tile_images = textures, tiles = textures,
groups = {oddly_breakable_by_hand=3}, groups = {oddly_breakable_by_hand=3},
drop = {max_items = 1, drop = {max_items = 1,
items = {{items = {"riesenpilz:"..sapling},rarity = 20,}, items = {{items = {"riesenpilz:"..sapling},rarity = 20,},
@ -364,7 +469,7 @@ pilznode("stem_blue", "Giant Mushroom Stem Blue",
minetest.register_node("riesenpilz:head_red_side", { minetest.register_node("riesenpilz:head_red_side", {
description = "Giant Mushroom Head Side", description = "Giant Mushroom Head Side",
tile_images = {"riesenpilz_head.png", "riesenpilz_lamellas.png", "riesenpilz_head.png", tiles = {"riesenpilz_head.png", "riesenpilz_lamellas.png", "riesenpilz_head.png",
"riesenpilz_head.png", "riesenpilz_head.png", "riesenpilz_lamellas.png"}, "riesenpilz_head.png", "riesenpilz_head.png", "riesenpilz_lamellas.png"},
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {oddly_breakable_by_hand=3}, groups = {oddly_breakable_by_hand=3},
@ -375,13 +480,36 @@ minetest.register_node("riesenpilz:head_red_side", {
minetest.register_node("riesenpilz:ground", { minetest.register_node("riesenpilz:ground", {
description = "Grass?", description = "Grass?",
tile_images = {"riesenpilz_ground_top.png","default_dirt.png","default_dirt.png^riesenpilz_ground_side.png"}, tiles = {"riesenpilz_ground_top.png","default_dirt.png","default_dirt.png^riesenpilz_ground_side.png"},
groups = {crumbly=3}, groups = {crumbly=3},
sounds = default.node_sound_dirt_defaults(), sounds = default.node_sound_dirt_defaults(),
drop = 'default:dirt' drop = 'default:dirt'
}) })
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")
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")
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")
--Growing --Growing
@ -393,17 +521,18 @@ minetest.register_tool("riesenpilz:growingtool", {
minetest.register_on_punchnode(function(pos, node, puncher) minetest.register_on_punchnode(function(pos, node, puncher)
if puncher:get_wielded_item():get_name() == "riesenpilz:growingtool" then if puncher:get_wielded_item():get_name() == "riesenpilz:growingtool" then
if minetest.env:get_node(pos).name == "riesenpilz:red" then local name = node.name
if name == "riesenpilz:red" then
riesenpilz_hybridpilz(pos) riesenpilz_hybridpilz(pos)
elseif minetest.env:get_node(pos).name == "riesenpilz:fly_agaric" then elseif name == "riesenpilz:fly_agaric" then
riesenpilz_minecraft_fliegenpilz(pos) riesenpilz_minecraft_fliegenpilz(pos)
elseif minetest.env:get_node(pos).name == "riesenpilz:brown" then elseif name == "riesenpilz:brown" then
riesenpilz_brauner_minecraftpilz(pos) riesenpilz_brauner_minecraftpilz(pos)
elseif minetest.env:get_node(pos).name == "riesenpilz:lavashroom" then elseif name == "riesenpilz:lavashroom" then
riesenpilz_lavashroom(pos) riesenpilz_lavashroom(pos)
elseif minetest.env:get_node(pos).name == "riesenpilz:glowshroom" then elseif name == "riesenpilz:glowshroom" then
riesenpilz_glowshroom(pos) riesenpilz_glowshroom(pos)
elseif minetest.env:get_node(pos).name == "default:apple" then elseif name == "default:apple" then
riesenpilz_apple(pos) riesenpilz_apple(pos)
end end
end end

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 B

259
under_construction.lua Normal file
View File

@ -0,0 +1,259 @@
--[[
function riesenpilz_circle(nam, pos, radius, rand, seed)
local ra = seed
for i = -radius, radius, 1 do
for j = -radius, radius, 1 do
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"
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})
end
ra = ra+1
end
end
end
end
elseif pr:next(1,80) == 1 then
riesenpilz_circle("riesenpilz:brown", boden, pr:next(2,3), 3, seed)
elseif pr:next(1,90) == 1 then
riesenpilz_circle("riesenpilz:red", boden, pr:next(3,4), 3, seed)
elseif pr:next(1,100) == 1 then
riesenpilz_circle("riesenpilz:fly_agaric", boden, 3, 3, seed)
elseif pr:next(1,4000) == 1 then
riesenpilz_circle("riesenpilz:lavashroom", boden, pr:next(4,5), 3, seed)
elseif pr:next(1,5000) == 1 then
riesenpilz_circle("riesenpilz:glowshroom", boden, 2, 3, seed)
]]
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 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})
end
end
end
end
local function find_grond(a,list)
for _,nam in ipairs(list) do
if a == nam then
return true
end
end
return false
end
local c_air = minetest.get_content_id("air")
local c_stone = minetest.get_content_id("default:stone")
local c_gr = minetest.get_content_id("default:dirt_with_grass")
local c_dirt = minetest.get_content_id("default:dirt")
local c_sand = minetest.get_content_id("default:sand")
local c_desert_sand = minetest.get_content_id("default:desert_sand")
local c_tree = minetest.get_content_id("default:tree")
local c_leaves = minetest.get_content_id("default:leaves")
local c_apple = minetest.get_content_id("default:apple")
local c_cactus = minetest.get_content_id("default:cactus")
local c_papyrus = minetest.get_content_id("default:papyrus")
local c_dry_shrub = minetest.get_content_id("default:dry_shrub")
local GROUND = {c_gr, c_sand, c_dirt, c_desert_sand}
--local USUAL_STUFF = {"default:leaves","default:apple","default:tree","default:cactus","default:papyrus"}
minetest.register_on_generated(function(minp, maxp, seed)
if minp.y <= -10 then
return
end
local x0,z0,x1,z1 = minp.x,minp.z,maxp.x,maxp.z -- Assume X and Z lengths are equal
local env = minetest.env --Should make things a bit faster.
local perlin1 = env:get_perlin(11,3, 0.5, 200) --Get map specific perlin
--[[if not (perlin1:get2d({x=x0, y=z0}) > 0.53) and not (perlin1:get2d({x=x1, y=z1}) > 0.53)
and not (perlin1:get2d({x=x0, y=z1}) > 0.53) and not (perlin1:get2d({x=x1, y=z0}) > 0.53)
and not (perlin1:get2d({x=(x1-x0)/2, y=(z1-z0)/2}) > 0.53) then]]
if not ( perlin1:get2d( {x=x0, y=z0} ) > 0.53 ) --top left
and not ( perlin1:get2d( { x = x0 + ( (x1-x0)/2), y=z0 } ) > 0.53 )--top middle
and not (perlin1:get2d({x=x1, y=z1}) > 0.53) --bottom right
and not (perlin1:get2d({x=x1, y=z0+((z1-z0)/2)}) > 0.53) --right middle
and not (perlin1:get2d({x=x0, y=z1}) > 0.53) --bottom left
and not (perlin1:get2d({x=x1, y=z0}) > 0.53) --top right
and not (perlin1:get2d({x=x0+((x1-x0)/2), y=z1}) > 0.53) --left middle
and not (perlin1:get2d({x=(x1-x0)/2, y=(z1-z0)/2}) > 0.53) --middle
and not (perlin1:get2d({x=x0, y=z1+((z1-z0)/2)}) > 0.53) then --bottom middle
print("[riesenpilz] abort")
return
end
local divs = (maxp.x-minp.x);
local pr = PseudoRandom(seed+68)
if riesenpilz.info then
local geninfo = "[riesenpilz] tries to generate a mushroom biome at: x=["..minp.x.."; "..maxp.x.."]; y=["..minp.y.."; "..maxp.y.."]; z=["..minp.z.."; "..maxp.z.."]"
print(geninfo)
minetest.chat_send_all(geninfo)
end
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local data = vm:get_data()
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
for p_pos in area:iterp(minp, maxp) do --remove tree stuff
local d_p_pos = data[p_pos]
for _,nam in ipairs({c_tree, c_leaves, c_apple}) do
if d_p_pos == nam then
data[p_pos] = c_air
break
end
end
end
--[[remove usual stuff
local trees = env:find_nodes_in_area(minp, maxp, USUAL_STUFF)
for i,v in pairs(trees) do
env:remove_node(v)
end]]
local smooth = riesenpilz.smooth
for j=0,divs do
for i=0,divs do
local x,z = x0+i,z0+j
--Check if we are in a "riesenpilz biome"
local in_biome = false
local test = perlin1:get2d({x=x, y=z})
--smooth mapgen
if smooth and (test > 0.73 or (test > 0.43 and pr:next(0,29) > (0.73 - test) * 100 )) then
in_biome = true
elseif (not smooth) and test > 0.53 then
in_biome = true
end
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_cactus, c_papyrus}) 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,-5,-1 do --because of the caves
if find_grond(data[area:index(x, y, z)], 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_rp_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
data[p_pos] = c_dirt
else
break
end
end
local boden = {x=x,y=ground_y+1,z=z}
if pr:next(1,15) == 1 then
data[p_boden] = c_dry_shrub
env:add_node(boden, {name="default:dry_shrub"})
elseif pr:next(1,80) == 1 then
riesenpilz_circle("riesenpilz:brown", boden, pr:next(3,4), 3)
elseif pr:next(1,90) == 1 then
riesenpilz_circle("riesenpilz:red", boden, pr:next(4,5), 3)
elseif pr:next(1,100) == 1 then
riesenpilz_circle("riesenpilz:fly_agaric", boden, 4, 3)
elseif pr:next(1,4000) == 1 then
riesenpilz_circle("riesenpilz:lavashroom", boden, pr:next(5,6), 3)
elseif pr:next(1,5000) == 1 then
riesenpilz_circle("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
riesenpilz_hybridpilz(boden)
elseif pr:next(1,340) == 10 then
riesenpilz_brauner_minecraftpilz(boden)
elseif pr:next(1,390) == 20 then
riesenpilz_minecraft_fliegenpilz(boden)
elseif pr:next(1,6000) == 2 and pr:next(1,200) == 15 then
riesenpilz_lavashroom(boden)
end
end
end
end
end
vm:set_data(data)
--vm:set_lighting({day=0, night=0})
vm:calc_lighting()
vm:update_liquids()
vm:write_to_map()
end)
--[[ if maxp.y < -10 then
local x0,z0,x1,z1 = minp.x,minp.z,maxp.x,maxp.z -- Assume X and Z lengths are equal
local env = minetest.env --Should make things a bit faster.
local perlin1 = env:get_perlin(11,3, 0.5, 200) --Get map specific perlin
--[if not (perlin1:get2d({x=x0, y=z0}) > 0.53) and not (perlin1:get2d({x=x1, y=z1}) > 0.53)
and not (perlin1:get2d({x=x0, y=z1}) > 0.53) and not (perlin1:get2d({x=x1, y=z0}) > 0.53)
and not (perlin1:get2d({x=(x1-x0)/2, y=(z1-z0)/2}) > 0.53) then]
if not ( perlin1:get2d( {x=x0, y=z0} ) > 0.53 ) --top left
and not ( perlin1:get2d( { x = x0 + ( (x1-x0)/2), y=z0 } ) > 0.53 )--top middle
and not (perlin1:get2d({x=x1, y=z1}) > 0.53) --bottom right
and not (perlin1:get2d({x=x1, y=z0+((z1-z0)/2)}) > 0.53) --right middle
and not (perlin1:get2d({x=x0, y=z1}) > 0.53) --bottom left
and not (perlin1:get2d({x=x1, y=z0}) > 0.53) --top right
and not (perlin1:get2d({x=x0+((x1-x0)/2), y=z1}) > 0.53) --left middle
and not (perlin1:get2d({x=(x1-x0)/2, y=(z1-z0)/2}) > 0.53) --middle
and not (perlin1:get2d({x=x0, y=z1+((z1-z0)/2)}) > 0.53) then --bottom middle
print("abortsumpf")
return
end
local divs = (maxp.x-minp.x);
local pr = PseudoRandom(seed+68)
for j=0,divs do
for i=0,divs do
local x,z = x0+i,z0+j
for y=minp.y,maxp.y,1 do
local pos = {x=x, y=y, z=z}
if env:get_node(pos).name == "air"
and env:get_node({x=x, y=y-1, z=z}).name == "default:stone"
and pr:next(1,40) == 33
and env:find_node_near(pos, 4, "group:igniter")
and not env:find_node_near(pos, 3, "group:igniter") then
env:add_node(pos, {name="riesenpilz:lavashroom"})
end
end
end
end
end
end)]]