Added metainfo about the corridors
This commit is contained in:
parent
e3d42f43a3
commit
cb5610f22b
46
init.lua
46
init.lua
@ -1,21 +1,47 @@
|
||||
local path = minetest.get_modpath("roomgen")
|
||||
|
||||
local A = 9 -- distance between the centers of the rooms (9 is the best value)
|
||||
|
||||
corridors = {
|
||||
{name="X"},
|
||||
{name="L"},
|
||||
{name="T"},
|
||||
{name="I"}, -- straight corridor
|
||||
{name="E"}, -- E is end
|
||||
{name="X", connect_to = {px=true, pz=true, nx=true, nz=true}},
|
||||
{name="I", connect_to = {px=true, nx=true}}, -- straight corridor (rotation angle is 0)
|
||||
{name="I", connect_to = {pz=true, nz=true}, rotation = 90},
|
||||
{name="L", connect_to = {px=true, nz=true}},
|
||||
{name="L", connect_to = {nx=true, nz=true}, rotation = 90}, --
|
||||
{name="L", connect_to = {nx=true, pz=true}, rotation = 180},
|
||||
{name="L", connect_to = {px=true, pz=true}, rotation = 270},
|
||||
{name="E", connect_to = {px=true}}, -- E is end
|
||||
{name="E", connect_to = {nz=true}, rotation = 90},
|
||||
{name="E", connect_to = {nx=true}, rotation = 180},
|
||||
{name="E", connect_to = {pz=true}, rotation = 270},
|
||||
{name="T", connect_to = {px=true, pz=true, nz=true}},
|
||||
{name="T", connect_to = {px=true, nx=true, nz=true}, rotation = 90},
|
||||
{name="T", connect_to = {nx=true, pz=true, nz=true}, rotation = 180},
|
||||
{name="T", connect_to = {px=true, nx=true, pz=true}, rotation = 270},
|
||||
}
|
||||
|
||||
function place_room(center, vm)
|
||||
local corridor = corridors[math.random(#corridors)].name
|
||||
placed_corridors = {}
|
||||
|
||||
local schematic = path .. "/schems/corridor_" .. corridor .. ".mts"
|
||||
minetest.place_schematic_on_vmanip(vm, center, schematic, "random") -- "random" is for the rotations
|
||||
function mind_neighbours(center) -- Checks what blocks are placed near given block
|
||||
connect_to = {}
|
||||
local dist = A + 1
|
||||
nx = {x = center.x - dist, y = center.y, z = center.z}
|
||||
end
|
||||
|
||||
local A = 9 -- distance between the centers of the rooms (9 is the best value)
|
||||
function place_room(center, vm)
|
||||
local corridor = corridors[math.random(#corridors)]
|
||||
local name = corridor.name
|
||||
local rotation = corridor.rotation
|
||||
|
||||
if not rotation then
|
||||
rotation = 0
|
||||
end
|
||||
|
||||
local schematic = path .. "/schems/corridor_" .. name .. ".mts"
|
||||
minetest.place_schematic_on_vmanip(vm, center, schematic, rotation)
|
||||
|
||||
table.insert(placed_corridors, corridor)
|
||||
end
|
||||
|
||||
minetest.register_on_mapgen_init(function(params) -- Automatically turn on singlenode generator
|
||||
minetest.set_mapgen_params({
|
||||
|
Loading…
x
Reference in New Issue
Block a user