Replace get_2d call from mg_villages with get2d

master
Solebull 2018-12-14 16:31:10 +01:00
parent 7e43fcc4ee
commit 34608e27c0
2 changed files with 8 additions and 8 deletions

View File

@ -48,20 +48,20 @@ end
-- if you change any of the 3 constants below, also change them in the function
-- mg_villages.village_area_mark_inside_village_area
mg_villages.inside_village = function(x, z, village, vnoise)
return mg_villages.get_vn(x, z, vnoise:get_2d({x = x, y = z}), village) <= 40
return mg_villages.get_vn(x, z, vnoise:get2d({x = x, y = z}), village) <= 40
end
mg_villages.inside_village_area = function(x, z, village, vnoise)
return mg_villages.get_vn(x, z, vnoise:get_2d({x = x, y = z}), village) <= 80
return mg_villages.get_vn(x, z, vnoise:get2d({x = x, y = z}), village) <= 80
end
mg_villages.inside_village_terrain_blend_area = function(x, z, village, vnoise)
return mg_villages.get_vn(x, z, vnoise:get_2d({x = x, y = z}), village) <= 160
return mg_villages.get_vn(x, z, vnoise:get2d({x = x, y = z}), village) <= 160
end
mg_villages.get_vnoise = function(x, z, village, vnoise) -- PM v
return mg_villages.get_vn(x, z, vnoise:get_2d({x = x, y = z}), village)
return mg_villages.get_vn(x, z, vnoise:get2d({x = x, y = z}), village)
end -- PM ^
mg_villages.get_vn = function(x, z, noise, village)
@ -593,7 +593,7 @@ mg_villages.village_area_mark_inside_village_area = function( village_area, vill
if( not( village_area[ x ][ z ] )) then
village_area[ x ][ z ] = { 0, 0 };
local n_rawnoise = village_noise:get_2d({x = x, y = z}) -- create new blended terrain
local n_rawnoise = village_noise:get2d({x = x, y = z}) -- create new blended terrain
for village_nr, village in ipairs(villages) do
local vn = mg_villages.get_vn(x, z, n_rawnoise, village);
if( village.is_single_house ) then

View File

@ -24,7 +24,7 @@ mg_villages.villages_at_point = function(minp, noise1)
local s = pi:next(1, 400)
local x = pi:next(mp.x, mp.x + 79)
local z = pi:next(mp.z, mp.z + 79)
if s <= mg_villages.VILLAGE_CHANCE and noise1:get_2d({x = x, y = z}) >= -0.3 then return {} end
if s <= mg_villages.VILLAGE_CHANCE and noise1:get2d({x = x, y = z}) >= -0.3 then return {} end
end
end
end
@ -32,7 +32,7 @@ mg_villages.villages_at_point = function(minp, noise1)
if pr:next(1, 400) > mg_villages.VILLAGE_CHANCE then return {} end -- No village here
local x = pr:next(minp.x, minp.x + 79)
local z = pr:next(minp.z, minp.z + 79)
if noise1:get_2d({x = x, y = z}) < -0.3 then return {} end -- Deep in the ocean
if noise1:get2d({x = x, y = z}) < -0.3 then return {} end -- Deep in the ocean
-- fallback: type "nore" (that is what the mod originally came with)
local village_type = 'nore';
@ -604,7 +604,7 @@ end
local function generate_walls(bpos, data, a, minp, maxp, vh, vx, vz, vs, vnoise)
for x = minp.x, maxp.x do
for z = minp.z, maxp.z do
local xx = (vnoise:get_2d({x=x, y=z})-2)*20+(40/(vs*vs))*((x-vx)*(x-vx)+(z-vz)*(z-vz))
local xx = (vnoise:get2d({x=x, y=z})-2)*20+(40/(vs*vs))*((x-vx)*(x-vx)+(z-vz)*(z-vz))
if xx>=40 and xx <= 44 then
bpos[#bpos+1] = {x=x, z=z, y=vh, btype="wall", bsizex=1, bsizez=1, brotate=0}
end