Voxelmanip checks space before spawn
This commit is contained in:
parent
a7c23cb751
commit
be23a94ddc
@ -1,4 +1,4 @@
|
|||||||
projects 0.1.0 by paramat
|
projects 0.1.1 by paramat
|
||||||
For Minetest 0.4.9 dev
|
For Minetest
|
||||||
Depends default
|
Depends default
|
||||||
Licenses: code WTFPL
|
Licenses: code WTFPL
|
||||||
|
90
init.lua
90
init.lua
@ -1,8 +1,10 @@
|
|||||||
-- projects 0.1.0 by paramat
|
-- projects 0.1.1 by paramat
|
||||||
-- For
|
-- For Minetest
|
||||||
-- Depends default
|
-- Depends default
|
||||||
-- License: code WTFPL
|
-- License: code WTFPL
|
||||||
|
|
||||||
|
-- rotation 0 90 180 270 is clockwise
|
||||||
|
|
||||||
-- Parameters
|
-- Parameters
|
||||||
|
|
||||||
|
|
||||||
@ -22,7 +24,7 @@ minetest.register_node("projects:flatn", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("projects:flats", {
|
minetest.register_node("projects:flats", {
|
||||||
description = "Spawn Flat SOuth",
|
description = "Spawn Flat South",
|
||||||
drawtype = "airlike",
|
drawtype = "airlike",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
@ -54,9 +56,29 @@ minetest.register_abm({
|
|||||||
interval = 13,
|
interval = 13,
|
||||||
chance = 1,
|
chance = 1,
|
||||||
action = function(pos, node)
|
action = function(pos, node)
|
||||||
|
local x = pos.x
|
||||||
|
local y = pos.y
|
||||||
|
local z = pos.z
|
||||||
|
local c_air = minetest.get_content_id("air")
|
||||||
|
local c_ignore = minetest.get_content_id("ignore")
|
||||||
|
local vm = minetest.get_voxel_manip()
|
||||||
|
local pos1 = {x=x-6, y=y-1, z=z+1}
|
||||||
|
local pos2 = {x=x+1, y=y+3, z=z+8}
|
||||||
|
local emin, emax = vm:read_from_map(pos1, pos2)
|
||||||
|
local area = VoxelArea:new({MinEdge=emin, MaxEdge=emax})
|
||||||
|
local data = vm:get_data()
|
||||||
|
for vi in area:iterp(pos1, pos2) do
|
||||||
|
local nodid = data[vi]
|
||||||
|
if nodid ~= c_air and nodid ~= c_ignore then
|
||||||
|
minetest.add_node(pos, {name="default:sandstonebrick"})
|
||||||
|
pos.y = pos.y + 1
|
||||||
|
minetest.add_node(pos, {name="default:sandstonebrick"})
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
minetest.add_node(pos, {name="air"})
|
minetest.add_node(pos, {name="air"})
|
||||||
local path = minetest.get_modpath("projects") .. "/schems/flat.mts"
|
local path = minetest.get_modpath("projects") .. "/schems/flat.mts"
|
||||||
minetest.place_schematic({x=pos.x-6, y=pos.y-1, z=pos.z+1}, path, 90, nil, true)
|
minetest.place_schematic({x=x-6, y=y-1, z=z+1}, path, 90, nil, true)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -67,6 +89,26 @@ minetest.register_abm({
|
|||||||
interval = 14,
|
interval = 14,
|
||||||
chance = 1,
|
chance = 1,
|
||||||
action = function(pos, node)
|
action = function(pos, node)
|
||||||
|
local x = pos.x
|
||||||
|
local y = pos.y
|
||||||
|
local z = pos.z
|
||||||
|
local c_air = minetest.get_content_id("air")
|
||||||
|
local c_ignore = minetest.get_content_id("ignore")
|
||||||
|
local vm = minetest.get_voxel_manip()
|
||||||
|
local pos1 = {x=x-1, y=y-1, z=z-8}
|
||||||
|
local pos2 = {x=x+6, y=y+3, z=z-1}
|
||||||
|
local emin, emax = vm:read_from_map(pos1, pos2)
|
||||||
|
local area = VoxelArea:new({MinEdge=emin, MaxEdge=emax})
|
||||||
|
local data = vm:get_data()
|
||||||
|
for vi in area:iterp(pos1, pos2) do
|
||||||
|
local nodid = data[vi]
|
||||||
|
if nodid ~= c_air and nodid ~= c_ignore then
|
||||||
|
minetest.add_node(pos, {name="default:sandstonebrick"})
|
||||||
|
pos.y = pos.y + 1
|
||||||
|
minetest.add_node(pos, {name="default:sandstonebrick"})
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
minetest.add_node(pos, {name="air"})
|
minetest.add_node(pos, {name="air"})
|
||||||
local path = minetest.get_modpath("projects") .. "/schems/flat.mts"
|
local path = minetest.get_modpath("projects") .. "/schems/flat.mts"
|
||||||
minetest.place_schematic({x=pos.x-1, y=pos.y-1, z=pos.z-8}, path, 270, nil, true)
|
minetest.place_schematic({x=pos.x-1, y=pos.y-1, z=pos.z-8}, path, 270, nil, true)
|
||||||
@ -80,6 +122,26 @@ minetest.register_abm({
|
|||||||
interval = 15,
|
interval = 15,
|
||||||
chance = 1,
|
chance = 1,
|
||||||
action = function(pos, node)
|
action = function(pos, node)
|
||||||
|
local x = pos.x
|
||||||
|
local y = pos.y
|
||||||
|
local z = pos.z
|
||||||
|
local c_air = minetest.get_content_id("air")
|
||||||
|
local c_ignore = minetest.get_content_id("ignore")
|
||||||
|
local vm = minetest.get_voxel_manip()
|
||||||
|
local pos1 = {x=x+1, y=y-1, z=z-1}
|
||||||
|
local pos2 = {x=x+8, y=y+3, z=z+6}
|
||||||
|
local emin, emax = vm:read_from_map(pos1, pos2)
|
||||||
|
local area = VoxelArea:new({MinEdge=emin, MaxEdge=emax})
|
||||||
|
local data = vm:get_data()
|
||||||
|
for vi in area:iterp(pos1, pos2) do
|
||||||
|
local nodid = data[vi]
|
||||||
|
if nodid ~= c_air and nodid ~= c_ignore then
|
||||||
|
minetest.add_node(pos, {name="default:sandstonebrick"})
|
||||||
|
pos.y = pos.y + 1
|
||||||
|
minetest.add_node(pos, {name="default:sandstonebrick"})
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
minetest.add_node(pos, {name="air"})
|
minetest.add_node(pos, {name="air"})
|
||||||
local path = minetest.get_modpath("projects") .. "/schems/flat.mts"
|
local path = minetest.get_modpath("projects") .. "/schems/flat.mts"
|
||||||
minetest.place_schematic({x=pos.x+1, y=pos.y-1, z=pos.z-1}, path, 180, nil, true)
|
minetest.place_schematic({x=pos.x+1, y=pos.y-1, z=pos.z-1}, path, 180, nil, true)
|
||||||
@ -93,6 +155,26 @@ minetest.register_abm({
|
|||||||
interval = 16,
|
interval = 16,
|
||||||
chance = 1,
|
chance = 1,
|
||||||
action = function(pos, node)
|
action = function(pos, node)
|
||||||
|
local x = pos.x
|
||||||
|
local y = pos.y
|
||||||
|
local z = pos.z
|
||||||
|
local c_air = minetest.get_content_id("air")
|
||||||
|
local c_ignore = minetest.get_content_id("ignore")
|
||||||
|
local vm = minetest.get_voxel_manip()
|
||||||
|
local pos1 = {x=x-8, y=y-1, z=z-6}
|
||||||
|
local pos2 = {x=x-1, y=y+3, z=z+1}
|
||||||
|
local emin, emax = vm:read_from_map(pos1, pos2)
|
||||||
|
local area = VoxelArea:new({MinEdge=emin, MaxEdge=emax})
|
||||||
|
local data = vm:get_data()
|
||||||
|
for vi in area:iterp(pos1, pos2) do
|
||||||
|
local nodid = data[vi]
|
||||||
|
if nodid ~= c_air and nodid ~= c_ignore then
|
||||||
|
minetest.add_node(pos, {name="default:sandstonebrick"})
|
||||||
|
pos.y = pos.y + 1
|
||||||
|
minetest.add_node(pos, {name="default:sandstonebrick"})
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
minetest.add_node(pos, {name="air"})
|
minetest.add_node(pos, {name="air"})
|
||||||
local path = minetest.get_modpath("projects") .. "/schems/flat.mts"
|
local path = minetest.get_modpath("projects") .. "/schems/flat.mts"
|
||||||
minetest.place_schematic({x=pos.x-8, y=pos.y-1, z=pos.z-6}, path, 0, nil, true)
|
minetest.place_schematic({x=pos.x-8, y=pos.y-1, z=pos.z-6}, path, 0, nil, true)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user