Move player spawning

This commit is contained in:
Brayd 2023-04-22 17:07:25 +02:00
parent 81084d5591
commit 991e574fc3
Signed by: brayd
GPG Key ID: C2B176B9DEB8BA48
1 changed files with 4 additions and 28 deletions

View File

@ -6,11 +6,11 @@ arbuinia_mapgen = {}
-- Set the 3D noise parameters for the terrain.
local np_terrain = {
offset = 0,
offset = 0.5,
scale = 1,
spread = {x = 100, y = 192, z = 100},
spread = {x = 560, y = 192, z = 569},
seed = 5900033,
octaves = 5,
octaves = 3,
persist = 0.63,
lacunarity = 2.0,
--flags = ""
@ -122,6 +122,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
end
end
biomegen.generate_all(data, area, vm, minp, maxp, seed)
-- After processing, write content ID data back to the voxelmanip.
vm:set_data(data)
-- Calculate lighting for what has been created.
@ -134,31 +135,6 @@ minetest.register_on_generated(function(minp, maxp, seed)
-- Print generation time of this mapchunk.
local chugent = math.ceil((os.clock() - t0) * 1000)
print ("[lvm_example] Mapchunk generation time " .. chugent .. " ms")
biomegen.generate_all(data, area, vm, minp, maxp, seed)
end)
-- Handle player spawning
local function spawn_player(player)
if minetest.setting_get("static_spawnpoint") then return end
local noise1 = minetest.get_perlin(12345, 6, 0.5, 256)
local min_dist = math.huge
local min_pos = {x = 0, y = 3, z = 0}
for bx = -20, 20 do
for bz = -20, 20 do
local minp = {x = -32 + 80 * bx, y = -32, z = -32 + 80 * bz}
end
end
player:setpos(min_pos)
end
minetest.register_on_newplayer(function (player)
spawn_player(player)
end)
minetest.register_on_respawnplayer(function (player)
spawn_player(player)
end)