1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-11-05 10:00:26 +01:00

[riesenpilz] Update

- For #352
This commit is contained in:
LeMagnesium 2015-12-31 13:43:25 +01:00
parent 8eebd39db8
commit ee352dbc60
57 changed files with 314 additions and 206 deletions

0
mods/riesenpilz/rest/ 😿 → mods/riesenpilz/ / 😿 Executable file → Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 B

View File

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 303 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -2,3 +2,5 @@
— 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)
rest also WTFPL

View File

@ -1,4 +1,6 @@
[Mod] riesenpilz [riesenpilz]
[Mod] mushrooms [riesenpilz]
This mod adds mushrooms to minetest. The growing tool can make them giant.
**Depends:** see [depends.txt](https://raw.githubusercontent.com/HybridDog/riesenpilz/master/depends.txt)
**License:** see [LICENSE.txt](https://raw.githubusercontent.com/HybridDog/riesenpilz/master/LICENSE.txt)
@ -11,4 +13,6 @@ If you got ideas or found bugs, please tell them to me.
TODO:
— add more giant mushrooms
— finish supporting the mushrooms mod
— finish supporting the mushrooms mod
— add lava suit
— eating must become possible

View File

@ -1,3 +1,4 @@
default
vector_extras
fence_registration?
watershed?

View File

@ -2,11 +2,12 @@ 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 modpath = minetest.get_modpath("riesenpilz").."/"
dofile(modpath.."settings.lua")
dofile(modpath.."functions.lua")
--Growing Functions
-- Growing Functions
local function r_area(manip, width, height, pos)
local emerged_pos1, emerged_pos2 = manip:read_from_map(
@ -19,13 +20,14 @@ 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)
riesenpilz.inform("a giant "..name.." mushroom grew at "..vector.pos_to_string(pos), 3, t1)
local t1 = os.clock()
manip:update_map()
riesenpilz.inform("map updated", 3, t1)
end
-- contents become added later
local c
function riesenpilz.red(pos, nodes, area, w)
@ -143,7 +145,7 @@ local function riesenpilz_minecraft_fliegenpilz(pos)
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)
riesenpilz.inform("a fly agaric grew at "..vector.pos_to_string(pos), 3, t1)
end
@ -280,7 +282,7 @@ function riesenpilz.parasol(pos, nodes, area, w, h)
nodes[i] = c.stem
end
local w = w or math.random(MAX_SIZE+1,MAX_SIZE+2)
local w = w or MAX_SIZE+math.random(2)
local bhead1 = w-1
local bhead2 = math.random(1,w-2)
@ -313,7 +315,7 @@ end
local function riesenpilz_parasol(pos)
local t1 = os.clock()
local w = math.random(MAX_SIZE+1,MAX_SIZE+2)
local w = MAX_SIZE+math.random(2)
local h = 6+math.random(MAX_SIZE)
local manip = minetest.get_voxel_manip()
@ -326,6 +328,86 @@ local function riesenpilz_parasol(pos)
end
function riesenpilz.red45(pos, nodes, area, h1, h2)
local walkspace = h1 or math.random(2,MAX_SIZE)
local toph = h2 or math.random(MAX_SIZE)
local h = walkspace+toph+4
-- stem
for i in area:iterp(pos, {x=pos.x, y=pos.y+h, z=pos.z}) do
nodes[i] = c.stem_red
end
for i = -1,1,2 do
for l = 0, 1 do
if math.random(2) == 1 then
nodes[area:index(pos.x+i, pos.y, pos.z-l*i)] = c.stem_red
if math.random(2) == 1 then
nodes[area:index(pos.x+i, pos.y+1, pos.z-l*i)] = c.stem_red
end
end
if math.random(2) == 1 then
nodes[area:index(pos.x+l*i, pos.y, pos.z+i)] = c.stem_red
if math.random(2) == 1 then
nodes[area:index(pos.x+l*i, pos.y+1, pos.z+i)] = c.stem_red
end
end
nodes[area:index(pos.x+i, pos.y+walkspace+2, pos.z-l*i)] = c.head_red
nodes[area:index(pos.x+l*i, pos.y+walkspace+2, pos.z+i)] = c.head_red
end
nodes[area:index(pos.x, pos.y+walkspace+3, pos.z+i)] = c.head_red
nodes[area:index(pos.x+i, pos.y+walkspace+3, pos.z)] = c.head_red
for j = -1,1,2 do
nodes[area:index(pos.x+j, pos.y+walkspace+1, pos.z+i)] = c.head_red
nodes[area:index(pos.x+j*3, pos.y+walkspace+1, pos.z+i*3)] = c.head_red
for z = 1,2 do
for x = 1,2 do
for y = h-toph, h-1 do
nodes[area:index(pos.x+x*j, pos.y+y, pos.z+z*i)] = c.head_red
end
if z ~= 2
or x ~= 2
or math.random(4) ~= 2 then
nodes[area:index(pos.x+x*j, pos.y+h, pos.z+z*i)] = c.head_red
end
local z = z+1
x = x+1
nodes[area:index(pos.x+x*j, pos.y+walkspace+2, pos.z+z*i)] = c.head_red
if z ~= 3
or x ~= 3
or math.random(2) == 1 then
nodes[area:index(pos.x+x*j, pos.y+walkspace+3, pos.z+z*i)] = c.head_red
end
end
end
end
end
-- top
for z = -1,1 do
for x = -1,1 do
nodes[area:index(pos.x+x, pos.y+h+1, pos.z+z)] = c.head_red
end
end
end
local function riesenpilz_red45(pos)
local t1 = os.clock()
local h1 = math.random(2,MAX_SIZE)
local h2 = math.random(MAX_SIZE)
local h = h1+h2+5
local manip = minetest.get_voxel_manip()
local area = r_area(manip, 3, h, pos)
local nodes = manip:get_data()
riesenpilz.red45(pos, nodes, area, h1, h2)
set_vm_data(manip, nodes, pos, t1, "red45")
end
function riesenpilz.apple(pos, nodes, area)
local size = 5
local a = size*2
@ -371,40 +453,45 @@ local function riesenpilz_apple(pos)
manip:set_data(nodes)
manip:write_to_map()
riesenpilz.inform("an apple grew at ("..pos.x.."|"..pos.y.."|"..pos.z..")", 3, t1)
riesenpilz.inform("an apple grew at "..vector.pos_to_string(pos), 3, t1)
manip:update_map()
end
--3D apple [3apple]
-- 3D apple [3apple]
minetest.override_item("default:apple", {
drawtype = "nodebox",
tiles = {"3apple_apple_top.png","3apple_apple_bottom.png","3apple_apple.png"},
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},
}
},
})
if riesenpilz.change_apple then
minetest.override_item("default:apple", {
drawtype = "nodebox",
tiles = {"3apple_apple_top.png", "3apple_apple_bottom.png", "3apple_apple.png"},
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},
}
},
})
end
--Mushroom Nodes
-- Mushroom Nodes
local mushrooms_list = {
["brown"] = {
local abm_allowed = true
local disallowed_ps = {}
for name,i in pairs({
brown = {
description = "brown mushroom",
box = {
{-0.15, -0.2, -0.15, 0.15, -0.1, 0.15},
@ -420,7 +507,7 @@ local mushrooms_list = {
chance = 18,
},
},
["red"] = {
red = {
description = "red mushroom",
box = {
{-1/16, -8/16, -1/16, 1/16, -6/16, 1/16},
@ -438,7 +525,7 @@ local mushrooms_list = {
chance = 30,
},
},
["fly_agaric"] = {
fly_agaric = {
description = "fly agaric",
box = {
{-0.05, -0.5, -0.05, 0.05, 1/20, 0.05},
@ -454,7 +541,7 @@ local mushrooms_list = {
chance = 30,
},
},
["lavashroom"] = {
lavashroom = {
description = "Lavashroom",
box = {
{-1/16, -8/16, -1/16, 1/16, -6/16, 1/16},
@ -471,16 +558,16 @@ local mushrooms_list = {
chance = 60,
},
},
["glowshroom"] = {
glowshroom = {
description = "Glowshroom",
box = {
{-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},
{-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}
{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}
},
growing = {
r = 3,
@ -491,7 +578,7 @@ local mushrooms_list = {
chance = 320,
},
},
["nether_shroom"] = {
nether_shroom = {
description = "Nether mushroom",
box = {
{-1/16, -8/16, -1/16, 1/16, -2/16, 1/16},
@ -504,7 +591,7 @@ local mushrooms_list = {
},
burntime = 6,
},
["parasol"] = {
parasol = {
description = "white parasol mushroom",
box = {
{-1/16, -8/16, -1/16, 1/16, 0, 1/16},
@ -522,15 +609,15 @@ local mushrooms_list = {
chance = 36,
},
},
["red45"] = {
red45 = {
description = "45 red mushroom",
box = {
{-1/16, -0.5, -1/16, 1/16, 1/8, 1/16},
{-3/16, 1/8, -3/16, 3/16, 1/4, 3/16},
{-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}
{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}
},
growing = {
r = {min=3, max=4},
@ -541,14 +628,14 @@ local mushrooms_list = {
chance = 180,
},
},
["brown45"] = {
brown45 = {
description = "45 brown mushroom",
box = {
{-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}
{-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}
},
growing = {
r = {min=2, max=3},
@ -559,11 +646,7 @@ local mushrooms_list = {
chance = 20,
},
},
}
local abm_allowed = true
local disallowed_ps = {}
for name,i in pairs(mushrooms_list) do
}) do
local burntime = i.burntime or 1
local box = {
type = "fixed",
@ -737,10 +820,19 @@ end)
--Mushroom Nodes
-- Big Mushroom Nodes
local pilznode_list = {
local head_sounds = default.node_sound_wood_defaults({
footstep = {name="riesenpilz_head", gain=0.1},
place = {name="default_place_node", gain=0.5},
dig = {name="riesenpilz_head", gain=0.2},
dug = {name="riesenpilz_stem", gain=0.1}
})
local add_fence = minetest.register_fence
local node_groups = {oddly_breakable_by_hand=3, fall_damage_add_percent=-80, bouncy=10}
for _,i in pairs({
{
typ = "stem",
description = "white",
@ -750,11 +842,18 @@ local pilznode_list = {
typ = "stem",
name = "brown",
textures = {"stem_top.png", "stem_top.png", "stem_brown.png"},
fence = false,
},
{
typ = "stem",
name = "blue",
textures = {"stem_top.png","stem_top.png","stem_blue.png"},
fence = false,
},
{
typ = "stem",
name = "red",
textures = {"stem_red45_top.png","stem_red45_top.png","stem_red45.png"},
},
{
name = "lamellas",
@ -784,14 +883,15 @@ local pilznode_list = {
typ = "head",
name = "brown",
textures = {"brown_top.png", "lamellas.png", "brown_top.png"},
sapling = "brown"
sapling = "brown",
},
{
typ = "head",
name = "brown_full",
description = "full brown",
textures = "brown_top.png",
sapling = "brown"
sapling = "brown",
fence = false,
},
{
typ = "head",
@ -825,16 +925,7 @@ local pilznode_list = {
textures = {"head_brown_bright.png", "head_white.png", "head_brown_bright.png"},
sapling = "parasol"
},
}
local head_sounds = default.node_sound_wood_defaults({
footstep = {name="riesenpilz_head", gain=0.1},
place = {name="default_place_node", gain=0.5},
dig = {name="riesenpilz_head", gain=0.2},
dug = {name="riesenpilz_stem", gain=0.1}
})
for _,i in pairs(pilznode_list) do
}) do
-- fill missing stuff
local textures = i.textures
i.description = i.description or i.name
@ -870,10 +961,15 @@ for _,i in pairs(pilznode_list) do
minetest.register_node(nodename, {
description = desctiption,
tiles = textures,
groups = {oddly_breakable_by_hand=3, fall_damage_add_percent=-80},
groups = node_groups,
drop = drop,
sounds = sounds,
})
if add_fence
and i.fence ~= false then
add_fence({fence_of = nodename})
end
end
minetest.register_node("riesenpilz:head_red_side", {
@ -881,7 +977,7 @@ minetest.register_node("riesenpilz:head_red_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, fall_damage_add_percent=-80},
groups = node_groups,
drop = {max_items = 1,
items = {{items = {"riesenpilz:fly_agaric"},rarity = 20,},
{items = {"riesenpilz:head_red"},rarity = 1,}}},
@ -892,7 +988,9 @@ minetest.register_node("riesenpilz:head_red_side", {
minetest.register_node("riesenpilz:ground", {
description = "dirt with rotten grass",
tiles = {"riesenpilz_ground_top.png","default_dirt.png","default_dirt.png^riesenpilz_ground_side.png"},
tiles = {"riesenpilz_ground_top.png","default_dirt.png",
{name="default_dirt.png^riesenpilz_ground_side.png", tileable_vertical = false}
},
groups = {crumbly=3},
sounds = default.node_sound_dirt_defaults(),
drop = 'default:dirt'
@ -923,6 +1021,8 @@ c = {
head_binge = minetest.get_content_id("riesenpilz:head_binge"),
head_brown_bright = minetest.get_content_id("riesenpilz:head_brown_bright"),
stem_red = minetest.get_content_id("riesenpilz:stem_red"),
red = minetest.get_content_id("default:copperblock"),
brown = minetest.get_content_id("default:desert_stone"),
tree = minetest.get_content_id("default:tree"),
@ -930,7 +1030,7 @@ c = {
--Growing
-- Growing
minetest.register_tool("riesenpilz:growingtool", {
@ -938,31 +1038,61 @@ minetest.register_tool("riesenpilz: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
minetest.register_on_punchnode(function(pos, node, player)
if player:get_wielded_item():get_name() ~= "riesenpilz:growingtool"
or minetest.is_protected(pos, player:get_player_name()) then
return
end
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 == "riesenpilz:red45" then
riesenpilz_red45(pos)
elseif name == "default:apple" then
riesenpilz_apple(pos)
end
end)
-- Food
minetest.register_craftitem("riesenpilz:mush45_meal", {
description = "Mushroom Meal",
inventory_image = "riesenpilz_mush45_meal.png",
on_use = minetest.item_eat(6),
})
minetest.register_craft({
output = "riesenpilz:mush45_meal 4",
recipe = {
{"riesenpilz:brown45", "riesenpilz:red45"},
{"riesenpilz:red45", "riesenpilz:brown45"},
}
})
if riesenpilz.enable_mapgen then
dofile(minetest.get_modpath("riesenpilz") .. "/mapgen.lua")
dofile(modpath.."mapgen.lua")
end
riesenpilz.inform("loaded", 1, load_time_start)
local time = math.floor(tonumber(os.clock()-load_time_start)*100+0.5)/100
local msg = "[riesenpilz] loaded after ca. "..time
if time > 0.05 then
minetest.log("warning", msg)
else
minetest.log("info", msg)
end

View File

@ -1,3 +1,5 @@
local minetest = minetest --Should make things a bit faster.
local c
local function define_contents()
c = {
@ -74,15 +76,25 @@ local function say_info(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
-- perlin noise "hills" are not peaks but looking like sinus curve
local function upper_rarity(rarity)
return math.sign(rarity)*math.sin(math.abs(rarity)*math.pi/2)
end
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 rarity = riesenpilz.mapgen_rarity
local riesenpilz_size = riesenpilz.mapgen_size
local nosmooth_rarity = 1-rarity/50
local perlin_scale = riesenpilz_size*100/rarity
local smooth_rarity_max, smooth_rarity_min, smooth_rarity_dif
local smooth = riesenpilz.smooth
if smooth then
local smooth_trans_size = riesenpilz.smooth_trans_size
smooth_rarity_max = upper_rarity(nosmooth_rarity+smooth_trans_size*2/perlin_scale)
smooth_rarity_min = upper_rarity(nosmooth_rarity-smooth_trans_size/perlin_scale)
smooth_rarity_dif = smooth_rarity_max-smooth_rarity_min
end
nosmooth_rarity = upper_rarity(nosmooth_rarity)
--local USUAL_STUFF = {"default:leaves","default:apple","default:tree","default:cactus","default:papyrus"}
@ -94,8 +106,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
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
local perlin1 = minetest.get_perlin(51,3, 0.5, perlin_scale) --Get map specific perlin
if not riesenpilz.always_generate then
local biome_allowed
@ -115,23 +126,6 @@ minetest.register_on_generated(function(minp, maxp, seed)
end
end
--[[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)
@ -145,6 +139,9 @@ minetest.register_on_generated(function(minp, maxp, seed)
local tab = {}
pr = PseudoRandom(seed+68)
local heightmap = minetest.get_mapgen_object("heightmap")
local hmi = 1
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
data = vm:get_data()
area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
@ -158,14 +155,6 @@ minetest.register_on_generated(function(minp, maxp, seed)
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
@ -185,31 +174,43 @@ minetest.register_on_generated(function(minp, maxp, seed)
) then
in_biome = true
end
elseif (not smooth)
and test > nosmooth_rarity then
elseif test > nosmooth_rarity then
in_biome = true
end
if in_biome then
local ground_y = nil --Definition des Bodens:
-- for y=maxp.y,0,-1 do
for y=maxp.y,1,-1 do
local p_pos = area:index(x, y, z)
local d_p_pos = data[p_pos]
for _,nam in pairs(c.USUAL_STUFF) do --remove usual stuff
if d_p_pos == nam then
data[p_pos] = c.air
p_pos = nil
break
end
end
if p_pos --else search ground_y
and find_ground(d_p_pos, c.GROUND) then
ground_y = y
local ymin = math.max(heightmap[hmi]-5, minp.y) -- -1
-- skip the air part
local ground
for y = math.min(heightmap[hmi]+20, maxp.y),ymin,-1 do
if data[area:index(x, y, z)] ~= c.air then
ground = y
break
end
end
local ground_y
if ground then
for y = ground,ymin,-1 do
local p_pos = area:index(x, y, z)
local d_p_pos = data[p_pos]
for _,nam in pairs(c.USUAL_STUFF) do --remove usual stuff
if d_p_pos == nam then
data[p_pos] = c.air
p_pos = nil
break
end
end
if p_pos --else search ground_y
and find_ground(d_p_pos, c.GROUND) then
ground_y = y
break
end
end
end
if ground_y then
data[area:index(x, ground_y, z)] = c.ground
for i = -1,-5,-1 do
@ -220,6 +221,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
break
end
end
local bigtype
local boden = {x=x,y=ground_y+1,z=z}
if pr:next(1,15) == 1 then
data[area:index(x, ground_y+1, z)] = c.dry_shrub
@ -231,28 +233,32 @@ minetest.register_on_generated(function(minp, maxp, seed)
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,340) == 10 then
bigtype = 2
elseif pr:next(1,380) == 1 then
bigtype = 1
elseif pr:next(1,390) == 20 then
bigtype = 3
elseif pr:next(1,800) == 7 then
bigtype = 5
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,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}
elseif pr:next(1,6000) == 2 then
if pr:next(1,200) == 15 then
bigtype = 4
elseif pr:next(1,2000) == 54 then
bigtype = 6
end
end
if bigtype then
tab[num] = {bigtype, boden}
num = num+1
end
end
end
hmi = hmi+1
end
end
riesenpilz.inform("ground finished", 2, t1)
@ -276,6 +282,8 @@ minetest.register_on_generated(function(minp, maxp, seed)
riesenpilz.lavashroom(p, data, area)
elseif m == 5 then
riesenpilz.parasol(p, data, area)
elseif m == 6 then
riesenpilz.red45(p, data, area)
end
end
riesenpilz.inform("giant shrooms generated", 2, t2)
@ -289,49 +297,9 @@ minetest.register_on_generated(function(minp, maxp, seed)
vm:set_lighting({day=0, night=0})
vm:calc_lighting()
vm:write_to_map()
data = nil
area = nil
riesenpilz.inform("data set", 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)]]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 216 B

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -21,7 +21,10 @@ riesenpilz.smooth_trans_size = 2
riesenpilz.info = true
--informs the players too
riesenpilz.inform_all = minetest.is_singleplayer()
riesenpilz.inform_all = false--minetest.is_singleplayer()
--1:<a bit of information> 2:<acceptable amount of information> 3:<lots of text>
riesenpilz.max_spam = 2
--3d apple
riesenpilz.change_apple = true

BIN
mods/riesenpilz/textures/riesenpilz_brown_side.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 251 B

After

Width:  |  Height:  |  Size: 251 B

BIN
mods/riesenpilz/textures/riesenpilz_brown_top.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 182 B

After

Width:  |  Height:  |  Size: 186 B

BIN
mods/riesenpilz/textures/riesenpilz_red_top.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 261 B

After

Width:  |  Height:  |  Size: 263 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 734 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 734 B