City Growth Pop-Up

mycophobia

Chieftain
Joined
Oct 14, 2017
Messages
32
I dunno if this is part of BUG or if it's been done before or anything but it took me a long time to figure out how to do so I reckon I'll share it!

These modifications will make it so a pop-up will appear whenever a city grows a size, allowing you to zoom to the city screen for that city or dismiss the pop-up. This will only work if the city governor is OFF, so be sure to uncheck it (or just unassign and reassign a worked tile) when you build a city to turn it off and get the popup when it grows.

In either a new mod containing copies of the following two files and their directories, or an existing mod with these files:

Stick this function somewhere in Assets/Python/Entrypoints/CvScreensInterface.py:

Code:
def doCityScreen(args):
    if args[0] == 1:
        return
    else:
        CyInterface().selectCity(CyGlobalContext().getActivePlayer().getCity(args[1]), False)

And then in Assets/Python/CvEventManager.py, find "def onCityGrowth(self, argsList):", and paste this after pCity and iPlayer are declared:

Code:
        if pCity.getOwner() == CyGame().getActivePlayer() and not pCity.isCitizensAutomated():
            popupInfo=CyPopupInfo()
            popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_PYTHON)
            popupInfo.setText(("%s has grown")%pCity.getName())
            popupInfo.setData1(pCity.getID())
            popupInfo.setOnClickedPythonCallback("doCityScreen")
            popupInfo.addPythonButton(CyTranslator().getText("TXT_KEY_POPUP_EXAMINE_CITY", ()), "")
            popupInfo.addPythonButton("OK", "")
            popupInfo.addPopup(iPlayer)
 
Last edited:
Thanks!

I'm not sure I could do it. I suspect this is probably at least compatible with BUG if you make those particular changes but to make it an actual option may require greater expertise than I currently have, especially considering I don't use BUG.
 
I see. I just said it because it's the typical game feature I'd love to use in the beginning of the game but would hate it from the middle when you have a lot of cities and micro managing them is no longer fun.
 
Ah well, I just figured out a way to enable/disable this fairly elegantly. If a city's governor is on, in other words if the citizens working the tiles are set to assign automatically, it won't prompt you for that city. I've edited the OP to make this change.

I understand that it's still better to have a global checkbox somewhere but this at least was super easy to implement.
 
Top Bottom