Make little cleanup

This commit is contained in:
kay27 2022-02-07 04:25:52 +04:00
parent 4ae1bf711d
commit 7e7c0c3a37
2 changed files with 4 additions and 31 deletions

View File

@ -23,9 +23,7 @@ function settlements.create_site_plan(minp, maxp, pr)
-- find center of chunk -- find center of chunk
local center = vector.add(minp, mcl_mapgen.HALF_CS_NODES) local center = vector.add(minp, mcl_mapgen.HALF_CS_NODES)
-- find center_surface of chunk -- find center_surface of chunk
local center_surface , surface_material = settlements.find_surface(center) local center_surface, surface_material = settlements.find_surface(center)
local chunks = {}
chunks[mcl_mapgen.get_chunk_number(center)] = true
-- go build settlement around center -- go build settlement around center
if not center_surface then return false end if not center_surface then return false end
@ -60,15 +58,8 @@ function settlements.create_site_plan(minp, maxp, pr)
local ptx, ptz = x + r * math.cos( angle ), z + r * math.sin( angle ) local ptx, ptz = x + r * math.cos( angle ), z + r * math.sin( angle )
ptx = settlements.round(ptx, 0) ptx = settlements.round(ptx, 0)
ptz = settlements.round(ptz, 0) ptz = settlements.round(ptz, 0)
local pos1 = { x=ptx, y=center_surface.y+50, z=ptz} local pos1 = { x=ptx, y=center_surface.y, z=ptz}
local chunk_number = mcl_mapgen.get_chunk_number(pos1) local pos_surface, surface_material = settlements.find_surface(pos1)
local pos_surface, surface_material
if chunks[chunk_number] then
pos_surface, surface_material = settlements.find_surface(pos1)
else
chunks[chunk_number] = true
pos_surface, surface_material = settlements.find_surface(pos1)
end
if not pos_surface then break end if not pos_surface then break end
local randomized_schematic_table = shuffle(settlements.schematic_table, pr) local randomized_schematic_table = shuffle(settlements.schematic_table, pr)

View File

@ -8,7 +8,7 @@ dofile(settlements.modpath.."/utils.lua")
dofile(settlements.modpath.."/foundation.lua") dofile(settlements.modpath.."/foundation.lua")
dofile(settlements.modpath.."/buildings.lua") dofile(settlements.modpath.."/buildings.lua")
dofile(settlements.modpath.."/paths.lua") dofile(settlements.modpath.."/paths.lua")
--dofile(settlements.modpath.."/convert_lua_mts.lua")
-- --
-- load settlements on server -- load settlements on server
-- --
@ -33,24 +33,6 @@ minetest.register_node("mcl_villages:stonebrickcarved", {
}) })
--[[ Enable for testing, but use MineClone2's own spawn code if/when merging.
--
-- register inhabitants
--
if minetest.get_modpath("mobs_mc") then
mobs:register_spawn("mobs_mc:villager", --name
{"mcl_core:stonebrickcarved"}, --nodes
15, --max_light
0, --min_light
20, --chance
7, --active_object_count
31000, --max_height
nil) --day_toggle
end
--]]
-- --
-- on map generation, try to build a settlement -- on map generation, try to build a settlement
-- --