Modding - Construction Blueprints

## Construction Blueprints

Construction blueprints define how you build stuff. You can define costs, limitations on where these buildings can be placed, and other parameters. Construction blueprints are defined in the file, `Constructions.json`, and you can find the base types and categories in `ConstructionBase.json`.

To define the buildings themselves and their behavior, see Modding - Buildings.

## Base Types

There are a few pre-defined base types for construction blueprints that the actual blueprints inherit from. These define construction behavior and limitations common for objects that inherit them, such as objects that need to be built within the power area, or objects that can only be built outside the city, and so on. You can find the base types in the `ConstructionBase.json` file that is supplied with the Reference Configuration Files.

## Format

Construction blueprints are defined using the standard Entity Format.

## Production Recipe Parameters

This is a list of the different parameters that can be applied to construction blueprints. Some are optional, while others are always required.

### Sprite

The sprite parameter will determine the building icon in the construction menu and in the research screen. By default, it will search for a sprite called `build_[construction ID]`, but you can define a different one using the following format:

```
sprite: "my_building"

```

See Adding Sprites for more information on adding your own image files.

### Object

```
"object": "researchlab",

```

The Map Object that will be constructed.

### Costs

```
"costs": {
	"funds": 100,
	"warpedwood": 30,
	"featherstone": 20
},

```

Resources that will be consumed to build a single instance of this object. It's a set of Items and amounts.

### Category

```
"category": "infrastructure",

```

The category of this building in the build menu. You can see all the categories in the `ConstructionBase.json` file.

### Maximum Amount

```
"max-amount": 3

```

Max amount can be used to make this building of limited availability. An example from the vanilla game is the Materializer, which you can only build 3 of. You can increase this size in-game through Modifiers that can be gained through research, infrastructure upgrades, buildings, and other means.

Default value is -1, which means there is no limit.

### Requires Unlock

```
requires-unlock: true

```

Whether or not you need to unlock this construction blueprint (through Research or some other method) before you can build it.

To unlock a construction blueprint, use an unlock Modifier with the "ConstructionType" entry.

### Other Parameters

There are a few more parameters that are only used in special cases. These are all optional and have default values.

```
show-gamepedia: true
show-new: true
show-research-unlock: true
missions-on-unlock: {
  tesla-production: true
}

```

**show-gamepedia / show-new / show-research-unlock** - default true. When set to false, this production recipe won't appear in some places. If show-gamepedia is false, the recipe will not appear in the Dream Archives at all. If show-new is false, the item will appear in the Dream Archives, but will not be marked as "New". Useful for starting recipes so the player is not overwhelmed with tens of recipes that are marked New when the game starts. If show-research-unlock is set to false, this recipe won't appear in the list of unlocks under the research that unlocks it. When unlocking a new harvester, for example, it may be enough to show the unlocked building and there is no need to show the recipe that is unlocked with it.

**missions-on-unlock** - You can use this to configure tutorials that will be shown when this production recipe is unlocked for the first time. See Modding - Tutorials for more information.

### Type Components

Additional behavior for construction blueprints, especially limitations on where they can be built, are configured by adding Type Components to the blueprint configuration. Below is a list of the different components that are supported for building blueprints.

See Modding - Instance and Type Components for information on adding components to entities.

## Available Components

Construction blueprints only have Type Components, there are no instances of these blueprints in the game (the instance created after building is a Map Object, not a construction blueprint). Here is a list of the available components:

### ConstructionComponentBuildMode

Used for constructions that are built in special manner, such as road tiles and city area expansions. It's unlikely you'll want to use any of those, but there is one build mode that can be useful - MultiTileBuildInputBase - which lets players drag & drop to build many instances at once (for example - walls). Note - multi tile building only supports 1x1 objects.

```
"multi-tile-build": {
	"typecomponents": {
		"buildmode": {
			"class": "ConstructionComponentBuildMode",
			"buildmode": "MultiTileBuildInputBase"
		}
	}
},

```

The example above is a base type for constructions that are built with multi tile build support. The "buildmode" parameter is required and determines the input mode used to build this object. There is no default value, you can simply remove the build mode component entirely for the normal build input mode.

### ConstructionComponentBuildOnObject

```
"cityobject": {
	"parents": [
		"constructions.base.default"
	],
	"typecomponents": {
		"incity": {
			"class": "ConstructionComponentBuildOnObject",
			"object": "citytile"
		}
	}
},

```

Add this component if this building can only be built on top of another object. Examples are buildings that can only be built inside the city (they need to be built on top of a city tile object), and harvesters that need to be built on resource nodes. The "object" parameter determines the object that this needs to be built on.

If you want your construction to require more than one object, simply add another component for each additional object.

### ConstructionComponentPowerRequired

Add this component to blueprints that can only be placed within the power distribution area. Most city buildings should have this component. There are no parameters for this component.

### ConstructionComponentBlocked

```
"flyengine": {
	"parents": [
		"constructions.base.citypowered"
	],
	"typecomponents": {
		"block-engine": {
			"class": "ConstructionComponentBlocked",
			"tag": "block-engine"
		}
	}
},

```

This component tells the system which other objects will block this construction, so it can't be built on or near them. The only parameter is the blocking tags - objects with these block tags will block this construction.

To define which blocking tags each building creates, and the range in which it creates these blockers (for example, floating devices block other floating devices in a large radius around them, not just on the tiles they are built on) - see the MapObjTypeComponentBlockAround component in the Modding - Buildings page.