A small step for this mod...

You don't need an event. Missions use the event mechanism. You make a mission and have code that does what you want. Look at the Herd folder Horse units for the XML and the CvEventManager for the python code it uses. Sorry if this is a bit brief but it is way past my bed time and it looks like it will be cool enough to sleep tonight!

That was a bit too brief for me I'm afraid :(
I was looking at My_Mods/Herds but there is only the Beastmaster, but no Horse unit. Inside it there is a UNITCLASS_TAMED_HORSE_PAIR but I couldn't find a specific mission there. I also couldn't find a CvEventManager. I've looked at every file in the Python Folder und also in the Event Folder.

This is was I have in the MissionInfo:

Spoiler :
Code:
		<MissionInfo>
			<Type>MISSION_LAUNCH_LUNAR_ROVER</Type>
			<Description>TXT_KEY_MISSION_LAUNCH_LUNAR_ROVER</Description>
			<Help/>
			<Help>TXT_KEY_MISSION_LAUNCH_LUNAR_ROVER_HELP</Help>
			<Waypoint>NONE</Waypoint>
			<EntityEventType>NONE</EntityEventType>
			<iTime>0</iTime>
			<bTarget>0</bTarget>
			<bBuild>0</bBuild>
			<bSound>0</bSound>
			<bVisible>1</bVisible>
			<Button>Art/Interface/Buttons/Units/button_neanderthal.dds</Button>
		</MissionInfo>


And this for the Outcome:
Spoiler :
Code:
		<OutcomeInfo>
			<Type>OUTCOME_LAUNCH_LUNAR_ROVER</Type>
			<Description>TXT_KEY_LAUNCH_LUNAR_ROVER</Description>
			<Message>TXT_KEY_OUTCOME_LAUNCH_LUNAR_ROVER_MESSAGE</Message>
			<PrereqTech>TECH_LUNAR_BASES</PrereqTech>
			<bNeutralTerritory>0</bNeutralTerritory>
			<bHostileTerritory>0</bHostileTerritory>
			<bCity>0</bCity>
		</OutcomeInfo>

And then I think you need an "action" tag on the unit in question. At least that was the chase with the mission to upgrade a Ship to a Bulldozer.

Spoiler :
Code:
			<Actions>
				<Action>
					<MissionType>MISSION_LAUNCH_LUNAR_ROVER</MissionType>
					<iCost>
						<Adapt>
							<ID>ADAPT_DEFAULT</ID>
							<Constant>15</Constant>
						</Adapt>
					</iCost>
[B]#That assignes cost to the unit I guess.[/B]
					<ActionOutcomes>
						<Outcome>
							<OutcomeType>OUTCOME_LAUNCH_LUNAR_ROVER</OutcomeType>
							<iChance>100</iChance>
							<UnitType>UNIT_LUNAR_ROVER</UnitType>
[B]# This says always (100%) do something with the Unit Rover. [/B]
							[I]<bUnitToCity>
								<Constant>0</Constant>
							</bUnitToCity>
							<PlotCondition>
								<Not>
									<Is>TAG_ANARCHY</Is>
								</Not>
							</PlotCondition>
						</Outcome>
					</ActionOutcomes>
				</Action>
			</Actions>[/I]

Can you change the bUnitToCity to bUnitToPlot? And then set as PlotCondition to a list of all 5 lunar terrains?




-----------


There are no screenshots yet. It wouldn't be too interesting, because I just copied unit graphics and buttons from other buildings and units. At some point I have to ask Toffer or Sparth if they could make them prettier ;)
 
Sorry it was in another file
Code:
<Actions>
	<Action>
		<MissionType>MISSION_BUILD_DOMESTICATED_HERD</MissionType>
		<ActionOutcomes>
			<Outcome>
				<OutcomeType>OUTCOME_BUILD_DOMESTICATED_HERD</OutcomeType>
[COLOR="Red"]				<iChance>50</iChance>
				<PlotCondition>
					<Greater>
						[B]<Python>canBuildDonkeyBonus</Python>[/B]
						<Constant>0</Constant>
					</Greater>
				</PlotCondition>
[/COLOR]				[COLOR="Red"][COLOR="Red"][COLOR="Blue"][B]<PythonCallback>doBuildDonkeyBonus</PythonCallback>[/B]
[/COLOR][/COLOR][/COLOR]			</Outcome>
			<Outcome>
				<OutcomeType>OUTCOME_BUILD_DOMESTICATED_HERD_WITH_PASTURE</OutcomeType>
				<iChance>100</iChance>
				<PlotCondition>
					<Greater>
						[B]<Python>canBuildDonkeyBonusAndPasture</Python>[/B]
						<Constant>0</Constant>
					</Greater>
				</PlotCondition>
				[B]<PythonCallback>doBuildDonkeyBonusAndPasture</PythonCallback>[/B]
			</Outcome>
		</ActionOutcomes>
	</Action>
</Actions>

The red is the test to see if the action can happen and the blue is the action that happens. In this case both are calls to the Python event code CvRandomEventInterface.py. The code there that does the stuff is
Code:
def doBuildDonkeyBonus(argsList):
	pPlot = argsList[0]

	if pPlot == False:
		return 0 
	pPlot.setImprovementType(-1)
	pPlot.setBonusType(gc.getInfoTypeForString("BONUS_DONKEY"))

def canBuildDonkeyBonusAndPasture(argsList):
	pPlot = argsList[0]

	if pPlot == False:
		return 0 
	if pPlot.isCity():
		return 0 
	if not (pPlot.getBonusType(-1) == -1):
		return 0 # a resource already on this plot
	if not (pPlot.getTerrainType() in (gc.getInfoTypeForString("TERRAIN_MARSH"), gc.getInfoTypeForString("TERRAIN_DUNES"), gc.getInfoTypeForString("TERRAIN_DESERT"), gc.getInfoTypeForString("TERRAIN_TUNDRA"), gc.getInfoTypeForString("TERRAIN_ICE"), gc.getInfoTypeForString("TERRAIN_PERMAFROST"), gc.getInfoTypeForString("TERRAIN_BARREN")) or pPlot.getFeatureType() in (gc.getInfoTypeForString("FEATURE_SWAMP"),gc.getInfoTypeForString("FEATURE_PEAT_BOG"))):
		return 1
	return 0

def doBuildDonkeyBonusAndPasture(argsList):
	pPlot = argsList[0]

	if pPlot == False:
		return 0 
	pPlot.setImprovementType(gc.getInfoTypeForString("IMPROVEMENT_PASTURE"))
	pPlot.setBonusType(gc.getInfoTypeForString("BONUS_DONKEY"))

All you need in the Plot condition is normal stuff for city or building. In the doing bit you need to get a random plot and change the X and Y coords of the unit to move it to the new location.
 
You have no python posted for the "canBuildDonkeyBonus" (without Pasture), right?

Apart from that I can follow the logic here. So what I need would be something like:

Spoiler :
Code:
<Actions>
	<Action>
		<MissionType>MISSION_LAUNCH_LUNAR_ROVER</MissionType>
		<ActionOutcomes>
			<Outcome>
				<OutcomeType>OUTCOME_LAUNCH_LUNAR_ROVER</OutcomeType>
				<iChance>100</iChance>
				<PlotCondition>
					<Greater>
						<Python>canLaunchRover</Python>
						<Constant>0</Constant>
					</Greater>
				</PlotCondition>
				<PythonCallback>doLaunchRover</PythonCallback>
			</Outcome>
		</ActionOutcomes>
	</Action>
</Actions>

As for python, I have barely an Idea how this has to look like.


canLaunchRover python should include:

Code:
def canLaunchRover(argsList):
	pPlot = argsList[0]

	if pPlot == False:
		return 0 
	if pPlot.isCity():
		return 1 
	return 0

Actually for this unit it's useless since you can build the launcher only in cities and can't move it. I was thinking of limit the launch site to equatorial cities, but you can go to the moon via a polar orbit just as well (it just takes more fuel and is therefore more expensive, but this is not relevant for now.) For the Construction Ship, the canLaunchConstructionShip would look like:

Code:
def canLaunchRover(argsList):
	pPlot = argsList[0]

	if pPlot == False:
		return 0  
[COLOR="Red"]	if you control a Lunar Rover unit and this is on a lunar terrain:[/COLOR]
		return 1 

	return 0

I can see how to "get" terrain types in here, but not how to make a "check inside a check" so to say.


For the final outcome (the rover first):

Code:
Select a plot somewhere.
Loop:
Check if it is one of the following terrains: Lunar Barren etc...
If Not: Select another random plot. 

If true: Place Unit Rover on this plot

End.

Aaaaand I have no idea how to do this :crazyeye: I think this could be horribly inefficient since you loop trough so many plots and only 1/10 or so will be lunar.
Even worse if you would want to exclude all lunar plots that have a city (or base) on them.

The Construction Ship would be:

Code:
Look for a Rover Unit that belongs to you.
Get plot where the Rover unit is.
Place Construction Ship on that plot.

End.

Is this a structure that would work? (obviously it has to be translated into actual python).
 
I suspect this COULD work for the placement plot:

Code:
def DoLaunchRover(argsList):

  kTriggeredData = argsList[0]

  plot = gc.getMap().plot(kTriggeredData.iPlotX, kTriggeredData.iPlotY)
  	if (pPlot.getTerrainType() in (gc.getInfoTypeForString("TERRAIN_LUNAR_BARREN"), gc.getInfoTypeForString("TERRAIN_LUNAR_ROCKY"), gc.getInfoTypeForString("TERRAIN_LUNAR_DESERT"), gc.getInfoTypeForString("TERRAIN_LUNAR_PLAINS"):
		return 1
 
plot.setUnit(gc.getInfoTypeForString("UNIT_LUNAR_ROVER"))
 
First thing we need to do is create a module that creates an array of valid lunar landing plots at the start of a session. This means an init function. Once built we will need to tell BUG where it is and get it to run it. This is done in tow files in the Assets\Config folder. One new one for the new program and a modification to the init.XML to tell BUG to use it. (Note: this code can easily be extended to create arrays for the other regions you may want to launch to.)

This is how BUG implements the modular Python we use.

To do
  1. Decide on a name for the python module. This will also be the name of the new XML file in the Config folder.

  2. Create the Python file putting in the basic stuff needed to run Python and use the BUG stuff.
    Code:
    ## Code for Caveman2Cosmos
    ##
    ## [B][COLOR="Red"]Description of what the code does and who wrote it[/COLOR][/B]
    ##
    
    from CvPythonExtensions import *
    import BugUtil
    import CvUtil
    
    # globals [B]these create a single object for use later in the code slightly speeding up the code[/B]
    gc = CyGlobalContext()
    localText = CyTranslator()
    
    def init():
    	BugUtil.debug("Caveman2Cosmos [I]<insert module name here>[/I].") # [B]This is how you write debug information to the PythonDbg.log[/B]
  3. Next we set up the arrays we are going to use later when finding a valid target plot.
    Code:
    # globals 
    gc = CyGlobalContext()
    localText = CyTranslator()
    
    [B]# Our new" globals"[/B]
    aValidLunarLandingPlots = [] [B]# or some other name you like. The "a" at the start indicates the variable is an array[/B]
    
    [B]# list of valid landing terrains[/B]
    aValidLunarLandingTerrains = [ "TERRAIN_LUNAR_BASALT", 
                                             "TERRAIN_LUNAR_PLAINS", 
                                             "TERRAIN_LUNAR_ROCKY", 
                                             "TERRAIN_LUNAR_BARREN", 
                                             "TERRAIN_LUNAR_DESERT"]
    
    def init():

    I have included all Lunar terrains in the list but you may want fewer. It is laid out that way to make it easier to read for humans.

    We could and should make the code faster by having the above array coded as
    Code:
    aValidLunarLandingTerrains = [ gc.getInfoTypeForString("TERRAIN_LUNAR_BASALT"), 
                                             gc.getInfoTypeForString("TERRAIN_LUNAR_PLAINS"), 
                                             gc.getInfoTypeForString("TERRAIN_LUNAR_ROCKY"), 
                                             gc.getInfoTypeForString("TERRAIN_LUNAR_BARREN"), 
                                             gc.getInfoTypeForString("TERRAIN_LUNAR_DESERT")]
    otherwise we will need to do the calls during the game slowing turn time. It is probably not important in this case. The other reason is that an array of integers will take up less memory that an array of strings.

  4. Next we iterate through the whole map and add those plots to the array that have the correct terrains.
    Code:
    # globals 
    gc = CyGlobalContext()
    localText = CyTranslator()
    
    [B]mmap = gc.getMap()[/B]
    ...
    def init():
    	BugUtil.debug("Caveman2Cosmos [I]<insert module name here>[/I].")
    
    	for i in range(mmap.numPlots()):
    		iPlot = mmap.plotByIndex(i)
    			if iPlot.getTerrainType() in aValidLunarLandingTerrains(): [B]# I think I have the syntax right[/B]
    				aValidLunarLandingPlots.append(iPlot)

    I am not certain I have the syntax of the last two lines correct. That is basically the code needed. You may want to add some debug prints after the loop to print out the X,Y coordinates and the terrain type.

  5. Now you need to create the BUG config XML file
    Code:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    	<!--
        [B]description here[/B]
    	-->
    <mod id="[I]<insert name here>[/I]" module="[I]<insert same name here>[/I]">
    	<init/>
    </mod>
  6. Finally add the module to the end of the list in the init.xml file.

After all that you are ready to use the code in the event functions.
 
Thank you for the tutorial!

So I first created a new folder that belongs into Assets/Python and it is named Faustmouse. Inside this folder I created a a python file named LunarLandingSites. I just copy pasted your example together and tried to understand it, and I think I did. Here is what my file reads: (My questions in red)

Code:
## Code for picking a valid landing site for Rovers
##

from CvPythonExtensions import *
import BugUtil
import CvUtil

# globals
gc = CyGlobalContext()
localText = CyTranslator()

def init():
	BugUtil.debug("Caveman2Cosmos Faustmouse.") [COLOR="Red"]#Name of the folder (Faustmouse) or of the file (LunarLandingSites)? Also, do you keep the "?[/COLOR]

# new globals
aValidLunarLandingPlots = [] 

# list of valid landing terrains
aValidLunarLandingTerrains = [ gc.getInfoTypeForString("TERRAIN_LUNAR_BASALT"), 
                                         gc.getInfoTypeForString("TERRAIN_LUNAR_PLAINS"), 
                                         gc.getInfoTypeForString("TERRAIN_LUNAR_ROCKY"), 
                                         gc.getInfoTypeForString("TERRAIN_LUNAR_BARREN"), 
                                         gc.getInfoTypeForString("TERRAIN_LUNAR_DESERT")]

mmap = gc.getMap()
... [COLOR="red"]#What do these 3 dots mean?
[/COLOR]def init():
	BugUtil.debug("Caveman2Cosmos Faustmouse.") [COLOR="red"]# Again, name of the Folder or the File?[/COLOR]

	for i in range(mmap.numPlots()):
		iPlot = mmap.plotByIndex(i)
			if iPlot.getTerrainType() in aValidLunarLandingTerrains(): 
				aValidLunarLandingPlots.append(iPlot)


So this generates an array of all plots with one of the above 5 terrains, right?

Then I also made a new XML file which belongs in the assets/config folder. It reads:

Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
	<!--
    Lunar Landing Sites for Rovers
	-->
<mod id="LunarLandingSites" module="LunarLandingSites">
	<init/>
</mod>

I looked into your other files here and I think this time I got the mod id correct.

Then I looked for the init XML file (in assets/config) and opened it. If I understood this correctly then all I have to do now would be to add this part on the very bottom: (above the /bug of course)

Code:
 <load mod="LunarLandingSited"/> 
	-->
	<load mod="LunarLandingSited"/>
	<!--

Again, I'm not sure if this is the correct name or if it has to be the Folder's name.
 
OK so my tutorial was not as clear as I thought:lol:
Code:
## Code for picking a valid landing site for Rovers
##

from CvPythonExtensions import *
import BugUtil
import CvUtil

# globals
gc = CyGlobalContext()
localText = CyTranslator()

# new globals
mmap = gc.getMap()
aValidLunarLandingPlots = [] 

# list of valid landing terrains
aValidLunarLandingTerrains = [ gc.getInfoTypeForString("TERRAIN_LUNAR_BASALT"), 
                                         gc.getInfoTypeForString("TERRAIN_LUNAR_PLAINS"), 
                                         gc.getInfoTypeForString("TERRAIN_LUNAR_ROCKY"), 
                                         gc.getInfoTypeForString("TERRAIN_LUNAR_BARREN"), 
                                         gc.getInfoTypeForString("TERRAIN_LUNAR_DESERT")]


def init():
	BugUtil.debug("Caveman2Cosmos Lunar Landing Plots.")

	for i in range(mmap.numPlots()):
		iPlot = mmap.plotByIndex(i)
			if iPlot.getTerrainType() in aValidLunarLandingTerrains(): 
				aValidLunarLandingPlots.append(iPlot)
				BugUtil.debug("  add Lunar Plot at %d, %d",(iPlot.getX(),iPlot.getY())

The debug stuff is what will be printed in the PythonDBG.log file. You just need to make it something so that you can find it when checking what you have done.

This is just wrong - remove the three lines.
Code:
	-->
	<load mod="LunarLandingSited"/>
	<!--
 
OK so my tutorial was not as clear as I thought:lol:

I think it's me, I never worked with python before and don't have a lot programming experience as well, so all I can do is basically copy and paste :sad:

Code:
## Code for picking a valid landing site for Rovers
##

from CvPythonExtensions import *
import BugUtil
import CvUtil

# globals
gc = CyGlobalContext()
localText = CyTranslator()

# new globals
mmap = gc.getMap()
aValidLunarLandingPlots = [] 

# list of valid landing terrains
aValidLunarLandingTerrains = [ gc.getInfoTypeForString("TERRAIN_LUNAR_BASALT"), 
                                         gc.getInfoTypeForString("TERRAIN_LUNAR_PLAINS"), 
                                         gc.getInfoTypeForString("TERRAIN_LUNAR_ROCKY"), 
                                         gc.getInfoTypeForString("TERRAIN_LUNAR_BARREN"), 
                                         gc.getInfoTypeForString("TERRAIN_LUNAR_DESERT")]


def init():
	BugUtil.debug("Caveman2Cosmos Lunar Landing Plots.")

	for i in range(mmap.numPlots()):
		iPlot = mmap.plotByIndex(i)
			if iPlot.getTerrainType() in aValidLunarLandingTerrains(): 
				aValidLunarLandingPlots.append(iPlot)
				BugUtil.debug("  add Lunar Plot at %d, %d",(iPlot.getX(),iPlot.getY())
And this is now what belongs in the assets/python/Faustmouse "LunarLandingSites" File? Because there is still a "BugUtil.debug" in there. And Lunar Landing Plots is what? I haven't used the name before.

The debug stuff is what will be printed in the PythonDBG.log file. You just need to make it something so that you can find it when checking what you have done.

This is just wrong - remove the three lines.
Code:
	-->
	<load mod="LunarLandingSited"/>
	<!--

So it should be just <load mod="LunarLandingSites"/> ?
 
1) Yes that is the code for Assets/Python/LunarLandingSites.py . It was after midnight when I commented so I typed Plots because that is what we are searching through but Sites is better since it is a subset.

When you extend this to Martian sites it would be best to use the same init function so that you only go through all plots in one go rather than twice.

2) Yes
 
Ok, so the code actually makes a list of the valid lunar terrains and stores it?

Code:
BugUtil.debug("  add Lunar Plot at %d, %d",(iPlot.getX(),iPlot.getY())

Or is everything behind def init(): only for debugging purposes?
 
Ok, so the code actually makes a list of the valid lunar terrains and stores it?

Code:
BugUtil.debug("  add Lunar Plot at %d, %d",(iPlot.getX(),iPlot.getY())

Or is everything behind def init(): only for debugging purposes?

Code:
def init():
	[COLOR="Red"]BugUtil.debug("Caveman2Cosmos Lunar Landing Plots.")[/COLOR]

	for i in range(mmap.numPlots()):
		iPlot = mmap.plotByIndex(i)
			if iPlot.getTerrainType() in aValidLunarLandingTerrains(): 
				aValidLunarLandingPlots.append(iPlot)
				[COLOR="Red"]BugUtil.debug("  add Lunar Plot at %d, %d",(iPlot.getX(),iPlot.getY())[/COLOR]

The bits in red are debug stuff so that you can check that it is working. The rest does the work and yes it stores a list of valid landing spots.

In the code that actually moves to the unit you will need to make sure that plots are not owned by someone else before getting the landing site. In the longer run you may want to also create another list of player landing spots or some such. It depends on how many plots there are, if few <1000 then doing the loop through this list every time is probably better than using memory to hold a new list; memory that could be used better elsewhere.
 
@Mouse:

I've added the ConstructCondition filter to all free building sources. However, unfortunately, this check can only take place at the time the building is attempted to be given to the city and if this is based on a condition that can change, it would be unlikely to re-check at any appropriate time thereafter so it's going to be semi-permanent once a city has determined it can't have the free building.

For this reason, it would be beneficial to scour all buildings given for free in the mod and check their ConstructConditions (or alternatively go about it the opposite way, or create a list of buildings given for free and a list of buildings with construct conditions and compare the two to find where one exists on the other.) We need to make sure this isn't going to foul up anything outside of the realm of what you wanted this for!

If a newly planted city doesn't have access, for example, to a bonus that the free building requires, that COULD be problematic for all new cities since it may be that the check could take place before the trade network notifies the newly founded city that the city should now have that bonus.

This will be quite useful if existing free buildings don't have much use of the ConstructCondition tag and given the newness of the ConstructCondition, its quite possible it hasn't seen enough use to be problematic yet. This should work great for your needs though.

But I'm going to leave the xml validation check to you. I've added the ConstructCondition as a validation check on my end. Hopefully it works as intended (the order the city data is built when founded could cause similar issues trying to use it the way its intended.)

Let me know how well this project fares for you. If its not well I may be able to come up with another solution but I'm hoping, for the sake of minimizing massive turn delays, that this is sufficient.
 
I made a list of all wonders and national wonders that give a free building and will check these free buildings over the weekend.

I also tested it and the problem is that the Lunar Base is given in the same turn as the free buildings. So they when the check occours the newly found lunar city is still valid since the Lunar Base does not exist in that moment. If this is easy to fix on your hand then be my guest, but if not I can change the not requirement to lunar terrain instead, no biggy.
 
Don't forget that there are some pseudo-National Wonders that work because they give buildings free to all cities. These are just regular buildings.
 
Yes all the Myths and Stories use the but I have used it for at least one Jade building also. The Traditions and Doctrines also use the same mechanism but most of the existing ones should be obsolete before travel to the moon.
 
This is not about lunar buildings. It's about the new mechanism that will deny free buildings if there is an unmatching ConstructCondition. So if you didn't use construct conditions then nothing changes.
 
I made a list of all wonders and national wonders that give a free building and will check these free buildings over the weekend.

I also tested it and the problem is that the Lunar Base is given in the same turn as the free buildings. So they when the check occours the newly found lunar city is still valid since the Lunar Base does not exist in that moment. If this is easy to fix on your hand then be my guest, but if not I can change the not requirement to lunar terrain instead, no biggy.
Hmm... Try using the ConstructCondition on the free buildings you're trying to deny specifying 'not' specified lunar terrains on the plot. That might work. The plot is there already so as long as the construct condition will check this the way I suspect it would, this could be a valid solution. Unfortunately, it'll add quite a bit of processing time if we don't come up with a better way to resolve this.

Perhaps the best thing would be to assign to the initializing city almost immediately a new boolean function such as 'isLunar()' which would draw from a plot boolean. Then again, the better way to do this would be to prepare for more types (although this is already somewhat ready for implementation if we were using multimaps!) so that mars, solar system and other map regions could be equally defined. Then give buildings a 'PrereqMapType' tag or 'bLunar' tag. This would require a tremendous review of buildings to define valid maptypes but it would be the fastest way to process these checks during the game. I could also make it so that if no PrereqMapTypes are defined then the building is assumed valid on all map types. I doubt many buildings would qualify for that in the long run. The city would gain the 'MapType' in THIS system by checking the 'MapType' tag that would need to exist on the terrain and thus be inherrited by the plot definition.

Actually, this would probably work fairly well with multimaps too, considering that it could help to play into map generation. It could also be a tag given to units so as to state which map type tiles the unit can even exist on. This would be a valid fix to the helicopter issue for example.

Again, though, this is going to require a MASSIVE and I mean MASSIVE amount of xml work once setup. Are you up for that effort?



To remind myself here: I've also been asked to have coast and river prereqs checked on free building assignments.

@DH: relating to the above, should the Peak prereq also be checked or is that just not applied anywhere in free building assignments and we should leave it out until it is for whatever reason it becomes necessary?
 
@DH: relating to the above, should the Peak prereq also be checked or is that just not applied anywhere in free building assignments and we should leave it out until it is for whatever reason it becomes necessary?

There are some buildings that require peak in the vicinity. There is even one that (used to) require the city be built on a peak. I don't know of any of the top of my head.

I would suggest it be included it for completeness. Having it separate has caused problems in the past.
 
There are some buildings that require peak in the vicinity. There is even one that (used to) require the city be built on a peak. I don't know of any of the top of my head.

I would suggest it be included it for completeness. Having it separate has caused problems in the past.

There's actually an interesting filter function that encompasses all of those plus a few other terrain and feature prereq considerations. Shouldn't be too bad to run it through this test. I looked at every line and it looks appropriate.


Also, while tweaking with this I figured I'd get started with the coding of the MapType tags. Should be fairly easy from a coding perspective to work out. But it does take further definitions of maps in the enums so I figured I'd post the map definitions I think C2C will use in full eventually:
Code:
	NO_MAP = -1,
	MAP_INITIAL,
	MAP_SUBTERRANEAN,
	MAP_SOLAR_SYSTEM,
	MAP_LUNAR,
	MAP_MARTIAN,
	MAP_VENUSIAN,
	MAP_JOVIAN,
	MAP_AQUATIC,
	MAP_PLASMA,
	MAP_GALACTIC,
	MAX_MAPS = 10,
These are hard coded and since they won't have their own unique xml for the group, this is all that's necessary really. Anyhow, these are the identifiers we'll have. Thing is, each map type needs to have its OWN types of terrains. It won't be until and unless multi-maps is active that terrains and features must adhere to the map itself to be existing there so what that means is these proxy multimaps will be able to define the plots themselves by the use of a terrain tag that will define the type by one of the above categories.

I'll let you know what the tags will be to work with once I get them installed.


EDIT:
Ok, going on the SVN soon are these tags:
Code:
<MapTypes>
	<MapType>MAP_LUNAR</MapType>
</MapTypes>

<PrereqMapTypes>
	<MapType>MAP_LUNAR</MapType>
</PrereqMapTypes>
The prereq tag is only on Buildings at the moment but the MapTypes tag may as well be named prereqmaptype for features and improvements. For terrains it's just maptypes because that's really the basis of the modification. Earth terrains need to now be defined as it shows above for lunar ones as MAP_INITIAL. Assign this xml to the terrains first and then you can use the prereqmaptypes tag on buildings to craft what is and is not ONLY earth and ONLY moon buildings.

I'll build this out further soon... gotta get a little text work in and some unit work but for the evening, I've done enough I think ;)
 
Back
Top Bottom