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
modding:constructiontypes [2020/08/01 12:12]
yoshi [UpdateFn Return Properties]
modding:constructiontypes [2023/02/04 14:32] (current)
yoshi [UpdateFn Return Properties]
Line 69: Line 69:
   },   },
   ...   ...
-},+}
 </code>   </code>  
      
Line 118: Line 118:
   * ''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''.
Line 170: Line 174:
   * ''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 189: Line 193:
 -- 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 } },
 }, },
Line 224: Line 228:
 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.
Line 239: Line 247:
   autoRemovable = false,   autoRemovable = false,
   categories = { "misc" },   categories = { "misc" },
 +  snapping = { 
 +    rail = true, 
 +    road = true, 
 +    water = false 
 +  },
   ...   ...
 </code> </code>
Line 250: Line 263:
 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:
Line 312: Line 325:
 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 337:
 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 346:
 ... ...
 }, },
-rule = {    +result.rule = {    
   capacity = 1,       capacity = 1,    
   consumptionFactor = 1.2,       consumptionFactor = 1.2,    
Line 346: Line 359:
 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 366:
  
 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. 
  
Line 364: Line 381:
  
 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 ====
modding/constructiontypes.1596276727.txt.gz · Last modified: 2020/08/01 12:12 by yoshi