Shqype
Shqyptar
Vicinity Bonus SDK Mod Component
For BTS 3.13, made with Bhruic's unofficial patch 1.11
This was requested by Kalimakhus, but I know that other people have wanted something like this, and it serves multiple uses.
What it does: This mod allows you to set a vicinity bonus requirement for the construction of buildings and units in your cities. A vicinity bonus is a resource within your city's workable radius that is connected to your city and improved with its necessary improvement. This allows for greater city diversification, and emphasizes the necessity of city placement: Two well placed cities can easily share a resource if strategically positioned. In the last screenshot below, for example, Lisbon and Oporto will both share the copper resource, since it is in the vicinity of both cities, but Guimaraes does not have copper in its vicinity, and thus will not be able to construct units and buildings that require such a vicinity bonus.
For all intents and purposes resource sharing will work the same: the city will still have the resource as in vanilla CIV, but it will not be able to train units or construct buildings requiring vicinity bonuses unless those resources are in that city's vicinity.

Four new (optional) XML tags have been added to the BuildingInfos and UnitInfos XML files. They are <VicinityBonus> and <PrereqVicinityBonuses> for buildings, with <VicinityBonusType> and <PrereqVicinityBonuses> for units. The latter of both sets are used as OR prereqs, meaning only one of the resources listed will be needed to satisfy the construction requirement.
The Barracks has been set to require Copper in the city's vicinity:
The Granary has been set to require either Wheat, Rice, or Corn in its city's vicinity:
The Warrior has been set to require Fish in the city's vicinity:
The Settler has been set to require either Cow, Sheep, or Pig in its city's vicinity:
I've also added a new function, bool CvPlot::isHasValidBonus(), which checks if a particular plot has a valid bonus. This means that the plot must be within the player's city radius, it must be part of a bonus network, it must have the proper improvement necessary to "work" the resource (make it valid), and the player must have the proper tech which reveals the resource. The limit to the number of prereqs corresponds to the limit of OR prereqs as alterable in the GlobalInfos XML file.
To see what I changed in the source code, just search for "Shqype," as I have commented all my additions with either "Shqype Vicinity Bonus Start" and "Shqype Vicinity Bonus End" for multi-line additions, or "Shqype Vicinity Bonus Add/Change" for one-line additions/changes. The new schemas are also included.
Please let me know what you guys think of it and if there are any bugs you may encounter. There may be unforeseen scenarios that I haven't accounted for, so let me know if something doesn't work as expected. Enjoy!
For BTS 3.13, made with Bhruic's unofficial patch 1.11
This was requested by Kalimakhus, but I know that other people have wanted something like this, and it serves multiple uses.
What it does: This mod allows you to set a vicinity bonus requirement for the construction of buildings and units in your cities. A vicinity bonus is a resource within your city's workable radius that is connected to your city and improved with its necessary improvement. This allows for greater city diversification, and emphasizes the necessity of city placement: Two well placed cities can easily share a resource if strategically positioned. In the last screenshot below, for example, Lisbon and Oporto will both share the copper resource, since it is in the vicinity of both cities, but Guimaraes does not have copper in its vicinity, and thus will not be able to construct units and buildings that require such a vicinity bonus.
For all intents and purposes resource sharing will work the same: the city will still have the resource as in vanilla CIV, but it will not be able to train units or construct buildings requiring vicinity bonuses unless those resources are in that city's vicinity.






Four new (optional) XML tags have been added to the BuildingInfos and UnitInfos XML files. They are <VicinityBonus> and <PrereqVicinityBonuses> for buildings, with <VicinityBonusType> and <PrereqVicinityBonuses> for units. The latter of both sets are used as OR prereqs, meaning only one of the resources listed will be needed to satisfy the construction requirement.
The Barracks has been set to require Copper in the city's vicinity:
Spoiler :
<VicinityBonus>BONUS_COPPER</VicinityBonus>
The Granary has been set to require either Wheat, Rice, or Corn in its city's vicinity:
Spoiler :
<PrereqVicinityBonuses>
<VicinityBonus>BONUS_WHEAT</VicinityBonus>
<VicinityBonus>BONUS_RICE</VicinityBonus>
<VicinityBonus>BONUS_CORN</VicinityBonus>
</PrereqVicinityBonuses>
<VicinityBonus>BONUS_WHEAT</VicinityBonus>
<VicinityBonus>BONUS_RICE</VicinityBonus>
<VicinityBonus>BONUS_CORN</VicinityBonus>
</PrereqVicinityBonuses>
The Warrior has been set to require Fish in the city's vicinity:
Spoiler :
<VicinityBonusType>BONUS_FISH</VicinityBonusType>
The Settler has been set to require either Cow, Sheep, or Pig in its city's vicinity:
Spoiler :
<PrereqVicinityBonuses>
<VicinityBonusType>BONUS_COW</VicinityBonusType>
<VicinityBonusType>BONUS_SHEEP</VicinityBonusType>
<VicinityBonusType>BONUS_PIG</VicinityBonusType>
</PrereqVicinityBonuses>
<VicinityBonusType>BONUS_COW</VicinityBonusType>
<VicinityBonusType>BONUS_SHEEP</VicinityBonusType>
<VicinityBonusType>BONUS_PIG</VicinityBonusType>
</PrereqVicinityBonuses>
I've also added a new function, bool CvPlot::isHasValidBonus(), which checks if a particular plot has a valid bonus. This means that the plot must be within the player's city radius, it must be part of a bonus network, it must have the proper improvement necessary to "work" the resource (make it valid), and the player must have the proper tech which reveals the resource. The limit to the number of prereqs corresponds to the limit of OR prereqs as alterable in the GlobalInfos XML file.
To see what I changed in the source code, just search for "Shqype," as I have commented all my additions with either "Shqype Vicinity Bonus Start" and "Shqype Vicinity Bonus End" for multi-line additions, or "Shqype Vicinity Bonus Add/Change" for one-line additions/changes. The new schemas are also included.
Please let me know what you guys think of it and if there are any bugs you may encounter. There may be unforeseen scenarios that I haven't accounted for, so let me know if something doesn't work as expected. Enjoy!