updated village (natural spawning)

This commit is contained in:
cale 2016-03-19 11:21:31 +01:00
parent 31b44f5f0f
commit 2748dbf9d4

View File

@ -73,23 +73,38 @@ minetest.register_node("village:spawn", {
minetest.register_abm({
nodenames = {"village:spawn"},
interval = 3.0,
interval = 1.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
minetest.set_node(pos, {name = "air"})
village.gen(pos)
if not places.pos["village_" .. tostring(village.num)] then
places.pos["village_" .. tostring(village.num)] = {x=pos.x, y=pos.y, z=pos.z}
village.num = village.num +1
places.save_places()
else
-- TODO : save village num
village.num = village.num +10
if math.random(150) == 50 then
village.gen(pos)
if not places.pos["village_" .. tostring(village.num)] then
places.pos["village_" .. tostring(village.num)] = {x=pos.x, y=pos.y, z=pos.z}
village.num = village.num +1
places.save_places()
else
-- TODO : save village num
village.num = village.num +10
if not places.pos["village_" .. tostring(village.num)] then
places.pos["village_" .. tostring(village.num)] = {x=pos.x, y=pos.y, z=pos.z}
village.num = village.num +1
places.save_places()
end
end
end
end,
})
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:grass", "default:wet_grass"},
sidelen = 16,
fill_ratio = 0.004,
biomes = {
"grassland", "jungle"
},
y_min = 0,
y_max = 31000,
decoration = "village:spawn",
})