OK, I think I've got most of this figured out, but had a few questions of why things are the way they are. It looks like there are 4 blocks within two files.
Block 1 in file CvMainInterface.py:
PHP:
# Eliminates Religion from city
if (inputClass.getNotifyCode() == 11 and inputClass.getData1() == 665 and inputClass.getData2() == 665):
pPlot = CyMap( ).plot( g_pSelectedUnit.getX( ), g_pSelectedUnit.getY( ) )
iMessageID = pGodsOfOld.m_iNetMessage_Inquisitor #Question how does this work???
iPlotX = pPlot.getX()
iPlotY = pPlot.getY()
iOwner = g_pSelectedUnit.getOwner()
iUnitID = g_pSelectedUnit.getID()
CyMessageControl( ).sendModNetMessage( iMessageID, iPlotX, iPlotY, iOwner, iUnitID )
The part that I have marked - is this defined in another file? Can you change the name at will?
Block 2 in file CvEventManager.py
PHP:
#Net Messages
self.m_iNetMessage_Inquisitor = 0
self.m_iNetMessage_ProphetKi = 1
self.m_iNetMessage_ProphetEnki = 2
self.m_iNetMessage_ProphetEnlil = 3
self.m_iNetMessage_ProphetNanna = 4
self.m_iNetMessage_ProphetUtu = 5
self.m_iNetMessage_ProphetAn = 6
Here the net messages are defined. Is there a reason for this added step? Could you just define iMessageID = 0, and then in the next block take you cue of iMessageID == 0 (then do the rest of the stuff)
Block 3 in file CvEventManager.py
PHP:
def onModNetMessage(self, argsList):
'Called whenever CyMessageControl().sendModNetMessage() is called - this is all for you modders!'
iData1, iData2, iData3, iData4, iData5 = argsList
print("Modder's net message!")
CvUtil.pyPrint( 'onModNetMessage' )
iMessageID = iData1
#Inquisitor's Effect on a City
if ( iMessageID == self.m_iNetMessage_Inquisitor ):
iPlotX = iData2
iPlotY = iData3
iOwner = iData4
iUnitID = iData5
pPlot = CyMap( ).plot( iPlotX, iPlotY )
pCity = pPlot.getPlotCity( )
pPlayer = gc.getPlayer( iOwner )
pUnit = pPlayer.getUnit( iUnitID )
self.doInquisitorPersecution( pCity, pUnit )
This block takes the net message integers, converts them back into pointers, and then runs the command. Why is this broken into two blocks? Couldn't you just tack on the actual command instead of the self.doInquisitorPersecution( pCity, pUnit ) ?
Also, is it important that the arguements are pointers? could you pass the integers, and convert to pointers in the next block? (where the "action" is taking place
Block 4 in file CvEventManager.py
PHP:
def doInquisitorPersecution( self, pCity, pUnit ):
pPlayer = gc.getPlayer( pCity.getOwner( ) )
#gets a list of all religions in the city except state religion
lCityReligions = [ ]
for iReligionLoop in range(gc.getNumReligionInfos( )):
if pCity.isHasReligion( iReligionLoop ):
if pPlayer.getStateReligion( ) != iReligionLoop:
lCityReligions.append( iReligionLoop )
Here we finally get to the action. Does this block have to be placed in a specific location, or is it ok to put it at the end?
Thanks again!
If you think there's interest, and if my understanding turn out correct, I could clean this stuff up and post a "mini-tutorial"