Big update (2)

Add new biome: Cold Mesa and Mesa
Add `.clear()` method to `amgmt.biome`, `amgmt.tree`, `amgmt.ore`
Add `bakedclay` support
New mineshaft algorithm and shape!
Better lake spawn algorithm
Tidy up!
This commit is contained in:
Muhammad Rifqi Priyo Susanto 2015-03-02 16:28:24 +07:00
parent 37144ee798
commit c0b7eb78ae
14 changed files with 190 additions and 49 deletions

View File

@ -17,8 +17,8 @@ CC0 1.0 Universal
- Biomes, Trees, Nodes, Ores, etc. are modifyable
- Experimental water lakes!
- Experimental mineshaft!
- New caving system!
- 'Moreores' mod support
- New caving system!
- Using 15 2D perlin noise
##Noise usage
@ -32,6 +32,7 @@ CC0 1.0 Universal
- Frozen River
- Ice Plains
- Ice Plains Spikes
- Cold Mesa
- Cold Taiga
- Gravel Plain
- Stone Plain
@ -44,4 +45,5 @@ CC0 1.0 Universal
- Forest
- Jungle
- Savanna
- Mesa
- Desert

View File

@ -16,8 +16,8 @@ CC0 1.0 Universal
- Biomes, Trees, Nodes, Ores, etc. are modifyable
- Experimental water lakes!
- Experimental mineshaft!
- New caving system!
- 'Moreores' mod support
- New caving system!
- Using 15 2D perlin noise
#Noise usage
@ -31,6 +31,7 @@ CC0 1.0 Universal
- Frozen River
- Ice Plains
- Ice Plains Spikes
- Cold Mesa
- Cold Taiga
- Gravel Plain
- Stone Plain
@ -43,4 +44,5 @@ CC0 1.0 Universal
- Forest
- Jungle
- Savanna
- Mesa
- Desert

View File

@ -12,10 +12,22 @@ local c_gravel = gci("default:gravel")
local c_dirt = gci("default:dirt")
local c_dirt_grass = gci("default:dirt_with_grass")
local c_dirt_snow = gci("default:dirt_with_snow")
local c_dirt_savanna = gci("amgmt:dirt_at_savanna")
local c_sand = gci("default:sand")
local c_sandstone = gci("default:sandstone")
local c_clay = gci("default:clay")
local c_dirt_savanna = gci("amgmt:dirt_at_savanna")
local c_bakedclayred = gci("amgmt:bakedclay_red")
local c_bakedclayorange = gci("amgmt:bakedclay_orange")
local c_bakedclayblue = gci("amgmt:bakedclay_blue")
local c_bakedclaycyan = gci("amgmt:bakedclay_cyan")
-- bakedclay mod by TenPlus1 WTFPL
if minetest.get_modpath("bakedclay") then
local c_bakedclayred = gci("bakedclay:red")
local c_bakedclayorange = gci("bakedclay:orange")
local c_bakedclayblue = gci("bakedclay:blue")
local c_bakedclaycyan = gci("bakedclay:cyan")
end
--generated structures
badd({
@ -97,6 +109,33 @@ badd({
end
end
})
badd({
name = "Cold Mesa",
mint = 0,
maxt = 0.2,
minh = 0,
maxh = 30,
trees = {},
get_block = function(temp, humi, base, wl, y)
if y > base and y > wl then
return c_air
elseif y > base and y <= wl then
if base < wl then
return c_water
elseif base >= wl then
return c_air
end
elseif y <= base then
if math.floor(y / 4) * 4 == y then
return c_bakedclaycyan
else
return c_bakedclayblue
end
else
return c_stone
end
end
})
badd({
name = "Ice Plains Spikes",
mint = 0,
@ -132,6 +171,8 @@ badd({
name = "Cold Taiga",
mint = 0,
maxt = 0.2,
minh = 70,
maxh = 100,
trees = {{"pine_cold",25}},
get_block = function(temp, humi, base, wl, y)
if y > base and y > wl then
@ -452,6 +493,41 @@ badd({
end
})
-- hot
badd({
name = "Mesa",
mint = 1.8,
maxt = 2,
minh = 10,
maxh = 50,
trees = nil,
get_block = function(temp, humi, base, wl, y)
if y > base and y > wl then
return c_air
elseif y > base and y <= wl then
if base < wl then
return c_water
elseif base >= wl then
return c_air
end
elseif y < base then
if math.floor(y / 4) * 4 == y then
return c_bakedclayorange
else
return c_bakedclayred
end
elseif y == base then
if math.floor((y + 2) / 4) * 4 == (y + 2) then
return c_clay
elseif math.floor(y / 4) * 4 == y then
return c_bakedclayorange
else
return c_bakedclayred
end
else
return c_stone
end
end
})
badd({
name = "Desert",
mint = 1.8,

View File

@ -14,6 +14,11 @@ function amgmt.biome.add(p)
}
end
function amgmt.biome.clear()
-- reset
amgmt.biome.list = {}
end
-- testing purpose only!
amgmt.biome.add({
name = "NIL (Biome?)",

View File

@ -1,2 +1,3 @@
default
flowers
bakedclay?

View File

@ -6,7 +6,7 @@ amgmt = {}
print("[amgmt] (Another Map Generator for Minetest)")
--param?
DEBUG = false -- turn this off if your debug.txt is too full
DEBUG = false -- set to false if your debug.txt is too full
wl = 0 -- water level
HMAX = 500
HMIN = -30000
@ -215,7 +215,6 @@ local function amgmt_generate(minp, maxp, seed, vm, emin, emax)
local temp_ = math.abs(temp[nizx] * 2)
local humi_ = math.abs(humi[nizx] * 100)
base_ = get_base(base_, temp_, humi_, plat_)
--amgmt.debug(x..","..z.." : "..temp_)
for y_ = minp.y, maxp.y do
nizyx = nizyx + sidelen
local vi = area:index(x,y_,z)
@ -286,13 +285,14 @@ local function amgmt_generate(minp, maxp, seed, vm, emin, emax)
amgmt.debug("cave generated - "..t3.."ms")
--]]
--forming lake
--
--forming lake
local t2 = os.clock()
local chulen = (maxp.x - minp.x + 1) / 16
local nizx = 0
for cz = 0, chulen-1 do
for cx = 0, chulen-1 do
-- for every chunk do
nizx = (cz*chulen + cx) * 16
local found_lake = false
for z = minp.z + cz*16 +3, minp.z + (cz+1)*16 -3 do -- +-3 for lake borders
@ -306,7 +306,7 @@ local function amgmt_generate(minp, maxp, seed, vm, emin, emax)
local humi_ = math.abs(humi[nizx] * 100)
base_ = get_base(base_, temp_, humi_, plat_)
local lake_ = math.abs(lake[nizx])
if lake_ < 0.0005 then
if lake_ < 0.0005 and base_ > 5 then
--amgmt.debug("lake found! "..x..","..base_..","..z.." ("..lake_..")")
found_lake = true
for u = -2, 2 do
@ -348,8 +348,8 @@ local function amgmt_generate(minp, maxp, seed, vm, emin, emax)
amgmt.debug("lake formed - "..t3.."ms")
--]]
--tree planting
--
--tree planting
local t2 = os.clock()
local nizx = 0
for z = minp.z, maxp.z do
@ -374,13 +374,6 @@ local function amgmt_generate(minp, maxp, seed, vm, emin, emax)
then
amgmt.tree.spawn({x=x,y=base_+1,z=z},tr[i][1],data,area,seed,minp,maxp,pr)
filled = true
--[[
amgmt.debug(
"spawned "..tr[i][1]..
" at "..x..","..(base_+1)..","..z..
" in "..biome__.name.." biome"
)
--]]
end
end
end

View File

@ -3,9 +3,11 @@ amgmt.mineshaft = {}
local gci = minetest.get_content_id
local c_air = gci("air")
local c_glass = gci("default:glass")
local c_plank = gci("default:wood")
local c_torch = gci("default:torch")
local function make_room(x, z, data, area, minp)
local function make_room(x, z, data, area, minp, pr)
local ox, oz = 0, 0
if minp.x < 0 then ox = 1 end
if minp.z < 0 then oz = 1 end
@ -18,16 +20,20 @@ local function make_room(x, z, data, area, minp)
data[area:index(xx,-25,zz)] = c_air
data[area:index(xx,-26,zz)] = c_air
data[area:index(xx,-27,zz)] = c_air
if pr:next(1,5) <= 2 then
data[area:index(xx,-28,zz)] = c_plank
end
end
end
data[area:index(x+1,-24,z+1)] = c_glass -- place a glass to make it handplaced-like
data[area:index(x+1,-25,z+1)] = c_torch -- the default position is on ceiling, no need to rotate
end
function amgmt.mineshaft.generate(minp, maxp, data, area, seed, pr, noise)
if
minp.y <= -27 and maxp.y >= -25
and (noise[1] < -0.9 or noise[1] > 0.9) -- pick most-nothwest noise
and (noise[1] < -1 or noise[1] > 1) -- pick most-northwest noise
then
amgmt.debug("mineshaft is being constructed...")
@ -42,31 +48,32 @@ function amgmt.mineshaft.generate(minp, maxp, data, area, seed, pr, noise)
local minp = {x = xx, z = zz}
-- base room
make_room(3, 3, data, area, minp)
make_room(3, 3, data, area, minp, pr)
-- make it random :)
for rr = 0, math.abs(xx/16 + yy/16 + zz/16) do local rrr = pr:next(0,1) end
-- generate corridors in 4 direction: East South West North
-- East
if pr:next(1,3) < 2 then
make_room(4, 3, data, area, minp)
make_room(4, 3, data, area, minp, pr)
local n = pr:next(1,6)
if n < 4 then
make_room(5, 3, data, area, minp)
make_room(5, 3, data, area, minp, pr)
elseif n < 5 then
make_room(5, 3, data, area, minp)
make_room(5, 3, data, area, minp, pr)
if pr:next(1,6) < 2 then
local n = pr:next(1,3)
if n == 1 then --left
make_room(5, 2, data, area, minp)
make_room(5, 2, data, area, minp, pr)
if pr:next(1,12) < 2 then
make_room(5, 1, data, area, minp)
make_room(5, 1, data, area, minp, pr)
end
elseif n == 2 then --right
make_room(5, 4, data, area, minp)
make_room(5, 4, data, area, minp, pr)
if pr:next(1,12) < 2 then
make_room(5, 5, data, area, minp)
make_room(5, 5, data, area, minp, pr)
end
end
end
@ -75,23 +82,23 @@ function amgmt.mineshaft.generate(minp, maxp, data, area, seed, pr, noise)
-- South
if pr:next(1,3) < 2 then
make_room(3, 4, data, area, minp)
make_room(3, 4, data, area, minp, pr)
local n = pr:next(1,6)
if n < 4 then
make_room(3, 5, data, area, minp)
make_room(3, 5, data, area, minp, pr)
elseif n < 5 then
make_room(3, 5, data, area, minp)
make_room(3, 5, data, area, minp, pr)
if pr:next(1,6) < 2 then
local n = pr:next(1,3)
if n == 1 then --left
make_room(4, 5, data, area, minp)
make_room(4, 5, data, area, minp, pr)
if pr:next(1,12) < 2 then
make_room(5, 5, data, area, minp)
make_room(5, 5, data, area, minp, pr)
end
elseif n == 2 then --right
make_room(2, 5, data, area, minp)
make_room(2, 5, data, area, minp, pr)
if pr:next(1,12) < 2 then
make_room(1, 5, data, area, minp)
make_room(1, 5, data, area, minp, pr)
end
end
end
@ -100,23 +107,23 @@ function amgmt.mineshaft.generate(minp, maxp, data, area, seed, pr, noise)
-- West
if pr:next(1,3) < 2 then
make_room(2, 3, data, area, minp)
make_room(2, 3, data, area, minp, pr)
local n = pr:next(1,6)
if n < 4 then
make_room(1, 3, data, area, minp)
make_room(1, 3, data, area, minp, pr)
elseif n < 5 then
make_room(1, 3, data, area, minp)
make_room(1, 3, data, area, minp, pr)
if pr:next(1,6) < 2 then
local n = pr:next(1,3)
if n == 1 then --left
make_room(1, 4, data, area, minp)
make_room(1, 4, data, area, minp, pr)
if pr:next(1,12) < 2 then
make_room(1, 5, data, area, minp)
make_room(1, 5, data, area, minp, pr)
end
elseif n == 2 then --right
make_room(1, 2, data, area, minp)
make_room(1, 2, data, area, minp, pr)
if pr:next(1,12) < 2 then
make_room(1, 1, data, area, minp)
make_room(1, 1, data, area, minp, pr)
end
end
end
@ -125,23 +132,23 @@ function amgmt.mineshaft.generate(minp, maxp, data, area, seed, pr, noise)
-- North
if pr:next(1,3) < 2 then
make_room(3, 2, data, area, minp)
make_room(3, 2, data, area, minp, pr)
local n = pr:next(1,6)
if n < 4 then
make_room(3, 1, data, area, minp)
make_room(3, 1, data, area, minp, pr)
elseif n < 5 then
make_room(3, 1, data, area, minp)
make_room(3, 1, data, area, minp, pr)
if pr:next(1,6) < 2 then
local n = pr:next(1,3)
if n == 1 then --left
make_room(2, 1, data, area, minp)
make_room(2, 1, data, area, minp, pr)
if pr:next(1,12) < 2 then
make_room(1, 1, data, area, minp)
make_room(1, 1, data, area, minp, pr)
end
elseif n == 2 then --right
make_room(4, 1, data, area, minp)
make_room(4, 1, data, area, minp, pr)
if pr:next(1,12) < 2 then
make_room(5, 1, data, area, minp)
make_room(5, 1, data, area, minp, pr)
end
end
end

View File

@ -1,10 +1,49 @@
minetest.register_node("amgmt:bedrock", {
description = "amgmt's BEDROCK (How you get this?)",
description = "amgmt's BEDROCK (How do you get this?)",
tiles ={"default_cobble.png"},
groups = {unbreakable = 1, not_in_creative_inventory = 1},
sounds = default.node_sound_stone_defaults()
})
-- from TenPlus1's bakedclay (0.3) WTFPL
local color = {
{"orange","Orange"},
{"red","Red"},
{"blue","Blue"},
{"cyan","Cyan"},
}
for i=1, #color do
local param = {
description = color[i][2] .. " Baked Clay",
tiles = {"amgmt_bakedclay_" .. color[i][1] .. ".png"},
groups = {cracky=3,bakedclay=1},
sounds = default.node_sound_stone_defaults()
}
if minetest.get_modpath("bakedclay") then
param.drop = "bakedclay:" .. color[i][1]
param.groups.not_in_creative_inventory = 1
end
minetest.register_node("amgmt:bakedclay_" .. color[i][1], param)
end
if minetest.get_modpath("bakedclay") then
minetest.register_alias("amgmt:bakedclay_orange","bakedclay:orange")
minetest.register_alias("amgmt:bakedclay_red","bakedclay:red")
minetest.register_alias("amgmt:bakedclay_blue","bakedclay:blue")
minetest.register_alias("amgmt:bakedclay_cyan","bakedclay:cyan")
else
minetest.register_craft({
type = "cooking",
output = "amgmt:hardened_clay",
recipe = "default:clay",
})
minetest.register_alias("bakedclay:orange","amgmt:bakedclay_orange")
minetest.register_alias("bakedclay:red","amgmt:bakedclay_red")
minetest.register_alias("bakedclay:blue","amgmt:bakedclay_blue")
minetest.register_alias("bakedclay:cyan","amgmt:bakedclay_cyan")
end
minetest.register_node("amgmt:dirt_at_savanna", {
description = "Dirt with Grass at Savanna",
tiles = {"amgmt_savanna_grass.png", "default_dirt.png", "default_dirt.png^amgmt_savanna_grass_side.png"},

View File

@ -6,6 +6,12 @@ amgmt.ore.registered_sheet = {}
local seeddiff_count = 1024
function amgmt.ore.clear()
amgmt.ore.registered = {}
amgmt.ore.registered_sheet = {}
seeddiff_count = 1024
end
function amgmt.ore.register(def)
-- registering ore per 16x16x16 block size
amgmt.ore.registered[#amgmt.ore.registered+1] = {

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 421 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 425 B

View File

@ -18,6 +18,16 @@ function amgmt.tree.register(def)
amgmt.tree.count = amgmt.tree.count + 1
end
function amgmt.tree.clear()
amgmt.tree.registered = {}
amgmt.tree.count = 0
amgmt.tree.register({
name = "nil",
grow = function() end
})
end
amgmt.tree.register({
name = "nil",
grow = function() end
@ -495,7 +505,7 @@ regtr({
end
end
end
j = h + pr:next(2,3)
local j = h + pr:next(2,3)
for u = 0, 1 do
for i = -1, 0 do
local vi = area:index(x+u, y-1, z+i)