Difference between revisions of "Documentation/Engine/Units/trailer def"

From SCS Modding Wiki
Jump to navigation Jump to search
(Attributes: Corrected mass ratio attribute)
(One intermediate revision by the same user not shown)
Line 11: Line 11:
 
|string
 
|string
 
|
 
|
|The unit name of the '''trailer''' unit to be enabled for the cargo. This attribute can safely refer to units which aren't present. (Only for legacy usage when defined in /def/cargo/<cargo_name>/)
+
|The unit name of the '''trailer''' unit to be enabled for the cargo. This attribute can safely refer to units which aren't present.
 
|-
 
|-
|gross_trailer_weight_limit
+
|mass
 
|float
 
|float
 
|
 
|
|The maximum technical or logical combined weight of the trailer and its cargo (take into account bridge formula, and other similar rules).
+
|The total mass of the cargo for this trailer configuration in kilograms (kg).
 
|-
 
|-
|chassis_mass
+
|volume_factor
 
|float
 
|float
|
+
|1.0
|The mass of the trailer chassis in kg.
+
|The amount of cargo relative to what the cargo definition is nominally based on. This allows the game economy to scale the pay per distance for trailers of different sizes hauling the same cargo. ''Added in 1.28.''
|-
+
{{Note|For example, if the cargo definition is nominally based on a 53ft trailer, the volume_factor for a 40ft trailer might be approximately 0.75 (40÷53).}}
|body_mass
 
|float
 
|
 
|The mass of the trailer body in kg.
 
 
|-
 
|-
 
|length
 
|length
|float
+
|uint
 
|0
 
|0
|The length of the trailer combination in meters. When generating a job this is compared against the '''allowed_trailer_length''' of the source and destination depot [[Documentation/Engine/Units/prefab_data|prefabs]] to determine whether this trailer_def is suitable for the job.
+
|The approximate length of the trailer combination in meters. When generating a job this is compared against the '''allowed_trailer_length''' of the source and destination depot [[Documentation/Engine/Units/prefab_data|prefabs]] to determine whether this trailer_def is suitable for the job. The valid range is [0, 255]. If set to 0, no restrictions are applied. ''Added in 1.28.''
 
|-
 
|-
|axles
+
|country
|uint
 
|
 
|The number of axles in the trailer combination, which is checked against country_data→mass_limit_per_axle_count to determine the allowable gross weight.
 
|-
 
|volume
 
|float
 
|
 
|The interior volume of the trailer body in m<sup>3</sup>.
 
|-
 
|body_type
 
|token
 
|
 
|Sets the body type of the trailer configuration, which determines which cargoes are allowed to be carried.
 
|-
 
|chain_type
 
|token
 
|
 
|Sets the trailer chain type of the trailer configuration.
 
|-
 
|country_validity
 
 
|array&lt;token&gt;
 
|array&lt;token&gt;
 
|
 
|
|Each member is a <!--[[Documentation/Engine/Units/country_data|country]]-->country (or a state in ATS) where this trailer_def will be suitable for generated jobs. Both the origin and destination of a job must be in the ''country'' array for the trailer_def to be suitable for it. If unset, then the trailer_def is suitable in all countries.
+
|Each member is a <!--[[Documentation/Engine/Units/country_data|country]]-->country (or a state in ATS) where this trailer_def will be suitable for generated jobs. Both the origin and destination of a job must be in the ''country'' array for the trailer_def to be suitable for it. If unset, then the trailer_def is suitable in all countries. ''Added in 1.28.''
  
 
For example, the following would be limited to only Nevada and Arizona:
 
For example, the following would be limited to only Nevada and Arizona:
<pre>country[]: arizona
+
<pre>country[]: az
country[]: nevada</pre>
+
country[]: nv</pre>
 +
|-
 +
|cog_offset
 +
|array&lt;float3&gt;
 +
|
 +
|Each member defines the offset of the cargo center of gravity from the calculated value for each trailer in the trailer configuration, starting with the ''master'' trailer and iterating through the ''slave'' trailers. (X, Y, Z) corresponds to lateral, vertical, and longitudinal offsets respectively.
 
|-
 
|-
|'''mass_ratio'''
+
|cargo_mass_ratio
 
|array&lt;float&gt;
 
|array&lt;float&gt;
|
+
|<pre>cargo_mass_ratio:&nbsp;1
 +
cargo_mass_ratio[0]:&nbsp;1</pre>
 
|Each member defines how much of the cargo mass and forces are borne by each trailer in the trailer configuration, starting with the ''master'' trailer and iterating through the ''slave'' trailers. These must add up to 1.
 
|Each member defines how much of the cargo mass and forces are borne by each trailer in the trailer configuration, starting with the ''master'' trailer and iterating through the ''slave'' trailers. These must add up to 1.
 
|}
 
|}

Revision as of 16:47, 21 January 2018

The trailer_def unit class acts as an intermediary between cargo_data and trailer units. Units of this type are usually defined in /def/cargo/<cargo_name>/<trailer_name>.sii, corresponding to def/cargo/<cargo_name>.sii. They define which trailer configuration to enable for the cargo, the cargo's mass for that trailer configuration, how that mass is distributed/placed on the trailer and its slave units, and where the configuration is permitted.

Attributes

Name Type Default Value Description
trailer string The unit name of the trailer unit to be enabled for the cargo. This attribute can safely refer to units which aren't present.
mass float The total mass of the cargo for this trailer configuration in kilograms (kg).
volume_factor float 1.0 The amount of cargo relative to what the cargo definition is nominally based on. This allows the game economy to scale the pay per distance for trailers of different sizes hauling the same cargo. Added in 1.28.

Note: For example, if the cargo definition is nominally based on a 53ft trailer, the volume_factor for a 40ft trailer might be approximately 0.75 (40÷53).

length uint 0 The approximate length of the trailer combination in meters. When generating a job this is compared against the allowed_trailer_length of the source and destination depot prefabs to determine whether this trailer_def is suitable for the job. The valid range is [0, 255]. If set to 0, no restrictions are applied. Added in 1.28.
country array<token> Each member is a country (or a state in ATS) where this trailer_def will be suitable for generated jobs. Both the origin and destination of a job must be in the country array for the trailer_def to be suitable for it. If unset, then the trailer_def is suitable in all countries. Added in 1.28.

For example, the following would be limited to only Nevada and Arizona:

country[]: az
country[]: nv
cog_offset array<float3> Each member defines the offset of the cargo center of gravity from the calculated value for each trailer in the trailer configuration, starting with the master trailer and iterating through the slave trailers. (X, Y, Z) corresponds to lateral, vertical, and longitudinal offsets respectively.
cargo_mass_ratio array<float>
cargo_mass_ratio: 1
cargo_mass_ratio[0]: 1
Each member defines how much of the cargo mass and forces are borne by each trailer in the trailer configuration, starting with the master trailer and iterating through the slave trailers. These must add up to 1.

World of Trucks Compatibility

World of Trucks jobs will make use of mod trailers if the following conditions are satisfied:

  • The mass is equal to, or greater than the job's cargo mass.
  • The length is compatible with the source and destination prefabs.
  • The configuration is valid for the source and destination country.
  • The trailer count is equal to the trailer count of the job (i.e. A multipivot trailer configuration won't be selected for a single-trailer job).

Related Units