Final Frontier Worldbuilder

TC01

Deity
Joined
Jun 28, 2009
Messages
2,216
Location
Irregularly Online
Final Frontier Worldbuilder v1.2

After a discussion in this thread in the Star Trek Mod forum about how useless Worldbuilder was in Final Frontier, I decided to try to make it work. What do I mean, useless? Well, prior to this utility/modcomp, you couldn't add or remove solar systems properly- they would appear with no sun or planets, and would come back the next turn if you removed them. Buildings would be placed in a solar system- but not on a specific planet. And all sorts of other things were wrong as well.

I've succeeded in making it work, and thus am releasing this version of "Final Frontier Worldbuilder." Now, it doesn't make major changes to Worldbuilder- you can't change the sun or planets in a solar system, for instance- but it makes Worldbuilder useful for making a Final Frontier map. This is not intended to help people cheat. (Although, you could use it that way...) It is intended to allow Final Frontier modders to be able to make scenarios using Worldbuilder, not the .WBS file. It is mostly finished, but there are some bugs and little other things to add.

You can probably also use this with other mods for Final Frontier. First, you should check and see if this is already included in that mod. If it isn't, then there are directions under the "To Install" section on how to install it for a mod based off of Final Frontier.

This utility is included in Final Frontier Plus.

Feature List:

Changes to the in-game Worldbuilder:
-When you place a solar system in Worldbuilder, planets and sun type will be randomly generated.
-When you overwrite a solar system with another feature, it will not come back the next turn.
-When you place a building in a city, it will add that building to the planet where buildings are being built.
-When you add a building using the Edit City menu, every planet in the solar system will get that building.
-When you remove a building using the Edit City menu, every planet in the solar system will loose that building.
-When you remove a solar system in Worldbuilder using the "Remove" button, it will not come back the next turn.
-When you build a city, population will be correctly assigned to that solar system.
-When you place a Black Hole, the Black Hole Gravity Field will automatically appear on the correct plots around it.
-When you place a Supernova, the Damage Zone will automatically appear on the correct plots around it.
-When you remove a Black Hole, the Black Hole Gravity Field will automatically be removed as well.
-When you remove a Supernova, the Damage Zone will automatically be removed as well.

Changes to the Worldbuilder Save file:
-Worldbuilder now saves and loads buildings on different planets
-Worldbuilder now saves and loads the name of each planet
-Worldbuilder now saves and loads the population of each planet
-Worldbuilder now saves and loads the names of units (thanks to deanej)
-Worldbuilder now saves and loads the selected and building planets of a city
-Worldbuilder now saves the name of the mod the WBS was created in

Worldbuilder Save File Changes:

Several changes have been made to the WBS files, used for scenarios. SelectedPlanet and BuildingPlanetRing tags have been added to the city section. A PlanetName tag has been added to the planet data section, a Planet1Population (and Planet2Population, and so on...) tag has been added to the city data section to store population per planet, and a Planet1BuildingType (and Planet2BuildingType, and so on...) tag has been added to the city data section to say that a building should be on a specific planet.

This means that scenarios created using Final Frontier Worldbuilder will not be compatible with versions of Civ not using Final Frontier Worldbuilder- or, rather, they will be, but any tags added by FF Worldbuilder won't be loaded into the game.

See the spoiler tag for more information.

Spoiler WBS File Editing Help :
The planets of a solar system were stored under the "FeatureType=FEATURE_SOLAR_SYSTEM" line, as seen below:

Code:
PlanetType=ORANGE_PLANET, OrbitRing=4, PlanetSize=1, HasMoon=1, HasRings=0
PlanetType=RED_PLANET, OrbitRing=2, PlanetSize=2, HasMoon=0, HasRings=0
PlanetType=RED_PLANET, OrbitRing=1, PlanetSize=1, HasMoon=0, HasRings=0
PlanetType=BLUE_PLANET, OrbitRing=7, PlanetSize=2, HasMoon=0, HasRings=0
PlanetType=GREEN_PLANET, OrbitRing=3, PlanetSize=1, HasMoon=0, HasRings=0
PlanetType=RED_PLANET, OrbitRing=8, PlanetSize=0, HasMoon=0, HasRings=0

Now, an additional tag has been added to the end of this list called "PlanetName=". It specifies what the name of the planet is. See below for an example:

Code:
PlanetType=ORANGE_PLANET, OrbitRing=4, PlanetSize=1, HasMoon=1, HasRings=0, PlanetName=Xi Horus 
PlanetType=RED_PLANET, OrbitRing=2, PlanetSize=2, HasMoon=0, HasRings=0, PlanetName=Zeus Cancer 
PlanetType=RED_PLANET, OrbitRing=1, PlanetSize=1, HasMoon=0, HasRings=0, PlanetName=Sigma Libra 
PlanetType=BLUE_PLANET, OrbitRing=7, PlanetSize=2, HasMoon=0, HasRings=0, PlanetName=Gamma Hephaestus 
PlanetType=GREEN_PLANET, OrbitRing=3, PlanetSize=1, HasMoon=0, HasRings=0, PlanetName=Paradise
PlanetType=RED_PLANET, OrbitRing=8, PlanetSize=0, HasMoon=0, HasRings=0, PlanetName=Pi Hermes

The following lines of code can be added to any city define (below any "BeginCity"). They control the distribution of "CityPopulation=" among various planets in the solar system. The total of all the values of the planet population tags must equal the city population, and it should go under the "CityPopulation=" line.

Code:
Planet1Population=2
Planet2Population=1
Planet3Population=0
Planet4Population=1
Planet5Population=2
Planet6Population=1
Planet7Population=0
Planet8Population=1

The following lines of code can be added to any city define (below any "BeginCity"). They store buildings to a specific planet, so "Planet1BuildingType=" means that the listed building is added to Planet 1, and the same for all the others. They should be added under the last "BuildingType=" line)

Code:
Planet1BuildingType=BUILDING_CAPITOL
Planet2BuildingType=BUILDING_NUTRITION_FACILITY
Planet3BuildingType=BUILDING_MINING_FACILITY
Planet4BuildingType=BUILDING_RECYCLING_CENTER
Planet5BuildingType=BUILDING_NUTRITION_FACILITY
Planet6BuildingType=BUILDING_MINING_FACILITY
Planet7BuildingType=BUILDING_RECYCLING_CENTER
Planet8BuildingType=BUILDING_CAPITOL

The following lines of code can be added to any city define (under BeginCity). They specify the selected planet and the building planet ring for each city- the planet that is selected in the city screen and the planet that buildings will be created on.

Code:
SelectedPlanet= 2
BuildingPlanetRing = 2

Download Here

Changelog:

Code:
v1.2 Changelog:
-Fixed a bug with black hole/supernova removal
-Worldbuilder now saves and loads the selected and building planets of a system
-Worldbuilder once again saves and loads what a city is producing
-Worldbuilder automatically stores the name of the mod to the ModPath tag in the WBS file

v1.1 Changelog:
-Fixed a major bug where Worldbuilder was unable to load WBS save files
-Worldbuilder now saves and loads the name of each planet
-Worldbuilder now saves and loads the population of each planet
-Worldbuilder now saves and loads the names of units (thanks to deanej)
-Worldbuilder no longer stores what a city is producing due to FF issues (thanks to deanej)

v1.0 Changelog:
-Worldbuilder now properly saves (and then loads) buildings on different planets.
-When you place a Black Hole, the Black Hole Gravity Field will automatically appear on the correct plots around it.
-When you place a Supernova, the Damage Zone will automatically appear on the correct plots around it.
-When you remove a Black Hole, the Black Hole Gravity Field will automatically be removed as well.
-When you remove a Supernova, the Damage Zone will automatically be removed as well.

v0.9 Changelog:
-When you remove a solar system in Worldbuilder using the "Remove" button, it will not come back the next turn.
-When you build a city, population will be correctly assigned to that solar system.
-Any other FF specific code triggered when a city is built will now be triggered when a city is Worldbuildered.

To Install:
If you are installing this utility for Final Frontier, all you need to do is unzip the files and copy the Final Frontier folder in the download into your Beyond the Sword\Mods directory.

If you are installing this utility for a modmod of Final Frontier, then you may need to do more work, or you may not, since those mods might be using this utility anyway. FF Worldbuilder contains three files. One, CvWorldBuilderScreen.py, is not in Final Frontier. Another, CvWBDesc.py, is in Final Frontier, but it is sparsely edited by mods, so you should be able to just overwrite it.

The third file is the problem. CvFinalFrontierEvents.py is probably the most-frequently edited python file. Fortunately, the change I made to it was very small, and therefore I have provided a guide to merge my change in. See the spoiler below for instructions.

Spoiler CvFinalFrontierEvents.py Merging Guide :
Open CvFinalFrontierEvents.py and find the "onGameStart" function, shown below with much of its code, at least in normal Final Frontier:

Code:
	def onGameStart(self, argsList):
		'Called at the start of the game'
		self.parent.onGameStart(self, argsList)
		
		self.iWinningTeam = -1
		self.iTimeLeft = 0
		
		self.initValues()
		self.initMembers()
		
		CyGame().makeNukesValid(true)
		CyGame().setStartYear(2302)
		
		AI.initPlayerAIInfos()
		
		# Give Barbs some techs
		iTechHappy0 = CvUtil.findInfoTypeNum(gc.getTechInfo,gc.getNumTechInfos(),'TECH_HAPPY_0')
		iTechIndustry0 = CvUtil.findInfoTypeNum(gc.getTechInfo,gc.getNumTechInfos(),'TECH_INDUSTRY_0')
		iTechMilitary0 = CvUtil.findInfoTypeNum(gc.getTechInfo,gc.getNumTechInfos(),'TECH_MILITARY_0')
		iTechMilitary1 = CvUtil.findInfoTypeNum(gc.getTechInfo,gc.getNumTechInfos(),'TECH_MILITARY_1')
		
		pBarbPlayer = gc.getPlayer(18)
		pBarbTeam = gc.getTeam(pBarbPlayer.getTeam())
		pBarbTeam.setHasTech(iTechHappy0, true, 18, false, false)
		pBarbTeam.setHasTech(iTechIndustry0, true, 18, false, false)
		pBarbTeam.setHasTech(iTechMilitary0, true, 18, false, false)
		pBarbTeam.setHasTech(iTechMilitary1, false, 18, false, false)
		
		# Is this a scenario file?
		if ('.CivBeyondSwordWBSave' in CyMap().getMapScriptName()):
			
			import CvWBInterface
			
			# Search through all plots on the map for Solar Systems to add content for
			for pWBPlotLoop in CvWBInterface.WBDesc.plotDesc:
				
				iX = pWBPlotLoop.iX
				iY = pWBPlotLoop.iY
				
				pPlot = CyMap().plot(iX, iY)
				
				if (pPlot.getFeatureType() == self.iFeatureIDSolarSystem):
					
					iStarType = getStarIndexFromTag(pWBPlotLoop.szStarType)
					
					pSystem = CvSystem(iX,iY,iStarType)
					
					for iPlanetLoop in range(pWBPlotLoop.iNumPlanets):
						iPlanetType = getPlanetIndexFromTag(pWBPlotLoop.aszPlanetType[iPlanetLoop])
						iOrbitRing = pWBPlotLoop.aiOrbitRing[iPlanetLoop]
						iPlanetSize = pWBPlotLoop.aiPlanetSize[iPlanetLoop]
						bMoon = pWBPlotLoop.aiMoon[iPlanetLoop]
						bRings = pWBPlotLoop.aiRings[iPlanetLoop]
						
						pSystem.addPlanet(iPlanetType, iPlanetSize, iOrbitRing, bMoon, bRings)
						
					self.addSystem(pSystem)
			
			# Add Buildings in WBS to Home Planet of Star System
			for iPlayerLoop in range(gc.getMAX_CIV_PLAYERS()):
				pPlayer = gc.getPlayer(iPlayerLoop)
				for iCityLoop in range(pPlayer.getNumCities()):
					pCity = pPlayer.getCity(iCityLoop)
					
					pSystem = self.getSystemAt(pCity.getX(), pCity.getY())
					iBestPlanet = getBestPlanetInSystem(pSystem)
					pPlanet = pSystem.getPlanetByIndex(iBestPlanet)
					
					for iBuildingLoop in range(gc.getNumBuildingInfos()):
						
						if (pCity.isHasBuilding(iBuildingLoop)):
							pPlanet.setHasBuilding(iBuildingLoop, true)
			
		else:
			
			# Loop through all plots, find the Solar Systems and give them randomized starting junk
			for iPlotLoop in range(CyMap().numPlots()):
				pPlot = CyMap().plotByIndex(iPlotLoop)
				
				if (pPlot.getFeatureType() == self.iFeatureIDSolarSystem):
					iYield = -1 #No preference
					pSystem = createRandomSystem(pPlot.getX(), pPlot.getY(), iYield, iPlanetQuantityTypePoor)	# Called from CvSolarSystem
					self.addSystem(pSystem)

That's a lot of code. Fortunately, much of it can be gotten rid of very easily, since much of it handles building the solar systems on loading of a Worldbuilder save. Since that has now been moved to CvWBDesc.py, the entire section above should now look like the code below. Copy paste the code below over the code above.

Code:
	def onGameStart(self, argsList):
		'Called at the start of the game'
		self.parent.onGameStart(self, argsList)
		
		self.iWinningTeam = -1
		self.iTimeLeft = 0
		
		self.initValues()
		
		CyGame().makeNukesValid(true)
		CyGame().setStartYear(2302)
		
		AI.initPlayerAIInfos()
		
		# Give Barbs some techs
		iTechHappy0 = CvUtil.findInfoTypeNum(gc.getTechInfo,gc.getNumTechInfos(),'TECH_HAPPY_0')
		iTechIndustry0 = CvUtil.findInfoTypeNum(gc.getTechInfo,gc.getNumTechInfos(),'TECH_INDUSTRY_0')
		iTechMilitary0 = CvUtil.findInfoTypeNum(gc.getTechInfo,gc.getNumTechInfos(),'TECH_MILITARY_0')
		iTechMilitary1 = CvUtil.findInfoTypeNum(gc.getTechInfo,gc.getNumTechInfos(),'TECH_MILITARY_1')
		
		pBarbPlayer = gc.getPlayer(18)
		pBarbTeam = gc.getTeam(pBarbPlayer.getTeam())
		pBarbTeam.setHasTech(iTechHappy0, true, 18, false, false)
		pBarbTeam.setHasTech(iTechIndustry0, true, 18, false, false)
		pBarbTeam.setHasTech(iTechMilitary0, true, 18, false, false)
		pBarbTeam.setHasTech(iTechMilitary1, false, 18, false, false)

		# Is this not a scenario file?
		if not ('.CivBeyondSwordWBSave' in CyMap().getMapScriptName()):
			
			self.initMembers()
			
			# Loop through all plots, find the Solar Systems and give them randomized starting junk
			for iPlotLoop in range(CyMap().numPlots()):
				pPlot = CyMap().plotByIndex(iPlotLoop)
				
				if (pPlot.getFeatureType() == self.iFeatureIDSolarSystem):
					iYield = -1 #No preference
					pSystem = createRandomSystem(pPlot.getX(), pPlot.getY(), iYield, iPlanetQuantityTypePoor)	# Called from CvSolarSystem
					self.addSystem(pSystem)

If the code in the mod you are editing looks very different, then these are the changes you have to make:

  1. Remove the line that says "self.initMembers()" at the top of the function
  2. Add the code below somewhere in the function.

Here is the code you must add:

Code:
		if not ('.CivBeyondSwordWBSave' in CyMap().getMapScriptName()):
			self.initMembers()



To Do: (Feel free to suggest problems with Final Frontier's Worldbuilder or WBS file system that could be fixed here. There is nothing I can think of that needs doing, so this is effectively done.).

Credits:
-TC01
-deanej (ideas, help)
-apenpaap (ideas)
-JEELEN (feedback)
-The_J, God-Emperor, Emperor Fool (help)
-Jon Shafer for making Final Frontier
-Firaxis for making Civilization IV
 
Well, I tried creating a scenario for MOO2Civ, but once I go into Worldbuilder no stars, planet sizes, features or names and no population shows up (that is: starting civs system do have a pop number, but inside the system no pop is present; this already was the case when using Worldbuilder in FF, as you probably know)... :(
 
Oops... I guess I forgot to actually move over all the code ran when a city is built. I'll do that for the next version, thanks.
 
I've released the 0.9 update. It makes creating cities with worldbuilder work properly (it fixes the issue with population not being assigned that JEELEN reported) and it allows you to remove solar systems just by using the Erase All button (or whatever it's called) it goes away forever, not just for one turn.

You can apply it on top of the original 0.8 version, and download it from the same DL page.
 
I've released v1.0! This utility is officially done, unless anyone else has any issues they want me to work on or bugs to fix...

The main thing v1.0 does is that a WBS file now stores buildings to planets, so if you put a building on the sixth planet of a solar system, that will be stored in the WBS and loaded in the next game. (To see how to do this, check out the first post). Also, this time I tested saving and loading: I was able to save in Worldbuilder and then load that game as a scenario. So saving in general should work...

v1.0 also makes black holes and supernovas operate like solar systems in that special code is executed on their placement and removal. The game will automatically add the "Black Hole Gravity Field" and "Supernova Damage Zone" features to the correct tiles, and automatically remove them as well.
 
I've fixed a major issue that deanej brought to my attention with save loading, i.e. that it didn't work, you got some python exceptions. (I'm not sure how I was able to successfully load a save, because all attempts after that I failed and definitely saw python exceptions).

Save loading now definitely works, AND I've moved a massive chunk of code from CvFinalFrontierEvents.py to CvWBDesc.py that creates solar systems when you start up a scenario. The upside of this is, there's now less code in a frequently-edited file that could confuse people. The downside is... there's another file included in this that is frequently edited in modmods.

EDIT: Stuff here removed now that v1.1 has been released.
 
Still getting python exceptions:
Traceback (most recent call last):

File "CvWBInterface", line 18, in writeDesc

File "CvWBDesc", line 1786, in write

File "CvWBDesc", line 1380, in write

AttributeError: 'NoneType' object has no attribute 'getSunType'
ERR: Python function writeDesc failed, module CvWBInterface
 
Still getting python exceptions:
Traceback (most recent call last):

File "CvWBInterface", line 18, in writeDesc

File "CvWBDesc", line 1786, in write

File "CvWBDesc", line 1380, in write

AttributeError: 'NoneType' object has no attribute 'getSunType'
ERR: Python function writeDesc failed, module CvWBInterface

Are you using the CvWBDesc.py in the attachment above? Because in that file, line 1380 is blank...

I was getting this python exception (or something like it) until I moved the call to "initMembers()" in onGameStart to only be triggered "if not ('.CivBeyondSwordWBSave' in CyMap().getMapScriptName()):", i.e., if this is not a scenario file, and added it right before plot data is added to the map in CvWBDesc.py. (see the changed code in the spoiler).

On my end, saves are loaded fine. Repeated, multiple saves...
 
My version has a few changes that you haven't merged in - the ability to store unit names added in patch 3.17 to BtS (but not to Final Frontier) and the removal of the ability to store what a city is currently producing (as this is incompatible with Final Frontier).

It's possible you aren't seeing anything because the code isn't being called. The method for detecting worldbuildersaves that Final Frontier uses doesn't actually work as far as I can tell. In all my tests it has never once managed to detect one properly, so it will always treat the game as a new random map. Hence why Star Trek used scriptData (and now a game option).
 
My version has a few changes that you haven't merged in - the ability to store unit names added in patch 3.17 to BtS (but not to Final Frontier) and the removal of the ability to store what a city is currently producing (as this is incompatible with Final Frontier).

Well, I'd be happy to merge those in... can you post your CvWBDesc.py, since that would be easier then me doing it manually?

It's possible you aren't seeing anything because the code isn't being called. The method for detecting worldbuildersaves that Final Frontier uses doesn't actually work as far as I can tell. In all my tests it has never once managed to detect one properly, so it will always treat the game as a new random map. Hence why Star Trek used scriptData (and now a game option).

That's... disheartening. It means that things are working, but I don't know why they're working.

You see, I just ran the following test. Here is the code as it was, when everything was working:

Code:
	def onGameStart(self, argsList):
		'Called at the start of the game'
		self.parent.onGameStart(self, argsList)
		
		self.iWinningTeam = -1
		self.iTimeLeft = 0
		
		[COLOR="red"]self.initValues()[/COLOR]
		
		CyGame().makeNukesValid(true)
		CyGame().setStartYear(2302)
		
		AI.initPlayerAIInfos()
		
		# Give Barbs some techs
		iTechHappy0 = CvUtil.findInfoTypeNum(gc.getTechInfo,gc.getNumTechInfos(),'TECH_HAPPY_0')
		iTechIndustry0 = CvUtil.findInfoTypeNum(gc.getTechInfo,gc.getNumTechInfos(),'TECH_INDUSTRY_0')
		iTechMilitary0 = CvUtil.findInfoTypeNum(gc.getTechInfo,gc.getNumTechInfos(),'TECH_MILITARY_0')
		iTechMilitary1 = CvUtil.findInfoTypeNum(gc.getTechInfo,gc.getNumTechInfos(),'TECH_MILITARY_1')
		
		pBarbPlayer = gc.getPlayer(18)
		pBarbTeam = gc.getTeam(pBarbPlayer.getTeam())
		pBarbTeam.setHasTech(iTechHappy0, true, 18, false, false)
		pBarbTeam.setHasTech(iTechIndustry0, true, 18, false, false)
		pBarbTeam.setHasTech(iTechMilitary0, true, 18, false, false)
		pBarbTeam.setHasTech(iTechMilitary1, false, 18, false, false)

[COLOR="Red"]		# Is this not a scenario file?
		if not ('.CivBeyondSwordWBSave' in CyMap().getMapScriptName()):
			
			self.initMembers()[/COLOR]

When I moved self.initMembers() back to it's original place (as seen below), I got your python exception, except it was on line 1374 (although that is because you altered CvWBDesc.py). When I changed it back again, things worked fine. So... I'm not sure what's going on here. What I haven't done is tested the original check for scenarios as you have. But here, things seem to work.

Code that does not work:

Code:
	def onGameStart(self, argsList):
		'Called at the start of the game'
		self.parent.onGameStart(self, argsList)
		
		self.iWinningTeam = -1
		self.iTimeLeft = 0
		
		[COLOR="red"]self.initValues()
		self.initMembers()[/COLOR]
		
		CyGame().makeNukesValid(true)
		CyGame().setStartYear(2302)
		
		AI.initPlayerAIInfos()
		
		# Give Barbs some techs
		iTechHappy0 = CvUtil.findInfoTypeNum(gc.getTechInfo,gc.getNumTechInfos(),'TECH_HAPPY_0')
		iTechIndustry0 = CvUtil.findInfoTypeNum(gc.getTechInfo,gc.getNumTechInfos(),'TECH_INDUSTRY_0')
		iTechMilitary0 = CvUtil.findInfoTypeNum(gc.getTechInfo,gc.getNumTechInfos(),'TECH_MILITARY_0')
		iTechMilitary1 = CvUtil.findInfoTypeNum(gc.getTechInfo,gc.getNumTechInfos(),'TECH_MILITARY_1')
		
		pBarbPlayer = gc.getPlayer(18)
		pBarbTeam = gc.getTeam(pBarbPlayer.getTeam())
		pBarbTeam.setHasTech(iTechHappy0, true, 18, false, false)
		pBarbTeam.setHasTech(iTechIndustry0, true, 18, false, false)
		pBarbTeam.setHasTech(iTechMilitary0, true, 18, false, false)
		pBarbTeam.setHasTech(iTechMilitary1, false, 18, false, false)

EDIT: I added a print statement to print "This is a scenario!" if ('.CivBeyondSwordWBSave' in CyMap().getMapScriptName()), and I did indeed get a "This is a scenario!" in PythonDbg.log. So... it would seem that this method works. Or does it?
 
Looks like I didn't catch the initMembers change. That fixes it.

All I know is that in the early days of Star Trek I was getting random systems from scenario files. But it's possible that I broke it somehow... there have been numerous changes I've made both to the SDK and python, many of which I didn't understand at the time (some of which I still don't, but those are thankfully mostly in the SDK now).

I've attached my WorldBuilder files below. Other than changing the add buildings via edit city to add only to current planet (rather than all) and the changes I already mentoned, they should be identical to yours. Perhaps this will allow us to figure out why the remove black hole/super nova doesn't work on my end as well.

EDIT: I should also mention that having worldbuilder actually work properly is going to enable me to test out some SDK changes properly.
 
Looks like I didn't catch the initMembers change. That fixes it.

All I know is that in the early days of Star Trek I was getting random systems from scenario files. But it's possible that I broke it somehow... there have been numerous changes I've made both to the SDK and python, many of which I didn't understand at the time (some of which I still don't, but those are thankfully mostly in the SDK now).

I've attached my WorldBuilder files below. Other than changing the add buildings via edit city to add only to current planet (rather than all) and the changes I already mentoned, they should be identical to yours. Perhaps this will allow us to figure out why the remove black hole/super nova doesn't work on my end as well.

EDIT: I should also mention that having worldbuilder actually work properly is going to enable me to test out some SDK changes properly.

I merged in the unit name code. (I say merged because I had already edited CvWBDesc to save planet names as well). But why doesn't the production process of a city work properly in Final Frontier? Oh well, I've gotten rid of that code anyway.

I've been unable to get black hole/supernova removal to work, though...


I'm also going to make Worldbuilder track city population per planet (so, much like the building stuff, there will be "Planet1Population=", "Planet2Population=", etc., tags in a WBS file.
 
I know the ability to store the building being produced caused a python exception (other than not working it didn't break anything else, just an annoyance); the others might actually work (if the issue was with how Final Frontier won't store what planet is currently selected, which I think is the issue).

I also just remembered that I was having an issue with removing buildings. Regardless, the improvements allowed me to more easily test the new XML tags I just added for buildings (the days of storing long lists in python are over, with the exception of CvAI).
 
I know the ability to store the building being produced caused a python exception (other than not working it didn't break anything else, just an annoyance); the others might actually work (if the issue was with how Final Frontier won't store what planet is currently selected, which I think is the issue).

I also just remembered that I was having an issue with removing buildings. Regardless, the improvements allowed me to more easily test the new XML tags I just added for buildings (the days of storing long lists in python are over, with the exception of CvAI).

I'll look at the production stuff in the future.

I haven't had any issue removing buildings- it all seems to work fine. So I think it's an issue with your changed code in the attached CvWorldBuilderScreen:

Code:
iBuildingsPerSystem = self.m_pCurrentPlot.getPlotCity().getNumRealBuilding(iIndex)
pBuildingPlanet = pSystem.getPlanet(pSystem.getBuildingPlanetRing())
if not pBuildingPlanet.isHasBuilding(iIndex):
	pBuildingPlanet.setHasBuilding(iIndex, true)
	self.m_pCurrentPlot.getPlotCity().setNumRealBuilding(iIndex, iBuildingsPerSystem+1)

This works fine for adding a building to a system. But it doesn't work in removing the building from the system. That's why in my code, I have two sections- on adding a building to all planets, and one removing it all times from all planets. You need to add something like this:

Code:
if pBuildingPlanet.isHasBuilding(iIndex):
	pBuildingPlanet.setHasBuilding(iIndex, false)
	self.m_pCurrentPlot.getPlotCity().setNumRealBuilding(iIndex, iBuildingsPerSystem-1)
 
Top Bottom