fix island distribution

This commit is contained in:
Kimapr 2019-12-21 10:14:08 +05:00
parent e77fb4ccbb
commit b4a567ed0b
1 changed files with 4 additions and 2 deletions

View File

@ -229,6 +229,8 @@ end
local function gen_island_pos(name) local function gen_island_pos(name)
local x,y,z = 0,0,0 local x,y,z = 0,0,0
x,z = x+math.random(-32,32),z+math.random(-32,32)
y=256+math.random(-64,64)
local ok = checkpos(x,y,z) local ok = checkpos(x,y,z)
for k,isl in ipairs(cells) do for k,isl in ipairs(cells) do
if isl and isl.valid then if isl and isl.valid then
@ -244,7 +246,7 @@ local function gen_island_pos(name)
end end
end end
while not ok do while not ok do
x,z = x+math.random(-256,256),z+math.random(-256,256) x,z = x+math.random(-32,32),z+math.random(-32,32)
y=256+math.random(-64,64) y=256+math.random(-64,64)
ok = checkpos(x,y,z) ok = checkpos(x,y,z)
end end
@ -276,7 +278,7 @@ minetest.register_globalstep(function(dt)
cells[is.k].valid = false cells[is.k].valid = false
end end
local p = ref:get_pos() local p = ref:get_pos()
if p.y < 0 then if p.y < -64 then
ref:set_hp(ref:get_hp()-2,{reason="set_hp"}) ref:set_hp(ref:get_hp()-2,{reason="set_hp"})
if p.y < -128 then if p.y < -128 then
local land = players[ref:get_player_name()] local land = players[ref:get_player_name()]