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},
|
||||||
@ -272,7 +274,7 @@ function village.spawn_chunk(pos, orient, replace, pr, chunktype, nofill)
|
|||||||
"village:entity_spawner",
|
"village:entity_spawner",
|
||||||
function(pos)
|
function(pos)
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
end)
|
end)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -444,7 +446,7 @@ function village.spawn_village(pos, pr)
|
|||||||
pr,
|
pr,
|
||||||
"lamppost",
|
"lamppost",
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -453,4 +455,4 @@ minetest.after(
|
|||||||
0,
|
0,
|
||||||
function()
|
function()
|
||||||
village.load_villages()
|
village.load_villages()
|
||||||
end)
|
end)
|
||||||
|
@ -6,7 +6,7 @@ minetest.register_node(
|
|||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
groups = {dig_immediate = 2},
|
groups = {dig_immediate = 2},
|
||||||
sounds = default.node_sound_wood_defaults()
|
sounds = default.node_sound_wood_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node(
|
minetest.register_node(
|
||||||
"village:grassland_village",
|
"village:grassland_village",
|
||||||
@ -16,7 +16,7 @@ minetest.register_node(
|
|||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
groups = {dig_immediate = 2},
|
groups = {dig_immediate = 2},
|
||||||
sounds = default.node_sound_wood_defaults()
|
sounds = default.node_sound_wood_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node(
|
minetest.register_node(
|
||||||
"village:grassland_village_mg",
|
"village:grassland_village_mg",
|
||||||
@ -33,7 +33,7 @@ minetest.register_node(
|
|||||||
air_equivalent = true,
|
air_equivalent = true,
|
||||||
drop = "",
|
drop = "",
|
||||||
groups = {not_in_craftingguide = 1},
|
groups = {not_in_craftingguide = 1},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_abm(
|
minetest.register_abm(
|
||||||
{
|
{
|
||||||
@ -41,24 +41,32 @@ minetest.register_abm(
|
|||||||
interval = 1,
|
interval = 1,
|
||||||
chance = 1,
|
chance = 1,
|
||||||
action = function(pos, node)
|
action = function(pos, node)
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
local pr = PseudoRandom(minetest.get_mapgen_params().seed+pos.x+pos.y+pos.z)
|
|
||||||
if node.name == "village:grassland_village_mg" then
|
if minetest.setting_get_bool("mapgen_disable_villages")
|
||||||
if ((minetest.get_mapgen_params().seed+pos.x+pos.y+pos.z) % 30) == 1 then
|
|
||||||
local nearest = village.get_nearest_village(pos)
|
local pr = PseudoRandom(minetest.get_mapgen_params().seed+pos.x+pos.y+pos.z)
|
||||||
if nearest.dist > village.min_spawn_dist then
|
|
||||||
print("Spawning a (Mapgen)Grassland village at "..dump(pos))
|
if node.name == "village:grassland_village_mg" then
|
||||||
minetest.after(3.0, function() village.spawn_village(pos, pr) end) -- a short delay to (hopefully)ensure that the surrounding terrain is generated
|
if ((minetest.get_mapgen_params().seed+pos.x+pos.y+pos.z) % 30) == 1 then
|
||||||
else
|
local nearest = village.get_nearest_village(pos)
|
||||||
print("Cannot spawn village, too near another village")
|
|
||||||
end
|
if nearest.dist > village.min_spawn_dist then
|
||||||
end
|
minetest.log("Spawning a (Mapgen)Grassland village at "..dump(pos))
|
||||||
else
|
|
||||||
print("Spawning a Grassland village at "..dump(pos))
|
-- a short delay to (hopefully) ensure that the surrounding terrain is generated
|
||||||
village.spawn_village(pos, pr)
|
minetest.after(3.0, function() village.spawn_village(pos, pr) end)
|
||||||
end
|
else
|
||||||
end
|
minetest.log("Cannot spawn village, too near another village")
|
||||||
})
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
minetest.log("Spawning a Grassland village at "..dump(pos))
|
||||||
|
|
||||||
|
village.spawn_village(pos, pr)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_decoration(
|
minetest.register_decoration(
|
||||||
{
|
{
|
||||||
@ -70,4 +78,4 @@ minetest.register_decoration(
|
|||||||
decoration = {"village:grassland_village_mg"},
|
decoration = {"village:grassland_village_mg"},
|
||||||
y_min = 1,
|
y_min = 1,
|
||||||
y_max = 1000,
|
y_max = 1000,
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user