Arcology Shielding

BobeBrown

Warlord
Joined
Oct 4, 2009
Messages
255
Hi, In a mod I am using the shielding from Next War mod. When the shielding buildings are present in a city with other buildings like World Trade Center, Communication Satellties, Radar Station and other tall buildings the sheilding size goes absolutely huge. Going nearly 10times the normal size in with Radar Station present.

Spoiler the crazy image :





Ive taken this python coding from NextWar and added to BuG folders and files.

NeotericWorld.py
Code:
# NeotericWorld

from CvPythonExtensions import *
import BugUtil

gc = CyGlobalContext()


def onGameStart(argsList):
		'Called at the start of the game'

		if gc.getGame().isOption(GameOptionTypes.GAMEOPTION_ALWAYS_WAR):
                        for i in xrange(gc.getMAX_CIV_TEAMS ()):
                                FirstTeam = gc.getTeam(i)
                                if FirstTeam.isHuman():continue
                                for j in xrange(gc.getMAX_CIV_TEAMS ()):
                                        SecondTeam = gc.getTeam(j)
                                        if SecondTeam.isHuman():continue
                                        if i==j:continue
                                        FirstTeam.declareWar(j,False,WarPlanTypes.WARPLAN_TOTAL)
                                        FirstTeam.setPermanentWarPeace(j,True)
                                        SecondTeam.declareWar(i,False,WarPlanTypes.WARPLAN_TOTAL)
                                        SecondTeam.setPermanentWarPeace(i,True)


def onBuildingBuilt(rgsList):
		'Building Completed'
		pCity, iBuildingType = argsList
		game = gc.getGame()
		if ((not gc.getGame().isNetworkMultiPlayer()) and (pCity.getOwner() == gc.getGame().getActivePlayer()) and isWorldWonderClass(gc.getBuildingInfo(iBuildingType).getBuildingClassType())):
			# If this is a wonder...
			popupInfo = CyPopupInfo()
			popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_PYTHON_SCREEN)
			popupInfo.setData1(iBuildingType)
			popupInfo.setData2(pCity.getID())
			popupInfo.setData3(0)
			popupInfo.setText(u"showWonderMovie")
			popupInfo.addPopup(pCity.getOwner())

		CvAdvisorUtils.buildingBuiltFeats(pCity, iBuildingType)
		
		if iBuildingType == CvUtil.findInfoTypeNum(gc.getBuildingInfo, gc.getNumBuildingInfos(), "BUILDING_ARCOLOGY_SHIELDING"):
			pCity.setNumRealBuilding(CvUtil.findInfoTypeNum(gc.getBuildingInfo, gc.getNumBuildingInfos(), "BUILDING_ARCOLOGY"), False)
		elif iBuildingType == CvUtil.findInfoTypeNum(gc.getBuildingInfo, gc.getNumBuildingInfos(), "BUILDING_DEFLECTOR_SHIELDING"):
			pCity.setNumRealBuilding(CvUtil.findInfoTypeNum(gc.getBuildingInfo, gc.getNumBuildingInfos(), "BUILDING_ARCOLOGY_SHIELDING"), False)

		if (not self.__LOG_BUILDING):
			return
		CvUtil.pyPrint('%s was finished by Player %d Civilization %s' 
			%(PyInfo.BuildingInfo(iBuildingType).getDescription(), pCity.getOwner(), gc.getPlayer(pCity.getOwner()).getCivilizationDescription(0)))


def onCityRazed(self, argsList):
		'City Razed'
		city, iPlayer = argsList
		iOwner = city.findHighestCulture()

		# Partisans!
		if city.getPopulation > 1 and iOwner != -1 and iPlayer != -1:
			owner = gc.getPlayer(iOwner)
			if not owner.isBarbarian() and owner.getNumCities() > 0:
				if gc.getTeam(owner.getTeam()).isAtWar(gc.getPlayer(iPlayer).getTeam()):
					if gc.getNumEventTriggerInfos() > 0: # prevents mods that don't have events from getting an error
						iEvent = CvUtil.findInfoTypeNum(gc.getEventTriggerInfo, gc.getNumEventTriggerInfos(),'EVENTTRIGGER_PARTISANS')
						if iEvent != -1 and gc.getGame().isEventActive(iEvent) and owner.getEventTriggerWeight(iEvent) < 0:
							triggerData = owner.initTriggeredData(iEvent, true, -1, city.getX(), city.getY(), iPlayer, city.getID(), -1, -1, -1, -1)
			
		#Raze the Arcology
		owner = PyPlayer(city.getOwner())
		razor = PyPlayer(iPlayer)
		
		self.iArcologyCityID = -1
		
		if city.getNumRealBuilding(gc.getInfoTypeForString("BUILDING_ARCOLOGY")) or city.getNumRealBuilding(gc.getInfoTypeForString("BUILDING_ARCOLOGY_SHIELDING")) or city.getNumRealBuilding(gc.getInfoTypeForString("BUILDING_DEFLECTOR_SHIELDING")):
			self.iArcologyCityID = city.getID()
		
		CvUtil.pyPrint('Player %d Civilization %s City %s was razed by Player %d' 
			%(owner.getID(), owner.getCivilizationName(), city.getName(), razor.getID()))	
		CvUtil.pyPrint("City Razed Event: %s" %(city.getName(),))

def onCityLost(argsList):
		'City Lost'
		city = argsList[0]
		player = PyPlayer(city.getOwner())
		
		if city.getID() == self.iArcologyCityID:
			city.plot().setImprovementType(gc.getInfoTypeForString("IMPROVEMENT_CITY_RUINS_ARCOLOGY"))
		
		if (not self.__LOG_CITYLOST):
			return
		CvUtil.pyPrint('City %s was lost by Player %d Civilization %s' 
			%(city.getName(), player.getID(), player.getCivilizationName()))



def cannotConstruct(argsList):
		pCity = argsList[0]
		eBuilding = argsList[1]
		bContinue = argsList[2]
		bTestVisible = argsList[3]
		bIgnoreCost = argsList[4]
		
		# player can't build an arcology if they have shielding or advanced shielding
		if eBuilding == gc.getInfoTypeForString("BUILDING_ARCOLOGY"):
			if pCity.getNumRealBuilding(gc.getInfoTypeForString("BUILDING_ARCOLOGY_SHIELDING")) or pCity.getNumRealBuilding(gc.getInfoTypeForString("BUILDING_DEFLECTOR_SHIELDING")):
				return True
		
		# player can't build shielding if they have advanced
		if eBuilding == gc.getInfoTypeForString("BUILDING_ARCOLOGY_SHIELDING"):
			if pCity.getNumRealBuilding(gc.getInfoTypeForString("BUILDING_DEFLECTOR_SHIELDING")):
				return True

		return False
Neoteric World.xml inside Config folder
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!--
    NeotericWorld - Code for Arcology Shielding, Always War
-->
<mod id="NeotericWorld" module="NeotericWorld">

	<event type="GameStart" function="onGameStart"/>
	<event type="BuildingBuilt" function="onBuildingBuilt"/>
	<event type="CityRazed" function="onCityRazed"/>
	<event type="CityLost" function="onCityLost"/>
	<gameutils/>

</mod>

Init.xml inside config folder
Code:
<bug>
....
[/screen]
<load mod="Neoteric World"/>
</bug>

OnGameStart is the AlwaysWar mod by The_J and is working. The rest does not seem to be working? Does this code even negate the shielding resizing?
 
BobeBrown, this is not a Python problem, this is a graphical problem.
You'll experience huge Arcologies when you have a building that has some "error" in it, meaning even thou it seems perfect in-game, it's bigger than it seems. And the Arcology is always just big enough to include the buildings in a city.
Try removing the buildings from the city one-by-one and check the Arcology size to identify the culprit.

Cheers.
 
BobeBrown, this is not a Python problem, this is a graphical problem.

Moderator Action: Right. Thread moved.

You'll experience huge Arcologies when you have a building that has some "error" in it, meaning even thou it seems perfect in-game, it's bigger than it seems. And the Arcology is always just big enough to include the buildings in a city.
Try removing the buildings from the city one-by-one and check the Arcology size to identify the culprit.

Cheers.

The easier and dirty solution would be: Change in the artdefines LSYSTEM_ARCOLOGY to LSYSTEM_1x1.
The arcology will then not grow anymore with the city and it's buildings and will so not grow incredible big.
The disadvantage: It will not grow with the city :/. You have to set an adequate size before, just guessing how big a city could become.
 
So, there is another solution I discovered that seems to work pretty good. Once you know the building(s) that is/are causing your trouble (i.e. Radar Station in my case), go into the Civ4ArtDefines_Building.xml file and change the dimensions in the LSYSTEM to 0x0. For example, I changed the Radar Station to 0x0 and my problems disappeared. Much better than me having to manually remove this building from the city. Keep in mind the building (i.e. Radar Station) won't show up any longer as a little icon in the city, but for me, I didn't care much about this.
 
Top Bottom