Custom map coordinates
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
Fork of Mistere's Adventure Map Island Creator adding the ability to specify
|
||||
coordinates for the island center.
|
||||
@@ -1,7 +1,5 @@
|
||||
-- forces the map into singlenode mode, don't do this if this is just a "realm".
|
||||
luamap.set_singlenode()
|
||||
-- creates a terrain noise
|
||||
luamap.register_noise("terrain",{
|
||||
luamap.register_noise("adventure_map_terrain",{
|
||||
type = "3d",
|
||||
np_vals = {
|
||||
offset = 0,
|
||||
@@ -15,7 +13,7 @@ luamap.register_noise("terrain",{
|
||||
},
|
||||
|
||||
})
|
||||
luamap.register_noise("mountains",{
|
||||
luamap.register_noise("adventure_map_mountains",{
|
||||
type = "2d",
|
||||
np_vals = {
|
||||
offset = 0,
|
||||
@@ -30,7 +28,7 @@ luamap.register_noise("mountains",{
|
||||
|
||||
})
|
||||
|
||||
luamap.register_noise("dunes",{
|
||||
luamap.register_noise("adventure_map_dunes",{
|
||||
type = "2d",
|
||||
np_vals = {
|
||||
offset = 0,
|
||||
@@ -45,7 +43,7 @@ luamap.register_noise("dunes",{
|
||||
|
||||
})
|
||||
|
||||
luamap.register_noise("hills",{
|
||||
luamap.register_noise("adventure_map_hills",{
|
||||
type = "2d",
|
||||
np_vals = {
|
||||
offset = 0,
|
||||
@@ -60,7 +58,7 @@ luamap.register_noise("hills",{
|
||||
|
||||
})
|
||||
|
||||
luamap.register_noise("canyons",{
|
||||
luamap.register_noise("adventure_map_canyons",{
|
||||
type = "3d",
|
||||
np_vals = {
|
||||
offset = 0,
|
||||
@@ -75,7 +73,7 @@ luamap.register_noise("canyons",{
|
||||
|
||||
})
|
||||
|
||||
luamap.register_noise("canyon_top",{
|
||||
luamap.register_noise("adventure_map_canyon_top",{
|
||||
type = "2d",
|
||||
np_vals = {
|
||||
offset = 0,
|
||||
@@ -108,6 +106,14 @@ local desert_sandstone = cid("default:desert_sandstone")
|
||||
local dirt_with_snow = cid("default:dirt_with_snow")
|
||||
local dirt_with_coniferous_litter = cid("default:dirt_with_coniferous_litter")
|
||||
|
||||
local island_center = {x = 0, y = 0, z = 0}
|
||||
|
||||
local function get_island_bounds()
|
||||
local minp = vector.new(island_center.x - 500, island_center.y - 30, island_center.z - 500)
|
||||
local maxp = vector.new(island_center.x + 500, island_center.y + 50, island_center.z + 500)
|
||||
return minp, maxp
|
||||
end
|
||||
|
||||
|
||||
local old_logic = luamap.logic
|
||||
|
||||
@@ -115,18 +121,21 @@ function luamap.logic(noise_vals,x,y,z,seed,original_content)
|
||||
|
||||
-- get any terrain defined in another mod
|
||||
local content = old_logic(noise_vals,x,y,z,seed,original_content)
|
||||
x = x - island_center.x
|
||||
y = y - island_center.y
|
||||
z = z - island_center.z
|
||||
local o_y = y -- original y before modification
|
||||
|
||||
local r = 500
|
||||
local biomeoffset = 250
|
||||
local e = 2.71828
|
||||
local lake_water_level = 37
|
||||
local mountains = noise_vals.mountains
|
||||
local desertdunes = noise_vals.dunes
|
||||
local hills = noise_vals.hills
|
||||
local canyons = noise_vals.canyons
|
||||
local canyon_top = noise_vals.canyon_top
|
||||
local biome_depth = math.abs(noise_vals.terrain*6) + 1
|
||||
local mountains = noise_vals.adventure_map_mountains
|
||||
local desertdunes = noise_vals.adventure_map_dunes
|
||||
local hills = noise_vals.adventure_map_hills
|
||||
local canyons = noise_vals.adventure_map_canyons
|
||||
local canyon_top = noise_vals.adventure_map_canyon_top
|
||||
local biome_depth = math.abs(noise_vals.adventure_map_terrain*6) + 1
|
||||
local mtnareaspread = 100
|
||||
local dsrtareaspread = 140
|
||||
local lkareaspread = 110
|
||||
@@ -166,7 +175,7 @@ function luamap.logic(noise_vals,x,y,z,seed,original_content)
|
||||
-- mix in the hills
|
||||
y=y-hills_mix*hills*20
|
||||
-- mix in the small detail terrain but not in the desert
|
||||
y=y-noise_vals.terrain*not_desert*5
|
||||
y=y-noise_vals.adventure_map_terrain*not_desert*5
|
||||
|
||||
|
||||
local biome = "grass"
|
||||
@@ -273,17 +282,24 @@ function luamap.logic(noise_vals,x,y,z,seed,original_content)
|
||||
return content
|
||||
end
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
minetest.chat_send_player(player:get_player_name(),"MisterE's Adventure Map Creator mod is overriding mapgen. Use /emerge_map to load the entire map (it will take a while)")
|
||||
end)
|
||||
|
||||
minetest.register_chatcommand("emerge_map", {
|
||||
description = "Emerge the entire adventure map island",
|
||||
params = "<x> <y> <z>",
|
||||
description = "Set adventure map center and emerge it at those coordinates",
|
||||
privs = {server=true},
|
||||
func = function(name, param)
|
||||
local minp = vector.new(-500,-30,-500)
|
||||
local maxp = vector.new(500, 50, 500)
|
||||
local sx, sy, sz = param:match("^%s*([%-]?%d+)%s+([%-]?%d+)%s+([%-]?%d+)%s*$")
|
||||
if not sx then
|
||||
return false, "Usage: /adventure_map x y z"
|
||||
end
|
||||
|
||||
island_center.x = tonumber(sx)
|
||||
island_center.y = tonumber(sy)
|
||||
island_center.z = tonumber(sz)
|
||||
|
||||
local minp, maxp = get_island_bounds()
|
||||
minetest.emerge_area(minp, maxp)
|
||||
minetest.chat_send_player(name, "MisterE's Adventure map is emerging! Have fun creating! Try using worldedit additions with bonemeal mods to create forests, and the terraform mod to edit the landscape.")
|
||||
|
||||
minetest.chat_send_player(name, "Adventure map center set to (" .. island_center.x .. ", " .. island_center.y .. ", " .. island_center.z .. "). Emerging map now...")
|
||||
return true, "Adventure map placement started."
|
||||
end
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user