TC01
Deity
I've been trying to make Worldbuilder in Final Frontier (well, Star Trek actually) to place a randomized solar system when you place a solar system on a plot. Such code exists; the game uses it in onGameStart to generate random systems after starting a mapscript:
So I went into CvWBDesc.py and edited class CvPlotDesc def apply here:
No system was generated, and neither print statement appears in PythonDbg.log. The debug confirms that I have selected the Solar System button to place, but not that anything else has happened. Thinking perhaps that this meant that no code after the setFeatureType() statement was executed, I tried this:
However, again, no print statements appeared, and no solar system was generated. Is there something wrong with my code or my print statements, or both? Is there a way to make this work? I really have no clue where to go from here.
Thanks in advance if you can help.
Code:
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)
So I went into CvWBDesc.py and edited class CvPlotDesc def apply here:
Code:
if (self.featureType):
featureTypeNum = CvUtil.findInfoTypeNum(gc.getFeatureInfo, gc.getNumFeatureInfos(), self.featureType)
plot.setFeatureType(featureTypeNum, self.featureVariety)
[COLOR="Red"] print "Post setFeatureType code reached"
if self.featureType == 'FEATURE_SOLAR_SYSTEM':
print "Solar System Placed by Worldbuilder"
FinalFrontier = CvEventInterface.getEventManager()
pSystem = createRandomSystem(plot.getX(), plot.getY(), -1, 3)
FinalFrontier.addSystem(pSystem)[/COLOR]
No system was generated, and neither print statement appears in PythonDbg.log. The debug confirms that I have selected the Solar System button to place, but not that anything else has happened. Thinking perhaps that this meant that no code after the setFeatureType() statement was executed, I tried this:
Code:
if (self.featureType):
featureTypeNum = CvUtil.findInfoTypeNum(gc.getFeatureInfo, gc.getNumFeatureInfos(), self.featureType)
[COLOR="red"] print "Post setFeatureType code reached"
if self.featureType == 'FEATURE_SOLAR_SYSTEM':
print "Solar System Placed by Worldbuilder"
FinalFrontier = CvEventInterface.getEventManager()
pSystem = createRandomSystem(plot.getX(), plot.getY(), -1, 3)
FinalFrontier.addSystem(pSystem)
plot.setFeatureType(featureTypeNum, self.featureVariety)[/COLOR]
However, again, no print statements appeared, and no solar system was generated. Is there something wrong with my code or my print statements, or both? Is there a way to make this work? I really have no clue where to go from here.
Thanks in advance if you can help.