half the island range, add island border view

This commit is contained in:
Kimapr 2019-12-25 22:41:17 +05:00
parent 5db8fa04cf
commit 7f3e709818
1 changed files with 60 additions and 1 deletions

View File

@ -158,8 +158,65 @@ end
local air_c = minetest.get_content_id("air") local air_c = minetest.get_content_id("air")
local ignore_c = minetest.get_content_id("ignore") local ignore_c = minetest.get_content_id("ignore")
local function spawn_particle(x,y,z,player)
minetest.add_particlespawner{
amount = 30,
-- Number of particles spawned over the time period `time`.
time = 60,
minpos = {x=x, y=y, z=z},
maxpos = {x=x, y=y, z=z},
minvel = {x=-0.5, y=-0.5, z=-0.5},
maxvel = {x=0.5, y=0.5, z=0.5},
minacc = {x=0, y=0, z=0},
maxacc = {x=0, y=0, z=0},
minexptime = 2,
maxexptime = 3,
minsize = 5,
maxsize = 10,
vertical = false,
texture = "nc_lux_gravel.png",
playername = player,
glow = 14
}
end
local function island_range(x,y,z) local function island_range(x,y,z)
return {x=x-64,y=y-64,z=z-64},{x=x+64,y=y+64,z=z+64} return {x=x-32,y=y-32,z=z-32},{x=x+32,y=y+32,z=z+32}
end
local function spawn_particles(x,y,z,player)
local mi,ma = island_range(x,y,z)
local visited = {}
for n1=0,1 do
for n2=0,1 do
for _,ord1 in ipairs({"x","y","z"}) do
for _,ord2 in ipairs({"x","y","z"}) do
for _,ord3 in ipairs({"x","y","z"}) do
if ord2 ~= ord1 and ord3 ~= ord2 and ord3 ~= ord1 then
for x=mi[ord1],ma[ord1] do
local pos = {[ord1]=x}
if n1 == 0 then
pos[ord2] = mi[ord2]
else
pos[ord2] = ma[ord2]
end
if n2 == 0 then
pos[ord3] = mi[ord3]
else
pos[ord3] = ma[ord3]
end
--print(dump(pos))
if math.random(10)==1 then
spawn_particle(pos.x,pos.y,pos.z,player)
end
end
end
end
end
end
end
end
end end
local function checkpos(x,y,z) local function checkpos(x,y,z)
local vm = VoxelManip(island_range(x,y,z)) local vm = VoxelManip(island_range(x,y,z))
@ -427,6 +484,8 @@ minetest.register_chatcommand("query", {
minetest.chat_send_player(name," takeable: "..tostring(is.valid)) minetest.chat_send_player(name," takeable: "..tostring(is.valid))
minetest.chat_send_player(name," pos: "..minetest.pos_to_string(is.pos)) minetest.chat_send_player(name," pos: "..minetest.pos_to_string(is.pos))
minetest.chat_send_player(name,"]") minetest.chat_send_player(name,"]")
local p = is.pos
spawn_particles(p.x,p.y,p.z,name)
else else
minetest.chat_send_player(name,S"No island here") minetest.chat_send_player(name,S"No island here")
end end