[BNW] Get and Set TerrainType don't match returning wrong values

Elvalantan

Chieftain
Joined
Sep 2, 2017
Messages
3
Hi again, reffering to my older topic about changing resources plains and terrains near player's cities and city-states: https://forums.civfanatics.com/thre...ty-states-and-players-start-locations.621950/ I have another problem.

When I use Terrain functions sick things happens. For example function below change desert plots without Features near start location (plotX, plotY) to water. I put this code before the last end of Four_Corners.lua.
PlotTypes, ResourcesTypes and FeatureTypes seems to work OK.



for ix = -5, 5 do
for iy = -5, 5 do
local newX = plotX + ix;
local newY = plotY + iy;
local newPlot = Map.GetPlot(newX, newY);
local terrainType = newPlot:GetTerrainType();


if (terrainType==TerrainTypes.TERRAIN_TUNDRA or terrainType==TerrainTypes.TERRAIN_SNOW) then
newPlot:SetTerrainType(TerrainTypes.TERRAIN_PLAINS, true, true);
end


if (terrainType==TerrainTypes.TERRAIN_DESERT and newPlot:GetFeatureType()==FeatureTypes.NO_FEATURE) then
newPlot:SetTerrainType(TerrainTypes.TERRAIN_HILL, true, true);
end

end
end
 
Top Bottom