Action0/Cargos

From GRFSpecs
< Action0
Revision as of 15:12, 6 December 2009 by Frosch (talk | contribs)
Jump to navigationJump to search

Action 0 properties for cargo types

Action 0 - Properties for cargo types

Defining properties of cargo types

{maketoc}

The NewCargos switch of TTDPatch allows modifying the existing 12 cargos per climate, and allows adding 20 new cargos per climate as well. These cargo slots are numbered from 0 to 31, where slots 0-11 are used by default TTD cargos and slots 12-31 contain uninitialized garbage by default (so you can't trust them having meaningful information, you must set all of their properties).

-=Properties=-

||Number|Size|Description

08|B|Bit number for bitmasks

09|W|TextID for the cargo type name

0A|W|TextID for the name of one unit from the cargo type

0B|W|TextID to be displayed for 1 unit of cargo

0C|W|TextID to be displayed for multiple units of cargo

0D|W|TextID for cargo type abbreviation

0E|W|Sprite number for the icon of the cargo

0F|B|Weight of one unit of the cargo

10,11|B|Penalty times

12|D|Base price

13|B|Color for the station list window

14|B|Color for the cargo payment list window

15|B|Freight status (for FreightTrains switch); 0=not freight, 1=is freight

16|W|Cargo classes

17|D|Cargo label

18|B|Substitute type for town growth

19|W|Multiplier for town growth

1A|B|Callback flags||

-=Comments=-

Bit number for bitmasks (08)

This value must be used in Action3 and in cargo bit mask properties such as refit masks. Values 1C-1F should be safe to use (if they aren't already taken, of course) if you intend to maintain compatibility with GRFs unaware of the newcargos switch. Further assuming that no active GRFs support the toyland climate, you can use values 11-1A as well.

Additionally, you can use the value FFh to disable the given cargo slot. This way, it won't appear in cargo type lists, but it won't be removed from things already on the map. If you disable a cargo, you'll probably want to zero out the cargo label (property 17) as well.

TextID for the cargo type name (09)

This textID should refer to the name of the cargo, capitalized, to match the TTD style (e.g. "Passengers", "Coal", "Gold Ore", "Milk")

You can reuse existing TextIDs or create custom strings using Action4 with an offset in the DCxx range. Note that you need to set language-id bit 7 as well in the Action4 for a custom string. (Also applies to properties 0A to 0D)

TextID for one unit of the type (0A)

This textID should refer to the cargo type name in the singular. Currently, this ID is used only in subsidy messages ("First Passenger service..." instead of "First Passengers service...", for example)

TextID for 1 unit of cargo (0B)

This textID will be used to display the amount of the cargo if there's exactly 1 unit waiting. Although there's only one unit waiting, you'll still have to use either the special character 7C (print signed word) or 87 (print amount in litres and add suffix " litres") so TTD removes the amount from its internal reference stack. For example, if you have a new cargo named "gold ore", this should be "\7C ton of gold ore", which will expand to "1 ton of gold ore". On the other hand, a liquid cargo named "milk" should be something like "\87 of milk", which will expand to either "100 litres of milk" or "1,000 litres of milk" (The multiplier for liquid cargos depends on miscmods.dontfixlitres. If it's on, the multiplier is 100, otherwise it's 1000)

TextID for multiple units of cargo (0C)

This textID will be used to display the amount of cargo if the amount waiting isn't exactly 1. You'll need the same special characters as above, but now they will be expanded according to the actual cargo waiting. Sticking to the example above, you'll need "\7C tons of gold ore" and "\87 of milk", which can expand to "42 tons of gold ore" and "42,000 litres of milk", accordingly. You will note that liquid cargos can have the same textID for both property 0B and 0C since they always use the plural form.

TextID for cargo type abbreviation (0D)

This textID will be used in the station list window to represent the cargo waiting. It should be a two-letter abbreviation prefixed by the special character 0E to switch to the microscopic font. The microscopic font has every letter capitalized, so capitalization isn't important here. Continuing the above example, gold ore could have this as "GO" and milk as "MK" ("ML" is already taken by mail).

Sprite number for icon (0E)

This is a sprite number of an old TTD sprite to be displayed in the station window for this cargo, or FFFFh if the icon should be found by following the action 3 associated with this cargo. The icon must not be bigger than 10x10 pixels. One icon will be shown for every 10 units of the cargo waiting, up to 23 icons, which is the maximum.

Weight of one unit of the cargo (0F)

This property defines the weight of 1 unit from the cargo, which will be used to calculate the weight of the vehicles when loaded. The unit is 1/16 ton (which is 62.5 kg). With the examples above, gold ore should have this as 16 (since 1 ton of gold ore should weigh exactly 1 ton), while milk should have this slightly above 16 (milk is denser than water).

Penalty times and price factor (10,11,12)

These three values define how much is paid for the delivery of the cargo type. The price factor is subject to inflation, but GRFs needn't care about this, TTDPatch will adjust the price for them.

The income generated from cargo delivery is calculated as:

income=train prop. 28/29 for a description of the utility of this property.

This is a bit mask of all cargo classes to which this cargo belongs, out of the following:

||Bit|Value|Cargo class

0|1|Passengers

1|2|Mail

2|4|Express cargo (any prioritised cargo)

3|8|Armored cargo (needing security measures, e.g. valuables or gold)

4|10|Bulk freight (any non-packaged cargo suitable for pouring, e.g. coal, grain, ore, cement, ...)

5|20|Piece goods (any unitised cargo, packed or unpacked)

6|40|Liquids (any liquid or gaseous cargo, food or chemical)

7|80|Refrigerated cargo (any goods needing temperature-controlling, e.g. perishable goods, food, or chemicals needing cooling/heating)

8|100|Hazardous cargo (explosives, acids, radioactive material, ...)

9|200|covered/sheltered freight (any cargo needing moisture protection, i.e. transportation in box vans, silo wagons or containers required)

10|400|Oversized and/or overweight cargo (any cargo needing special means of transportation, e.g. industrial equipment, machinery, large format glass, ... )

15|8000|Special (used for livery refit tricks rather than actual cargos)||

Only cargos which are in class 0 (passengers) will appear in bus stations.  Only cargos which are not in class 0 will appear in truck stations.

Cargo label (17)

Cargo labels are globally unique identifiers for a cargo type. They are used to allow vehicle grfs to easily support many cargo types, whether they are active or not and no matter what slot or bit they are using.

Read about the cargo translation table for further info.

The following properties exist for TTDPatch 2.0.1 alpha 72 and above only

Substitute type and multiplier for town growth (18, 19)

These properties allow you to modify how a cargo type affects town growth. Property 18 can contain one of the following values:

||Value|Meaning|Details (*)

00|Affect towns as passengers do|Cargo produced by houses is added to the statistics in the town GUI.

02|Affect towns as mail does|Cargo produced by houses is added to the statistics in the town GUI.

05|Affect towns as goods/candy does|See note about subsidies below.

09|Affect towns as water does|Second required cargo for towngrowth in the desert

0B|Affect towns as food/fizzy drinks do|First required cargo for towngrowth in desert/above snowline. Alse see note about subsidies below.

FF|Don't affect town growth (default)| ||

<nowiki>(*)</nowiki> This is the interpretation of OpenTTD. TTDPatch might only share parts of it.

The incoming cargo amount is multiplied by property 19, then divided by 256 before it is added to the town statistics. This allows you to have smaller or bigger impact than original cargoes do. Please note that cargoes accepted by industries affect the closest town as well; for example, if you have an industry that accepts passengers, every passenger brought to the industry affects the town just like if they were transported to the town directly. Usually, it's not a good idea to have industries that process such cargoes; they should be accepted by towns only.

Note: In OpenTTD property 18 also affects the creation of subsidies. Usually subsidies apply to cargo transportation between two industries. For cargos with substitution-type 05 or 0B the destination will be a town instead. Independent of property 18 subsidies from town to town are only created for cargo slot 0 (Passengers).

Callback flags (1A)

||Bit|Value|Var. 0C|Callback

0|1|39|Custom profit calculation

1|2|145|Custom station rating calculation||