Vehem
Modmod Monkey
- Joined
- Nov 22, 2005
- Messages
- 3,219
Doviello Icehouse Release 1
The MODCOMP adds one new unique building to the Doviello civilization, replacing the Smokehouse. Named an "Icehouse", this building fulfills all the normal roles of a Smokehouse, but has an additional ability when the city containing it is built in Tundra or Snow/Ice terrain.
In that case, the city will become immune to the effects of starvation. You may effectively grow the city to whatever size you can achieve in the tundra (using farms/agriculture, deer-camps etc), then switch from food production to working other tiles without losing population. This allows more viable tundra-based cities, although Tundra still remains quite poor in terms of it's yields and improvement potential.
The Icehouse has no additional benefits if the city is built in any other type of terrain - it only works for Tundra/Ice based cities.
The original suggestion for this came from Cephalo in [this thread]. I adapted it slightly and used a building to implement the ability as seems to be the trend with Civ-specific buildings (Svaltafar Hunting Lodges, Ljosofar Archery Ranges, Bannor Training Yards, Lanun Harbours etc).
==
The MODCOMP is a combined SDK/Python/XML mod, with two new functions exposed to Python "cannotGrow" and "cannotStarve". These are called whenever a city is due to change population due to food and can block the population change if the function returns true. The XML changes implement the Icehouse as an example usage.
The MODCOMP adds one new unique building to the Doviello civilization, replacing the Smokehouse. Named an "Icehouse", this building fulfills all the normal roles of a Smokehouse, but has an additional ability when the city containing it is built in Tundra or Snow/Ice terrain.
In that case, the city will become immune to the effects of starvation. You may effectively grow the city to whatever size you can achieve in the tundra (using farms/agriculture, deer-camps etc), then switch from food production to working other tiles without losing population. This allows more viable tundra-based cities, although Tundra still remains quite poor in terms of it's yields and improvement potential.
The Icehouse has no additional benefits if the city is built in any other type of terrain - it only works for Tundra/Ice based cities.
The original suggestion for this came from Cephalo in [this thread]. I adapted it slightly and used a building to implement the ability as seems to be the trend with Civ-specific buildings (Svaltafar Hunting Lodges, Ljosofar Archery Ranges, Bannor Training Yards, Lanun Harbours etc).
==
The MODCOMP is a combined SDK/Python/XML mod, with two new functions exposed to Python "cannotGrow" and "cannotStarve". These are called whenever a city is due to change population due to food and can block the population change if the function returns true. The XML changes implement the Icehouse as an example usage.
Spoiler code diff's :
Code:
------------------ Assets/XML/Buildings/CIV4BuildingInfos.xml ------------------
index 63acdc0..d0f3a6a 100644
@@ -30245,6 +30245,237 @@
</SpecialistCommerceChanges>
</BuildingInfo>
<BuildingInfo>
+ <BuildingClass>BUILDINGCLASS_SMOKEHOUSE</BuildingClass>
+ <Type>BUILDING_DOVIELLO_SMOKEHOUSE</Type>
+ <SpecialBuildingType>NONE</SpecialBuildingType>
+ <Description>TXT_KEY_BUILDING_DOVIELLO_SMOKEHOUSE</Description>
+ <Civilopedia>TXT_KEY_BUILDING_DOVIELLO_SMOKEHOUSE_PEDIA</Civilopedia>
+ <Strategy>TXT_KEY_BUILDING_DOVIELLO_SMOKEHOUSE_STRATEGY</Strategy>
+ <Help></Help>
+ <Advisor>ADVISOR_GROWTH</Advisor>
+ <ArtDefineTag>ART_DEF_BUILDING_SMOKEHOUSE</ArtDefineTag>
+ <MovieDefineTag>NONE</MovieDefineTag>
+ <HolyCity>NONE</HolyCity>
+ <ReligionType>NONE</ReligionType>
+ <StateReligion>NONE</StateReligion>
+ <bStateReligion>0</bStateReligion>
+ <PrereqReligion>NONE</PrereqReligion>
+ <PrereqCorporation>NONE</PrereqCorporation>
+ <FoundsCorporation>NONE</FoundsCorporation>
+ <GlobalReligionCommerce>NONE</GlobalReligionCommerce>
+ <GlobalCorporationCommerce>NONE</GlobalCorporationCommerce>
+ <VictoryPrereq>NONE</VictoryPrereq>
+ <FreeStartEra>NONE</FreeStartEra>
+ <MaxStartEra>NONE</MaxStartEra>
+ <ObsoleteTech>NONE</ObsoleteTech>
+ <PrereqTech>TECH_ANIMAL_HUSBANDRY</PrereqTech>
+ <TechTypes>
+ </TechTypes>
+ <Bonus>NONE</Bonus>
+ <PrereqBonuses>
+ </PrereqBonuses>
+ <ProductionTraits>
+ </ProductionTraits>
+ <HappinessTraits>
+ </HappinessTraits>
+ <NoBonus>NONE</NoBonus>
+ <PowerBonus>NONE</PowerBonus>
+ <FreeBonus>NONE</FreeBonus>
+ <iNumFreeBonuses>0</iNumFreeBonuses>
+ <FreeBuilding>NONE</FreeBuilding>
+ <FreePromotion>NONE</FreePromotion>
+ <CivicOption>NONE</CivicOption>
+ <GreatPeopleUnitClass>NONE</GreatPeopleUnitClass>
+ <iGreatPeopleRateChange>0</iGreatPeopleRateChange>
+ <iHurryAngerModifier>0</iHurryAngerModifier>
+ <bBorderObstacle>0</bBorderObstacle>
+ <bTeamShare>0</bTeamShare>
+ <bWater>0</bWater>
+ <bRiver>0</bRiver>
+ <bPower>0</bPower>
+ <bDirtyPower>0</bDirtyPower>
+ <bAreaCleanPower>0</bAreaCleanPower>
+ <DiploVoteType>NONE</DiploVoteType>
+ <bForceTeamVoteEligible>0</bForceTeamVoteEligible>
+ <bCapital>0</bCapital>
+ <bGovernmentCenter>0</bGovernmentCenter>
+ <bGoldenAge>0</bGoldenAge>
+ <bAllowsNukes>0</bAllowsNukes>
+ <bMapCentering>0</bMapCentering>
+ <bNoUnhappiness>0</bNoUnhappiness>
+ <bNoUnhealthyPopulation>0</bNoUnhealthyPopulation>
+ <bBuildingOnlyHealthy>0</bBuildingOnlyHealthy>
+ <bNeverCapture>0</bNeverCapture>
+ <bNukeImmune>0</bNukeImmune>
+ <bPrereqReligion>0</bPrereqReligion>
+ <bCenterInCity>0</bCenterInCity>
+ <iAIWeight>0</iAIWeight>
+ <iCost>120</iCost>
+ <iHurryCostModifier>0</iHurryCostModifier>
+ <iAdvancedStartCost>100</iAdvancedStartCost>
+ <iAdvancedStartCostIncrease>0</iAdvancedStartCostIncrease>
+ <iMinAreaSize>-1</iMinAreaSize>
+ <iConquestProb>25</iConquestProb>
+ <iCitiesPrereq>0</iCitiesPrereq>
+ <iTeamsPrereq>0</iTeamsPrereq>
+ <iLevelPrereq>0</iLevelPrereq>
+ <iMinLatitude>0</iMinLatitude>
+ <iMaxLatitude>90</iMaxLatitude>
+ <iGreatPeopleRateModifier>0</iGreatPeopleRateModifier>
+ <iGreatGeneralRateModifier>0</iGreatGeneralRateModifier>
+ <iDomesticGreatGeneralRateModifier>0</iDomesticGreatGeneralRateModifier>
+ <iGlobalGreatPeopleRateModifier>0</iGlobalGreatPeopleRateModifier>
+ <iAnarchyModifier>0</iAnarchyModifier>
+ <iGoldenAgeModifier>0</iGoldenAgeModifier>
+ <iGlobalHurryModifier>0</iGlobalHurryModifier>
+ <iExperience>0</iExperience>
+ <iGlobalExperience>0</iGlobalExperience>
+ <iFoodKept>20</iFoodKept>
+ <iAirlift>0</iAirlift>
+ <iAirModifier>0</iAirModifier>
+ <iAirUnitCapacity>0</iAirUnitCapacity>
+ <iNukeModifier>0</iNukeModifier>
+ <iNukeExplosionRand>0</iNukeExplosionRand>
+ <iFreeSpecialist>0</iFreeSpecialist>
+ <iAreaFreeSpecialist>0</iAreaFreeSpecialist>
+ <iGlobalFreeSpecialist>0</iGlobalFreeSpecialist>
+ <iMaintenanceModifier>0</iMaintenanceModifier>
+ <iWarWearinessModifier>0</iWarWearinessModifier>
+ <iGlobalWarWearinessModifier>0</iGlobalWarWearinessModifier>
+ <iEnemyWarWearinessModifier>0</iEnemyWarWearinessModifier>
+ <iHealRateChange>0</iHealRateChange>
+ <iHealth>0</iHealth>
+ <iAreaHealth>0</iAreaHealth>
+ <iGlobalHealth>0</iGlobalHealth>
+ <iHappiness>0</iHappiness>
+ <iAreaHappiness>0</iAreaHappiness>
+ <iGlobalHappiness>0</iGlobalHappiness>
+ <iStateReligionHappiness>0</iStateReligionHappiness>
+ <iWorkerSpeedModifier>0</iWorkerSpeedModifier>
+ <iMilitaryProductionModifier>0</iMilitaryProductionModifier>
+ <iSpaceProductionModifier>0</iSpaceProductionModifier>
+ <iGlobalSpaceProductionModifier>0</iGlobalSpaceProductionModifier>
+ <iTradeRoutes>0</iTradeRoutes>
+ <iCoastalTradeRoutes>0</iCoastalTradeRoutes>
+ <iGlobalTradeRoutes>0</iGlobalTradeRoutes>
+ <iTradeRouteModifier>0</iTradeRouteModifier>
+ <iForeignTradeRouteModifier>0</iForeignTradeRouteModifier>
+ <iGlobalPopulationChange>0</iGlobalPopulationChange>
+ <iFreeTechs>0</iFreeTechs>
+ <iDefense>0</iDefense>
+ <iBombardDefense>0</iBombardDefense>
+ <iAllCityDefense>0</iAllCityDefense>
+ <iEspionageDefense>0</iEspionageDefense>
+ <iAsset>3</iAsset>
+ <iPower>0</iPower>
+ <fVisibilityPriority>9</fVisibilityPriority>
+ <SeaPlotYieldChanges>
+ </SeaPlotYieldChanges>
+ <RiverPlotYieldChanges>
+ </RiverPlotYieldChanges>
+ <GlobalSeaPlotYieldChanges>
+ </GlobalSeaPlotYieldChanges>
+ <YieldChanges>
+ </YieldChanges>
+ <YieldModifiers>
+ </YieldModifiers>
+ <CommerceChanges>
+ </CommerceChanges>
+ <ObsoleteSafeCommerceChanges>
+ </ObsoleteSafeCommerceChanges>
+ <CommerceChangeDoubleTimes>
+ </CommerceChangeDoubleTimes>
+ <CommerceModifiers>
+ </CommerceModifiers>
+ <GlobalCommerceModifiers>
+ </GlobalCommerceModifiers>
+ <SpecialistExtraCommerces>
+ </SpecialistExtraCommerces>
+ <StateReligionCommerces>
+ </StateReligionCommerces>
+ <CommerceHappinesses>
+ </CommerceHappinesses>
+ <ReligionChanges>
+ </ReligionChanges>
+ <SpecialistCounts>
+ </SpecialistCounts>
+ <FreeSpecialistCounts>
+ </FreeSpecialistCounts>
+ <CommerceFlexibles>
+ </CommerceFlexibles>
+ <CommerceChangeOriginalOwners>
+ </CommerceChangeOriginalOwners>
+ <ConstructSound>AS2D_BUILD_GRANARY</ConstructSound>
+ <BonusHealthChanges>
+ <BonusHealthChange>
+ <BonusType>BONUS_COW</BonusType>
+ <iHealthChange>1</iHealthChange>
+ </BonusHealthChange>
+ <BonusHealthChange>
+ <BonusType>BONUS_PIG</BonusType>
+ <iHealthChange>1</iHealthChange>
+ </BonusHealthChange>
+ <BonusHealthChange>
+ <BonusType>BONUS_SHEEP</BonusType>
+ <iHealthChange>1</iHealthChange>
+ </BonusHealthChange>
+ <BonusHealthChange>
+ <BonusType>BONUS_TOAD</BonusType>
+ <iHealthChange>1</iHealthChange>
+ </BonusHealthChange>
+ </BonusHealthChanges>
+ <BonusHappinessChanges>
+ </BonusHappinessChanges>
+ <BonusProductionModifiers>
+ </BonusProductionModifiers>
+ <UnitCombatFreeExperiences>
+ </UnitCombatFreeExperiences>
+ <DomainFreeExperiences>
+ </DomainFreeExperiences>
+ <DomainProductionModifiers>
+ </DomainProductionModifiers>
+ <BuildingHappinessChanges>
+ </BuildingHappinessChanges>
+ <PrereqBuildingClasses>
+ </PrereqBuildingClasses>
+ <BuildingClassNeededs>
+ </BuildingClassNeededs>
+ <SpecialistYieldChanges>
+ </SpecialistYieldChanges>
+ <BonusYieldModifiers>
+ </BonusYieldModifiers>
+ <ImprovementFreeSpecialists>
+ </ImprovementFreeSpecialists>
+ <Flavors>
+ <Flavor>
+ <FlavorType>FLAVOR_GROWTH</FlavorType>
+ <iFlavor>10</iFlavor>
+ </Flavor>
+ </Flavors>
+ <HotKey></HotKey>
+ <bAltDown>0</bAltDown>
+ <bShiftDown>0</bShiftDown>
+ <bCtrlDown>0</bCtrlDown>
+ <bGraphicalOnly>0</bGraphicalOnly>
+ <iHotKeyPriority>0</iHotKeyPriority>
+ <bApplyFreePromotionOnMove>0</bApplyFreePromotionOnMove>
+ <bEquipment>0</bEquipment>
+ <bNoCivicAnger>0</bNoCivicAnger>
+ <bRequiresCaster>0</bRequiresCaster>
+ <bUnhappyProduction>0</bUnhappyProduction>
+ <iCrime>0</iCrime>
+ <iFreePromotionPick>0</iFreePromotionPick>
+ <iModifyGlobalCounter>0</iModifyGlobalCounter>
+ <iPlotRadius>0</iPlotRadius>
+ <iResistMagic>0</iResistMagic>
+ <FreeBonus2>NONE</FreeBonus2>
+ <FreeBonus3>NONE</FreeBonus3>
+ <PrereqTrait>NONE</PrereqTrait>
+ <RemovePromotion>NONE</RemovePromotion>
+ <SpecialistCommerceChanges>
+ </SpecialistCommerceChanges>
+ </BuildingInfo>
+ <BuildingInfo>
<BuildingClass>BUILDINGCLASS_SMUGGLERS_PORT</BuildingClass>
<Type>BUILDING_SMUGGLERS_PORT</Type>
<SpecialBuildingType>NONE</SpecialBuildingType>
-------------- Assets/XML/Civilizations/CIV4CivilizationInfos.xml --------------
index 7369b36..5c042a3 100644
@@ -3607,6 +3607,10 @@
<BuildingType>NONE</BuildingType>
</Building>
<Building>
+ <BuildingClassType>BUILDINGCLASS_SMOKEHOUSE</BuildingClassType>
+ <BuildingType>BUILDING_DOVIELLO_SMOKEHOUSE</BuildingType>
+ </Building>
+ <Building>
<BuildingClassType>BUILDINGCLASS_BOWYER</BuildingClassType>
<BuildingType>NONE</BuildingType>
</Building>
------------------------- Assets/python/CvGameUtils.py -------------------------
index d8bd006..b8c047f 100644
@@ -567,6 +567,17 @@ class CvGameUtils:
pCity = argsList[0]
return False
+ def cannotGrow(self,argsList):
+ pCity = argsList[0]
+ return False
+
+ def cannotStarve(self,argsList):
+ pCity = argsList[0]
+ if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_DOVIELLO_SMOKEHOUSE')) > 0:
+ if (pCity.plot().getTerrainType()==gc.getInfoTypeForString('TERRAIN_TUNDRA')) or (pCity.plot().getTerrainType()==gc.getInfoTypeForString('TERRAIN_SNOW')):
+ return True;
+ return False
+
def doProduction(self,argsList):
pCity = argsList[0]
return False
----------------- Assets/python/entrypoints/CvGameInterface.py -----------------
return gameUtils().doGoody(argsList)
def doGrowth(argsList):
#CvUtil.pyPrint( "CvGameInterface.doGrowth" )
return gameUtils().doGrowth(argsList)
+def cannotGrow(argsList):
+ #CvUtil.pyPrint( "CvGameInterface.cannotGrow" )
+ return gameUtils().cannotGrow(argsList)
+
+def cannotStarve(argsList):
+ #CvUtil.pyPrint( "CvGameInterface.cannotStarve" )
+ return gameUtils().cannotStarve(argsList)
+
+
def doProduction(argsList):
#CvUtil.pyPrint( "CvGameInterface.doProduction" )
return gameUtils().doProduction(argsList)
Spoiler SDK Source Changes in CvCity.cpp :
Code:
void CvCity::doGrowth()
{
int iDiff;
CyCity* pyCity = new CyCity(this);
CyArgsList argsList;
argsList.add(gDLL->getPythonIFace()->makePythonObject(pyCity)); // pass in city class
long lResult=0;
gDLL->getPythonIFace()->callFunction(PYGameModule, "doGrowth", argsList.makeFunctionArgs(), &lResult);
delete pyCity; // python fxn must not hold on to this pointer
if (lResult == 1)
{
return;
}
iDiff = foodDifference();
changeFood(iDiff);
changeFoodKept(iDiff);
setFoodKept(range(getFoodKept(), 0, ((growthThreshold() * getMaxFoodKeptPercent()) / 100)));
if (getFood() >= growthThreshold())
{
+ CyCity* pyCity = new CyCity(this);
+ CyArgsList argsList;
+ argsList.add(gDLL->getPythonIFace()->makePythonObject(pyCity)); // pass in city class
+ long lResult=0;
+ gDLL->getPythonIFace()->callFunction(PYGameModule, "cannotGrow", argsList.makeFunctionArgs(), &lResult);
+ delete pyCity; // python fxn must not hold on to this pointer
+ if (lResult==1)
+ {
+ setFood(growthThreshold());
+ return;
+ }
if (AI_isEmphasizeAvoidGrowth())
{
setFood(growthThreshold());
}
else
{
changeFood(-(std::max(0, (growthThreshold() - getFoodKept()))));
changePopulation(1);
// ONEVENT - City growth
gDLL->getEventReporterIFace()->cityGrowth(this, getOwnerINLINE());
}
}
else if (getFood() < 0)
{
changeFood(-(getFood()));
+ CyCity* pyCity = new CyCity(this);
+ CyArgsList argsList;
+ argsList.add(gDLL->getPythonIFace()->makePythonObject(pyCity)); // pass in city class
+ long lResult=0;
+ gDLL->getPythonIFace()->callFunction(PYGameModule, "cannotStarve", argsList.makeFunctionArgs(), &lResult);
+ delete pyCity; // python fxn must not hold on to this pointer
+ if (lResult==1)
+ {
+ return;
+ }
if (getPopulation() > 1)
{
changePopulation(-1);
}
}