Alyph said:Hi Kael,
Is this CannotTrain function the one located in CvGameInterface.py and CvGameUtils.py? Does it work? When will this func be called? very before player open the city window or small building list? I try to use another CannotConstruct func to disable building, but didn't see it take effect? Could you bring me more details please?
I use CvGameInterface.py, but I've rewritten most everything so I have given up any hope of making anything I have done modular. The following is my CannotConstruct event:
Code:
def cannotConstruct(argsList):
pCity = argsList[0]
eBuilding = argsList[1]
bContinue = argsList[2]
bTestVisible = argsList[3]
bIgnoreCost = argsList[4]
if eBuilding == gc.getInfoTypeForString('BUILDING_ABATTOIR'):
if pPlayer.getStateReligion() == gc.getInfoTypeForString('RELIGION_THE_ORDER'):
return True
if eBuilding == gc.getInfoTypeForString('BUILDING_ABATTOIR'):
if pPlayer.getStateReligion() == gc.getInfoTypeForString('RELIGION_RUNES_OF_KILMORPH'):
return True
if eBuilding == gc.getInfoTypeForString('BUILDING_CASTLE'):
if pPlayer.getStateReligion() == gc.getInfoTypeForString('RELIGION_THE_ASHEN_VEIL'):
return True
if eBuilding == gc.getInfoTypeForString('BUILDING_CASTLE'):
if pPlayer.getStateReligion() == gc.getInfoTypeForString('RELIGION_OCTOPUS_OVERLORDS'):
return True
if eBuilding == gc.getInfoTypeForString('BUILDING_CATHEDRAL'):
if pPlayer.getStateReligion() == gc.getInfoTypeForString('RELIGION_THE_ASHEN_VEIL'):
return True
if eBuilding == gc.getInfoTypeForString('BUILDING_SUMMONING_CHAMBER'):
if pPlayer.getStateReligion() == gc.getInfoTypeForString('RELIGION_THE_ORDER'):
return True
return False
This code takes place when the game goes to build the list of available object the player can build. As it places each in the list it runs each through this function. If it comes through False then it gets added to the list, if it comes through True then is doesn't get added ot the list.
That may seem backward but rememebr this is the CannotConstruct function, so if it it True that it cannot construct it then it cant be built.
So in my code if it is checking out an ABATTOIR it does a check to see what the players religion is. If it is The Order then it is rejected and the player isn't allowed to build it. From the players perspective they are never presented with the option to build the building.