Buildings are constructed within districts and provide various bonuses to your cities:
import { ACTION_GROUP_BUNDLE, CONSTRUCTIBLE_TYPE_TAG, ConstructibleBuilder, DISTRICT, Mod, YIELD} from "civ7-modding-tools";const mod = new Mod({ id: 'my-building-mod', version: '1.0',});// Create a buildingconst trainingGrounds = new ConstructibleBuilder({ // Specify which Age this building belongs to actionGroupBundle: ACTION_GROUP_BUNDLE.AGE_ANTIQUITY, // Core building properties constructible: { constructibleType: 'BUILDING_TRAINING_GROUNDS', }, // Indicate this is a building (vs improvement) building: {}, // Tags affect how the building functions typeTags: [ CONSTRUCTIBLE_TYPE_TAG.AGELESS, CONSTRUCTIBLE_TYPE_TAG.PRODUCTION, CONSTRUCTIBLE_TYPE_TAG.MILITARY ], // Where the building can be placed constructibleValidDistricts: [ DISTRICT.URBAN, DISTRICT.CITY_CENTER, ], // Yields provided by the building constructibleYieldChanges: [ { yieldType: YIELD.PRODUCTION, yieldChange: 2 }, ], // Maintenance costs constructibleMaintenances: [ { yieldType: YIELD.GOLD, amount: 2 }, ], // Text that appears in-game localizations: [ { name: 'Training Grounds', description: 'Military training facility providing production bonuses.', tooltip: 'Provides +2 Production but costs 2 Gold per turn to maintain.' }, ]});// Add building to mod and buildmod.add([trainingGrounds]).build('./dist');
Create improvements that require specific resources:
const resourceImprovement = new ConstructibleBuilder({ // Basic improvement properties... // Can only be built on tiles with this resource constructibleValidResources: [ RESOURCE.IRON ], // Other properties...});