User Tools

Site Tools

Urban Games

modding:constructiontypes

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
modding:constructiontypes [2020/06/15 15:57]
yoshi [Terminal Groups]
modding:constructiontypes [2022/01/09 13:43]
yoshi [Terminal Groups]
Line 28: Line 28:
 ===== 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''.
Line 69: Line 69:
   },   },
   ...   ...
-},+}
 </code>   </code>  
      
Line 149: Line 149:
 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.
Line 155: Line 155:
 ==== 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.
Line 170: Line 170:
   * ''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 ====
Line 212: Line 212:
 <code lua> <code lua>
 result.stocks = { } result.stocks = { }
-result.rule = { input = { { } }, output = { COAL = 1 }, capacity = 200 }+result.rule = { input = { { } }, output = { COAL = 1 }, capacity = 200 }
 </code> </code>
  
Line 239: Line 239:
   autoRemovable = false,   autoRemovable = false,
   categories = { "misc" },   categories = { "misc" },
 +  snapping = { 
 +    rail = true, 
 +    road = true, 
 +    water = false 
 +  },
   ...   ...
 </code> </code>
Line 250: Line 255:
 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.
Line 300: Line 305:
  
 ==== 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''
Line 312: Line 317:
 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:
Line 324: Line 329:
 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",      
Line 333: Line 338:
 ... ...
 }, },
-rule = {    +result.rule = {    
   capacity = 1,       capacity = 1,    
   consumptionFactor = 1.2,       consumptionFactor = 1.2,    
Line 346: Line 351:
 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
Line 353: Line 358:
  
 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 =====+===== 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.
Line 364: Line 369:
  
 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 ====
Line 409: Line 421:
 \\ \\
  
-<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>
modding/constructiontypes.txt · Last modified: 2023/02/04 14:32 by yoshi