Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local generate_house = function( minp, maxp )
- local height = 5
- local width = 6
- local length = 6
- local amount = math.random(0, 10)
- for a = 0, amount do
- if (math.random() < 0.5) then
- local pos = {
- x = math.random( minp.x, maxp.x ),
- y = math.random( minp.y, maxp.y ),
- z = math.random( minp.z, maxp.z ),
- }
- local px = { x=pos.x, y=pos.y, z=pos.z }
- local nx = minetest.env:get_node( px )
- if nx.name == "default:dirt" then
- for i = 0, width do
- for j = 0, height do
- for k = 0, length do
- if (pos.y > 0) and (pos.y < 30) then
- local p = { x=pos.x+i, y=pos.y+j, z=pos.z+k }
- local n = minetest.env:get_node( p )
- --if n.name == "air" then
- if (p.x >= pos.x+1 and p.x <= pos.x+(width-1)) and (p.y >= pos.y+1 and p.y <= pos.y+(height-1)) and (p.z >= pos.z+1 and p.z <= pos.x+(length-1)) then
- --skip
- else
- minetest.env:add_node( p, "default:cobble" )
- end
- --end
- end
- end
- end
- end
- end
- end
- end
- end
- minetest.register_on_generated(generate_house)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement