tu_79
Deity
Code:odds = mg.featurePercent if plot:IsFreshWater() then odds = odds + mg.featureWetVariance else odds = odds - mg.featureWetVariance end -- Increase chance for features when there are other features nearby already. --print("odds before forest", odds) for nearPlot in Plot_GetPlotsInCircle(plot, 0, 2) do local nearFeatureID = nearPlot:GetFeatureType() --[[ if nearFeatureID == FeatureTypes.FEATURE_FOREST then odds = odds * math.min(1.2, (1 + 3 * mg.featurePercent / 4.0)) elseif nearFeatureID == FeatureTypes.FEATURE_JUNGLE or nearFeatureID == FeatureTypes.FEATURE_MARSH then odds = odds * math.min(1.3, (1 + 5 * mg.featurePercent / 4.0)) end --]] if nearFeatureID ~= FeatureTypes.NO_FEATURE then odds = odds + 0.10 elseif nearPlot:GetTerrainType() == TerrainTypes.PLOT_HILLS or nearPlot:IsMountain() then odds = odds - 0.02 end end --print("odds after forest", odds)
This part you added made it so that when map is wet, it has a 100% chance of spawning features near another tile with feature if the tile is near fresh water and 95% if not.
Also, there is code forcing jungle hills into grass and jungle non-hills into plains. No idea why.
"odds + mg.featureWetVariance" this part is not mine. It's in old Communitas. The logic is to increase forest around fresh water. I reduced this effect and allowed more forest without fresh water.
Actually, what I added is this
Code:
if nearFeatureID ~= FeatureTypes.NO_FEATURE then
odds = odds + 0.10
elseif nearPlot:GetTerrainType() == TerrainTypes.PLOT_HILLS or nearPlot:IsMountain() then
odds = odds - 0.02
end
There's another function that adds forests, using forestRandomPercent:
Code:
function IsGoodExtraForestTile(plot)
local x, y = plot:GetX(), plot:GetY()
local odds = mg.forestRandomPercent
local terrainID = plot:GetTerrainType()
local resID = plot:GetResourceType()
if not plot:CanHaveFeature(FeatureTypes.FEATURE_FOREST) then
return false
end
if terrainID == TerrainTypes.TERRAIN_TUNDRA then
if resID ~= -1 then
return true
end
if plot:IsFreshWater() then
odds = odds + mg.featureWetVariance
end
end
-- Avoid filling flat holes of tropical areas, which are too dense already
if not plot:IsHills() and Contains(mg.tropicalPlots, plot) then
odds = odds - 0.30
end
for nearPlot in Plot_GetPlotsInCircle(plot, 1, 1) do
local nearTerrainID = nearPlot:GetTerrainType()
local nearFeatureID = nearPlot:GetFeatureType()
if nearPlot:IsMountain() then
-- do nothing
elseif nearPlot:IsHills() then
-- Region already has enough production and rough terrain
odds = odds - 0.10
elseif nearTerrainID == TerrainTypes.TERRAIN_SNOW then
-- Help extreme polar regions
odds = odds + 0.2
elseif nearTerrainID == TerrainTypes.TERRAIN_TUNDRA then
odds = odds + 0.1
elseif terrainID == TerrainTypes.TERRAIN_TUNDRA and Plot_IsWater(nearPlot) then
odds = odds + 0.1
end
-- Avoid tropics
if Contains(mg.tropicalPlots, nearPlot) then
odds = odds - 0.10
end
-- Too dry
if nearTerrainID == TerrainTypes.TERRAIN_DESERT then
odds = odds - 0.20
end
end
if 100 * mg.featurePercent * math.min(1, odds) >= Map.Rand(100, "Add Extra Forest - Lua") then
--plot:SetFeatureType(FeatureTypes.FEATURE_FOREST, -1)
return true
end
return false
end
Me neither. I saw it too, but I don't know if that's intented. Maybe the coder thought that once we chopp the jungle, we'd like it better like that. Remember that in vanilla, flat grassland was disappointing due to low production.Also, there is code forcing jungle hills into grass and jungle non-hills into plains. No idea why.
Another thing that bothers me, and I don't know if it is intended either, it's forests on tundra having just 1 food. I'm used to see forest with minimum 2 food in other maps, but I don't know what is the actual standard value.