Kein automatisches Aufladen (und Beschränkung auf 2 Nahrungsressis):
In PAE_Trade.py:
PHP-Code:
# Collect bonus on current plot ('stored' in cultivation unit)
def doCollectBonus(pUnit):
iTeam = pUnit.getTeam()
pPlot = pUnit.plot()
if pPlot == None or pPlot.isNone(): return False
eBonus = pPlot.getBonusType(iTeam) # If there is an invisible bonus on pPlot, it will not be removed
# Remove the bonus first, even in cities
if eBonus != -1:
sScriptDataString = CvUtil.getScriptData(pUnit, ["cultivationBonuses"], "")
lBonusList = convertStringToIntList(sScriptDataString)
if eBonus not in lBonusList: lBonusList.append(eBonus)
CvUtil.addScriptData(pUnit, "cultivationBonuses", convertIntListToString(lBonusList))
pPlot.setBonusType(-1) # remove bonus
# In Cities: charge all bonus from city environment
# elif pPlot.isCity():
# initCultivationUnit(pUnit, pPlot.getPlotCity())
pUnit.finishMoves()
PHP-Code:
# Initialises ScriptData for new cultivation Units
def initCultivationUnit(pUnit, pCity):
#~ global lCultivatable
#~ iX = pCity.getX()
#~ iY = pCity.getY()
#~ iCityOwnerTeam = pCity.getTeam()
lStored = []
#~ for x in xrange(5): # check plots
#~ for y in xrange(5):
#~ pLoopPlot = gc.getMap().plot(iX + x - 2, iY + y - 2)
#~ if pLoopPlot != None and not pLoopPlot.isNone():
#~ if pLoopPlot.getTeam() != iCityOwnerTeam: continue
#~ # plot needs to have suitable improvement and city needs to have access to bonus (=> connection via trade route (street))
#~ eBonus = pLoopPlot.getBonusType(iCityOwnerTeam)
#~ eImprovement = pLoopPlot.getImprovementType()
#~ if eImprovement != -1 and eBonus != -1 and eBonus not in lStored and eBonus in lCultivatable:
#~ if gc.getImprovementInfo(eImprovement).isImprovementBonusMakesValid(eBonus) and hasBonusIgnoreFreeBonuses(pCity, eBonus):
#~ lStored.append(eBonus)
#~ if gc.getPlayer(pUnit.getOwner()).isHuman():
#~ if len(lStored) > 0:
#~ CyInterface().addMessage(pUnit.getOwner(), True, 5, CyTranslator().getText("TXT_KEY_MESSAGE_TRADE_COLLECT_GOODS",("",)), "AS2D_BUILD_GRANARY", 2, None, ColorTypes(13), 0, 0, False, False)
#~ else:
#~ CyInterface().addMessage(pUnit.getOwner(), True, 5, CyTranslator().getText("TXT_KEY_MESSAGE_TRADE_COLLECT_NO_GOODS",("",)), "AS2D_ERROR", 2, None, ColorTypes(13), 0, 0, False, False)
sScriptDataString = convertIntListToString(lStored)
## sScriptDataString = "" # String which will be stored in pUnit, represents bonuses stored in unit
## for eBonus in lStored:
## sScriptDataString += ","
## sScriptDataString += str(eBonus)
## sScriptDataString = sScriptDataString[1:] # Remove comma at the beginning
CvUtil.addScriptData(pUnit, "cultivationBonuses", sScriptDataString) # string looks like e.g. "23,45,12,34"