finetuning

This commit is contained in:
kno10 2024-07-20 13:57:01 +02:00
parent 79d96e9ea0
commit 8e94eca3be
5 changed files with 91 additions and 91 deletions

View File

@ -43,7 +43,7 @@ local function try_place_building(minp, maxp, pos_surface, building_all_info, ro
table.sort(ys)
-- well supported base, not too uneven?
if #ys < 5 or ys[#ys]-ys[1] > fheight + 3 then return nil end
pos_surface.y = ys[math.ceil(#ys/2)]
pos_surface.y = 0.5 * (ys[math.floor(#ys/2)] + ys[math.ceil(#ys/2)]) -- median
-- check distance to other buildings
if not mcl_villages.check_distance(settlement_info, pos_surface, math.max(fheight, fdepth)) then return nil end
return pos_surface
@ -53,7 +53,7 @@ end
--------------------------------------------------------------------------------
function mcl_villages.create_site_plan(minp, maxp, pr)
local center = vector.new(math.floor((minp.x+maxp.x)/2),maxp.y,math.floor((minp.z+maxp.z)/2))
minetest.log("action", "sudo make me a village at: " .. minetest.pos_to_string(center))
minetest.log("action", "[mcl_villages] sudo make me a village at: " .. minetest.pos_to_string(center))
local possible_rotations = {"0", "90", "180", "270"}
local center_surface
@ -62,8 +62,9 @@ function mcl_villages.create_site_plan(minp, maxp, pr)
-- now some buildings around in a circle, radius = size of town center
local x, y, z, r = center.x, maxp.y, center.z, 0
-- draw j circles around center and increase radius by math.random(2,5)
for j = 1,10 do
for angle = 0, math.pi*2, 0.262 do -- 24 attempts on a circle
for j = 1,15 do
for a = 0, 23, 1 do
local angle = a * 71 / 24 * math.pi * 2 -- prime to increase randomness
local pos1 = vector.new(math.floor(x + r * math.cos(angle) + 0.5), y, math.floor(z - r * math.sin(angle) + 0.5))
local pos_surface, surface_material = mcl_villages.find_surface(pos1, false)
if pos_surface then
@ -74,18 +75,19 @@ function mcl_villages.create_site_plan(minp, maxp, pr)
for i = 1, #randomized_schematic_table do
local building_all_info = randomized_schematic_table[i]
-- already enough buildings of that type?
if count_buildings[building_all_info["name"]] < building_all_info["max_num"]*number_of_buildings then
if count_buildings[building_all_info["name"]] < building_all_info["max_num"]*number_of_buildings
and (r >= 25 or not string.find(building_all_info["name"], "lamp")) then -- no lamps in the center
local rotation = possible_rotations[pr:next(1, #possible_rotations)]
local pos = try_place_building(minp, maxp, pos_surface, building_all_info, rotation, settlement_info, pr)
if pos then
if #settlement_info == 0 then -- town bell
center_surface, y = pos, pos.y + max_height_difference
center_surface, y = pos, pos.y + max_height_difference * 0.5 + 1
end
-- limit height differences to town center
if math.abs(pos.y - center_surface.y) > max_height_difference * 0.7 then
if math.abs(pos.y - center_surface.y) > max_height_difference * 0.5 then
break -- other buildings likely will not fit either
end
count_buildings[building_all_info["name"]] = count_buildings[building_all_info["name"]] +1
count_buildings[building_all_info["name"]] = (count_buildings[building_all_info["name"]] or 0) + 1
number_built = number_built + 1
pos.y = pos.y + (building_all_info["yadjust"] or 0)
@ -96,7 +98,7 @@ function mcl_villages.create_site_plan(minp, maxp, pr)
rotat = rotation,
surface_mat = surface_material
})
-- minetest.log("action", "Placing "..building_all_info["name"].." at "..minetest.pos_to_string(pos))
-- minetest.log("action", "[mcl_villages] Placing "..building_all_info["name"].." at "..minetest.pos_to_string(pos))
break
end
end
@ -111,15 +113,14 @@ function mcl_villages.create_site_plan(minp, maxp, pr)
break
end
r = r + pr:next(2,5)
if r > 35 then break end -- avoid touching neighboring blocks
end
mcl_villages.debug("really ".. number_built)
if number_built < 8 then
minetest.log("action", "Bad village location, could only place "..number_built.." buildings.")
if number_built < 7 then
minetest.log("action", "[mcl_villages] Bad village location, could only place "..number_built.." buildings.")
return
end
minetest.log("action", "Village completed at " .. minetest.pos_to_string(center))
--minetest.log("Village completed at " .. minetest.pos_to_string(center)) -- for debugging only
minetest.log("action", "[mcl_villages] village plan completed at " .. minetest.pos_to_string(center))
--minetest.log("[mcl_villages] village plan completed at " .. minetest.pos_to_string(center)) -- for debugging only
return settlement_info
end
-------------------------------------------------------------------------------
@ -128,23 +129,18 @@ end
-- Initialize node
local function construct_node(p1, p2, name)
local r = minetest.registered_nodes[name]
if r then
if r.on_construct then
local nodes = minetest.find_nodes_in_area(p1, p2, name)
for p=1, #nodes do
local pos = nodes[p]
r.on_construct(pos)
end
return nodes
end
if not r or not r.on_construct then
minetest.log("warning", "[mcl_villages] No on_construct defined for node name " .. name)
return
end
minetest.log("warning", "[mcl_villages] Attempt to 'construct' inexistant nodes: " .. name)
local nodes = minetest.find_nodes_in_area(p1, p2, name)
for p=1, #nodes do
r.on_construct(nodes[p])
end
return nodes
end
local function spawn_iron_golem(pos)
--minetest.log("action", "Attempt to spawn iron golem.")
--minetest.log("action", "[mcl_villages] Attempt to spawn iron golem.")
local p = minetest.find_node_near(pos,50,"mcl_core:grass_path")
if p then
p.y = p.y + 1
@ -156,7 +152,7 @@ local function spawn_iron_golem(pos)
end
local function spawn_villagers(minp,maxp)
--minetest.log("action", "Attempt to spawn villagers.")
--minetest.log("action", "[mcl_villages] Attempt to spawn villagers.")
local beds=minetest.find_nodes_in_area(vector.offset(minp,-20,-20,-20),vector.offset(maxp,20,20,20),{"mcl_beds:bed_red_bottom"})
for _,bed in pairs(beds) do
local m = minetest.get_meta(bed)
@ -195,6 +191,13 @@ local function init_nodes(p1, p2, size, rotation, pr)
mcl_villages.fill_chest(pos, pr)
end
end
local nodes = construct_node(p1, p2, "mcl_chests:chest_small")
if nodes and #nodes > 0 then
for p=1, #nodes do
local pos = nodes[p]
mcl_villages.fill_chest(pos, pr)
end
end
end
function mcl_villages.place_schematics(settlement_info, pr)
@ -223,9 +226,12 @@ function mcl_villages.place_schematics(settlement_info, pr)
for _, sub in pairs(mcl_villages.mcla_to_vl) do
schem_lua = schem_lua:gsub(sub[1], sub[2])
end
local schematic = loadstring(schem_lua)()
if not schem_lua then error("schema failed to load "..building_all_info["name"]) end
local schematic = loadstring(schem_lua)
if not schematic then error("schema failed to load "..building_all_info["name"].." "..schem_lua) end
schematic = schematic() -- evaluate
if schematic.size["x"] ~= building_all_info["hwidth"] or schematic.size["y"] ~= building_all_info["hheight"] or schematic.size["z"] ~= building_all_info["hdepth"] then
minetest.log(building_all_info["name"].." width "..schematic.size["x"].." height "..schematic.size["y"].." depth "..schematic.size["z"])
minetest.log("warning", "[mcl_villages] schematic size differs: "..building_all_info["name"].." width "..schematic.size["x"].." height "..schematic.size["y"].." depth "..schematic.size["z"])
end
building_all_info["schem_lua"] = schem_lua
end

View File

@ -60,29 +60,29 @@ local basic_pseudobiome_villages = minetest.settings:get_bool("basic_pseudobiome
mcl_villages.schematic_table = {
{name = "belltower", mts = schem_path.."new_villages/belltower.mts", hwidth = 9, hdepth = 9, hheight = 7, hsize = 12, max_num = 0.01 , rplc = basic_pseudobiome_villages, yadjust = 1, yadjust = 1 },
{name = "old_belltower", mts = schem_path.."belltower.mts", hwidth = 5, hdepth = 5, hheight = 6, hsize = 8, max_num = 0, rplc = basic_pseudobiome_villages, yadjust = 1 },
{name = "large_house", mts = schem_path.."large_house.mts", hwidth = 12, hdepth = 12, hheight = 10, hsize = 18, max_num = 0.08 , rplc = basic_pseudobiome_villages },
{name = "blacksmith", mts = schem_path.."blacksmith.mts", hwidth = 8, hdepth = 11, hheight = 8, hsize = 15, max_num = 0.01 , rplc = basic_pseudobiome_villages },
--{name = "old_belltower", mts = schem_path.."belltower.mts", hwidth = 5, hdepth = 5, hheight = 6, hsize = 8, max_num = 0, rplc = basic_pseudobiome_villages, yadjust = 1 },
--{name = "large_house", mts = schem_path.."large_house.mts", hwidth = 12, hdepth = 12, hheight = 10, hsize = 18, max_num = 0.08 , rplc = basic_pseudobiome_villages },
--{name = "blacksmith", mts = schem_path.."blacksmith.mts", hwidth = 8, hdepth = 11, hheight = 8, hsize = 15, max_num = 0.01 , rplc = basic_pseudobiome_villages },
{name = "new_blacksmith", mts = schem_path.."new_villages/blacksmith.mts", hwidth = 9, hdepth = 11, hheight = 8, hsize = 15, max_num = 0.01 , rplc = basic_pseudobiome_villages, yadjust = 1 },
{name = "weaponsmith", mts = schem_path.."new_villages/weaponsmith.mts", hwidth = 11, hdepth = 9, hheight = 6, hsize = 15, max_num = 0.01 , rplc = basic_pseudobiome_villages, yadjust = 1 },
{name = "toolsmith", mts = schem_path.."new_villages/toolsmith.mts", hwidth = 9, hdepth = 11, hheight = 6, hsize = 15, max_num = 0.01 , rplc = basic_pseudobiome_villages, yadjust = 1 },
{name = "tannery", mts = schem_path.."new_villages/leather_worker.mts", hwidth = 8, hdepth = 8, hheight = 7, hsize = 12, max_num = 0.01 , rplc = basic_pseudobiome_villages, yadjust = 1 },
{name = "butcher", mts = schem_path.."butcher.mts", hwidth = 12, hdepth = 8, hheight = 10, hsize = 15, max_num = 0.01 , rplc = basic_pseudobiome_villages },
{name = "church", mts = schem_path.."church.mts", hwidth = 13, hdepth = 14, hheight = 15, hsize = 20, max_num = 0.01 , rplc = basic_pseudobiome_villages },
--{name = "butcher", mts = schem_path.."butcher.mts", hwidth = 12, hdepth = 8, hheight = 10, hsize = 15, max_num = 0.01 , rplc = basic_pseudobiome_villages },
--{name = "church", mts = schem_path.."church.mts", hwidth = 13, hdepth = 14, hheight = 15, hsize = 20, max_num = 0.01 , rplc = basic_pseudobiome_villages },
{name = "newchurch", mts = schem_path.."new_villages/church.mts", hwidth = 14, hdepth = 16, hheight = 13, hsize = 22, max_num = 0.01 , rplc = basic_pseudobiome_villages, yadjust = 1 },
{name = "chapel", mts = schem_path.."new_villages/chapel.mts", hwidth = 9, hdepth = 10, hheight = 6, hsize = 14, max_num = 0.01 , rplc = basic_pseudobiome_villages, yadjust = 1 },
{name = "farm", mts = schem_path.."farm.mts", hwidth = 9, hdepth = 7, hheight = 8, hsize = 12, max_num = 0.1 , rplc = basic_pseudobiome_villages, yadjust = 0 },
{name = "lamp", mts = schem_path.."lamp.mts", hwidth = 3, hdepth = 4, hheight = 6, hsize = 6, max_num = 0.001 , rplc = false },
{name = "lamp_1", mts = schem_path.."new_villages/lamp_1.mts", hwidth = 1, hdepth = 1, hheight = 4, hsize = 2, max_num = 0.001 , rplc = false, yadjust = 1 },
{name = "lamp_2", mts = schem_path.."new_villages/lamp_2.mts", hwidth = 1, hdepth = 2, hheight = 6, hsize = 3, max_num = 0.001 , rplc = false, yadjust = 1 },
{name = "lamp_3", mts = schem_path.."new_villages/lamp_3.mts", hwidth = 3, hdepth = 3, hheight = 4, hsize = 5, max_num = 0.001 , rplc = false, yadjust = 1 },
{name = "lamp_4", mts = schem_path.."new_villages/lamp_4.mts", hwidth = 1, hdepth = 2, hheight = 5, hsize = 3, max_num = 0.001 , rplc = false, yadjust = 1 },
{name = "lamp_5", mts = schem_path.."new_villages/lamp_5.mts", hwidth = 1, hdepth = 1, hheight = 2, hsize = 2, max_num = 0.001 , rplc = false, yadjust = 1 },
{name = "lamp_6", mts = schem_path.."new_villages/lamp_6.mts", hwidth = 1, hdepth = 1, hheight = 3, hsize = 2, max_num = 0.001 , rplc = false, yadjust = 1 },
{name = "library", mts = schem_path.."library.mts", hwidth = 12, hdepth = 12, hheight = 9, hsize = 18, max_num = 0.01 , rplc = basic_pseudobiome_villages },
--{name = "farm", mts = schem_path.."farm.mts", hwidth = 9, hdepth = 7, hheight = 8, hsize = 12, max_num = 0.1 , rplc = basic_pseudobiome_villages, yadjust = 0 },
--{name = "lamp", mts = schem_path.."lamp.mts", hwidth = 3, hdepth = 4, hheight = 6, hsize = 6, max_num = 0.001 , rplc = false },
{name = "lamp_1", mts = schem_path.."new_villages/lamp_1.mts", hwidth = 1, hdepth = 1, hheight = 4, hsize = 4, max_num = 0.001 , rplc = false, yadjust = 1 },
{name = "lamp_2", mts = schem_path.."new_villages/lamp_2.mts", hwidth = 1, hdepth = 2, hheight = 6, hsize = 5, max_num = 0.001 , rplc = false, yadjust = 1 },
{name = "lamp_3", mts = schem_path.."new_villages/lamp_3.mts", hwidth = 3, hdepth = 3, hheight = 4, hsize = 6, max_num = 0.001 , rplc = false, yadjust = 1 },
{name = "lamp_4", mts = schem_path.."new_villages/lamp_4.mts", hwidth = 1, hdepth = 2, hheight = 5, hsize = 5, max_num = 0.001 , rplc = false, yadjust = 1 },
{name = "lamp_5", mts = schem_path.."new_villages/lamp_5.mts", hwidth = 1, hdepth = 1, hheight = 2, hsize = 4, max_num = 0.001 , rplc = false, yadjust = 1 },
{name = "lamp_6", mts = schem_path.."new_villages/lamp_6.mts", hwidth = 1, hdepth = 1, hheight = 3, hsize = 4, max_num = 0.001 , rplc = false, yadjust = 1 },
--{name = "library", mts = schem_path.."library.mts", hwidth = 12, hdepth = 12, hheight = 9, hsize = 18, max_num = 0.01 , rplc = basic_pseudobiome_villages },
{name = "newlibrary", mts = schem_path.."new_villages/library.mts", hwidth = 14, hdepth = 14, hheight = 7, hsize = 21, max_num = 0.01 , rplc = basic_pseudobiome_villages, yadjust = 1 },
{name = "medium_house", mts = schem_path.."medium_house.mts", hwidth = 9, hdepth = 12, hheight = 9, hsize = 16, max_num = 0.08 , rplc = basic_pseudobiome_villages },
{name = "small_house", mts = schem_path.."small_house.mts", hwidth = 9, hdepth = 8, hheight = 9, hsize = 13, max_num = 0.3 , rplc = basic_pseudobiome_villages },
--{name = "medium_house", mts = schem_path.."medium_house.mts", hwidth = 9, hdepth = 12, hheight = 9, hsize = 16, max_num = 0.08 , rplc = basic_pseudobiome_villages },
--{name = "small_house", mts = schem_path.."small_house.mts", hwidth = 9, hdepth = 8, hheight = 9, hsize = 13, max_num = 0.3 , rplc = basic_pseudobiome_villages },
{name = "house_1_bed", mts = schem_path.."new_villages/house_1_bed.mts", hwidth = 9, hdepth = 8, hheight = 7, hsize = 13, max_num = 0.3 , rplc = basic_pseudobiome_villages, yadjust = 1 },
{name = "house_2_bed", mts = schem_path.."new_villages/house_2_bed.mts", hwidth = 11, hdepth = 8, hheight = 7, hsize = 15, max_num = 0.2 , rplc = basic_pseudobiome_villages, yadjust = 1 },
{name = "house_3_bed", mts = schem_path.."new_villages/house_3_bed.mts", hwidth = 11, hdepth = 13, hheight = 9, hsize = 18, max_num = 0.1 , rplc = basic_pseudobiome_villages, yadjust = 1 },
@ -91,10 +91,10 @@ mcl_villages.schematic_table = {
{name = "mill", mts = schem_path.."new_villages/mill.mts", hwidth = 8, hdepth = 8, hheight = 7, hsize = 12, max_num = 0.01 , rplc = basic_pseudobiome_villages, yadjust = 1 },
{name = "cartographer", mts = schem_path.."new_villages/cartographer.mts", hwidth = 9, hdepth = 12, hheight = 6, hsize = 16, max_num = 0.01 , rplc = basic_pseudobiome_villages, yadjust = 2 },
{name = "fletcher", mts = schem_path.."new_villages/fletcher.mts", hwidth = 8, hdepth = 8, hheight = 7, hsize = 12, max_num = 0.01 , rplc = basic_pseudobiome_villages, yadjust = 1 },
{name = "new_butcher", mts = schem_path.."new_villages/butcher.mts", hwidth = 8, hdepth = 14, hheight = 9, hsize = 17, max_num = 0.01 , rplc = basic_pseudobiome_villages, yadjust = 2 },
{name = "new_butcher", mts = schem_path.."new_villages/butcher.mts", hwidth = 8, hdepth = 14, hheight = 9, hsize = 17, max_num = 0.01 , rplc = basic_pseudobiome_villages, yadjust = 1 },
{name = "fish_farm", mts = schem_path.."new_villages/fishery.mts", hwidth = 10, hdepth = 7, hheight = 9, hsize = 13, max_num = 0.01 , rplc = basic_pseudobiome_villages, yadjust=-2 },
{name = "tavern", mts = schem_path.."tavern.mts", hwidth = 12, hdepth = 10, hheight = 13, hsize = 17, max_num = 0.050, rplc = basic_pseudobiome_villages },
{name = "well", mts = schem_path.."well.mts", hwidth = 6, hdepth = 8, hheight = 7, hsize = 11, max_num = 0.01, rplc = basic_pseudobiome_villages },
--{name = "tavern", mts = schem_path.."tavern.mts", hwidth = 12, hdepth = 10, hheight = 13, hsize = 17, max_num = 0.050, rplc = basic_pseudobiome_villages },
--{name = "well", mts = schem_path.."well.mts", hwidth = 6, hdepth = 8, hheight = 7, hsize = 11, max_num = 0.01, rplc = basic_pseudobiome_villages },
{name = "new_well", mts = schem_path.."new_villages/well.mts", hwidth = 6, hdepth = 6, hheight = 8, hsize = 9, max_num = 0.01, rplc = basic_pseudobiome_villages, yadjust=-1 },
{name = "new_farm", mts = schem_path.."new_villages/farm.mts", hwidth=10, hdepth=9, hheight=6, hsize=14, max_num = 0.1, rplc = basic_pseudobiome_villages, yadjust = 1 },
{name = "farm_small", mts = schem_path.."new_villages/farm_small_1.mts", hwidth=10, hdepth=9, hheight=6, hsize=14, max_num = 0.1, rplc = basic_pseudobiome_villages, yadjust = 1 },
@ -157,18 +157,20 @@ mcl_villages.biome_map = {
CherryGrove = "cherry",
-- no change, but try to convert MCLA material
FlowerForest = "oak",
Forest = "oak",
MushroomIsland = "oak",
Plains = "oak",
StoneBeach = "oak",
SunflowerPlains = "oak",
Swampland = "oak",
-- FlowerForest = "oak",
-- Forest = "oak",
-- MushroomIsland = "oak",
-- Plains = "oak",
-- StoneBeach = "oak",
-- SunflowerPlains = "oak",
-- Swampland = "oak",
}
mcl_villages.vl_to_mcla = {
{ '"mcl_core:tree"', '"mcl_trees:tree_oak"'},
{ '"mcl_core:darktree"', '"mcl_trees:tree_dark_oak"'},
{ '"mcl_core:wood"', '"mcl_trees:wood_oak"'},
{ '"mcl_core:darkwood"', '"mcl_trees:wood_dark_oak"'},
{ '"mcl_fences:fence', '"mcl_fences:oak_fence'},
{ '"mcl_stairs:stair_wood"', '"mcl_stairs:stair_oak"'},
{ '"mcl_stairs:stair_wood_', '"mcl_stairs:stair_oak_'},
@ -181,9 +183,10 @@ mcl_villages.vl_to_mcla = {
{ '"mcl_itemframes:item_frame"', '"mcl_itemframes:frame"' },
{ '"mesecons_pressureplates:pressure_plate_wood_', '"mesecons_pressureplates:pressure_plate_oak_'},
-- tree types
{ '"mcl_core:([a-z]*)tree"', '"mcl_trees:tree_%1"' },
{ '"mcl_core:([a-z]*)wood"', '"mcl_trees:wood_%1"' },
{ '"mcl_stairs:stair_([a-z]*)tree"', '"mcl_stairs:stair_%1"' },
{ '"mcl_core:([a-z]*)tree"', '"mcl_trees:tree_%1"'},
{ '"mcl_core:([a-z]*)wood"', '"mcl_trees:wood_%1"'},
{ '"mcl_stairs:stair_darkwood"', '"mcl_stairs:stair_dark_oak"'},
{ '"mcl_stairs:stair_([a-z]*)wood"', '"mcl_stairs:stair_%1"'},
}
mcl_villages.mcla_to_vl = {
-- oneway
@ -192,10 +195,15 @@ mcl_villages.mcla_to_vl = {
{ '"mcl_villages:crop_root', '"mcl_farming:potato'}, -- TODO: support biome specific farming
{ '"mcl_villages:crop_grain', '"mcl_farming:wheat'}, -- TODO: support biome specific farming
{ '"mcl_villages:crop_gourd', '"mcl_farming:pumpkin'}, -- TODO: support biome specific farming
{ '"mcl_villages:crop_flower', '"mcl_farming:sweet_berry_bush'}, -- TODO: support biome specific farming
{ '"mcl_villages:crop_flower_0"', '"mcl_flowers:tulip_red"'}, -- TODO: support biome specific farming
{ '"mcl_villages:crop_flower_1"', '"mcl_flowers:tulip_orange"'}, -- TODO: support biome specific farming
{ '"mcl_villages:crop_flower_2"', '"mcl_flowers:tulip_pink"'}, -- TODO: support biome specific farming
{ '"mcl_villages:crop_flower_3"', '"mcl_flowers:tulip_white"'}, -- TODO: support biome specific farming
-- bidirectional
{ '"mcl_trees:tree_oak"', '"mcl_core:tree"'},
{ '"mcl_trees:tree_dark_oak"', '"mcl_core:darktree"'},
{ '"mcl_trees:wood_oak"', '"mcl_core:wood"'},
{ '"mcl_trees:wood_dark_oak"', '"mcl_core:darkwood"'},
{ '"mcl_fences:oak_fence', '"mcl_fences:fence'},
{ '"mcl_stairs:stair_oak"', '"mcl_stairs:stair_wood"'},
{ '"mcl_stairs:stair_oak_bark', '"mcl_stairs:stair_tree_bark'},
@ -204,19 +212,19 @@ mcl_villages.mcla_to_vl = {
{ '"mcl_stairs:slab_oak_', '"mcl_stairs:slab_wood_'},
{ '"mcl_doors:door_oak_', '"mcl_doors:wooden_door_'},
{ '"mcl_doors:trapdoor_oak_', '"mcl_doors:trapdoor_'},
{ '"mcl_panes:bar', '"xpanes:bar' },
{ '"mcl_panes:pane', '"xpanes:pane' },
{ '"mcl_itemframes:frame"', '"mcl_itemframes:item_frame"' },
{ '"mcl_panes:bar', '"xpanes:bar'},
{ '"mcl_panes:pane', '"xpanes:pane'},
{ '"mcl_itemframes:frame"', '"mcl_itemframes:item_frame"'},
{ '"mesecons_pressureplates:pressure_plate_oak_', '"mesecons_pressureplates:pressure_plate_wood_'},
-- tree types
{ '"mcl_trees:tree_([a-z]*)"', '"mcl_core:%1tree"' },
{ '"mcl_trees:wood_([a-z]*)"', '"mcl_core:%1wood"' },
{ '"mcl_stairs:stair_birch(["_])', '"mcl_stairs:stair_birchwood%1' },
{ '"mcl_stairs:stair_spruce(["_])', '"mcl_stairs:stair_sprucewood%1' },
{ '"mcl_stairs:stair_dark(["_])', '"mcl_stairs:stair_darkwood%1' },
{ '"mcl_stairs:stair_jungle(["_])', '"mcl_stairs:stair_junglewood%1' },
{ '"mcl_stairs:stair_acacia(["_])', '"mcl_stairs:stair_acaciawood%1' },
{ '"mcl_stairs:stair_bamboo(["_])', '"mcl_stairs:stair_bamboowood%1' },
{ '"mcl_trees:tree_([a-z]*)"', '"mcl_core:%1tree"'},
{ '"mcl_trees:wood_([a-z]*)"', '"mcl_core:%1wood"'},
{ '"mcl_stairs:stair_birch(["_])', '"mcl_stairs:stair_birchwood%1'},
{ '"mcl_stairs:stair_spruce(["_])', '"mcl_stairs:stair_sprucewood%1'},
{ '"mcl_stairs:stair_dark_oak(["_])', '"mcl_stairs:stair_darkwood%1'},
{ '"mcl_stairs:stair_jungle(["_])', '"mcl_stairs:stair_junglewood%1'},
{ '"mcl_stairs:stair_acacia(["_])', '"mcl_stairs:stair_acaciawood%1'},
{ '"mcl_stairs:stair_bamboo(["_])', '"mcl_stairs:stair_bamboowood%1'},
}
mcl_villages.material_substitions = {
desert = {
@ -249,7 +257,6 @@ mcl_villages.material_substitions = {
{ '"mcl_stairs:stair_oak([^"]*)"', '"mcl_stairs:stair_sandstonesmooth%1"' },
},
spruce = {
{ '"(mcl_core:wood|mcl_core:tree|mcl_stairs:stair_wood|mcl_fences:fence)"', '"%1_oak"'}, -- VL to MCLA
{ '"mcl_stairs:slab_oak([^"]*)"', '"mcl_stairs:slab_sprucewood%1"' },
{
'"mesecons_pressureplates:pressure_plate_oak_([^"]+)"',
@ -261,10 +268,8 @@ mcl_villages.material_substitions = {
{ "mcl_trees:wood_oak", "mcl_trees:wood_spruce" },
{ '"mcl_fences:oak_fence([^"]*)"', '"mcl_fences:spruce_fence%1"' },
{ '"mcl_stairs:stair_oak([^"]*)"', '"mcl_stairs:stair_spruce%1"' },
{ '"(mcl_core:wood|mcl_core:tree|mcl_stairs:stair_wood|mcl_fences:fence)_oak"', '"%1"'}, -- MCLA to VL
},
birch = {
{ '"(mcl_core:wood|mcl_core:tree|mcl_stairs:stair_wood|mcl_fences:fence)"', '"%1_oak"'}, -- VL to MCLA
{ '"mcl_stairs:slab_oak([^"]*)"', '"mcl_stairs:slab_birchwood%1"' },
{
'"mesecons_pressureplates:pressure_plate_oak_([^"]+)"',
@ -272,14 +277,12 @@ mcl_villages.material_substitions = {
},
{ '"mcl_doors:trapdoor_oak([^"]*)"', '"mcl_doors:birch_trapdoor%1"' },
{ '"mcl_doors:door_oak([^"]*)"', '"mcl_doors:birch_door%1"' },
{ "mcl_trees:tree_oak", "mcl_trees:tree_birch" },
{ "mcl_trees:tree_oak", "mcl_core:stripped_birch" }, -- divert from MCLA, use stripped birch, what is the name in MCLA?
{ "mcl_trees:wood_oak", "mcl_trees:wood_birch" },
{ '"mcl_fences:oak_fence([^"]*)"', '"mcl_fences:birch_fence%1"' },
{ '"mcl_stairs:stair_oak([^"]*)"', '"mcl_stairs:stair_birch%1"' },
{ '"(mcl_core:wood|mcl_core:tree|mcl_stairs:stair_wood|mcl_fences:fence)_oak"', '"%1"'}, -- MCLA to VL
},
acacia = {
{ '"(mcl_core:wood|mcl_core:tree|mcl_stairs:stair_wood|mcl_fences:fence)"', '"%1_oak"'}, -- VL to MCLA
{ '"mcl_stairs:slab_oak([^"]*)"', '"mcl_stairs:slab_acaciawood%1"' },
{
'"mesecons_pressureplates:pressure_plate_oak_([^"]+)"',
@ -291,10 +294,8 @@ mcl_villages.material_substitions = {
{ "mcl_trees:wood_oak", "mcl_trees:wood_acacia" },
{ '"mcl_fences:oak_fence([^"]*)"', '"mcl_fences:acacia_fence%1"' },
{ '"mcl_stairs:stair_oak([^"]*)"', '"mcl_stairs:stair_acacia%1"' },
{ '"(mcl_core:wood|mcl_core:tree|mcl_stairs:stair_wood|mcl_fences:fence)_oak"', '"%1"'}, -- MCLA to VL
},
dark_oak = {
{ '"(mcl_core:wood|mcl_core:tree|mcl_stairs:stair_wood|mcl_fences:fence)"', '"%1_oak"'}, -- VL to MCLA
{ '"mcl_stairs:slab_oak([^"]*)"', '"mcl_stairs:slab_darkwood%1"' },
{
'"mesecons_pressureplates:pressure_plate_oak_([^"]+)"',
@ -306,10 +307,8 @@ mcl_villages.material_substitions = {
{ "mcl_trees:wood_oak", "mcl_trees:wood_dark_oak" },
{ '"mcl_fences:oak_fence([^"]*)"', '"mcl_fences:dark_oak_fence%1"' },
{ '"mcl_stairs:stair_oak([^"]*)"', '"mcl_stairs:stair_dark_oak%1"' },
{ '"(mcl_core:wood|mcl_core:tree|mcl_stairs:stair_wood|mcl_fences:fence)_oak"', '"%1"'}, -- MCLA to VL
},
jungle = {
{ '"(mcl_core:wood|mcl_core:tree|mcl_stairs:stair_wood|mcl_fences:fence)"', '"%1_oak"'}, -- VL to MCLA
{ '"mcl_stairs:slab_oak([^"]*)"', '"mcl_stairs:slab_junglewood%1"' },
{
'"mesecons_pressureplates:pressure_plate_oak_([^"]+)"',
@ -321,10 +320,8 @@ mcl_villages.material_substitions = {
{ "mcl_trees:wood_oak", "mcl_trees:wood_jungle" },
{ '"mcl_fences:oak_fence([^"]*)"', '"mcl_fences:jungle_fence%1"' },
{ '"mcl_stairs:stair_oak([^"]*)"', '"mcl_stairs:stair_jungle%1"' },
{ '"(mcl_core:wood|mcl_core:tree|mcl_stairs:stair_wood|mcl_fences:fence)_oak"', '"%1"'}, -- MCLA to VL
},
bamboo = {
{ '"(mcl_core:wood|mcl_core:tree|mcl_stairs:stair_wood|mcl_fences:fence)"', '"%1_oak"'}, -- VL to MCLA
{ '"mcl_stairs:slab_oak([^"]*)"', '"mcl_stairs:slab_bamboo_block%1"' },
{
'"mesecons_pressureplates:pressure_plate_oak_([^"]+)"',
@ -341,10 +338,8 @@ mcl_villages.material_substitions = {
{ "mcl_trees:wood_oak", "mcl_trees:wood_bamboo" },
{ '"mcl_fences:oak_fence([^"]*)"', '"mcl_fences:bamboo_fence%1"' },
{ '"mcl_stairs:stair_oak([^"]*)"', '"mcl_stairs:stair_bamboo%1"' },
{ '"(mcl_core:wood|mcl_core:tree|mcl_stairs:stair_wood|mcl_fences:fence)_oak"', '"%1"'}, -- MCLA to VL
},
cherry = {
{ '"(mcl_core:wood|mcl_core:tree|mcl_stairs:stair_wood|mcl_fences:fence)"', '"%1_oak"'}, -- VL to MCLA
{ '"mcl_stairs:slab_oak([^"]*)"', '"mcl_stairs:slab_cherry_blossom%1"' },
{
'"mesecons_pressureplates:pressure_plate_oak_([^"]+)"',
@ -356,9 +351,5 @@ mcl_villages.material_substitions = {
{ "mcl_trees:wood_oak", "mcl_trees:wood_cherry_blossom" },
{ '"mcl_fences:oak_fence([^"]*)"', '"mcl_fences:cherry_blossom_fence%1"' },
{ '"mcl_stairs:stair_oak([^"]*)"', '"mcl_stairs:stair_cherry_blossom%1"' },
{ '"(mcl_core:wood|mcl_core:tree|mcl_stairs:stair_wood|mcl_fences:fence)_oak"', '"%1"'}, -- MCLA to VL
},
oak = {
{ '"(mcl_core:wood|mcl_core:tree|mcl_stairs:stair_wood|mcl_fences:fence)_oak"', '"%1"'}, -- MCLA to VL
},
}

View File

@ -1,7 +1,7 @@
mcl_villages = {}
mcl_villages.modpath = minetest.get_modpath(minetest.get_current_modname())
local village_chance = tonumber(minetest.settings:get("mcl_villages_village_chance")) or 10
local village_chance = tonumber(minetest.settings:get("mcl_villages_village_chance")) or 5
dofile(mcl_villages.modpath.."/const.lua")
dofile(mcl_villages.modpath.."/utils.lua")

View File

@ -93,7 +93,7 @@ function mcl_villages.check_distance(settlement_info, building_pos, building_siz
local dx, dz = building_pos.x - built_house["pos"].x, building_pos.z - built_house["pos"].z
--local d = math.sqrt(dx*dx+dz*dz)
--if 2 * d < building_size + built_house["hsize"] then return false end
if math.max(math.abs(dx), math.abs(dz)) * 2 - 6 <= building_size + built_house["hsize"] then return false end
if math.max(math.abs(dx), math.abs(dz)) * 2 - 8 <= building_size + built_house["hsize"] then return false end
end
return true
end
@ -105,7 +105,7 @@ function mcl_villages.fill_chest(pos, pr)
local meta = minetest.get_meta(pos)
if meta:get_string("infotext") ~= "Chest" then
-- For MineClone2 0.70 or before
-- minetest.registered_nodes["mcl_chests:chest"].on_construct(pos)
minetest.registered_nodes["mcl_chests:chest"].on_construct(pos)
--
-- For MineClone2 after commit 09ab1482b5 (the new entity chests)
minetest.registered_nodes["mcl_chests:chest_small"].on_construct(pos)

View File

@ -45,6 +45,9 @@ mcl_disabled_structures (Disabled structures) string
# Comma separated list of disabled event names
mcl_disabled_events (Disabled events) string
# Amount of village to generate
mcl_villages_village_chance (Amount of villages) int 5 0 100
[Players]
# If enabled, players respawn at the bed they last lay on instead of normal
# spawn.