Minor changes to villages backend
This commit is contained in:
parent
583925d611
commit
abb1c196da
@ -245,6 +245,7 @@ function village.spawn_chunk(pos, orient, replace, pr, chunktype, nofill)
|
|||||||
|
|
||||||
util.reconstruct(pos, {x = pos.x+12, y = pos.y+12, z = pos.z+12})
|
util.reconstruct(pos, {x = pos.x+12, y = pos.y+12, z = pos.z+12})
|
||||||
util.fixlight(pos, {x = pos.x+12, y = pos.y+12, z = pos.z+12})
|
util.fixlight(pos, {x = pos.x+12, y = pos.y+12, z = pos.z+12})
|
||||||
|
|
||||||
util.nodefunc(
|
util.nodefunc(
|
||||||
pos,
|
pos,
|
||||||
{x = pos.x+12, y = pos.y+12, z = pos.z+12},
|
{x = pos.x+12, y = pos.y+12, z = pos.z+12},
|
||||||
@ -252,6 +253,7 @@ function village.spawn_chunk(pos, orient, replace, pr, chunktype, nofill)
|
|||||||
function(pos)
|
function(pos)
|
||||||
goodies.fill(pos, chunktype, pr, "main", 3)
|
goodies.fill(pos, chunktype, pr, "main", 3)
|
||||||
end, true)
|
end, true)
|
||||||
|
|
||||||
util.nodefunc(
|
util.nodefunc(
|
||||||
pos,
|
pos,
|
||||||
{x = pos.x+12, y = pos.y+12, z = pos.z+12},
|
{x = pos.x+12, y = pos.y+12, z = pos.z+12},
|
||||||
|
@ -42,19 +42,27 @@ minetest.register_abm(
|
|||||||
chance = 1,
|
chance = 1,
|
||||||
action = function(pos, node)
|
action = function(pos, node)
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
|
|
||||||
|
if minetest.setting_get_bool("mapgen_disable_villages")
|
||||||
|
|
||||||
local pr = 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 node.name == "village:grassland_village_mg" then
|
||||||
if ((minetest.get_mapgen_params().seed+pos.x+pos.y+pos.z) % 30) == 1 then
|
if ((minetest.get_mapgen_params().seed+pos.x+pos.y+pos.z) % 30) == 1 then
|
||||||
local nearest = village.get_nearest_village(pos)
|
local nearest = village.get_nearest_village(pos)
|
||||||
|
|
||||||
if nearest.dist > village.min_spawn_dist then
|
if nearest.dist > village.min_spawn_dist then
|
||||||
print("Spawning a (Mapgen)Grassland village at "..dump(pos))
|
minetest.log("Spawning a (Mapgen)Grassland village at "..dump(pos))
|
||||||
minetest.after(3.0, function() village.spawn_village(pos, pr) end) -- a short delay to (hopefully)ensure that the surrounding terrain is generated
|
|
||||||
|
-- a short delay to (hopefully) ensure that the surrounding terrain is generated
|
||||||
|
minetest.after(3.0, function() village.spawn_village(pos, pr) end)
|
||||||
else
|
else
|
||||||
print("Cannot spawn village, too near another village")
|
minetest.log("Cannot spawn village, too near another village")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
print("Spawning a Grassland village at "..dump(pos))
|
minetest.log("Spawning a Grassland village at "..dump(pos))
|
||||||
|
|
||||||
village.spawn_village(pos, pr)
|
village.spawn_village(pos, pr)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user