initial commit
subgame + mods
4
mods/riesenpilz/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
## Generic ignorable patterns and files
|
||||
*~
|
||||
.*.swp
|
||||
debug.txt
|
10
mods/riesenpilz/README.txt
Normal file
@ -0,0 +1,10 @@
|
||||
------Mushrooms------
|
||||
— riesenpilz_stem.png (edited with gimp) from gamiano.de
|
||||
— glowshroom and lavashroom from bas080's plants mod (WTFPL)
|
||||
— parasol mushroom from a mod called mushrooms (WTFPL)
|
||||
— "45" mushrooms from r01922090's mush45 mod (WTFPL)
|
||||
|
||||
TODO:
|
||||
— add giant nethershroom
|
||||
— finish supporting the mushrooms mod
|
||||
— generate mushrooms not only in mushroom biomes
|
2
mods/riesenpilz/depends.txt
Normal file
@ -0,0 +1,2 @@
|
||||
default
|
||||
|
19
mods/riesenpilz/functions.lua
Normal file
@ -0,0 +1,19 @@
|
||||
if riesenpilz.info then
|
||||
function riesenpilz.inform(msg, spam, t)
|
||||
if spam <= riesenpilz.max_spam then
|
||||
local info
|
||||
if t then
|
||||
info = string.format("[riesenpilz] "..msg.." after ca. %.2fs", os.clock() - t)
|
||||
else
|
||||
info = "[riesenpilz] "..msg
|
||||
end
|
||||
print(info)
|
||||
if riesenpilz.inform_all then
|
||||
minetest.chat_send_all(info)
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
function riesenpilz.inform()
|
||||
end
|
||||
end
|
614
mods/riesenpilz/init.lua
Normal file
@ -0,0 +1,614 @@
|
||||
local load_time_start = os.clock()
|
||||
local MAX_SIZE = 3
|
||||
|
||||
riesenpilz = {}
|
||||
dofile(minetest.get_modpath("riesenpilz").."/settings.lua")
|
||||
dofile(minetest.get_modpath("riesenpilz").."/functions.lua")
|
||||
|
||||
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()
|
||||
riesenpilz.inform("a "..name.." mushroom grew at ("..pos.x.."|"..pos.y.."|"..pos.z..")", 3, t1)
|
||||
local t1 = os.clock()
|
||||
manip:update_map()
|
||||
riesenpilz.inform("map updated", 3, t1)
|
||||
end
|
||||
|
||||
--Growing Functions
|
||||
|
||||
local c
|
||||
|
||||
function riesenpilz_hybridpilz(pos)
|
||||
|
||||
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, 1 do
|
||||
nodes[area:index(pos.x, pos.y+i, pos.z)] = c.stem
|
||||
end
|
||||
|
||||
for l = -br+1, br, 1 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
|
||||
end
|
||||
end
|
||||
|
||||
for k = -breite, breite, 1 do
|
||||
for l = -breite, breite, 1 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
|
||||
end
|
||||
end
|
||||
|
||||
set_vm_data(manip, nodes, pos, t1, "red")
|
||||
end
|
||||
|
||||
|
||||
function riesenpilz_brauner_minecraftpilz(pos)
|
||||
|
||||
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
|
||||
nodes[i] = c.stem
|
||||
end
|
||||
|
||||
for l = -br, br, 1 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
|
||||
end
|
||||
for k = -br, br, 1 do
|
||||
nodes[area:index(pos.x+l, pos.y+height+1, pos.z+k)] = c.head_brown
|
||||
end
|
||||
end
|
||||
|
||||
set_vm_data(manip, nodes, pos, t1, "brown")
|
||||
end
|
||||
|
||||
|
||||
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()
|
||||
|
||||
local height = 3
|
||||
|
||||
for i = 0, height, 1 do
|
||||
nodes[area:index(pos.x, pos.y+i, pos.z)] = c.stem
|
||||
end
|
||||
|
||||
for j = -1, 1, 1 do
|
||||
for k = -1, 1, 1 do
|
||||
nodes[area:index(pos.x+j, pos.y+height+1, pos.z+k)] = c.head_red
|
||||
end
|
||||
for l = 1, height, 1 do
|
||||
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] = c.head_red_side
|
||||
param2s[tmp] = p[2]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
manip:set_data(nodes)
|
||||
manip:set_param2_data(param2s)
|
||||
manip:write_to_map()
|
||||
manip:update_map()
|
||||
riesenpilz.inform("a fly agaric grew at ("..pos.x.."|"..pos.y.."|"..pos.z..")", 3, t1)
|
||||
end
|
||||
|
||||
|
||||
local function ran_node(a, b, ran)
|
||||
if math.random(ran) == 1 then
|
||||
return a
|
||||
end
|
||||
return b
|
||||
end
|
||||
|
||||
function riesenpilz_lavashroom(pos)
|
||||
|
||||
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
|
||||
|
||||
for i = -1, 1, 2 do
|
||||
local o = 2*i
|
||||
|
||||
for n = 0, height, 1 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
|
||||
|
||||
for l = -1, 1, 1 do
|
||||
for k = 2, 3, 1 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
|
||||
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
|
||||
end
|
||||
|
||||
for m = -1, 1, 2 do
|
||||
for k = 2, 3, 1 do
|
||||
for j = 2, 3, 1 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)
|
||||
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
|
||||
end
|
||||
|
||||
for l = -3+1, 3, 1 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)
|
||||
end
|
||||
|
||||
for j = 0, 1, 1 do
|
||||
for l = -3, 3, 1 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)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
for k = -2, 2, 1 do
|
||||
for l = -2, 2, 1 do
|
||||
nodes[area:index(pos.x+k, pos.y+height+6, pos.z+l)] = ran_node(c.head_yellow, c.head_orange, 4)
|
||||
end
|
||||
end
|
||||
|
||||
set_vm_data(manip, nodes, pos, t1, "lavashroom")
|
||||
end
|
||||
|
||||
|
||||
function riesenpilz_glowshroom(pos)
|
||||
|
||||
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, 1 do
|
||||
nodes[area:index(pos.x, pos.y+i, pos.z)] = c.stem_blue
|
||||
end
|
||||
|
||||
for i = -1, 1, 2 do
|
||||
|
||||
for k = -br, br, 2*br do
|
||||
for l = 2, height, 1 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, 1 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
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
for l = 0, br, 1 do
|
||||
for i = -br+l, br-l, 1 do
|
||||
for k = -br+l, br-l, 1 do
|
||||
nodes[area:index(pos.x+i, pos.y+height+1+l, pos.z+k)] = c.head_blue
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
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)
|
||||
|
||||
--stem
|
||||
for i in area:iterp(pos, {x=pos.x, y=pos.y+height-2, z=pos.z}) do
|
||||
nodes[i] = c.stem
|
||||
end
|
||||
|
||||
for _,j in ipairs({
|
||||
{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
|
||||
nodes[i] = j[3]
|
||||
end
|
||||
end
|
||||
|
||||
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
|
||||
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
|
||||
end
|
||||
end
|
||||
|
||||
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()
|
||||
|
||||
local size = 5
|
||||
local a = size*2
|
||||
local b = size-1
|
||||
|
||||
for l = -b, b, 1 do
|
||||
for j = 1, a-1, 1 do
|
||||
for k = -size, size, a do
|
||||
nodes[area:index(pos.x+k, pos.y+j, pos.z+l)] = c.red
|
||||
nodes[area:index(pos.x+l, pos.y+j, pos.z+k)] = c.red
|
||||
end
|
||||
end
|
||||
for i = -b, b, 1 do
|
||||
nodes[area:index(pos.x+i, pos.y, pos.z+l)] = c.red
|
||||
nodes[area:index(pos.x+i, pos.y+a, pos.z+l)] = c.red
|
||||
end
|
||||
end
|
||||
|
||||
for i = a+1, a+b, 1 do
|
||||
nodes[area:index(pos.x, pos.y+i, pos.z)] = c.tree
|
||||
end
|
||||
|
||||
local c = pos.y+1
|
||||
for i = -3,1,1 do
|
||||
nodes[area:index(pos.x+i, c, pos.z+1)] = c.brown
|
||||
end
|
||||
for i = 0,1,1 do
|
||||
nodes[area:index(pos.x+i+1, c, pos.z-1-i)] = c.brown
|
||||
nodes[area:index(pos.x+i+2, c, pos.z-1-i)] = c.brown
|
||||
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
|
||||
|
||||
manip:set_data(nodes)
|
||||
manip:write_to_map()
|
||||
riesenpilz.inform("an apple grew at ("..pos.x.."|"..pos.y.."|"..pos.z..")", 3, t1)
|
||||
manip:update_map()
|
||||
end
|
||||
|
||||
|
||||
|
||||
--3D apple [3apple]
|
||||
|
||||
|
||||
local tmp = minetest.registered_nodes["default:apple"]
|
||||
minetest.register_node(":default:apple", {
|
||||
description = tmp.description,
|
||||
drawtype = "nodebox",
|
||||
visual_scale = tmp.visual_scale,
|
||||
tiles = {"3apple_apple_top.png","3apple_apple_bottom.png","3apple_apple.png"},
|
||||
inventory_image = tmp.inventory_image,
|
||||
sunlight_propagates = tmp.sunlight_propagates,
|
||||
walkable = tmp.walkable,
|
||||
paramtype = tmp.paramtype,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-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},
|
||||
}
|
||||
},
|
||||
groups = tmp.groups,
|
||||
on_use = tmp.on_use,
|
||||
sounds = tmp.sounds,
|
||||
after_place_node = tmp.after_place_node,
|
||||
})
|
||||
|
||||
|
||||
|
||||
--Mushroom Nodes
|
||||
|
||||
|
||||
local function pilz(name, desc, b, burntime)
|
||||
burntime = burntime or 1
|
||||
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,
|
||||
furnace_burntime = burntime
|
||||
})
|
||||
end
|
||||
|
||||
local BOX = {
|
||||
RED = {
|
||||
{-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},
|
||||
{-2/16, -3/16, -2/16, 2/16, -2/16, 2/16}
|
||||
},
|
||||
BROWN = {
|
||||
{-0.15, -0.2, -0.15, 0.15, -0.1, 0.15},
|
||||
{-0.2, -0.3, -0.2, 0.2, -0.2, 0.2},
|
||||
{-0.05, -0.5, -0.05, 0.05, -0.3, 0.05}
|
||||
},
|
||||
FLY_AGARIC = {
|
||||
{-0.05, -0.5, -0.05, 0.05, 1/20, 0.05},
|
||||
{-3/20, -6/20, -3/20, 3/20, 0, 3/20},
|
||||
{-4/20, -2/20, -4/20, 4/20, -4/20, 4/20}
|
||||
},
|
||||
LAVASHROOM = {
|
||||
{-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},
|
||||
{-4/16, -4/16, -4/16, 4/16, -2/16, 4/16}
|
||||
},
|
||||
GLOWSHROOM = {
|
||||
{-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},
|
||||
{3/16, -7/16, 3/16, 2/16, -5/16, 2/16}
|
||||
},
|
||||
NETHER_SHROOM = {
|
||||
{-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}
|
||||
},
|
||||
PARASOL = {
|
||||
{-1/16, -8/16, -1/16, 1/16, 0, 1/16},
|
||||
{-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},
|
||||
{-3/16, -2/16, -3/16, 3/16, -1/16, 3/16}
|
||||
},
|
||||
RED45 = {
|
||||
{-1/16, -0.5, -1/16, 1/16, 1/8, 1/16},
|
||||
{-3/16, 1/8, -3/16, 3/16, 1/4, 3/16},
|
||||
{-5/16, -1/4, -5/16, -1/16, 1/8, -1/16},
|
||||
{1/16, -1/4, -5/16, 5/16, 1/8, -1/16},
|
||||
{-5/16, -1/4, 1/16, -1/16, 1/8, 5/16},
|
||||
{1/16, -1/4, 1/16, 5/16, 1/8, 5/16}
|
||||
},
|
||||
BROWN45 = {
|
||||
{-1/16, -0.5, -1/16, 1/16, 1/16, 1/16},
|
||||
{-3/8, 1/8, -7/16, 3/8, 1/4, 7/16},
|
||||
{-7/16, 1/8, -3/8, 7/16, 1/4, 3/8},
|
||||
{-3/8, 1/4, -3/8, 3/8, 5/16, 3/8},
|
||||
{-3/8, 1/16, -3/8, 3/8, 1/8, 3/8}
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
local mushrooms_list = {
|
||||
{"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, 6},
|
||||
{"parasol", "Parasol Mushroom", BOX.PARASOL},
|
||||
{"red45", "45 Brown Mushroom", BOX.RED45},
|
||||
{"brown45", "45 Red Mushroom", BOX.BROWN45},
|
||||
}
|
||||
|
||||
for _,i in ipairs(mushrooms_list) do
|
||||
pilz(i[1], i[2], i[3], i[4])
|
||||
end
|
||||
|
||||
|
||||
|
||||
--Mushroom Blocks
|
||||
|
||||
|
||||
local function pilznode(name, desc, textures, sapling)
|
||||
minetest.register_node("riesenpilz:"..name, {
|
||||
description = desc,
|
||||
tiles = textures,
|
||||
groups = {oddly_breakable_by_hand=3},
|
||||
drop = {max_items = 1,
|
||||
items = {{items = {"riesenpilz:"..sapling},rarity = 20,},
|
||||
{items = {"riesenpilz:"..name},rarity = 1,}}},
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
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"},
|
||||
{s.."blue", GSS.."Blue", {rs.."top.png",rs.."top.png",rs.."blue.png"}, s.."blue"},
|
||||
{"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"},
|
||||
{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"},
|
||||
}
|
||||
|
||||
for _,i in ipairs(pilznode_list) do
|
||||
pilznode(i[1], i[2], i[3], i[4])
|
||||
end
|
||||
|
||||
|
||||
minetest.register_node("riesenpilz:head_red_side", {
|
||||
description = "Giant Mushroom Head 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},
|
||||
drop = {max_items = 1,
|
||||
items = {{items = {"riesenpilz:fly_agaric"},rarity = 20,},
|
||||
{items = {"riesenpilz:head_red"},rarity = 1,}}},
|
||||
})
|
||||
|
||||
minetest.register_node("riesenpilz:ground", {
|
||||
description = "Grass?",
|
||||
tiles = {"riesenpilz_ground_top.png","default_dirt.png","default_dirt.png^riesenpilz_ground_side.png"},
|
||||
groups = {crumbly=3},
|
||||
sounds = default.node_sound_dirt_defaults(),
|
||||
drop = 'default:dirt'
|
||||
})
|
||||
|
||||
|
||||
c = {
|
||||
air = minetest.get_content_id("air"),
|
||||
|
||||
stem = minetest.get_content_id("riesenpilz:stem"),
|
||||
head_red = minetest.get_content_id("riesenpilz:head_red"),
|
||||
lamellas = minetest.get_content_id("riesenpilz:lamellas"),
|
||||
|
||||
head_brown = minetest.get_content_id("riesenpilz:head_brown"),
|
||||
|
||||
head_red_side = minetest.get_content_id("riesenpilz:head_red_side"),
|
||||
|
||||
stem_brown = minetest.get_content_id("riesenpilz:stem_brown"),
|
||||
head_brown_full = minetest.get_content_id("riesenpilz:head_brown_full"),
|
||||
head_orange = minetest.get_content_id("riesenpilz:head_orange"),
|
||||
head_yellow = minetest.get_content_id("riesenpilz:head_yellow"),
|
||||
|
||||
stem_blue = minetest.get_content_id("riesenpilz:stem_blue"),
|
||||
head_blue = minetest.get_content_id("riesenpilz:head_blue"),
|
||||
head_blue_bright = minetest.get_content_id("riesenpilz:head_blue_bright"),
|
||||
|
||||
head_white = minetest.get_content_id("riesenpilz:head_white"),
|
||||
head_binge = minetest.get_content_id("riesenpilz:head_binge"),
|
||||
head_brown_bright = minetest.get_content_id("riesenpilz:head_brown_bright"),
|
||||
|
||||
red = minetest.get_content_id("default:copperblock"),
|
||||
brown = minetest.get_content_id("default:desert_stone"),
|
||||
tree = minetest.get_content_id("default:tree"),
|
||||
}
|
||||
|
||||
|
||||
|
||||
--Growing
|
||||
|
||||
|
||||
minetest.register_tool("riesenpilz:growingtool", {
|
||||
description = "Growingtool",
|
||||
inventory_image = "riesenpilz_growingtool.png",
|
||||
})
|
||||
|
||||
minetest.register_on_punchnode(function(pos, node, puncher)
|
||||
if puncher:get_wielded_item():get_name() == "riesenpilz:growingtool" then
|
||||
local name = node.name
|
||||
if name == "riesenpilz:red" then
|
||||
riesenpilz_hybridpilz(pos)
|
||||
elseif name == "riesenpilz:fly_agaric" then
|
||||
riesenpilz_minecraft_fliegenpilz(pos)
|
||||
elseif name == "riesenpilz:brown" then
|
||||
riesenpilz_brauner_minecraftpilz(pos)
|
||||
elseif name == "riesenpilz:lavashroom" then
|
||||
riesenpilz_lavashroom(pos)
|
||||
elseif name == "riesenpilz:glowshroom" then
|
||||
riesenpilz_glowshroom(pos)
|
||||
elseif name == "riesenpilz:parasol" then
|
||||
riesenpilz_parasol(pos)
|
||||
elseif name == "default:apple" then
|
||||
riesenpilz_apple(pos)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
|
||||
if riesenpilz.enable_mapgen then
|
||||
dofile(minetest.get_modpath("riesenpilz") .. "/mapgen.lua")
|
||||
end
|
||||
|
||||
riesenpilz.inform("loaded", 1, load_time_start)
|
317
mods/riesenpilz/mapgen.lua
Normal file
@ -0,0 +1,317 @@
|
||||
local c
|
||||
local function define_contents()
|
||||
c = {
|
||||
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"),
|
||||
|
||||
dry_shrub = minetest.get_content_id("default:dry_shrub"),
|
||||
|
||||
ground = minetest.get_content_id("riesenpilz:ground"),
|
||||
riesenpilz_brown = minetest.get_content_id("riesenpilz:brown"),
|
||||
riesenpilz_red = minetest.get_content_id("riesenpilz:red"),
|
||||
riesenpilz_fly_agaric = minetest.get_content_id("riesenpilz:fly_agaric"),
|
||||
riesenpilz_lavashroom = minetest.get_content_id("riesenpilz:lavashroom"),
|
||||
riesenpilz_glowshroom = minetest.get_content_id("riesenpilz:glowshroom"),
|
||||
riesenpilz_parasol = minetest.get_content_id("riesenpilz:parasol"),
|
||||
|
||||
GROUND = {},
|
||||
TREE_STUFF = {
|
||||
minetest.get_content_id("default:tree"),
|
||||
minetest.get_content_id("default:leaves"),
|
||||
minetest.get_content_id("default:apple"),
|
||||
minetest.get_content_id("default:jungletree"),
|
||||
minetest.get_content_id("default:jungleleaves"),
|
||||
minetest.get_content_id("default:junglegrass"),
|
||||
},
|
||||
USUAL_STUFF = {
|
||||
minetest.get_content_id("default:cactus"),
|
||||
minetest.get_content_id("default:papyrus"),
|
||||
},
|
||||
}
|
||||
for name,data in pairs(minetest.registered_nodes) do
|
||||
local groups = data.groups
|
||||
if groups then
|
||||
if groups.crumbly == 3
|
||||
or groups.soil == 1 then
|
||||
table.insert(c.GROUND, minetest.get_content_id(name))
|
||||
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
|
||||
|
||||
|
||||
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 data[area:index(pos.x+i, pos.y, pos.z+j)] == c.air
|
||||
and pr:next(1,chance) == 1
|
||||
and data[area:index(pos.x+i, pos.y-1, pos.z+j)] == c.ground then
|
||||
data[area:index(pos.x+i, pos.y, pos.z+j)] = nam
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function say_info(info)
|
||||
local info = "[riesenpilz] "..info
|
||||
print(info)
|
||||
minetest.chat_send_all(info)
|
||||
end
|
||||
|
||||
local riesenpilz_rarity = riesenpilz.mapgen_rarity
|
||||
local riesenpilz_size = riesenpilz.mapgen_size
|
||||
local smooth_trans_size = riesenpilz.smooth_trans_size
|
||||
|
||||
local nosmooth_rarity = 1-riesenpilz_rarity/50
|
||||
local perlin_scale = riesenpilz_size*100/riesenpilz_rarity
|
||||
local smooth_rarity_max = nosmooth_rarity+smooth_trans_size*2/perlin_scale
|
||||
local smooth_rarity_min = nosmooth_rarity-smooth_trans_size/perlin_scale
|
||||
local smooth_rarity_dif = smooth_rarity_max-smooth_rarity_min
|
||||
|
||||
--local USUAL_STUFF = {"default:leaves","default:apple","default:tree","default:cactus","default:papyrus"}
|
||||
|
||||
local contents_defined
|
||||
minetest.register_on_generated(function(minp, maxp, seed)
|
||||
if maxp.y <= 0
|
||||
or minp.y >= 150 then --avoid generation in the sky
|
||||
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(51,3, 0.5, perlin_scale) --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 riesenpilz.always_generate
|
||||
and not ( perlin1:get2d( {x=x0, y=z0} ) > nosmooth_rarity ) --top left
|
||||
and not ( perlin1:get2d( { x = x0 + ( (x1-x0)/2), y=z0 } ) > nosmooth_rarity )--top middle
|
||||
and not (perlin1:get2d({x=x1, y=z1}) > nosmooth_rarity) --bottom right
|
||||
and not (perlin1:get2d({x=x1, y=z0+((z1-z0)/2)}) > nosmooth_rarity) --right middle
|
||||
and not (perlin1:get2d({x=x0, y=z1}) > nosmooth_rarity) --bottom left
|
||||
and not (perlin1:get2d({x=x1, y=z0}) > nosmooth_rarity) --top right
|
||||
and not (perlin1:get2d({x=x0+((x1-x0)/2), y=z1}) > nosmooth_rarity) --left middle
|
||||
and not (perlin1:get2d({x=(x1-x0)/2, y=(z1-z0)/2}) > nosmooth_rarity) --middle
|
||||
and not (perlin1:get2d({x=x0, y=z1+((z1-z0)/2)}) > nosmooth_rarity) then --bottom middle
|
||||
return
|
||||
end
|
||||
|
||||
local t1 = os.clock()
|
||||
riesenpilz.inform("tries to generate a giant mushroom biome at: x=["..minp.x.."; "..maxp.x.."]; y=["..minp.y.."; "..maxp.y.."]; z=["..minp.z.."; "..maxp.z.."]", 2)
|
||||
|
||||
if not contents_defined then
|
||||
define_contents()
|
||||
contents_defined = true
|
||||
end
|
||||
|
||||
local divs = (maxp.x-minp.x);
|
||||
local num = 1
|
||||
local tab = {}
|
||||
pr = PseudoRandom(seed+68)
|
||||
|
||||
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
||||
data = vm:get_data()
|
||||
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_STUFF) 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 riesenpilz.always_generate then
|
||||
in_biome = true
|
||||
elseif smooth then
|
||||
if test >= smooth_rarity_max
|
||||
or (
|
||||
test > smooth_rarity_min
|
||||
and pr:next(1, 1000) <= ((test-smooth_rarity_min)/smooth_rarity_dif)*1000
|
||||
) then
|
||||
in_biome = true
|
||||
end
|
||||
elseif (not smooth)
|
||||
and test > nosmooth_rarity 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.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_grond(data[area:index(x, y, z)], 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
|
||||
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
|
||||
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
|
||||
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
|
||||
riesenpilz_circle(c.riesenpilz_parasol, boden, pr:next(3,5), 3)
|
||||
elseif pr:next(1,90) == 1 then
|
||||
riesenpilz_circle(c.riesenpilz_red, boden, pr:next(4,5), 3)
|
||||
elseif pr:next(1,100) == 1 then
|
||||
riesenpilz_circle(c.riesenpilz_fly_agaric, boden, 4, 3)
|
||||
elseif pr:next(1,4000) == 1 then
|
||||
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
|
||||
elseif pr:next(1,340) == 10 then
|
||||
tab[num] = {2, boden}
|
||||
num = num+1
|
||||
elseif pr:next(1,390) == 20 then
|
||||
tab[num] = {3, boden}
|
||||
num = num+1
|
||||
elseif pr:next(1,6000) == 2 and pr:next(1,200) == 15 then
|
||||
tab[num] = {4, boden}
|
||||
num = num+1
|
||||
elseif pr:next(1,800) == 7 then
|
||||
tab[num] = {5, boden}
|
||||
num = num+1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
vm:set_data(data)
|
||||
vm:update_liquids()
|
||||
vm:write_to_map()
|
||||
riesenpilz.inform("ground finished", 2, t1)
|
||||
local t2 = os.clock()
|
||||
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)
|
||||
end
|
||||
end
|
||||
riesenpilz.inform("giant shrooms generated", 2, t2)
|
||||
riesenpilz.inform("done", 1, t1)
|
||||
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("abortriesenpilz")
|
||||
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)]]
|
BIN
mods/riesenpilz/rest/caverealms_fungi.png
Normal file
After Width: | Height: | Size: 249 B |
BIN
mods/riesenpilz/rest/caverealms_mycena.png
Normal file
After Width: | Height: | Size: 356 B |
BIN
mods/riesenpilz/rest/mush45_b.png
Normal file
After Width: | Height: | Size: 211 B |
BIN
mods/riesenpilz/rest/mush45_b0.png
Normal file
After Width: | Height: | Size: 234 B |
BIN
mods/riesenpilz/rest/mush45_b1.png
Normal file
After Width: | Height: | Size: 210 B |
BIN
mods/riesenpilz/rest/mush45_b2.png
Normal file
After Width: | Height: | Size: 257 B |
BIN
mods/riesenpilz/rest/mush45_bm.png
Normal file
After Width: | Height: | Size: 211 B |
BIN
mods/riesenpilz/rest/mush45_bm2.png
Normal file
After Width: | Height: | Size: 211 B |
BIN
mods/riesenpilz/rest/mush45_bm3.png
Normal file
After Width: | Height: | Size: 211 B |
BIN
mods/riesenpilz/rest/mush45_bm4.png
Normal file
After Width: | Height: | Size: 211 B |
BIN
mods/riesenpilz/rest/mush45_meal.png
Normal file
After Width: | Height: | Size: 232 B |
BIN
mods/riesenpilz/rest/mush45_r.png
Normal file
After Width: | Height: | Size: 233 B |
BIN
mods/riesenpilz/rest/mush45_r0.png
Normal file
After Width: | Height: | Size: 234 B |
BIN
mods/riesenpilz/rest/mush45_r1.png
Normal file
After Width: | Height: | Size: 208 B |
BIN
mods/riesenpilz/rest/mush45_r2.png
Normal file
After Width: | Height: | Size: 248 B |
BIN
mods/riesenpilz/rest/mush45_rm.png
Normal file
After Width: | Height: | Size: 234 B |
BIN
mods/riesenpilz/rest/mush45_rm2.png
Normal file
After Width: | Height: | Size: 239 B |
BIN
mods/riesenpilz/rest/mush45_rm3.png
Normal file
After Width: | Height: | Size: 234 B |
BIN
mods/riesenpilz/rest/mush45_rm4.png
Normal file
After Width: | Height: | Size: 238 B |
BIN
mods/riesenpilz/rest/mushrooms_mushroom_brown.png
Normal file
After Width: | Height: | Size: 303 B |
BIN
mods/riesenpilz/rest/mushrooms_mushroom_red.png
Normal file
After Width: | Height: | Size: 276 B |
203
mods/riesenpilz/rest/old_mapgen.lua
Normal file
@ -0,0 +1,203 @@
|
||||
--[[
|
||||
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_ground(pos, nodes)
|
||||
for _, evground in ipairs(nodes) do
|
||||
if minetest.env:get_node(pos).name == evground then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local GROUND = {"default:dirt_with_grass","default:dirt","default:sand","default:desert_sand"}
|
||||
USUAL_STUFF = {"default:leaves","default:apple","default:tree","default:cactus","default:papyrus"}
|
||||
minetest.register_on_generated(function(minp, maxp, seed)
|
||||
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)
|
||||
|
||||
--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
|
||||
|
||||
--Information:
|
||||
local geninfo = "-#- giant mushrooms generate: x=["..minp.x.."; "..maxp.x.."] z=["..minp.z.."; "..maxp.z.."]"
|
||||
print(geninfo)
|
||||
minetest.chat_send_all(geninfo)
|
||||
|
||||
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
|
||||
|
||||
local ground_y = nil --Definition des Bodens:
|
||||
for y=maxp.y,0,-1 do
|
||||
if find_ground({x=x,y=y,z=z}, GROUND) then
|
||||
ground_y = y
|
||||
break
|
||||
end
|
||||
end
|
||||
if ground_y then
|
||||
env:add_node({x=x,y=ground_y,z=z}, {name="riesenpilz:ground"})
|
||||
for i = -1,-5,-1 do
|
||||
local pos = {x=x,y=ground_y+i,z=z}
|
||||
if env:get_node(pos).name == "default:desert_sand" then
|
||||
env:add_node(pos, {name="default:dirt"})
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
local boden = {x=x,y=ground_y+1,z=z}
|
||||
if pr:next(1,15) == 1 then
|
||||
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
|
||||
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)
|
BIN
mods/riesenpilz/rest/riesenpilz_head.png
Normal file
After Width: | Height: | Size: 4.4 KiB |
27
mods/riesenpilz/settings.lua
Normal file
@ -0,0 +1,27 @@
|
||||
--This file contains configuration options for riesenpilz mod.
|
||||
|
||||
riesenpilz.enable_mapgen = true
|
||||
|
||||
--Generate giant mushroom biomes everywhere
|
||||
riesenpilz.always_generate = false
|
||||
|
||||
--Enables smooth transition of biomes.
|
||||
riesenpilz.smooth = true
|
||||
|
||||
--rarity in %
|
||||
riesenpilz.mapgen_rarity = 0.1
|
||||
|
||||
--size of the generated... (has an effect to the rarity, too)
|
||||
riesenpilz.mapgen_size = 50
|
||||
|
||||
--approximate size of smooth transitions
|
||||
riesenpilz.smooth_trans_size = 2
|
||||
|
||||
--says some information.
|
||||
riesenpilz.info = true
|
||||
|
||||
--informs the players too
|
||||
riesenpilz.inform_all = minetest.is_singleplayer()
|
||||
|
||||
--1:<a bit of information> 2:<acceptable amount of information> 3:<lots of text>
|
||||
riesenpilz.max_spam = 2
|
BIN
mods/riesenpilz/textures/3apple_apple.png
Normal file
After Width: | Height: | Size: 254 B |
BIN
mods/riesenpilz/textures/3apple_apple_bottom.png
Normal file
After Width: | Height: | Size: 246 B |
BIN
mods/riesenpilz/textures/3apple_apple_top.png
Normal file
After Width: | Height: | Size: 321 B |
BIN
mods/riesenpilz/textures/riesenpilz_brown45_bottom.png
Normal file
After Width: | Height: | Size: 105 B |
BIN
mods/riesenpilz/textures/riesenpilz_brown45_side.png
Normal file
After Width: | Height: | Size: 105 B |
BIN
mods/riesenpilz/textures/riesenpilz_brown45_top.png
Normal file
After Width: | Height: | Size: 105 B |
BIN
mods/riesenpilz/textures/riesenpilz_brown_bottom.png
Normal file
After Width: | Height: | Size: 320 B |
BIN
mods/riesenpilz/textures/riesenpilz_brown_side.png
Normal file
After Width: | Height: | Size: 251 B |
BIN
mods/riesenpilz/textures/riesenpilz_brown_top.png
Normal file
After Width: | Height: | Size: 186 B |
BIN
mods/riesenpilz/textures/riesenpilz_fly_agaric_bottom.png
Normal file
After Width: | Height: | Size: 313 B |
BIN
mods/riesenpilz/textures/riesenpilz_fly_agaric_side.png
Normal file
After Width: | Height: | Size: 284 B |
BIN
mods/riesenpilz/textures/riesenpilz_fly_agaric_top.png
Normal file
After Width: | Height: | Size: 220 B |
BIN
mods/riesenpilz/textures/riesenpilz_glowshroom_bottom.png
Normal file
After Width: | Height: | Size: 188 B |
BIN
mods/riesenpilz/textures/riesenpilz_glowshroom_side.png
Normal file
After Width: | Height: | Size: 150 B |
BIN
mods/riesenpilz/textures/riesenpilz_glowshroom_top.png
Normal file
After Width: | Height: | Size: 109 B |
BIN
mods/riesenpilz/textures/riesenpilz_ground_side.png
Normal file
After Width: | Height: | Size: 718 B |
BIN
mods/riesenpilz/textures/riesenpilz_ground_side_normal.png
Normal file
After Width: | Height: | Size: 638 B |
BIN
mods/riesenpilz/textures/riesenpilz_ground_top.png
Normal file
After Width: | Height: | Size: 619 B |
BIN
mods/riesenpilz/textures/riesenpilz_ground_top_normal.png
Normal file
After Width: | Height: | Size: 500 B |
BIN
mods/riesenpilz/textures/riesenpilz_growingtool.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
mods/riesenpilz/textures/riesenpilz_head.png
Normal file
After Width: | Height: | Size: 695 B |
BIN
mods/riesenpilz/textures/riesenpilz_head_binge.png
Normal file
After Width: | Height: | Size: 305 B |
BIN
mods/riesenpilz/textures/riesenpilz_head_blue.png
Normal file
After Width: | Height: | Size: 724 B |
BIN
mods/riesenpilz/textures/riesenpilz_head_blue_bright.png
Normal file
After Width: | Height: | Size: 761 B |
BIN
mods/riesenpilz/textures/riesenpilz_head_brown_bright.png
Normal file
After Width: | Height: | Size: 186 B |
BIN
mods/riesenpilz/textures/riesenpilz_head_normal.png
Normal file
After Width: | Height: | Size: 525 B |
BIN
mods/riesenpilz/textures/riesenpilz_head_orange.png
Normal file
After Width: | Height: | Size: 578 B |
BIN
mods/riesenpilz/textures/riesenpilz_head_white.png
Normal file
After Width: | Height: | Size: 544 B |
BIN
mods/riesenpilz/textures/riesenpilz_head_yellow.png
Normal file
After Width: | Height: | Size: 535 B |
BIN
mods/riesenpilz/textures/riesenpilz_lamellas.png
Normal file
After Width: | Height: | Size: 1000 B |
BIN
mods/riesenpilz/textures/riesenpilz_lamellas_normal.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
mods/riesenpilz/textures/riesenpilz_lavashroom_bottom.png
Normal file
After Width: | Height: | Size: 141 B |
BIN
mods/riesenpilz/textures/riesenpilz_lavashroom_side.png
Normal file
After Width: | Height: | Size: 149 B |
BIN
mods/riesenpilz/textures/riesenpilz_lavashroom_top.png
Normal file
After Width: | Height: | Size: 297 B |
BIN
mods/riesenpilz/textures/riesenpilz_nether_shroom_bottom.png
Normal file
After Width: | Height: | Size: 264 B |
BIN
mods/riesenpilz/textures/riesenpilz_nether_shroom_side.png
Normal file
After Width: | Height: | Size: 184 B |
BIN
mods/riesenpilz/textures/riesenpilz_nether_shroom_top.png
Normal file
After Width: | Height: | Size: 255 B |
BIN
mods/riesenpilz/textures/riesenpilz_parasol_bottom.png
Normal file
After Width: | Height: | Size: 236 B |
BIN
mods/riesenpilz/textures/riesenpilz_parasol_side.png
Normal file
After Width: | Height: | Size: 196 B |
BIN
mods/riesenpilz/textures/riesenpilz_parasol_top.png
Normal file
After Width: | Height: | Size: 183 B |
BIN
mods/riesenpilz/textures/riesenpilz_red45_bottom.png
Normal file
After Width: | Height: | Size: 140 B |
BIN
mods/riesenpilz/textures/riesenpilz_red45_side.png
Normal file
After Width: | Height: | Size: 131 B |
BIN
mods/riesenpilz/textures/riesenpilz_red45_top.png
Normal file
After Width: | Height: | Size: 98 B |
BIN
mods/riesenpilz/textures/riesenpilz_red_bottom.png
Normal file
After Width: | Height: | Size: 302 B |
BIN
mods/riesenpilz/textures/riesenpilz_red_side.png
Normal file
After Width: | Height: | Size: 267 B |
BIN
mods/riesenpilz/textures/riesenpilz_red_top.png
Normal file
After Width: | Height: | Size: 263 B |
BIN
mods/riesenpilz/textures/riesenpilz_stem.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
mods/riesenpilz/textures/riesenpilz_stem_blue.png
Normal file
After Width: | Height: | Size: 633 B |
BIN
mods/riesenpilz/textures/riesenpilz_stem_brown.png
Normal file
After Width: | Height: | Size: 701 B |
BIN
mods/riesenpilz/textures/riesenpilz_stem_normal.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
mods/riesenpilz/textures/riesenpilz_stem_top.png
Normal file
After Width: | Height: | Size: 130 B |