Both sides previous revision
Previous revision
Next revision
|
Previous revision
|
modding:constructiontypes [2020/06/15 15:57] yoshi [Terminal Groups] |
modding:constructiontypes [2023/02/04 14:32] yoshi [UpdateFn Return Properties] |
===== Stations ===== | ===== Stations ===== |
Stations are the constructions where people and cargo items can board and leave vehicles. Like the [[modding:resourcetypes:mdl#transport_network_provider|transport network provider]] in single meshes, constructions can have streets and tracks too. Therefore there are three blocks in the result: | Stations are the constructions where people and cargo items can board and leave vehicles. Like the [[modding:resourcetypes:mdl#transport_network_provider|transport network provider]] in single meshes, constructions can have streets and tracks too. Therefore there are three blocks in the result: |
* ''result.edgeLists'' as described in the [[modding:constructions#edge_lists|construction basics]]. | * ''result.edgeLists'' as described in the [[modding:constructionbasics#edge_lists|construction basics]]. |
* ''result.runways'' that are similar to the ones in the transport network provider but on edges from the ''edgeLists'' instead of the model lanes. | * ''result.runways'' that are similar to the ones in the transport network provider but on edges from the ''edgeLists'' instead of the model lanes. |
* ''result.terminalGroups'' that combines terminals from one or more models with the vehicle edges from the ''edgeLists''. | * ''result.terminalGroups'' that combines terminals from one or more models with the vehicle edges from the ''edgeLists''. |
}, | }, |
... | ... |
}, | } |
</code> | </code> |
| |
* ''inNodes'' is a list of nodes from the [[:modding:resourcetypes:mdl#transport_network_provider|transportNetworkProvider]] that are used as entry points for vehicles that enter the depot. | * ''inNodes'' is a list of nodes from the [[:modding:resourcetypes:mdl#transport_network_provider|transportNetworkProvider]] that are used as entry points for vehicles that enter the depot. |
* ''outNodes'' is a list of nodes from the [[:modding:resourcetypes:mdl#transport_network_provider|transportNetworkProvider]] that are used as exit points for vehicles that leave the depot. | * ''outNodes'' is a list of nodes from the [[:modding:resourcetypes:mdl#transport_network_provider|transportNetworkProvider]] that are used as exit points for vehicles that leave the depot. |
| ==== Events ==== |
| Depots support some [[modding:resourcetypes:mdl#animations|animation events]]: |
| * ''open'' animation is used to open the main doors. |
| * ''close'' animation is used to close the main doors. |
===== Industries ===== | ===== Industries ===== |
Industries are used for cargo production, conversion and consumption. Their ''.con'' files can be found in ''res/construction/industry/''. They have some special properties as well as some specifics regarding the ''updateFn''. | Industries are used for cargo production, conversion and consumption. Their ''.con'' files can be found in ''res/construction/industry/''. They have some special properties as well as some specifics regarding the ''updateFn''. |
The other block, ''placementParams'' is used for the automated distribution of industries over the map. The properties are used to contrain the distribution on dependance of previously built industries. There are: | The other block, ''placementParams'' is used for the automated distribution of industries over the map. The properties are used to contrain the distribution on dependance of previously built industries. There are: |
* ''buildOrder'' is the order in which the industries are generated. Usually industries without inputs have low values and are built first. | * ''buildOrder'' is the order in which the industries are generated. Usually industries without inputs have low values and are built first. |
* ''initWeight'' is the start weight of the industry distribution. With larger values, the industry is not very sensible to the other distance weights below. | * ''initWeight'' is used to define the quantity ratio relative to the other industries. |
* ''tags'' is a list of string keys that are assigned to this industry. | * ''tags'' is a list of string keys that are assigned to this industry. |
* ''distanceWeights'' is a list of tag keys with assigned weights. If another industry has a tag with negative assigned weight, it is unlikely that the current industry is placed near it. With positive weights, it's more likely that they pull the new industry near them. | * ''distanceWeights'' is a list of tag keys with assigned weights. If another industry has a tag with negative assigned weight, it is unlikely that the current industry is placed near it. With positive weights, it's more likely that they pull the new industry near them. |
==== UpdateFn Parameters ==== | ==== UpdateFn Parameters ==== |
The available parameters for industries are: | The available parameters for industries are: |
* ''paramX'' and ''paramY'' are from the keyboard controls. See the [[modding:constructions#models|basics]] to find out more about them. | * ''paramX'' and ''paramY'' are from the keyboard controls. See the [[modding:constructionbasics#models|basics]] to find out more about them. |
* ''seed'' is a number that can be used for randomization purposes. It increases whenever a construction is set. | * ''seed'' is a number that can be used for randomization purposes. It increases whenever a construction is set. |
* ''state'' is a data struct containing several cached informations about assets and tracks. | * ''state'' is a data struct containing several cached informations about assets and tracks. |
* ''industrialCapacity'' might be a capacity for jobs of residents. | * ''industrialCapacity'' might be a capacity for jobs of residents. |
| |
It is recommended to support these additional parameters to allow mission or game scripts to adjust the production and consumption of industries. The ''industryutil.lua'' in ''res/scripts/'' contains a possible implementation in the ''addIndutryData'' function. | It is recommended to support these additional parameters to allow mission or game scripts to adjust the production and consumption of industries. The ''industryutil.lua'' in ''res/scripts/'' contains a possible implementation in the ''addIndustryData'' function. |
| |
==== UpdateFn Return Properties ==== | ==== UpdateFn Return Properties ==== |
-- Specify the necessary cargo types and which edges are used for stock piling | -- Specify the necessary cargo types and which edges are used for stock piling |
result.stocks = { | result.stocks = { |
{ cargoType = "PLANKS", edges = { { 0, 0 }, moreCapacity = 100 }, | { cargoType = "PLANKS", edges = { { 0, 0 } }, moreCapacity = 100 }, |
{ cargoType = "STEEL", edges = { { 1, 0 } }, | { cargoType = "STEEL", edges = { { 1, 0 } }, |
}, | }, |
<code lua> | <code lua> |
result.stocks = { } | result.stocks = { } |
result.rule = { input = { { 0 } }, output = { COAL = 1 }, capacity = 200 } | result.rule = { input = { { } }, output = { COAL = 1 }, capacity = 200 } |
</code> | </code> |
| |
result.rule = { input = { { 2, 2 } }, output = { STEEL = 1 }, capacity = 200 } | result.rule = { input = { { 2, 2 } }, output = { STEEL = 1 }, capacity = 200 } |
</code> | </code> |
| ==== Events ==== |
| Industries support some [[modding:resourcetypes:mdl#animations|animation events]]: |
| * ''forever'' animation is used for roof ventilators or other elements that should animate permanently. It is looped forever and has no fixed length. |
| * ''producing'' animation is triggered if a industry is producing. |
===== Assets ===== | ===== Assets ===== |
Assets are generic constructions that are mainly used for decorative purposes. They may contain functional elements like edges though. | Assets are generic constructions that are mainly used for decorative purposes. They may contain functional elements like edges though. |
autoRemovable = false, | autoRemovable = false, |
categories = { "misc" }, | categories = { "misc" }, |
| snapping = { |
| rail = true, |
| road = true, |
| water = false |
| }, |
... | ... |
</code> | </code> |
To provide additional filter possibilities, it is possible to assign an asset construction to one or more categories. The string keys are added to the ''categories'' list. | To provide additional filter possibilities, it is possible to assign an asset construction to one or more categories. The string keys are added to the ''categories'' list. |
| |
| To allow snapping along tracks, streets or the water surface, the appropriate flags can be set to true in the ''snapping'' property. |
==== UpdateFn Parameters ==== | ==== UpdateFn Parameters ==== |
The available parameters for assets are: | The available parameters for assets are: |
* ''paramX'' and ''paramY'' are from the keyboard controls. See the [[modding:constructions#models|basics]] to find out more about them. | * ''paramX'' and ''paramY'' are from the keyboard controls. See the [[modding:constructionbasics#models|basics]] to find out more about them. |
* ''seed'' is a number that can be used for randomization purposes. It increases whenever a construction is set. | * ''seed'' is a number that can be used for randomization purposes. It increases whenever a construction is set. |
* ''state'' is a data struct containing several cached informations about assets and tracks. | * ''state'' is a data struct containing several cached informations about assets and tracks. |
| |
==== UpdateFn Return Properties ==== | ==== UpdateFn Return Properties ==== |
The returned data struct of town buildings should have the following properties that are described in the [[:modding:constructions|construction basics]]: | The returned data struct of town buildings should have the following properties that are described in the [[modding:constructionbasics|construction basics]]: |
* ''bulldozeCost'' | * ''bulldozeCost'' |
* ''cost'' | * ''cost'' |
The ''personCapacity'' block defines the number of residents that can be covered by this building in the specific type of building: | The ''personCapacity'' block defines the number of residents that can be covered by this building in the specific type of building: |
<code lua> | <code lua> |
personCapacity = { | result.personCapacity = { |
capacity = 2, | capacity = 2, |
type = "INDUSTRIAL" | type = "INDUSTRIAL" |
}, | }, |
</code> | </code> |
It contains two properties: | It contains two properties: |
Buildings may request cargo items. Therefore they have ''stocks'' and ''rule'' blocks too: | Buildings may request cargo items. Therefore they have ''stocks'' and ''rule'' blocks too: |
<code lua> | <code lua> |
stocks = { | result.stocks = { |
{ | { |
cargoType = "MACHINES", | cargoType = "MACHINES", |
... | ... |
}, | }, |
rule = { | result.rule = { |
capacity = 1, | capacity = 1, |
consumptionFactor = 1.2, | consumptionFactor = 1.2, |
The scaffolding is shown while the building is constructed. To define its outline, there is a ''scaffold'' property: | The scaffolding is shown while the building is constructed. To define its outline, there is a ''scaffold'' property: |
<code lua> | <code lua> |
scaffold = { | result.scaffold = { |
buildingFace = { { { 7.68415, 4.89475, 0 }, { 7.67744, 15.68718, 0 }, { 0.80814, 15.69474, 0 }, ... } }, | buildingFace = { { { 7.68415, 4.89475, 0 }, { 7.67744, 15.68718, 0 }, { 0.80814, 15.69474, 0 }, ... } }, |
height = -1 | height = -1 |
| |
The ''buildingFace'' is the bottom polygon around the house. The scaffolding is placed along the edges of this polygon with a slight offset so that it does not collide with the walls. The x and y coordinates are relative to the construction origin, z coordinates are ignored and automatically calculated depending on the terrain. The ''height'' value is used to offset the top height of the scaffolding below the roof. | The ''buildingFace'' is the bottom polygon around the house. The scaffolding is placed along the edges of this polygon with a slight offset so that it does not collide with the walls. The x and y coordinates are relative to the construction origin, z coordinates are ignored and automatically calculated depending on the terrain. The ''height'' value is used to offset the top height of the scaffolding below the roof. |
===== Street Constructions ===== | |
| ==== Events ==== |
| Town buildings support some [[modding:resourcetypes:mdl#animations|animation events]]: |
| * ''forever'' animation is used for roof ventilators or other elements that should animate permanently. It is looped forever and has no fixed length. |
| ===== Street Constructions / Track Constructions ===== |
Street constructions can be used to provide street templates like larger intersections or roundabouts. To provide additional filter possibilities, it is possible to assign an asset construction to one or more categories. The string keys are added to the ''categories'' list property. | Street constructions can be used to provide street templates like larger intersections or roundabouts. To provide additional filter possibilities, it is possible to assign an asset construction to one or more categories. The string keys are added to the ''categories'' list property. |
| |
Their ''upgradeFn'' has only a small set of parameters: | Their ''upgradeFn'' has only a small set of parameters: |
* ''paramX'' and ''paramY'' are from the keyboard controls. See the [[modding:constructions#models|basics]] to find out more about them. | * ''paramX'' and ''paramY'' are from the keyboard controls. See the [[modding:constructionbasics#models|basics]] to find out more about them. |
* ''seed'' is a number that can be used for randomization purposes. It increases whenever a construction is set. | * ''seed'' is a number that can be used for randomization purposes. It increases whenever a construction is set. |
* ''state'' is a data struct containing several cached informations about assets and tracks. | * ''state'' is a data struct containing several cached informations about assets and tracks. |
| |
The constructions may either use models or not. See below for information about pure street and track construction templates. | The constructions may either use models or not. See below for information about pure street and track construction templates. |
| |
| Track constructions work similar but for railway. They appear in the track construction tab in the rail menu. Without mods, this tab is not visible. |
| |
| <div download 100%> |
| A track construction example is available for {{:modding:templates:urban_games_demo_track_construction_1.zip|download}}. |
| </div> |
| |
| |
==== Build free streets and tracks ==== | ==== Build free streets and tracks ==== |
\\ | \\ |
| |
<div page_prev>[[:modding:constructions|Construction Basics]]</div> | <div page_prev>[[modding:constructionbasics|Construction Basics]]</div> |
<div page_next>[[modding:modularconstructions|Modular Constructions]]</div> | <div page_next>[[modding:modularconstructions|Modular Constructions]]</div> |