Vicevirtuoso
The Modetta Man
From earlier, is it possible to make a UI add a feature to a tile through lua?
Yes. You could use SetFeatureType to change the tile's feature. The way I'd do it is to check all tiles a player's workers are on to see if the improvement is there, and set their tiles to have the improvement if so.
Code:
function UIReplaceFeature(iPlayer)
if iPlayer < GameDefines.MAX_MAJOR_CIVS then
local pPlayer = Players[iPlayer]
if pPlayer:GetCivilizationType() == GameInfoTypes.CIVILIZATION_YOURCIV then
for pUnit in pPlayer:Units() do
if pUnit:GetUnitClassType() == GameInfoTypes.UNITCLASS_WORKER then
pPlot = pUnit:GetPlot()
if pPlot:GetImprovementTYpe == GameInfoTypes.IMPROVEMENT_YOURIMPROVEMENT then
pPlot:SetFeatureType(GameInfoTypes.FEATURE_YOURFEATURE, -1)
end
end
end
end
end
end
GameEvents.PlayerDoTurn.Add(UIReplaceFeature)
Note that due to the way the graphics engine works, setting features during gameplay will probably cause graphical glitches until the user zooms in on the plot or reloads the game.