Compare commits
25 Commits
Author | SHA1 | Date | |
---|---|---|---|
d4b5e9223c | |||
6879308ea3 | |||
4e32b5e9a0 | |||
6b259b94ad | |||
6257c39406 | |||
dc64c2fb6e | |||
c5d2a5875c | |||
2869aed00a | |||
f594c91ca3 | |||
c3826283ea | |||
52fec01943 | |||
2f91256fbf | |||
df97e1e4ee | |||
d4c348de96 | |||
f205e55c04 | |||
40c8d1d6e3 | |||
c075d386a7 | |||
3e71fdda35 | |||
84941ca103 | |||
c26e59d432 | |||
2d45b5e692 | |||
bf385faa96 | |||
737bbf6c00 | |||
f34f37a6d7 | |||
7bd30384cc |
Before Width: | Height: | Size: 249 B |
Before Width: | Height: | Size: 356 B |
BIN
/frying.mp3
@ -1,2 +0,0 @@
|
|||||||
frying from http://freesound.org/people/davidkay/sounds/132472/ (WTFPL)
|
|
||||||
cutting from http://freesound.org/people/nhaudio/sounds/192416/ (WTFPL)
|
|
BIN
/mush45_b.png
Before Width: | Height: | Size: 211 B |
BIN
/mush45_b0.png
Before Width: | Height: | Size: 234 B |
BIN
/mush45_b1.png
Before Width: | Height: | Size: 210 B |
BIN
/mush45_b2.png
Before Width: | Height: | Size: 257 B |
BIN
/mush45_bm.png
Before Width: | Height: | Size: 211 B |
BIN
/mush45_bm2.png
Before Width: | Height: | Size: 211 B |
BIN
/mush45_bm3.png
Before Width: | Height: | Size: 211 B |
BIN
/mush45_bm4.png
Before Width: | Height: | Size: 211 B |
BIN
/mush45_r.png
Before Width: | Height: | Size: 233 B |
BIN
/mush45_r0.png
Before Width: | Height: | Size: 234 B |
BIN
/mush45_rm.png
Before Width: | Height: | Size: 234 B |
BIN
/mush45_rm2.png
Before Width: | Height: | Size: 239 B |
BIN
/mush45_rm3.png
Before Width: | Height: | Size: 234 B |
BIN
/mush45_rm4.png
Before Width: | Height: | Size: 238 B |
Before Width: | Height: | Size: 303 B |
Before Width: | Height: | Size: 276 B |
203
/old_mapgen.lua
@ -1,203 +0,0 @@
|
|||||||
--[[
|
|
||||||
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.get_node(p).name == "air"
|
|
||||||
and random:next(1,rand) == 1
|
|
||||||
and minetest.get_node({x=pos.x+i, y=pos.y-1, z=pos.z+j}).name ~= "air" then
|
|
||||||
minetest.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.get_node({x=pos.x+i, y=pos.y, z=pos.z+j}).name == "air"
|
|
||||||
and math.random(1,chance) == 1
|
|
||||||
and minetest.get_node({x=pos.x+i, y=pos.y-1, z=pos.z+j}).name == "riesenpilz:ground" then
|
|
||||||
minetest.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.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)
|
|
Before Width: | Height: | Size: 4.4 KiB |
BIN
/smallhead.1.ogg
3
.luacheckrc
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
read_globals = {"minetest", "vector", "PseudoRandom", "ItemStack", "VoxelArea",
|
||||||
|
"table", "dump", "default"}
|
||||||
|
globals = {"riesenpilz"}
|
13
LICENSE.txt
@ -1,6 +1,9 @@
|
|||||||
------Mushrooms------
|
Sounds and textures
|
||||||
— glowshroom and lavashroom from bas080's plants mod (WTFPL)
|
CC by 3.0
|
||||||
— parasol mushroom from a mod called mushrooms (WTFPL)
|
Code
|
||||||
— "45" mushrooms from r01922090's mush45 mod (WTFPL)
|
MIT
|
||||||
|
|
||||||
rest also WTFPL
|
Some source information:
|
||||||
|
— glowshroom and lavashroom from bas080's plants mod (originally WTFPL)
|
||||||
|
— parasol mushroom from a mod called mushrooms (originally WTFPL)
|
||||||
|
— "45" mushrooms from r01922090's mush45 mod (originally WTFPL)
|
||||||
|
23
README.md
@ -2,17 +2,24 @@
|
|||||||
|
|
||||||
This mod adds mushrooms to minetest. The growing tool can make them giant.
|
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)
|
**Depends:** see [depends.txt](https://raw.githubusercontent.com/HybridDog/riesenpilz/master/depends.txt)<br/>
|
||||||
**License:** see [LICENSE.txt](https://raw.githubusercontent.com/HybridDog/riesenpilz/master/LICENSE.txt)
|
**License:** see [LICENSE.txt](https://raw.githubusercontent.com/HybridDog/riesenpilz/master/LICENSE.txt)<br/>
|
||||||
**Download:** [zip](https://github.com/HybridDog/riesenpilz/archive/master.zip), [tar.gz](https://github.com/HybridDog/riesenpilz/archive/master.tar.gz)
|
**Download:** [zip](https://github.com/HybridDog/riesenpilz/archive/master.zip), [tar.gz](https://github.com/HybridDog/riesenpilz/archive/master.tar.gz)<br/>
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
If you got ideas or found bugs, please tell them to me.
|
If you got ideas or found bugs, please tell them to me.
|
||||||
|
|
||||||
|
|
||||||
TODO:
|
TODO:
|
||||||
— add more giant mushrooms
|
* Mapgen: Do not use a fixed table of tree nodes; instead use a more flexible
|
||||||
— finish supporting the mushrooms mod
|
way to remove trees.
|
||||||
— add lava suit
|
* Add a settingtypes.txt
|
||||||
— eating must become possible
|
* Make the growingtool craftable
|
||||||
|
* Test if visual_scale is useful for the small mushroom nodes,
|
||||||
|
e.g. to make textures smaller or to use power-of-two sized textures.
|
||||||
|
Nodeboxes would need to be changed accordingly (maybe automatically).
|
||||||
|
* Add new features:
|
||||||
|
* Add more giant mushrooms
|
||||||
|
* Add more content from the mushrooms mod
|
||||||
|
* Add a lava suit
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
default
|
|
||||||
vector_extras
|
|
||||||
fence_registration?
|
|
@ -17,3 +17,21 @@ else
|
|||||||
function riesenpilz.inform()
|
function riesenpilz.inform()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local circle_tables = {}
|
||||||
|
function riesenpilz.circle(r)
|
||||||
|
local circle = circle_tables[r]
|
||||||
|
if circle then
|
||||||
|
return circle
|
||||||
|
end
|
||||||
|
circle = {}
|
||||||
|
for i = -r, r do
|
||||||
|
for j = -r, r do
|
||||||
|
if math.floor(math.sqrt(i * i + j * j) + 0.5) == r then
|
||||||
|
circle[#circle+1] = {x=i, y=0, z=j}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
circle_tables[r] = circle
|
||||||
|
return circle
|
||||||
|
end
|
||||||
|
416
init.lua
@ -17,22 +17,67 @@ local function r_area(manip, width, height, pos)
|
|||||||
return VoxelArea:new({MinEdge=emerged_pos1, MaxEdge=emerged_pos2})
|
return VoxelArea:new({MinEdge=emerged_pos1, MaxEdge=emerged_pos2})
|
||||||
end
|
end
|
||||||
|
|
||||||
local function set_vm_data(manip, nodes, pos, t1, name)
|
|
||||||
manip:set_data(nodes)
|
|
||||||
manip:write_to_map()
|
|
||||||
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
|
-- contents become added later
|
||||||
local c
|
local c
|
||||||
|
|
||||||
|
-- cache buildable_to ids
|
||||||
|
local re_al_cache = {[minetest.get_content_id("ignore")] = true}
|
||||||
|
local function replacing_allowed(id)
|
||||||
|
if re_al_cache[id] ~= nil then
|
||||||
|
return re_al_cache[id]
|
||||||
|
end
|
||||||
|
local def = minetest.registered_nodes[minetest.get_name_from_content_id(id)]
|
||||||
|
if not def
|
||||||
|
or def.buildable_to then
|
||||||
|
re_al_cache[id] = true
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
re_al_cache[id] = false
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local set_vm_nodes
|
||||||
|
if riesenpilz.giant_restrict_area then
|
||||||
|
function set_vm_nodes(manip, pznodes)
|
||||||
|
local nodes = manip:get_data()
|
||||||
|
for vi,id in pairs(pznodes) do
|
||||||
|
if not replacing_allowed(nodes[vi]) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
nodes[vi] = id
|
||||||
|
end
|
||||||
|
manip:set_data(nodes)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
else
|
||||||
|
function set_vm_nodes(manip, pznodes)
|
||||||
|
local nodes = manip:get_data()
|
||||||
|
for vi,id in pairs(pznodes) do
|
||||||
|
if replacing_allowed(nodes[vi]) then
|
||||||
|
nodes[vi] = id
|
||||||
|
end
|
||||||
|
end
|
||||||
|
manip:set_data(nodes)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function set_vm_data(manip, pznodes, pos, t1, name)
|
||||||
|
if not set_vm_nodes(manip, pznodes) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
manip:write_to_map()
|
||||||
|
riesenpilz.inform("a giant " .. name .. " mushroom grew at " ..
|
||||||
|
minetest.pos_to_string(pos), 3, t1)
|
||||||
|
local t2 = os.clock()
|
||||||
|
manip:update_map()
|
||||||
|
riesenpilz.inform("map updated", 3, t2)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
function riesenpilz.red(pos, nodes, area, w)
|
function riesenpilz.red(pos, nodes, area, w)
|
||||||
local w = w or math.random(MAX_SIZE)
|
w = w or math.random(MAX_SIZE)
|
||||||
local h = w+2
|
local h = w + 2
|
||||||
|
|
||||||
for i = 0, h do
|
for i = 0, h do
|
||||||
nodes[area:index(pos.x, pos.y+i, pos.z)] = c.stem
|
nodes[area:index(pos.x, pos.y+i, pos.z)] = c.stem
|
||||||
@ -61,17 +106,17 @@ local function riesenpilz_hybridpilz(pos)
|
|||||||
|
|
||||||
local manip = minetest.get_voxel_manip()
|
local manip = minetest.get_voxel_manip()
|
||||||
local area = r_area(manip, w+1, w+3, pos)
|
local area = r_area(manip, w+1, w+3, pos)
|
||||||
local nodes = manip:get_data()
|
|
||||||
|
|
||||||
riesenpilz.red(pos, nodes, area, w)
|
local pznodes = {}
|
||||||
|
riesenpilz.red(pos, pznodes, area, w)
|
||||||
|
|
||||||
set_vm_data(manip, nodes, pos, t1, "red")
|
set_vm_data(manip, pznodes, pos, t1, "red")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function riesenpilz.brown(pos, nodes, area, br)
|
function riesenpilz.brown(pos, nodes, area, br)
|
||||||
local br = br or math.random(MAX_SIZE-1)+1
|
br = br or math.random(MAX_SIZE-1)+1
|
||||||
local h = br+2
|
local h = br + 2
|
||||||
|
|
||||||
for i in area:iterp(pos, {x=pos.x, y=pos.y+h, z=pos.z}) do
|
for i in area:iterp(pos, {x=pos.x, y=pos.y+h, z=pos.z}) do
|
||||||
nodes[i] = c.stem
|
nodes[i] = c.stem
|
||||||
@ -96,11 +141,11 @@ local function riesenpilz_brauner_minecraftpilz(pos)
|
|||||||
|
|
||||||
local manip = minetest.get_voxel_manip()
|
local manip = minetest.get_voxel_manip()
|
||||||
local area = r_area(manip, br+1, br+3, pos)
|
local area = r_area(manip, br+1, br+3, pos)
|
||||||
local nodes = manip:get_data()
|
|
||||||
|
|
||||||
riesenpilz.brown(pos, nodes, area, br)
|
local pznodes = {}
|
||||||
|
riesenpilz.brown(pos, pznodes, area, br)
|
||||||
|
|
||||||
set_vm_data(manip, nodes, pos, t1, "brown")
|
set_vm_data(manip, pznodes, pos, t1, "brown")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -136,16 +181,19 @@ local function riesenpilz_minecraft_fliegenpilz(pos)
|
|||||||
|
|
||||||
local manip = minetest.get_voxel_manip()
|
local manip = minetest.get_voxel_manip()
|
||||||
local area = r_area(manip, 2, 4, pos)
|
local area = r_area(manip, 2, 4, pos)
|
||||||
local nodes = manip:get_data()
|
|
||||||
local param2s = manip:get_param2_data()
|
local param2s = manip:get_param2_data()
|
||||||
|
|
||||||
riesenpilz.fly_agaric(pos, nodes, area, param2s)
|
local pznodes = {}
|
||||||
|
riesenpilz.fly_agaric(pos, pznodes, area, param2s)
|
||||||
|
|
||||||
manip:set_data(nodes)
|
if not set_vm_nodes(manip, pznodes) then
|
||||||
|
return
|
||||||
|
end
|
||||||
manip:set_param2_data(param2s)
|
manip:set_param2_data(param2s)
|
||||||
manip:write_to_map()
|
manip:write_to_map()
|
||||||
manip:update_map()
|
manip:update_map()
|
||||||
riesenpilz.inform("a fly agaric grew at "..vector.pos_to_string(pos), 3, t1)
|
riesenpilz.inform("a fly agaric grew at " .. minetest.pos_to_string(pos),
|
||||||
|
3, t1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -157,7 +205,7 @@ local function ran_node(a, b, ran)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function riesenpilz.lavashroom(pos, nodes, area, h)
|
function riesenpilz.lavashroom(pos, nodes, area, h)
|
||||||
local h = h or 3+math.random(MAX_SIZE-2)
|
h = h or 3 + math.random(MAX_SIZE - 2)
|
||||||
|
|
||||||
-- remove the mushroom
|
-- remove the mushroom
|
||||||
nodes[area:indexp(pos)] = c.air
|
nodes[area:indexp(pos)] = c.air
|
||||||
@ -217,16 +265,16 @@ local function riesenpilz_lavashroom(pos)
|
|||||||
|
|
||||||
local manip = minetest.get_voxel_manip()
|
local manip = minetest.get_voxel_manip()
|
||||||
local area = r_area(manip, 4, h+6, pos)
|
local area = r_area(manip, 4, h+6, pos)
|
||||||
local nodes = manip:get_data()
|
|
||||||
|
|
||||||
riesenpilz.lavashroom(pos, nodes, area, h)
|
local pznodes = {}
|
||||||
|
riesenpilz.lavashroom(pos, pznodes, area, h)
|
||||||
|
|
||||||
set_vm_data(manip, nodes, pos, t1, "lavashroom")
|
set_vm_data(manip, pznodes, pos, t1, "lavashroom")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function riesenpilz.glowshroom(pos, nodes, area, h)
|
function riesenpilz.glowshroom(pos, nodes, area, h)
|
||||||
local h = h or 2+math.random(MAX_SIZE)
|
h = h or 2 + math.random(MAX_SIZE)
|
||||||
|
|
||||||
for i = 0, h do
|
for i = 0, h do
|
||||||
nodes[area:index(pos.x, pos.y+i, pos.z)] = c.stem_blue
|
nodes[area:index(pos.x, pos.y+i, pos.z)] = c.stem_blue
|
||||||
@ -266,29 +314,29 @@ local function riesenpilz_glowshroom(pos)
|
|||||||
|
|
||||||
local manip = minetest.get_voxel_manip()
|
local manip = minetest.get_voxel_manip()
|
||||||
local area = r_area(manip, 2, h+3, pos)
|
local area = r_area(manip, 2, h+3, pos)
|
||||||
local nodes = manip:get_data()
|
|
||||||
|
|
||||||
riesenpilz.glowshroom(pos, nodes, area, h)
|
local pznodes = {}
|
||||||
|
riesenpilz.glowshroom(pos, pznodes, area, h)
|
||||||
|
|
||||||
set_vm_data(manip, nodes, pos, t1, "glowshroom")
|
set_vm_data(manip, pznodes, pos, t1, "glowshroom")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function riesenpilz.parasol(pos, nodes, area, w, h)
|
function riesenpilz.parasol(pos, nodes, area, w, h)
|
||||||
local h = h or 6+math.random(MAX_SIZE)
|
h = h or 6 + math.random(MAX_SIZE)
|
||||||
|
|
||||||
--stem
|
--stem
|
||||||
for i in area:iterp(pos, {x=pos.x, y=pos.y+h-2, z=pos.z}) do
|
for i in area:iterp(pos, {x=pos.x, y=pos.y+h-2, z=pos.z}) do
|
||||||
nodes[i] = c.stem
|
nodes[i] = c.stem
|
||||||
end
|
end
|
||||||
|
|
||||||
local w = w or MAX_SIZE+math.random(2)
|
w = w or MAX_SIZE + math.random(2)
|
||||||
local bhead1 = w-1
|
local bhead1 = w-1
|
||||||
local bhead2 = math.random(1,w-2)
|
local bhead2 = math.random(1,w-2)
|
||||||
|
|
||||||
for _,j in pairs({
|
for _,j in pairs({
|
||||||
{bhead2, 0, c.head_brown_bright},
|
{bhead2, 0, c.head_brown_bright},
|
||||||
{bhead1, -1, c.head_binge}
|
{bhead1, -1, c.head_beige}
|
||||||
}) do
|
}) do
|
||||||
for i in area:iter(pos.x-j[1], pos.y+h+j[2], pos.z-j[1], pos.x+j[1], pos.y+h+j[2], pos.z+j[1]) do
|
for i in area:iter(pos.x-j[1], pos.y+h+j[2], pos.z-j[1], pos.x+j[1], pos.y+h+j[2], pos.z+j[1]) do
|
||||||
nodes[i] = j[3]
|
nodes[i] = j[3]
|
||||||
@ -302,8 +350,8 @@ function riesenpilz.parasol(pos, nodes, area, w, h)
|
|||||||
nodes[area:index(pos.x+l*k, pos.y+rh, pos.z+k)] = c.head_white
|
nodes[area:index(pos.x+l*k, pos.y+rh, pos.z+k)] = c.head_white
|
||||||
end
|
end
|
||||||
for l = -w+1, w do
|
for l = -w+1, w do
|
||||||
nodes[area:index(pos.x+w*k, pos.y+h-2, pos.z-l*k)] = c.head_binge
|
nodes[area:index(pos.x+w*k, pos.y+h-2, pos.z-l*k)] = c.head_beige
|
||||||
nodes[area:index(pos.x+l*k, pos.y+h-2, pos.z+w*k)] = c.head_binge
|
nodes[area:index(pos.x+l*k, pos.y+h-2, pos.z+w*k)] = c.head_beige
|
||||||
end
|
end
|
||||||
for l = -bhead1+1, bhead1 do
|
for l = -bhead1+1, bhead1 do
|
||||||
nodes[area:index(pos.x+bhead1*k, pos.y+h-2, pos.z-l*k)] = c.head_white
|
nodes[area:index(pos.x+bhead1*k, pos.y+h-2, pos.z-l*k)] = c.head_white
|
||||||
@ -320,11 +368,11 @@ local function riesenpilz_parasol(pos)
|
|||||||
|
|
||||||
local manip = minetest.get_voxel_manip()
|
local manip = minetest.get_voxel_manip()
|
||||||
local area = r_area(manip, w, h, pos)
|
local area = r_area(manip, w, h, pos)
|
||||||
local nodes = manip:get_data()
|
|
||||||
|
|
||||||
riesenpilz.parasol(pos, nodes, area, w, h)
|
local pznodes = {}
|
||||||
|
riesenpilz.parasol(pos, pznodes, area, w, h)
|
||||||
|
|
||||||
set_vm_data(manip, nodes, pos, t1, "parasol")
|
set_vm_data(manip, pznodes, pos, t1, "parasol")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -370,13 +418,15 @@ function riesenpilz.red45(pos, nodes, area, h1, h2)
|
|||||||
or math.random(4) ~= 2 then
|
or math.random(4) ~= 2 then
|
||||||
nodes[area:index(pos.x+x*j, pos.y+h, pos.z+z*i)] = c.head_red
|
nodes[area:index(pos.x+x*j, pos.y+h, pos.z+z*i)] = c.head_red
|
||||||
end
|
end
|
||||||
local z = z+1
|
local zo = z+1
|
||||||
x = x+1
|
local xo = x+1
|
||||||
nodes[area:index(pos.x+x*j, pos.y+walkspace+2, pos.z+z*i)] = c.head_red
|
nodes[area:index(pos.x + xo * j, pos.y + walkspace + 2,
|
||||||
if z ~= 3
|
pos.z + zo * i)] = c.head_red
|
||||||
or x ~= 3
|
if zo ~= 3
|
||||||
|
or xo ~= 3
|
||||||
or math.random(2) == 1 then
|
or math.random(2) == 1 then
|
||||||
nodes[area:index(pos.x+x*j, pos.y+walkspace+3, pos.z+z*i)] = c.head_red
|
nodes[area:index(pos.x + xo * j, pos.y + walkspace + 3,
|
||||||
|
pos.z + zo * i)] = c.head_red
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -400,11 +450,11 @@ local function riesenpilz_red45(pos)
|
|||||||
|
|
||||||
local manip = minetest.get_voxel_manip()
|
local manip = minetest.get_voxel_manip()
|
||||||
local area = r_area(manip, 3, h, pos)
|
local area = r_area(manip, 3, h, pos)
|
||||||
local nodes = manip:get_data()
|
|
||||||
|
|
||||||
riesenpilz.red45(pos, nodes, area, h1, h2)
|
local pznodes = {}
|
||||||
|
riesenpilz.red45(pos, pznodes, area, h1, h2)
|
||||||
|
|
||||||
set_vm_data(manip, nodes, pos, t1, "red45")
|
set_vm_data(manip, pznodes, pos, t1, "red45")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -430,16 +480,16 @@ function riesenpilz.apple(pos, nodes, area)
|
|||||||
nodes[area:index(pos.x, pos.y+i, pos.z)] = c.tree
|
nodes[area:index(pos.x, pos.y+i, pos.z)] = c.tree
|
||||||
end
|
end
|
||||||
|
|
||||||
local c = pos.y+1
|
local d = pos.y+1
|
||||||
for i = -3,1,1 do
|
for i = -3,1,1 do
|
||||||
nodes[area:index(pos.x+i, c, pos.z+1)] = c.brown
|
nodes[area:index(pos.x+i, d, pos.z+1)] = c.brown
|
||||||
end
|
end
|
||||||
for i = 0,1,1 do
|
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+1, d, pos.z-1-i)] = c.brown
|
||||||
nodes[area:index(pos.x+i+2, c, pos.z-1-i)] = c.brown
|
nodes[area:index(pos.x+i+2, d, pos.z-1-i)] = c.brown
|
||||||
end
|
end
|
||||||
nodes[area:index(pos.x+1, c, pos.z)] = c.brown
|
nodes[area:index(pos.x+1, d, pos.z)] = c.brown
|
||||||
nodes[area:index(pos.x-3, c+1, pos.z+1)] = c.brown
|
nodes[area:index(pos.x-3, d+1, pos.z+1)] = c.brown
|
||||||
end
|
end
|
||||||
|
|
||||||
local function riesenpilz_apple(pos)
|
local function riesenpilz_apple(pos)
|
||||||
@ -447,13 +497,15 @@ local function riesenpilz_apple(pos)
|
|||||||
local t1 = os.clock()
|
local t1 = os.clock()
|
||||||
local manip = minetest.get_voxel_manip()
|
local manip = minetest.get_voxel_manip()
|
||||||
local area = r_area(manip, 5, 14, pos)
|
local area = r_area(manip, 5, 14, pos)
|
||||||
local nodes = manip:get_data()
|
|
||||||
|
|
||||||
riesenpilz.apple(pos, nodes, area)
|
local pznodes = {}
|
||||||
|
riesenpilz.apple(pos, pznodes, area)
|
||||||
|
|
||||||
manip:set_data(nodes)
|
if not set_vm_nodes(manip, pznodes) then
|
||||||
|
return
|
||||||
|
end
|
||||||
manip:write_to_map()
|
manip:write_to_map()
|
||||||
riesenpilz.inform("an apple grew at "..vector.pos_to_string(pos), 3, t1)
|
riesenpilz.inform("an apple grew at " .. minetest.pos_to_string(pos), 3, t1)
|
||||||
manip:update_map()
|
manip:update_map()
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -490,7 +542,7 @@ end
|
|||||||
local abm_allowed = true
|
local abm_allowed = true
|
||||||
local disallowed_ps = {}
|
local disallowed_ps = {}
|
||||||
|
|
||||||
for name,i in pairs({
|
for name, ndata in pairs({
|
||||||
brown = {
|
brown = {
|
||||||
description = "brown mushroom",
|
description = "brown mushroom",
|
||||||
box = {
|
box = {
|
||||||
@ -506,6 +558,7 @@ for name,i in pairs({
|
|||||||
interval = 100,
|
interval = 100,
|
||||||
chance = 18,
|
chance = 18,
|
||||||
},
|
},
|
||||||
|
hp = 2,
|
||||||
},
|
},
|
||||||
red = {
|
red = {
|
||||||
description = "red mushroom",
|
description = "red mushroom",
|
||||||
@ -524,6 +577,7 @@ for name,i in pairs({
|
|||||||
interval = 50,
|
interval = 50,
|
||||||
chance = 30,
|
chance = 30,
|
||||||
},
|
},
|
||||||
|
hp = -2,
|
||||||
},
|
},
|
||||||
fly_agaric = {
|
fly_agaric = {
|
||||||
description = "fly agaric",
|
description = "fly agaric",
|
||||||
@ -540,6 +594,7 @@ for name,i in pairs({
|
|||||||
interval = 101,
|
interval = 101,
|
||||||
chance = 30,
|
chance = 30,
|
||||||
},
|
},
|
||||||
|
hp = -6,
|
||||||
},
|
},
|
||||||
lavashroom = {
|
lavashroom = {
|
||||||
description = "Lavashroom",
|
description = "Lavashroom",
|
||||||
@ -557,6 +612,7 @@ for name,i in pairs({
|
|||||||
interval = 1010,
|
interval = 1010,
|
||||||
chance = 60,
|
chance = 60,
|
||||||
},
|
},
|
||||||
|
hp = -1,
|
||||||
},
|
},
|
||||||
glowshroom = {
|
glowshroom = {
|
||||||
description = "Glowshroom",
|
description = "Glowshroom",
|
||||||
@ -577,6 +633,7 @@ for name,i in pairs({
|
|||||||
interval = 710,
|
interval = 710,
|
||||||
chance = 320,
|
chance = 320,
|
||||||
},
|
},
|
||||||
|
hp = -2,
|
||||||
},
|
},
|
||||||
nether_shroom = {
|
nether_shroom = {
|
||||||
description = "Nether mushroom",
|
description = "Nether mushroom",
|
||||||
@ -590,6 +647,7 @@ for name,i in pairs({
|
|||||||
{ 2/16, -1/16, -2/16, 4/16, 1/16, 2/16}
|
{ 2/16, -1/16, -2/16, 4/16, 1/16, 2/16}
|
||||||
},
|
},
|
||||||
burntime = 6,
|
burntime = 6,
|
||||||
|
hp = -3,
|
||||||
},
|
},
|
||||||
parasol = {
|
parasol = {
|
||||||
description = "white parasol mushroom",
|
description = "white parasol mushroom",
|
||||||
@ -608,6 +666,7 @@ for name,i in pairs({
|
|||||||
interval = 51,
|
interval = 51,
|
||||||
chance = 36,
|
chance = 36,
|
||||||
},
|
},
|
||||||
|
hp = 3,
|
||||||
},
|
},
|
||||||
red45 = {
|
red45 = {
|
||||||
description = "45 red mushroom",
|
description = "45 red mushroom",
|
||||||
@ -627,6 +686,7 @@ for name,i in pairs({
|
|||||||
interval = 1000,
|
interval = 1000,
|
||||||
chance = 180,
|
chance = 180,
|
||||||
},
|
},
|
||||||
|
hp = 1,
|
||||||
},
|
},
|
||||||
brown45 = {
|
brown45 = {
|
||||||
description = "45 brown mushroom",
|
description = "45 brown mushroom",
|
||||||
@ -645,17 +705,26 @@ for name,i in pairs({
|
|||||||
interval = 100,
|
interval = 100,
|
||||||
chance = 20,
|
chance = 20,
|
||||||
},
|
},
|
||||||
|
hp = 1,
|
||||||
},
|
},
|
||||||
}) do
|
}) do
|
||||||
local burntime = i.burntime or 1
|
local burntime = ndata.burntime or 1
|
||||||
local box = {
|
local box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = i.box
|
fixed = ndata.box
|
||||||
}
|
}
|
||||||
local nd = "riesenpilz:"..name
|
local nd = "riesenpilz:" .. name
|
||||||
minetest.register_node(nd, {
|
minetest.register_node(nd, {
|
||||||
description = i.description,
|
description = ndata.description,
|
||||||
tiles = {"riesenpilz_"..name.."_top.png", "riesenpilz_"..name.."_bottom.png", "riesenpilz_"..name.."_side.png"},
|
tiles = {
|
||||||
|
--~ {name = "riesenpilz_"..name.."_top.png", tileable_vertical = false},
|
||||||
|
--~ {name = "riesenpilz_"..name.."_bottom.png", tileable_vertical = false},
|
||||||
|
--~ {name = "riesenpilz_"..name.."_side.png", tileable_vertical = false},
|
||||||
|
"riesenpilz_" .. name .. "_top.png",
|
||||||
|
"riesenpilz_" .. name .. "_bottom.png",
|
||||||
|
"riesenpilz_" .. name .. "_side.png",
|
||||||
|
},
|
||||||
|
use_texture_alpha = "opaque",
|
||||||
inventory_image = "riesenpilz_"..name.."_side.png",
|
inventory_image = "riesenpilz_"..name.."_side.png",
|
||||||
walkable = false,
|
walkable = false,
|
||||||
buildable_to = true,
|
buildable_to = true,
|
||||||
@ -665,10 +734,11 @@ for name,i in pairs({
|
|||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
node_box = box,
|
node_box = box,
|
||||||
selection_box = box,
|
selection_box = box,
|
||||||
furnace_burntime = burntime
|
furnace_burntime = burntime,
|
||||||
|
on_secondary_use = minetest.item_eat(ndata.hp),
|
||||||
})
|
})
|
||||||
|
|
||||||
local g = i.growing
|
local g = ndata.growing
|
||||||
|
|
||||||
if g then
|
if g then
|
||||||
local grounds = g.grounds
|
local grounds = g.grounds
|
||||||
@ -705,6 +775,7 @@ for name,i in pairs({
|
|||||||
neighbors = g.neighbours,
|
neighbors = g.neighbours,
|
||||||
interval = g.interval,
|
interval = g.interval,
|
||||||
chance = g.chance,
|
chance = g.chance,
|
||||||
|
catch_up = false,
|
||||||
action = function(pos, node)
|
action = function(pos, node)
|
||||||
if not abm_allowed then
|
if not abm_allowed then
|
||||||
return
|
return
|
||||||
@ -729,8 +800,8 @@ for name,i in pairs({
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
local groups = data.groups
|
local groups = data.groups
|
||||||
for n,i in pairs(grounds) do
|
for groupname, groupvalue in pairs(grounds) do
|
||||||
if groups[n] ~= i then
|
if groups[groupname] ~= groupvalue then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -745,36 +816,36 @@ for name,i in pairs({
|
|||||||
-- should disallow lag
|
-- should disallow lag
|
||||||
abm_allowed = false
|
abm_allowed = false
|
||||||
minetest.after(2, function() abm_allowed = true end)
|
minetest.after(2, function() abm_allowed = true end)
|
||||||
table.insert(disallowed_ps, pos)
|
disallowed_ps[#disallowed_ps+1] = pos
|
||||||
|
|
||||||
-- witch circles
|
-- witch circles
|
||||||
local ps = {}
|
local ps = {}
|
||||||
for _,p in pairs(vector.circle(math.random(rmin, rmax))) do
|
for _,p in pairs(riesenpilz.circle(math.random(rmin, rmax))) do
|
||||||
local p = vector.add(pos, p)
|
p = vector.add(pos, p)
|
||||||
|
|
||||||
-- currently 3 is used here, approved by its use in the mapgen
|
-- currently 3 is used here, approved by its use in the mapgen
|
||||||
if math.random(3) == 1 then
|
if math.random(3) == 1 then
|
||||||
|
|
||||||
-- don't only use the current y for them
|
-- don't only use the current y for them
|
||||||
for y = 1,-1,-1 do
|
for y = 1,-1,-1 do
|
||||||
local pos = {x=p.x, y=p.y+y, z=p.z}
|
local pos_above = {x=p.x, y=p.y+y, z=p.z}
|
||||||
if minetest.get_node(pos).name ~= "air" then
|
if minetest.get_node(pos_above).name ~= "air" then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
local f = minetest.get_node({x=p.x, y=p.y+y-1, z=p.z}).name
|
local f = minetest.get_node({x=p.x, y=p.y+y-1, z=p.z}).name
|
||||||
if f ~= "air" then
|
if f ~= "air" then
|
||||||
|
|
||||||
-- they grown on specific nodes
|
-- they grown on specific nodes
|
||||||
local data = minetest.registered_nodes[f]
|
local data_ground = minetest.registered_nodes[f]
|
||||||
if data
|
if data_ground
|
||||||
and data.walkable
|
and data_ground.walkable
|
||||||
and data.groups
|
and data_ground.groups
|
||||||
and (not data.drawtype
|
and (not data_ground.drawtype
|
||||||
or data.drawtype == "normal"
|
or data_ground.drawtype == "normal"
|
||||||
) then
|
) then
|
||||||
local ground_disallowed
|
local ground_disallowed
|
||||||
for n,i in pairs(grounds) do
|
for n,i in pairs(grounds) do
|
||||||
if data.groups[n] ~= i then
|
if data_ground.groups[n] ~= i then
|
||||||
ground_disallowed = true
|
ground_disallowed = true
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
@ -782,10 +853,11 @@ for name,i in pairs({
|
|||||||
if not ground_disallowed then
|
if not ground_disallowed then
|
||||||
|
|
||||||
-- they also need specific light strengths
|
-- they also need specific light strengths
|
||||||
local light = minetest.get_node_light(pos, 0.5)
|
local light = minetest.get_node_light(
|
||||||
|
pos_above, 0.5)
|
||||||
if light >= lmin
|
if light >= lmin
|
||||||
and light <= lmax then
|
and light <= lmax then
|
||||||
table.insert(ps, pos)
|
ps[#ps+1] = pos_above
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -832,7 +904,7 @@ local head_sounds = default.node_sound_wood_defaults({
|
|||||||
local add_fence = minetest.register_fence
|
local add_fence = minetest.register_fence
|
||||||
local node_groups = {oddly_breakable_by_hand=3, fall_damage_add_percent=-80, bouncy=10}
|
local node_groups = {oddly_breakable_by_hand=3, fall_damage_add_percent=-80, bouncy=10}
|
||||||
|
|
||||||
for _,i in pairs({
|
for _, ndata in ipairs({
|
||||||
{
|
{
|
||||||
typ = "stem",
|
typ = "stem",
|
||||||
description = "white",
|
description = "white",
|
||||||
@ -914,8 +986,8 @@ for _,i in pairs({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
typ = "head",
|
typ = "head",
|
||||||
name = "binge",
|
name = "beige",
|
||||||
textures = {"head_binge.png", "head_white.png", "head_binge.png"},
|
textures = {"head_beige.png", "head_white.png", "head_beige.png"},
|
||||||
sapling = "parasol"
|
sapling = "parasol"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -927,8 +999,8 @@ for _,i in pairs({
|
|||||||
},
|
},
|
||||||
}) do
|
}) do
|
||||||
-- fill missing stuff
|
-- fill missing stuff
|
||||||
local textures = i.textures
|
local textures = ndata.textures
|
||||||
i.description = i.description or i.name
|
ndata.description = ndata.description or ndata.name
|
||||||
if type(textures) == "string" then
|
if type(textures) == "string" then
|
||||||
textures = {textures}
|
textures = {textures}
|
||||||
end
|
end
|
||||||
@ -937,25 +1009,26 @@ for _,i in pairs({
|
|||||||
end
|
end
|
||||||
local nodename = "riesenpilz:"
|
local nodename = "riesenpilz:"
|
||||||
local desctiption,sounds = "giant mushroom "
|
local desctiption,sounds = "giant mushroom "
|
||||||
if i.typ == "stem" then
|
if ndata.typ == "stem" then
|
||||||
desctiption = desctiption.."stem "..i.description
|
desctiption = desctiption .. "stem " .. ndata.description
|
||||||
nodename = nodename.."stem"..((i.name and "_"..i.name) or "")
|
nodename = nodename .. "stem" ..
|
||||||
|
((ndata.name and "_" .. ndata.name) or "")
|
||||||
sounds = default.node_sound_wood_defaults({
|
sounds = default.node_sound_wood_defaults({
|
||||||
footstep = {name="riesenpilz_stem", gain=0.2},
|
footstep = {name="riesenpilz_stem", gain=0.2},
|
||||||
place = {name="default_place_node", gain=0.5},
|
place = {name="default_place_node", gain=0.5},
|
||||||
dig = {name="riesenpilz_stem", gain=0.4},
|
dig = {name="riesenpilz_stem", gain=0.4},
|
||||||
dug = {name="default_wood_footstep", gain=0.3}
|
dug = {name="default_wood_footstep", gain=0.3}
|
||||||
})
|
})
|
||||||
elseif i.typ == "head" then
|
elseif ndata.typ == "head" then
|
||||||
desctiption = desctiption.."head "..i.description
|
desctiption = desctiption .. "head " .. ndata.description
|
||||||
nodename = nodename.."head_"..i.name
|
nodename = nodename .. "head_" .. ndata.name
|
||||||
sounds = head_sounds
|
sounds = head_sounds
|
||||||
else
|
else
|
||||||
nodename = nodename..i.name
|
nodename = nodename .. ndata.name
|
||||||
desctiption = desctiption..i.description
|
desctiption = desctiption .. ndata.description
|
||||||
end
|
end
|
||||||
local drop = i.sapling and {max_items = 1, items = {
|
local drop = ndata.sapling and {max_items = 1, items = {
|
||||||
{items = {"riesenpilz:"..i.sapling}, rarity = 20},
|
{items = {"riesenpilz:" .. ndata.sapling}, rarity = 20},
|
||||||
{items = {nodename}, rarity = 1}
|
{items = {nodename}, rarity = 1}
|
||||||
}}
|
}}
|
||||||
minetest.register_node(nodename, {
|
minetest.register_node(nodename, {
|
||||||
@ -967,7 +1040,7 @@ for _,i in pairs({
|
|||||||
})
|
})
|
||||||
|
|
||||||
if add_fence
|
if add_fence
|
||||||
and i.fence ~= false then
|
and ndata.fence ~= false then
|
||||||
add_fence({fence_of = nodename})
|
add_fence({fence_of = nodename})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1018,7 +1091,7 @@ c = {
|
|||||||
head_blue_bright = minetest.get_content_id("riesenpilz:head_blue_bright"),
|
head_blue_bright = minetest.get_content_id("riesenpilz:head_blue_bright"),
|
||||||
|
|
||||||
head_white = minetest.get_content_id("riesenpilz:head_white"),
|
head_white = minetest.get_content_id("riesenpilz:head_white"),
|
||||||
head_binge = minetest.get_content_id("riesenpilz:head_binge"),
|
head_beige = minetest.get_content_id("riesenpilz:head_beige"),
|
||||||
head_brown_bright = minetest.get_content_id("riesenpilz:head_brown_bright"),
|
head_brown_bright = minetest.get_content_id("riesenpilz:head_brown_bright"),
|
||||||
|
|
||||||
stem_red = minetest.get_content_id("riesenpilz:stem_red"),
|
stem_red = minetest.get_content_id("riesenpilz:stem_red"),
|
||||||
@ -1038,37 +1111,88 @@ minetest.register_tool("riesenpilz:growingtool", {
|
|||||||
inventory_image = "riesenpilz_growingtool.png",
|
inventory_image = "riesenpilz_growingtool.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
local grow_functions = {
|
||||||
|
["riesenpilz:red"] = riesenpilz_hybridpilz,
|
||||||
|
["riesenpilz:fly_agaric"] = riesenpilz_minecraft_fliegenpilz,
|
||||||
|
["riesenpilz:brown"] = riesenpilz_brauner_minecraftpilz,
|
||||||
|
["riesenpilz:lavashroom"] = riesenpilz_lavashroom,
|
||||||
|
["riesenpilz:glowshroom"] = riesenpilz_glowshroom,
|
||||||
|
["riesenpilz:parasol"] = riesenpilz_parasol,
|
||||||
|
["riesenpilz:red45"] = riesenpilz_red45,
|
||||||
|
["default:apple"] = riesenpilz_apple
|
||||||
|
}
|
||||||
|
local function get_grow(name)
|
||||||
|
if grow_functions[name] then
|
||||||
|
return grow_functions[name]
|
||||||
|
end
|
||||||
|
|
||||||
|
local is = {}
|
||||||
|
for i = 1,#minetest.registered_abms do
|
||||||
|
local ad = minetest.registered_abms[i]
|
||||||
|
if type(ad.nodenames) ~= "table" then
|
||||||
|
minetest.log("warning", "ABM nodenames is not a table: " ..
|
||||||
|
dump(ad))
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if ad.chance > 1
|
||||||
|
and table.indexof(ad.nodenames, name) ~= -1 then
|
||||||
|
is[#is+1] = ad.action
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local func
|
||||||
|
if is[1] then
|
||||||
|
function func(pos, node)
|
||||||
|
for i = 1,#is do
|
||||||
|
is[i](pos, node)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
local def = minetest.registered_nodes[name]
|
||||||
|
if def then
|
||||||
|
if def.on_timer then
|
||||||
|
func = def.on_timer
|
||||||
|
else
|
||||||
|
func = function(pos, _, player)
|
||||||
|
if def.on_place then
|
||||||
|
def.on_place(ItemStack(name), player, {
|
||||||
|
type = "node",
|
||||||
|
under = vector.new(pos),--{x=pos.x, y=pos.y-1, z=pos.z},
|
||||||
|
above = vector.new(pos)
|
||||||
|
})
|
||||||
|
end
|
||||||
|
if def.after_place_node then
|
||||||
|
def.after_place_node(pos)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
func = function() end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
grow_functions[name] = func
|
||||||
|
return func
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_on_punchnode(function(pos, node, player)
|
minetest.register_on_punchnode(function(pos, node, player)
|
||||||
if player:get_wielded_item():get_name() ~= "riesenpilz:growingtool"
|
if player:get_wielded_item():get_name() ~= "riesenpilz:growingtool"
|
||||||
or minetest.is_protected(pos, player:get_player_name()) then
|
or minetest.is_protected(pos, player:get_player_name()) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local name = node.name
|
local func = get_grow(node.name)
|
||||||
if name == "riesenpilz:red" then
|
if func then
|
||||||
riesenpilz_hybridpilz(pos)
|
func(pos, node, player)
|
||||||
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
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- Food
|
-- Uses
|
||||||
|
|
||||||
|
|
||||||
|
-- mush45's meal
|
||||||
minetest.register_craftitem("riesenpilz:mush45_meal", {
|
minetest.register_craftitem("riesenpilz:mush45_meal", {
|
||||||
description = "Mushroom Meal",
|
description = "Mushroom Meal",
|
||||||
inventory_image = "riesenpilz_mush45_meal.png",
|
inventory_image = "riesenpilz_mush45_meal.png",
|
||||||
@ -1084,11 +1208,67 @@ minetest.register_craft({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
--[[ unfinished
|
||||||
|
if minetest.global_exists(technic) then
|
||||||
|
if minetest.global_exists(digilines) then
|
||||||
|
-- digiline light value detector
|
||||||
|
minetest.register_node("riesenpilz:light_detector" {
|
||||||
|
tiles = {"riesenpilz_light_detector.png"},
|
||||||
|
paramtype = "light",
|
||||||
|
digiline = {
|
||||||
|
receive = function(pos)
|
||||||
|
local light = minetest.get_node_light(pos)
|
||||||
|
send("light_detector", light)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
--sounds = ,
|
||||||
|
})
|
||||||
|
|
||||||
|
--technic.comp({"riesenpilz:glowshroom 10", "coal"}, "riesenpilz:light_detector")
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--[ [
|
||||||
|
if minetest.global_exists(3darmor) then add to depends
|
||||||
|
--lavashroom skin armor, swimming in lava possible
|
||||||
|
|
||||||
|
minetest.register_craftitem("riesenpilz:lavashroom_flesh", {
|
||||||
|
description = "lavashroom's flesh",
|
||||||
|
inventory_image = "riesenpilz_lavashroom_flesh.png",
|
||||||
|
on_use = minetest.item_eat(3),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem("riesenpilz:lavashroom_skin", {
|
||||||
|
description = "lavashroom's skin",
|
||||||
|
inventory_image = "riesenpilz_lavashroom_skin.png",
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem("riesenpilz:antilava_plate", {
|
||||||
|
description = "lava protecting plate",
|
||||||
|
inventory_image = "riesenpilz_antilava_plate.png",
|
||||||
|
})
|
||||||
|
|
||||||
|
technic.centri("riesenpilz:lavashroom", {"riesenpilz:lavashroom_flesh", "riesenpilz:lavashroom_skin"})
|
||||||
|
technic.comp("riesenpilz:lavashroom_skin 5", "riesenpilz:antilava_plate")
|
||||||
|
|
||||||
|
armor_register(plate blah)
|
||||||
|
end--] ]
|
||||||
|
})
|
||||||
|
end--]]
|
||||||
|
|
||||||
|
|
||||||
if riesenpilz.enable_mapgen then
|
if riesenpilz.enable_mapgen then
|
||||||
dofile(modpath.."mapgen.lua")
|
dofile(modpath.."mapgen.lua")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- Legacy
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_alias("riesenpilz:head_binge", "riesenpilz:head_beige")
|
||||||
|
|
||||||
|
|
||||||
local time = math.floor(tonumber(os.clock()-load_time_start)*100+0.5)/100
|
local time = math.floor(tonumber(os.clock()-load_time_start)*100+0.5)/100
|
||||||
local msg = "[riesenpilz] loaded after ca. "..time
|
local msg = "[riesenpilz] loaded after ca. "..time
|
||||||
if time > 0.05 then
|
if time > 0.05 then
|
||||||
|
237
mapgen.lua
@ -6,6 +6,7 @@ local function define_contents()
|
|||||||
ignore = minetest.get_content_id("ignore"),
|
ignore = minetest.get_content_id("ignore"),
|
||||||
air = minetest.get_content_id("air"),
|
air = minetest.get_content_id("air"),
|
||||||
|
|
||||||
|
water = minetest.get_content_id("default:water_source"),
|
||||||
stone = minetest.get_content_id("default:stone"),
|
stone = minetest.get_content_id("default:stone"),
|
||||||
dirt = minetest.get_content_id("default:dirt"),
|
dirt = minetest.get_content_id("default:dirt"),
|
||||||
desert_sand = minetest.get_content_id("default:desert_sand"),
|
desert_sand = minetest.get_content_id("default:desert_sand"),
|
||||||
@ -20,7 +21,6 @@ local function define_contents()
|
|||||||
riesenpilz_glowshroom = minetest.get_content_id("riesenpilz:glowshroom"),
|
riesenpilz_glowshroom = minetest.get_content_id("riesenpilz:glowshroom"),
|
||||||
riesenpilz_parasol = minetest.get_content_id("riesenpilz:parasol"),
|
riesenpilz_parasol = minetest.get_content_id("riesenpilz:parasol"),
|
||||||
|
|
||||||
GROUND = {},
|
|
||||||
TREE_STUFF = {
|
TREE_STUFF = {
|
||||||
minetest.get_content_id("default:tree"),
|
minetest.get_content_id("default:tree"),
|
||||||
minetest.get_content_id("default:leaves"),
|
minetest.get_content_id("default:leaves"),
|
||||||
@ -29,74 +29,75 @@ local function define_contents()
|
|||||||
minetest.get_content_id("default:jungleleaves"),
|
minetest.get_content_id("default:jungleleaves"),
|
||||||
minetest.get_content_id("default:junglegrass"),
|
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
|
end
|
||||||
|
|
||||||
|
|
||||||
local function find_ground(a,list)
|
local grounds = {}
|
||||||
for i = 1,#list do
|
local function is_ground(id)
|
||||||
if a == list[i] then
|
local is = grounds[id]
|
||||||
return true
|
if is ~= nil then
|
||||||
end
|
return is
|
||||||
end
|
end
|
||||||
|
local data = minetest.registered_nodes[minetest.get_name_from_content_id(id)]
|
||||||
|
if not data
|
||||||
|
or data.paramtype == "light" then
|
||||||
|
grounds[id] = false
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
local groups = data.groups
|
||||||
|
if groups
|
||||||
|
and (groups.crumbly == 3 or groups.soil == 1) then
|
||||||
|
grounds[id] = true
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
grounds[id] = false
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local toremoves = {}
|
||||||
|
local function is_toremove(id)
|
||||||
|
local is = toremoves[id]
|
||||||
|
if is ~= nil then
|
||||||
|
return is
|
||||||
|
end
|
||||||
|
local data = minetest.registered_nodes[minetest.get_name_from_content_id(id)]
|
||||||
|
if not data then
|
||||||
|
toremoves[id] = false
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
local groups = data.groups
|
||||||
|
if groups
|
||||||
|
and groups.flammable then
|
||||||
|
toremoves[id] = true
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
toremoves[id] = false
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local data, area
|
local data = {}
|
||||||
function riesenpilz_circle(nam, pos, radius, chance)
|
local area, pr
|
||||||
for _,p in pairs(vector.circle(radius)) do
|
local function make_circle(nam, pos, radius, chance)
|
||||||
if pr:next(1,chance) == 1 then
|
local circle = riesenpilz.circle(radius)
|
||||||
local p = vector.add(pos, p)
|
for i = 1, #circle do
|
||||||
local p_p = area:indexp(p)
|
if pr:next(1, chance) == 1 then
|
||||||
if (data[p_p] == c.air or data[p_p] == c.ignore)
|
local vi = area:indexp(vector.add(pos, circle[i]))
|
||||||
and find_ground(data[area:index(p.x, p.y-1, p.z)], c.GROUND) then
|
if data[vi] == c.air
|
||||||
data[p_p] = nam
|
and is_ground(data[vi - area.ystride]) then
|
||||||
|
data[vi] = nam
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function say_info(info)
|
|
||||||
local info = "[riesenpilz] "..info
|
|
||||||
print(info)
|
|
||||||
minetest.chat_send_all(info)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- perlin noise "hills" are not peaks but looking like sinus curve
|
local nosmooth_rarity = 0.5
|
||||||
local function upper_rarity(rarity)
|
local smooth_rarity_max = 0.6
|
||||||
return math.sign(rarity)*math.sin(math.abs(rarity)*math.pi/2)
|
local smooth_rarity_min = 0.4
|
||||||
end
|
local smooth_rarity_dif = smooth_rarity_max - smooth_rarity_min
|
||||||
|
local perlin_scale = 500
|
||||||
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"}
|
|
||||||
|
|
||||||
local contents_defined
|
local contents_defined
|
||||||
minetest.register_on_generated(function(minp, maxp, seed)
|
minetest.register_on_generated(function(minp, maxp, seed)
|
||||||
@ -127,7 +128,9 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local t1 = os.clock()
|
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)
|
riesenpilz.inform(("tries to generate a giant mushroom biome at: " ..
|
||||||
|
"x=[%d; %d]; y=[%d; %d]; z=[%d; %d]"):format(minp.x, maxp.x, minp.y,
|
||||||
|
maxp.y, minp.z, maxp.z), 2)
|
||||||
|
|
||||||
if not contents_defined then
|
if not contents_defined then
|
||||||
define_contents()
|
define_contents()
|
||||||
@ -141,9 +144,10 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
|
|
||||||
local heightmap = minetest.get_mapgen_object("heightmap")
|
local heightmap = minetest.get_mapgen_object("heightmap")
|
||||||
local hmi = 1
|
local hmi = 1
|
||||||
|
local hm_zstride = divs+1
|
||||||
|
|
||||||
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
||||||
data = vm:get_data()
|
vm:get_data(data)
|
||||||
area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
|
area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
|
||||||
|
|
||||||
for p_pos in area:iterp(minp, maxp) do --remove tree stuff
|
for p_pos in area:iterp(minp, maxp) do --remove tree stuff
|
||||||
@ -166,7 +170,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
--smooth mapgen
|
--smooth mapgen
|
||||||
if riesenpilz.always_generate then
|
if riesenpilz.always_generate then
|
||||||
in_biome = true
|
in_biome = true
|
||||||
elseif smooth then
|
elseif riesenpilz.smooth then
|
||||||
if test >= smooth_rarity_max
|
if test >= smooth_rarity_max
|
||||||
or (
|
or (
|
||||||
test > smooth_rarity_min
|
test > smooth_rarity_min
|
||||||
@ -180,59 +184,62 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
|
|
||||||
if in_biome then
|
if in_biome then
|
||||||
|
|
||||||
local ymin = math.max(heightmap[hmi]-5, minp.y) -- -1
|
local ymin = math.max(heightmap[hmi]-5, minp.y)
|
||||||
|
local ymax = math.min(heightmap[hmi]+20, maxp.y)
|
||||||
|
|
||||||
-- skip the air part
|
-- skip the air part
|
||||||
local ground
|
local ground
|
||||||
for y = math.min(heightmap[hmi]+20, maxp.y),ymin,-1 do
|
local vi = area:index(x, ymax, z)
|
||||||
if data[area:index(x, y, z)] ~= c.air then
|
for y = ymax, ymin, -1 do
|
||||||
|
if data[vi] ~= c.air then
|
||||||
ground = y
|
ground = y
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
vi = vi - area.ystride
|
||||||
end
|
end
|
||||||
|
|
||||||
local ground_y
|
local ground_y
|
||||||
if ground then
|
if ground then
|
||||||
for y = ground,ymin,-1 do
|
for y = ground, ymin, -1 do
|
||||||
local p_pos = area:index(x, y, z)
|
local d_p_pos = data[vi]
|
||||||
local d_p_pos = data[p_pos]
|
if is_toremove(d_p_pos) then
|
||||||
for _,nam in pairs(c.USUAL_STUFF) do --remove usual stuff
|
-- remove trees etc.
|
||||||
if d_p_pos == nam then
|
data[vi] = c.air
|
||||||
data[p_pos] = c.air
|
else
|
||||||
p_pos = nil
|
if is_ground(d_p_pos) then
|
||||||
break
|
ground_y = y
|
||||||
|
heightmap[hmi] = y
|
||||||
end
|
end
|
||||||
end
|
|
||||||
if p_pos --else search ground_y
|
|
||||||
and find_ground(d_p_pos, c.GROUND) then
|
|
||||||
ground_y = y
|
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
vi = vi - area.ystride
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if ground_y then
|
if ground_y then
|
||||||
data[area:index(x, ground_y, z)] = c.ground
|
-- add ground and dirt below if needed
|
||||||
for i = -1,-5,-1 do
|
data[vi] = c.ground
|
||||||
local p_pos = area:index(x, ground_y+i, z)
|
for off = -1,-5,-1 do
|
||||||
if data[p_pos] == c.desert_sand then
|
local p_pos = vi + off * area.ystride
|
||||||
data[p_pos] = c.dirt
|
if not is_ground(data[p_pos])
|
||||||
else
|
or data[p_pos] == c.dirt then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
data[p_pos] = c.dirt
|
||||||
end
|
end
|
||||||
|
|
||||||
local bigtype
|
local bigtype
|
||||||
local boden = {x=x,y=ground_y+1,z=z}
|
local boden = {x=x,y=ground_y+1,z=z}
|
||||||
if pr:next(1,15) == 1 then
|
if pr:next(1,15) == 1 then
|
||||||
data[area:index(x, ground_y+1, z)] = c.dry_shrub
|
data[vi + area.ystride] = c.dry_shrub
|
||||||
elseif pr:next(1,80) == 1 then
|
elseif pr:next(1,80) == 1 then
|
||||||
riesenpilz_circle(c.riesenpilz_brown, boden, pr:next(3,4), 3)
|
make_circle(c.riesenpilz_brown, boden, pr:next(3,4), 3)
|
||||||
elseif pr:next(1,85) == 1 then
|
elseif pr:next(1,85) == 1 then
|
||||||
riesenpilz_circle(c.riesenpilz_parasol, boden, pr:next(3,5), 3)
|
make_circle(c.riesenpilz_parasol, boden, pr:next(3,5), 3)
|
||||||
elseif pr:next(1,90) == 1 then
|
elseif pr:next(1,90) == 1 then
|
||||||
riesenpilz_circle(c.riesenpilz_red, boden, pr:next(4,5), 3)
|
make_circle(c.riesenpilz_red, boden, pr:next(4,5), 3)
|
||||||
elseif pr:next(1,100) == 1 then
|
elseif pr:next(1,100) == 1 then
|
||||||
riesenpilz_circle(c.riesenpilz_fly_agaric, boden, 4, 3)
|
make_circle(c.riesenpilz_fly_agaric, boden, 4, 3)
|
||||||
elseif pr:next(1,340) == 10 then
|
elseif pr:next(1,340) == 10 then
|
||||||
bigtype = 2
|
bigtype = 2
|
||||||
elseif pr:next(1,380) == 1 then
|
elseif pr:next(1,380) == 1 then
|
||||||
@ -242,9 +249,9 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
elseif pr:next(1,800) == 7 then
|
elseif pr:next(1,800) == 7 then
|
||||||
bigtype = 5
|
bigtype = 5
|
||||||
elseif pr:next(1,4000) == 1 then
|
elseif pr:next(1,4000) == 1 then
|
||||||
riesenpilz_circle(c.riesenpilz_lavashroom, boden, pr:next(5,6), 3)
|
make_circle(c.riesenpilz_lavashroom, boden, pr:next(5,6), 3)
|
||||||
elseif pr:next(1,5000) == 1 then
|
elseif pr:next(1,5000) == 1 then
|
||||||
riesenpilz_circle(c.riesenpilz_glowshroom, boden, 3, 3)
|
make_circle(c.riesenpilz_glowshroom, boden, 3, 3)
|
||||||
elseif pr:next(1,6000) == 2 then
|
elseif pr:next(1,6000) == 2 then
|
||||||
if pr:next(1,200) == 15 then
|
if pr:next(1,200) == 15 then
|
||||||
bigtype = 4
|
bigtype = 4
|
||||||
@ -268,22 +275,51 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
local t2 = os.clock()
|
local t2 = os.clock()
|
||||||
for _,v in pairs(tab) do
|
for _,v in pairs(tab) do
|
||||||
local p = v[2]
|
local p = v[2]
|
||||||
local m = v[1]
|
|
||||||
if m == 1 then
|
-- simple test for the distance to the biome border
|
||||||
riesenpilz.red(p, data, area)
|
local found_border = false
|
||||||
elseif m == 2 then
|
local dist = 5
|
||||||
riesenpilz.brown(p, data, area)
|
local xmin = math.max(minp.x, p.x - dist)
|
||||||
elseif m == 3 then
|
local xmax = math.min(maxp.x, p.x + dist)
|
||||||
if not param2s then
|
local hm_vi = (p.z - minp.z) * hm_zstride + xmin - minp.x + 1
|
||||||
param2s = vm:get_param2_data()
|
for _ = xmin, xmax do
|
||||||
|
if not heightmap[hm_vi] then
|
||||||
|
found_border = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
hm_vi = hm_vi+1
|
||||||
|
end
|
||||||
|
if not found_border then
|
||||||
|
local zmin = math.max(minp.z, p.z - dist)
|
||||||
|
local zmax = math.min(maxp.z, p.z + dist)
|
||||||
|
hm_vi = (zmin - minp.z) * hm_zstride + p.x - minp.x + 1
|
||||||
|
for _ = zmin, zmax do
|
||||||
|
if not heightmap[hm_vi] then
|
||||||
|
found_border = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
hm_vi = hm_vi + hm_zstride
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if not found_border then
|
||||||
|
local m = v[1]
|
||||||
|
if m == 1 then
|
||||||
|
riesenpilz.red(p, data, area)
|
||||||
|
elseif m == 2 then
|
||||||
|
riesenpilz.brown(p, data, area)
|
||||||
|
elseif m == 3 then
|
||||||
|
if not param2s then
|
||||||
|
param2s = vm:get_param2_data()
|
||||||
|
end
|
||||||
|
riesenpilz.fly_agaric(p, data, area, param2s)
|
||||||
|
elseif m == 4 then
|
||||||
|
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.fly_agaric(p, data, area, param2s)
|
|
||||||
elseif m == 4 then
|
|
||||||
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
|
||||||
end
|
end
|
||||||
riesenpilz.inform("giant shrooms generated", 2, t2)
|
riesenpilz.inform("giant shrooms generated", 2, t2)
|
||||||
@ -297,7 +333,6 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
vm:set_lighting({day=0, night=0})
|
vm:set_lighting({day=0, night=0})
|
||||||
vm:calc_lighting()
|
vm:calc_lighting()
|
||||||
vm:write_to_map()
|
vm:write_to_map()
|
||||||
data = nil
|
|
||||||
area = nil
|
area = nil
|
||||||
riesenpilz.inform("data set", 2, t2)
|
riesenpilz.inform("data set", 2, t2)
|
||||||
|
|
||||||
|
3
mod.conf
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
name = riesenpilz
|
||||||
|
depends = default
|
||||||
|
optional_depends = digilines,fence_registration,technic
|
15
settings.lua
@ -1,6 +1,7 @@
|
|||||||
--This file contains configuration options for riesenpilz mod.
|
--This file contains configuration options for riesenpilz mod.
|
||||||
|
|
||||||
riesenpilz.enable_mapgen = true
|
-- mapgen size etc. does not work
|
||||||
|
riesenpilz.enable_mapgen = false
|
||||||
|
|
||||||
--Generate giant mushroom biomes everywhere
|
--Generate giant mushroom biomes everywhere
|
||||||
riesenpilz.always_generate = false
|
riesenpilz.always_generate = false
|
||||||
@ -8,15 +9,6 @@ riesenpilz.always_generate = false
|
|||||||
--Enables smooth transition of biomes.
|
--Enables smooth transition of biomes.
|
||||||
riesenpilz.smooth = true
|
riesenpilz.smooth = true
|
||||||
|
|
||||||
--rarity in %
|
|
||||||
riesenpilz.mapgen_rarity = 0.4
|
|
||||||
|
|
||||||
--size of the generated... (has an effect to the rarity, too)
|
|
||||||
riesenpilz.mapgen_size = 200
|
|
||||||
|
|
||||||
--approximate size of smooth transitions
|
|
||||||
riesenpilz.smooth_trans_size = 2
|
|
||||||
|
|
||||||
--says some information.
|
--says some information.
|
||||||
riesenpilz.info = true
|
riesenpilz.info = true
|
||||||
|
|
||||||
@ -28,3 +20,6 @@ riesenpilz.max_spam = 2
|
|||||||
|
|
||||||
--3d apple
|
--3d apple
|
||||||
riesenpilz.change_apple = true
|
riesenpilz.change_apple = true
|
||||||
|
|
||||||
|
--disallows growing a mushroom if it not every node would have a free place
|
||||||
|
riesenpilz.giant_restrict_area = false
|
||||||
|
Before Width: | Height: | Size: 246 B After Width: | Height: | Size: 236 B |
Before Width: | Height: | Size: 321 B After Width: | Height: | Size: 348 B |
Before Width: | Height: | Size: 118 B After Width: | Height: | Size: 108 B |
Before Width: | Height: | Size: 105 B After Width: | Height: | Size: 105 B |
Before Width: | Height: | Size: 320 B After Width: | Height: | Size: 319 B |
Before Width: | Height: | Size: 251 B After Width: | Height: | Size: 251 B |
Before Width: | Height: | Size: 186 B After Width: | Height: | Size: 186 B |
Before Width: | Height: | Size: 313 B After Width: | Height: | Size: 304 B |
Before Width: | Height: | Size: 284 B After Width: | Height: | Size: 284 B |
Before Width: | Height: | Size: 220 B After Width: | Height: | Size: 214 B |
Before Width: | Height: | Size: 188 B After Width: | Height: | Size: 183 B |
Before Width: | Height: | Size: 150 B After Width: | Height: | Size: 149 B |
Before Width: | Height: | Size: 109 B After Width: | Height: | Size: 105 B |
Before Width: | Height: | Size: 718 B After Width: | Height: | Size: 699 B |
Before Width: | Height: | Size: 638 B After Width: | Height: | Size: 631 B |
Before Width: | Height: | Size: 500 B After Width: | Height: | Size: 499 B |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 695 B After Width: | Height: | Size: 694 B |
Before Width: | Height: | Size: 305 B After Width: | Height: | Size: 305 B |
Before Width: | Height: | Size: 724 B After Width: | Height: | Size: 703 B |
Before Width: | Height: | Size: 761 B After Width: | Height: | Size: 742 B |
Before Width: | Height: | Size: 186 B After Width: | Height: | Size: 186 B |
Before Width: | Height: | Size: 525 B After Width: | Height: | Size: 522 B |
Before Width: | Height: | Size: 1000 B After Width: | Height: | Size: 974 B |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 141 B After Width: | Height: | Size: 137 B |
Before Width: | Height: | Size: 149 B After Width: | Height: | Size: 148 B |
Before Width: | Height: | Size: 297 B After Width: | Height: | Size: 297 B |
BIN
textures/riesenpilz_light_detector.png
Normal file
After Width: | Height: | Size: 279 B |
Before Width: | Height: | Size: 124 B After Width: | Height: | Size: 124 B |
Before Width: | Height: | Size: 264 B After Width: | Height: | Size: 264 B |
Before Width: | Height: | Size: 184 B After Width: | Height: | Size: 184 B |
Before Width: | Height: | Size: 255 B After Width: | Height: | Size: 250 B |
Before Width: | Height: | Size: 236 B After Width: | Height: | Size: 235 B |
Before Width: | Height: | Size: 196 B After Width: | Height: | Size: 195 B |
Before Width: | Height: | Size: 183 B After Width: | Height: | Size: 177 B |
Before Width: | Height: | Size: 140 B After Width: | Height: | Size: 111 B |
Before Width: | Height: | Size: 98 B After Width: | Height: | Size: 94 B |
Before Width: | Height: | Size: 267 B After Width: | Height: | Size: 266 B |
Before Width: | Height: | Size: 633 B After Width: | Height: | Size: 625 B |
Before Width: | Height: | Size: 734 B After Width: | Height: | Size: 716 B |
Before Width: | Height: | Size: 734 B After Width: | Height: | Size: 718 B |
Before Width: | Height: | Size: 521 B After Width: | Height: | Size: 519 B |