Alrik2002
Warlord
Mind though that the player that gets the popup will be able to select what the terraformed plot becomes. So addPopup needs to be called for the player that built the improvement. The code you posted just loops through all players and gives the popup to all which are human.
Ok. I checked the codes and it seems to me, that the popup will only be shown to the owner of the plot, which would be ok, because the improvements can only be build in your own territory. It would be very nice if you could check the codes too, if I´m right or wrong.
Code:
def onImprovementBuilt(self, argsList):
'Improvement Built'
iImprovement, iX, iY = argsList
##neu Alrik Beginn
pPlot = CyMap().plot(iX, iY)
[COLOR="Red"]iPlayer = pPlot.getOwner()
pPlayer = gc.getPlayer(iPlayer)[/COLOR]
## Terraform Begin (avain)
if(iImprovement==gc.getInfoTypeForString('IMPROVEMENT_FOREST')):
pPlot.setBonusType(-1)
pPlot.setFeatureType(gc.getInfoTypeForString('FEATURE_FOREST'), 0)
pPlot.setImprovementType(-1)
###neuBeginn Popup1 terraforming
if iImprovement == gc.getInfoTypeForString('IMPROVEMENT_LANDAUFSCHUETTUNG'):
pPlot.setPlotType(PlotTypes.PLOT_LAND, True, True)
pPlot.setImprovementType(-1)
##neu Alrik Beginn
[COLOR="Red"]if (pPlayer.isAlive() and pPlayer.isHuman()):[/COLOR]
##neu Alrik Ende
CyCamera().JustLookAtPlot( CyMap().plot(iX, iY))
popupInfo = CyPopupInfo()
popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_PYTHON)
popupInfo.setText(CyTranslator().getText("TXT_KEY_POPUP_SELECT_TERRAINTYPE",()))
popupInfo.setData1(iPlayer)
popupInfo.setData2(iX)
popupInfo.setData3(iY)
popupInfo.setOnClickedPythonCallback("SelectTerrainType")
popupInfo.addPythonButton(CyTranslator().getText("TXT_KEY_POPUP_GRAS", ()), "")
popupInfo.addPythonButton(CyTranslator().getText("TXT_KEY_POPUP_EBENE", ()), "")
popupInfo.addPythonButton(CyTranslator().getText("TXT_KEY_POPUP_WÜSTE", ()), "")
popupInfo.addPythonButton(CyTranslator().getText("TXT_KEY_POPUP_TUNDRA", ()), "")
popupInfo.addPythonButton(CyTranslator().getText("TXT_KEY_POPUP_SCHNEE", ()), "")
popupInfo.addPopup(iPlayer)
###Ende Popup1
if iImprovement == gc.getInfoTypeForString('IMPROVEMENT_LANDVERAENDERUNG'):
pPlot.setImprovementType(-1)
##neu Alrik Beginn
if (pPlayer.isAlive() and pPlayer.isHuman()):
##neu Alrik Ende
CyCamera().JustLookAtPlot( CyMap().plot(iX, iY))
popupInfo = CyPopupInfo()
popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_PYTHON)
popupInfo.setText(CyTranslator().getText("TXT_KEY_POPUP_SELECT_TERRAINTYPE",()))
popupInfo.setData1(iPlayer)
popupInfo.setData2(iX)
popupInfo.setData3(iY)
popupInfo.setOnClickedPythonCallback("SelectTerrainType")
popupInfo.addPythonButton(CyTranslator().getText("TXT_KEY_POPUP_GRAS", ()), "")
popupInfo.addPythonButton(CyTranslator().getText("TXT_KEY_POPUP_EBENE", ()), "")
popupInfo.addPythonButton(CyTranslator().getText("TXT_KEY_POPUP_WÜSTE", ()), "")
popupInfo.addPythonButton(CyTranslator().getText("TXT_KEY_POPUP_TUNDRA", ()), "")
popupInfo.addPythonButton(CyTranslator().getText("TXT_KEY_POPUP_SCHNEE", ()), "")
popupInfo.addPopup(iPlayer)
###Ende Popups
if iImprovement == gc.getInfoTypeForString('IMPROVEMENT_LANDABTRAGUNG'):
pPlot.setPlotType(PlotTypes.PLOT_OCEAN, True, True)
pPlot.setImprovementType(-1)
if iImprovement == gc.getInfoTypeForString('IMPROVEMENT_PLATTMACHEN'):
pPlot.setPlotType(PlotTypes.PLOT_LAND, True, True)
pPlot.setImprovementType(-1)
###Ende alles
# Aggriculture Mod
# Purpose: Places a agricultural bonus on plot upon worker
# completion of an improvement (Corn, Rice or Wheat)
if (iImprovement == gc.getInfoTypeForString('IMPROVEMENT_CORN')) :
pPlot.setImprovementType(-1)
pPlot.setBonusType(gc.getInfoTypeForString("BONUS_CORN"))
CyInterface().addMessage(CyMap().plot(iX,iY).getOwner(),True,25,'Mais wurde gepflanzt!','AS2D_DISCOVERBONUS',1,'Art/Interface/Buttons/general/happy_person.dds',ColorTypes(8),iX,iY,False,False)
if (iImprovement == gc.getInfoTypeForString('IMPROVEMENT_RICE')) :
pPlot.setImprovementType(0)
pPlot.setBonusType(gc.getInfoTypeForString("BONUS_RICE"))
CyInterface().addMessage(CyMap().plot(iX,iY).getOwner(),True,25,'Reis wurde gepflanzt!','AS2D_DISCOVERBONUS',1,'Art/Interface/Buttons/general/happy_person.dds',ColorTypes(8),iX,iY,False,False)
if (iImprovement == gc.getInfoTypeForString('IMPROVEMENT_WHEAT')) :
pPlot.setImprovementType(0)
pPlot.setBonusType(gc.getInfoTypeForString("BONUS_WHEAT"))
CyInterface().addMessage(CyMap().plot(iX,iY).getOwner(),True,25,'Weizen wurde gepflanzt!','AS2D_DISCOVERBONUS',1,'Art/Interface/Buttons/general/happy_person.dds',ColorTypes(8),iX,iY,False,False)
# End Aggriculture Mod
if (not self.__LOG_IMPROVEMENT):
return
CvUtil.pyPrint('Improvement %s was built at %d, %d'
%(PyInfo.ImprovementInfo(iImprovement).getDescription(), iX, iY))