only blend terrain if it does not already belong to another village

master
Sokomine 2015-01-31 06:18:32 +01:00
parent 77407d0cad
commit 8c6da7a356
1 changed files with 13 additions and 10 deletions

View File

@ -55,16 +55,19 @@ mg_villages.village_area_mark_single_house_area = function(village_area, minp, m
local flatradn = flatrad + n_absblend * 2 -- vary shape of house flat area
local nodrad = math.sqrt(xr ^ 2 + zr ^ 2) -- node radius
if x >= (pos.x-1) and x <= (pos.x + pos.bsizex + 1) -- area reserved for house
and z >= (pos.z-1) and z <= (pos.z + pos.bsizez + 1) then
village_area[ x ][ z ] = {village_nr, 4}
elseif nodrad <= flatradn or (xr == 0 and zr == 0) then -- irregular flat area around house
village_area[ x ][ z ] = {village_nr, 1}
elseif nodrad <= blenradn then -- terrain blend area
local blenprop = ((nodrad - flatradn) / (blenradn - flatradn))
village_area[ x ][ z ] = {village_nr, -1 * blenprop} -- terrain blending
else -- no change to terrain
--village_area[xrm][zrm] = {village_nr, 0}
-- only blend the terrain if it does not already belong to another village
if( village_area[ x ][ z ][ 2 ] == 0 ) then
if x >= (pos.x-1) and x <= (pos.x + pos.bsizex + 1) -- area reserved for house
and z >= (pos.z-1) and z <= (pos.z + pos.bsizez + 1) then
village_area[ x ][ z ] = {village_nr, 4}
elseif nodrad <= flatradn or (xr == 0 and zr == 0) then -- irregular flat area around house
village_area[ x ][ z ] = {village_nr, 1}
elseif nodrad <= blenradn then -- terrain blend area
local blenprop = ((nodrad - flatradn) / (blenradn - flatradn))
village_area[ x ][ z ] = {village_nr, -1 * blenprop} -- terrain blending
else -- no change to terrain
--village_area[xrm][zrm] = {village_nr, 0}
end
end
ni = ni + 1
end