Hallo Kathy,
leider funktioniert der Code nicht
Hast du noch eine Idee?
In der "History Rewritten" Mod haben sie es auch geschafft, die Änderung wurde aber nicht in der CvEventManager.py sondern in einer seperaten Datei vorgenommen.
Ab spätestens hier wird es für mich aber zu undurchsichtig.
Ich habe dir die Codes mal hier reingesetzt, vielleicht hift es bei der Suche nach einer Lösung.
CvEventManager.py
Code:
def onPlotFeatureRemoved(self, argsList):
'Plot Feature Removed'
pPlot = argsList[0]
pCity = argsList[1]
iFeatureType = argsList[2]
### Chopping
HR.doChopping(pPlot, pCity, False)
###
Seperate Python-Datei
Code:
### TERRAIN
def doChopping(pPlot, pCity, bForce):
'Adds production from chopping to a city'
iPlayer = pCity.getOwner()
pPlayer = gc.getPlayer(iPlayer)
iFeature = pPlot.getFeatureType()
lFeature = [gc.getInfoTypeForString('FEATURE_FOREST'), gc.getInfoTypeForString('FEATURE_JUNGLE'), gc.getInfoTypeForString('FEATURE_SAVANNAH')]
lBuild = [gc.getInfoTypeForString('BUILD_REMOVE_FOREST'), gc.getInfoTypeForString('BUILD_REMOVE_JUNGLE'), gc.getInfoTypeForString('BUILD_REMOVE_SAVANNAH')]
iProduction = 0
iBaseProduction = 0
for i in xrange(len(lFeature)):
if lFeature[i] == iFeature:
iBuild = lBuild[i]
iBaseProduction = pPlot.getFeatureProduction(iBuild, pPlayer.getTeam(), pCity)
break
if iBaseProduction > 0:
if bForce:
iProduction += iBaseProduction
# Extra chop production from civic
if pPlayer.isCivic(Civic.ChoppingModifier[0]):
iProduction += (iBaseProduction * Civic.ChoppingModifier[1] / 100)
# Extra production if a Prime Timber resource is also chopped
if pPlot.getBonusType(-1) == gc.getInfoTypeForString('BONUS_TIMBER'):
pPlot.setBonusType(-1)
iProduction += iBaseProduction
if pPlayer.isCivic(Civic.ChoppingModifier[0]):
iProduction += (iBaseProduction * Civic.ChoppingModifier[1] / 100)
BonusInfo = gc.getBonusInfo(gc.getInfoTypeForString('BONUS_TIMBER'))
for iPlayerX in xrange (gc.getMAX_CIV_PLAYERS()):
if iPlayerX != iPlayer:
pPlayerX = gc.getPlayer(iPlayerX)
if pPlot.isVisible(pPlayerX.getTeam(), False):
CyInterface().addMessage(iPlayerX, True, 10, CyTranslator().getText("TXT_KEY_MESSAGE_BONUS_DESTROYED", (BonusInfo.getDescription(),)), "", 0, BonusInfo.getButton(), gc.getInfoTypeForString("COLOR_WARNING_TEXT"), pPlot.getX(), pPlot.getY(), True, True)
if iProduction > 0:
sFeature = gc.getFeatureInfo(iFeature).getDescription()
pCity.setFeatureProduction(iProduction + pCity.getFeatureProduction())
CyInterface().addMessage(iPlayer, True, 10, CyTranslator().getText("TXT_KEY_MISC_CLEARING_FEATURE_BONUS", (sFeature, iProduction, pCity.getName())), "", 0, "", -1, -1, -1, False, False)