added automatic village generation(via biome decorations)

This commit is contained in:
kaadmy 2015-09-01 15:13:34 -07:00
parent eedb63f606
commit 7f685a2928
4 changed files with 29 additions and 16 deletions

View File

@ -238,7 +238,7 @@ minetest.register_biome(
node_underwater = "default:dirt",
node_shore_top = "default:sand",
node_shore_filler = "default:sandstone", height_shore = 0,
y_min = 0, y_max = 500,
y_min = 0, y_max = 200,
heat_point = 35, humidity_point = 40,
})

View File

@ -5,7 +5,7 @@ minetest.register_node(
tiles = {"default_brick.png^default_book.png"},
is_ground_content = false,
groups = {dig_immediate = 2},
sounds = default.node_sound_wood_defaults({})
sounds = default.node_sound_wood_defaults()
})
minetest.register_node(
@ -15,34 +15,47 @@ minetest.register_node(
tiles = {"default_grass.png^default_book.png"},
is_ground_content = false,
groups = {dig_immediate = 2},
sounds = default.node_sound_wood_defaults({})
sounds = default.node_sound_wood_defaults()
})
minetest.register_node(
"village:desert_village",
"village:grassland_village_mg",
{
description = "Spawns a village at this block when placed",
tiles = {"default_sand.png^default_book.png"},
description = "Mapgen village spawner(Has chance of not spawning village)",
tiles = {"default_grass.png^default_book.png"},
is_ground_content = false,
groups = {dig_immediate = 2},
sounds = default.node_sound_wood_defaults({})
sounds = default.node_sound_wood_defaults()
})
minetest.register_alias("village", "village:grassland_village")
minetest.register_abm(
{
nodenames = {"village:grassland_village"},
nodenames = {"village:grassland_village", "village:grassland_village_mg"},
interval = 1,
chance = 1,
action = function(pos, node)
print("Spawning a Grassland village at "..dump(pos))
minetest.remove_node(pos)
village.spawn_village(pos, PseudoRandom(minetest.get_mapgen_params().seed+pos.x+pos.y+pos.z))
local pr = PseudoRandom(minetest.get_mapgen_params().seed+pos.x+pos.y+pos.z)
if node.name == "village:grassland_village_mg" then
if pr:next(1, 100) == 1 then
print("Spawning a (Mapgen)Grassland village at "..dump(pos))
village.spawn_village(pos, pr)
end
else
print("Spawning a Grassland village at "..dump(pos))
village.spawn_village(pos, pr)
end
end
})
minetest.register_on_generated(
function(minp, maxp, seed)
end)
minetest.register_decoration(
{
deco_type = "simple",
place_on = "default:dirt_with_grass",
sidelen = 16,
fill_ratio = 0.005,
biomes = {"Grassland", "Forest"},
decoration = {"village:grassland_village_mg"},
y_min = 1,
y_max = 1000,
})