added villages! (WIP!!!!!)
This commit is contained in:
parent
118ce94a80
commit
7a5bda2986
@ -652,6 +652,12 @@ minetest.register_node("default:desert_stone", {
|
|||||||
drop = "default:stone_item 5",
|
drop = "default:stone_item 5",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_node("default:andesite", {
|
||||||
|
description = "Andesite",
|
||||||
|
tiles = {"default_andesite.png"},
|
||||||
|
groups = {cracky = 3},
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_node("default:cobble", {
|
minetest.register_node("default:cobble", {
|
||||||
description = "Cobble",
|
description = "Cobble",
|
||||||
tiles = {"default_cobble.png"},
|
tiles = {"default_cobble.png"},
|
||||||
|
BIN
mods/default/textures/default_andesite.png
Normal file
BIN
mods/default/textures/default_andesite.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 415 B |
11
mods/village/LICENSE.txt
Normal file
11
mods/village/LICENSE.txt
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
License for Code
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Copyright (C) 2016 cd2 (cdqwertz) <cdqwertz@gmail.com>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2.1 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
http://www.gnu.org/licenses/lgpl-2.1.html
|
83
mods/village/init.lua
Normal file
83
mods/village/init.lua
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
minetest.register_on_generated(function(minp, maxp, seed)
|
||||||
|
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
|
||||||
|
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
|
||||||
|
local data = vm:get_data()
|
||||||
|
|
||||||
|
local heightmap = minetest.get_mapgen_object("heightmap")
|
||||||
|
|
||||||
|
local c_air = minetest.get_content_id("air")
|
||||||
|
local c_stonebrick = minetest.get_content_id("default:stonebrick")
|
||||||
|
local c_wood = minetest.get_content_id("default:wood")
|
||||||
|
local c_wooden_planks = minetest.get_content_id("default:wooden_planks")
|
||||||
|
local c_wooden_planks_2 = minetest.get_content_id("default:wooden_planks_2")
|
||||||
|
|
||||||
|
local c_glass = minetest.get_content_id("default:glass")
|
||||||
|
|
||||||
|
local perlin1 = minetest.get_perlin(11,3, 0.5, 1)
|
||||||
|
local perlin2 = minetest.get_perlin(11,3, 0.5, 100)
|
||||||
|
|
||||||
|
local h_index = 0
|
||||||
|
|
||||||
|
local first_height = math.floor(heightmap[1]/4)*4
|
||||||
|
|
||||||
|
for z = minp.z, maxp.z do
|
||||||
|
for x = minp.x, maxp.x do
|
||||||
|
h_index = h_index+1
|
||||||
|
for y = minp.y, maxp.y do
|
||||||
|
local pos = area:index(x, y, z)
|
||||||
|
-- TODO : I think this is very slow...
|
||||||
|
local part = {x=math.floor(x/10)*10, y=math.floor(y/4)*4, z=math.floor(z/10)*10}
|
||||||
|
local h_part = math.floor(heightmap[h_index]/4)*4
|
||||||
|
|
||||||
|
local height = heightmap[h_index]
|
||||||
|
if perlin2:get2d({x=part.x, y=part.z}) > 0.9 then
|
||||||
|
if vector.equals({x=x, y=y, z=z}, part) then
|
||||||
|
first_height = math.floor(heightmap[h_index]/4)*4
|
||||||
|
end
|
||||||
|
if math.abs(perlin1:get2d({x=part.x, y=part.z})) > 0.7 then
|
||||||
|
if y < (math.abs(perlin1:get2d({x=part.x, y=part.z})) * 8 -2) + first_height and y > height then
|
||||||
|
if y > -1 and x > part.x and z > part.z and x < part.x+9 and z < part.z+9 then
|
||||||
|
-- walls
|
||||||
|
if part.x+1 == x then
|
||||||
|
data[pos] = c_wood
|
||||||
|
end
|
||||||
|
if part.z+1 == z then
|
||||||
|
data[pos] = c_wood
|
||||||
|
end
|
||||||
|
|
||||||
|
if part.x+8 == x then
|
||||||
|
data[pos] = c_wood
|
||||||
|
end
|
||||||
|
if part.z+8 == z then
|
||||||
|
data[pos] = c_wood
|
||||||
|
end
|
||||||
|
|
||||||
|
-- roof/floor
|
||||||
|
if part.y == y then
|
||||||
|
data[pos] = c_wood
|
||||||
|
end
|
||||||
|
if part.y+3 == y then
|
||||||
|
data[pos] = c_wood
|
||||||
|
end
|
||||||
|
elseif height == y then
|
||||||
|
data[pos] = c_stonebrick
|
||||||
|
else
|
||||||
|
data[pos] = c_air
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if height == y then
|
||||||
|
data[pos] = c_stonebrick
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
vm:set_data(data)
|
||||||
|
--vm:set_lighting({day=0, night=0})
|
||||||
|
vm:calc_lighting()
|
||||||
|
vm:write_to_map(data)
|
||||||
|
vm:update_liquids()
|
||||||
|
end)
|
Loading…
x
Reference in New Issue
Block a user