Difference between revisions of "Action0/Industries"
m (13 revisions) |
(Fix style and format) |
||
Line 1: | Line 1: | ||
+ | ==Introduction== |
||
− | |||
− | '''''Action 0 properties for industries''''' |
||
− | |||
− | =Action 0 - Properties for industries= |
||
− | |||
− | Defining properties of industries |
||
− | |||
− | {maketoc} |
||
Industries work similarly to town buildings as well, except that the maximum number of possible industries is 37 in TTDPatch and 64 in OpenTTD. The non-overridden original types count towards this limit. Industries don't have a climate mask; you should simply not define an industry if it would be for the wrong climate. |
Industries work similarly to town buildings as well, except that the maximum number of possible industries is 37 in TTDPatch and 64 in OpenTTD. The non-overridden original types count towards this limit. Industries don't have a climate mask; you should simply not define an industry if it would be for the wrong climate. |
||
Line 12: | Line 5: | ||
Defining industries follows the same schema as houses do: to start using an ID, you first need to define it by setting property 8 for it. If you try to reference an ID (either via action0 or via action3) that isn't defined, your request is ignored, but not reported as an error, either. This means that if you want to conditionally define an ID, all you need to do is skipping the action0 that sets property8, and everything else gets skipped automatically. |
Defining industries follows the same schema as houses do: to start using an ID, you first need to define it by setting property 8 for it. If you try to reference an ID (either via action0 or via action3) that isn't defined, your request is ignored, but not reported as an error, either. This means that if you want to conditionally define an ID, all you need to do is skipping the action0 that sets property8, and everything else gets skipped automatically. |
||
− | + | ==Properties== |
|
+ | {| |- |
||
− | |||
− | + | !Property !!Version !![[GRFActionsDetailed|Size]] !! Description |
|
+ | |- |
||
− | |||
− | 08|(a)|B|Substitute industry type |
+ | |08||(a)||B||Substitute industry type |
+ | |- |
||
− | |||
− | 09|(a)|B|Industry type override |
+ | |09||(a)||B||Industry type override |
+ | |- |
||
− | |||
− | 0A|(a)|V|Set industry layout(s) |
+ | |0A||(a)||V||Set industry layout(s) |
+ | |- |
||
− | |||
− | 0B|(a)|B|Industry production flags |
+ | |0B||(a)||B||Industry production flags |
+ | |- |
||
− | |||
− | 0C|(a)|W|Industry closure message |
+ | |0C||(a)||W||Industry closure message |
+ | |- |
||
− | |||
− | 0D|(a)|W|Production increase message |
+ | |0D||(a)||W||Production increase message |
+ | |- |
||
− | |||
− | 0E|(a)|W|Production decrease message |
+ | |0E||(a)||W||Production decrease message |
+ | |- |
||
− | |||
− | 0F|(a)|B|Fund cost multiplier |
+ | |0F||(a)||B||Fund cost multiplier |
+ | |- |
||
− | |||
− | 10|(a)|W|Production cargo types |
+ | |10||(a)||W||Production cargo types |
+ | |- |
||
− | |||
− | 11|(a)|D|Acceptance cargo types |
+ | |11||(a)||D||Acceptance cargo types |
+ | |- |
||
− | |||
− | 12,13|(a)|B|Production multipliers |
+ | |12,13||(a)||B||Production multipliers |
+ | |- |
||
− | |||
− | 14|(a)|B|Minimal amount of cargo distributed |
+ | |14||(a)||B||Minimal amount of cargo distributed |
+ | |- |
||
− | |||
− | 15|(a)|V|Random sound effects |
+ | |15||(a)||V||Random sound effects |
+ | |- |
||
− | |||
− | 16|(a)|3*B|Conflicting industry types |
+ | |16||(a)||3*B||Conflicting industry types |
+ | |- |
||
− | |||
− | 17|(a)|B|Probability in random game |
+ | |17||(a)||B||Probability in random game |
+ | |- |
||
− | |||
− | 18|(a)|B|Probability during gameplay |
+ | |18||(a)||B||Probability during gameplay |
+ | |- |
||
− | |||
− | 19|(a)|B|Map color |
+ | |19||(a)||B||Map color |
+ | |- |
||
− | |||
− | 1A|(a)|D|Special industry flags to define special behavior |
+ | |1A||(a)||D||Special industry flags to define special behavior |
+ | |- |
||
− | |||
− | 1B|(a)|W|New industry text ID |
+ | |1B||(a)||W||New industry text ID |
+ | |- |
||
− | |||
− | 1C,1D,1E|(a)|D|Input cargo multipliers for the three input cargo types |
+ | |1C,1D,1E||(a)||D||Input cargo multipliers for the three input cargo types |
+ | |- |
||
− | |||
− | 1F|(b)|W|Industry name |
+ | |1F||(b)||W||Industry name |
+ | |- |
||
− | |||
− | 20|(b)|D|Prospecting success chance |
+ | |20||(b)||D||Prospecting success chance |
+ | |- |
||
− | |||
− | 21,22|(b)|B|Callback flags |
+ | |21,22||(b)||B||Callback flags |
+ | |- |
||
− | |||
− | 23|(c)|D|Destruction cost multiplier |
+ | |23||(c)||D||Destruction cost multiplier |
+ | |- |
||
− | |||
− | 24|(d)|W|Default text for nearby station |
+ | |24||(d)||W||Default text for nearby station |
+ | |} |
||
(a) Available since TTDPatch 2.0.1 alpha 45 |
(a) Available since TTDPatch 2.0.1 alpha 45 |
||
Line 74: | Line 68: | ||
(d) Available since TTDPatch 2.6 alpha 0 r1782 |
(d) Available since TTDPatch 2.6 alpha 0 r1782 |
||
+ | ==Description== |
||
− | -=Comments=- |
||
− | ==Substitute industry type (08)== |
+ | ===Substitute industry type (08)=== |
Substitute industry type. The first assignment of this property copies all properties of the old type to this new type. Unlike for houses, the substitute type won't replace this new type if the definition becomes unavailable. List of valid types: [[IndustryTypes]] |
Substitute industry type. The first assignment of this property copies all properties of the old type to this new type. Unlike for houses, the substitute type won't replace this new type if the definition becomes unavailable. List of valid types: [[IndustryTypes]] |
||
Line 82: | Line 76: | ||
There's a special use of this property beginning from alpha 70: if you set it to FFh, you can disable an original industry. In this case, the ID used must be the number of industry you want to disable. Disable requests are ignored for industries not present on the current climate and industries already overridden. |
There's a special use of this property beginning from alpha 70: if you set it to FFh, you can disable an original industry. In this case, the ID used must be the number of industry you want to disable. Disable requests are ignored for industries not present on the current climate and industries already overridden. |
||
− | ==Industry type override (09)== |
+ | ===Industry type override (09)=== |
Industry type override. The overridden industry type won't be built in new random games. If the GRF file becomes active after the game was started, industries of the overridden new type won't be replaced by the new type. List of valid types: [[IndustryTypes]] |
Industry type override. The overridden industry type won't be built in new random games. If the GRF file becomes active after the game was started, industries of the overridden new type won't be replaced by the new type. List of valid types: [[IndustryTypes]] |
||
Line 92: | Line 86: | ||
Please note, however, that only one new industry can override an old type. If two new types want to override the same old type, the first one wins, and the second is added normally, ignoring its property 09. |
Please note, however, that only one new industry can override an old type. If two new types want to override the same old type, the first one wins, and the second is added normally, ignoring its property 09. |
||
− | ==Set industry layout(s) (0A)== |
+ | ===Set industry layout(s) (0A)=== |
Format of industry layout tables: |
Format of industry layout tables: |
||
+ | {| |- |
||
− | ||Size|Variable|Meaning |
||
+ | !Size!!Variable!!Meaning |
||
− | |||
+ | |- |
||
− | B|numlayouts|The total number of layouts following |
||
+ | |B||numlayouts||The total number of layouts following |
||
− | |||
+ | |- |
||
− | D|size|The size of the whole definition, excluding numlayouts and size |
||
+ | |D||size||The size of the whole definition, excluding numlayouts and size |
||
− | |||
+ | |- |
||
− | V|layouts|numlayout layouts, see format below|| |
||
+ | |V||layouts||numlayout layouts, see format below |
||
+ | |} |
||
Format of an industry layout: |
Format of an industry layout: |
||
Line 108: | Line 104: | ||
As a special case, if the first byte of a new industry layout is FEh, then only two bytes follow: the industry number and the layout number. The specified layout of the specified old industry type will be added to the layout list of the current industry. The following applies only if the first byte wasn't FEh |
As a special case, if the first byte of a new industry layout is FEh, then only two bytes follow: the industry number and the layout number. The specified layout of the specified old industry type will be added to the layout list of the current industry. The following applies only if the first byte wasn't FEh |
||
+ | {| |- |
||
− | ||Size|Variable|Meaning |
||
+ | !Size!!Variable!!Meaning |
||
− | |||
+ | |- |
||
− | B|xoffs |
||
+ | |B||xoffs |
||
− | |||
+ | |- |
||
− | B|yoffs|Offsets counted from the northernmost tile of the industry, specifying the position of the current tile. Both are taken as signed integers, but cannot go negative except the special case mentioned below. |
||
+ | |B||yoffs||Offsets counted from the northernmost tile of the industry, specifying the position of the current tile. Both are taken as signed integers, but cannot go negative except the special case mentioned below. |
||
− | |||
+ | |- |
||
− | B|oldtile|An old tile type to be put on the given tile |
||
+ | |B||oldtile||An old tile type to be put on the given tile |
||
− | |||
− | |- |
+ | |- |
+ | |||--or--|| |
||
− | |||
+ | |- |
||
− | 0xFE,W|newtile|The ID of an already defined industry tile, padded with 0 to create a word value. This tile type will be placed on the given tile. |
||
+ | |0xFE,W||newtile||The ID of an already defined industry tile, padded with 0 to create a word value. This tile type will be placed on the given tile. |
||
− | |||
− | |- |
+ | |- |
+ | |||--or--|| |
||
− | |||
+ | |- |
||
− | 0xFF| |The given tile is checked for clearance, but nothing will be placed on it. Useful to ensure some free space around your industry. This is the only case where xoffs and yoffs can be negative. If xoffs is negative, yoffs must be one lower than the wanted value.|| |
||
+ | |0xFF|| ||The given tile is checked for clearance, but nothing will be placed on it. Useful to ensure some free space around your industry. This is the only case where xoffs and yoffs can be negative. If xoffs is negative, yoffs must be one lower than the wanted value. |
||
+ | |} |
||
The layout consists of a list of the above tile definitions, terminated by two bytes: 0,80h |
The layout consists of a list of the above tile definitions, terminated by two bytes: 0,80h |
||
− | ==Industry production flags (0B)== |
+ | ===Industry production flags (0B)=== |
− | |||
− | ||Bit|Value|Meaning|Effect on nearby stations (a)|Effect if CB 29 is disabled |
||
− | |||
− | 0|1|extractive industry (e.g. coal mine)|suffix 'Mines' if some non-liquid, non-passenger, non-mail cargo is produced|Standard primary-industry production change |
||
− | |||
− | 1|2|organic industry (e.g. forest)|suffix 'Forest' or 'Woods' if wood is produced|Standard primary-industry production change |
||
+ | {| |- |
||
− | 2|4|processing industry (e.g. steel mill)|none|Standard processing-industry closing-behaviour|| |
||
+ | !Bit!!Value!!Meaning!!Effect on nearby stations (a)!!Effect if CB 29 is disabled |
||
+ | |- |
||
+ | |0||1||extractive industry (e.g. coal mine)||suffix 'Mines' if some non-liquid, non-passenger, non-mail cargo is produced||Standard primary-industry production change |
||
+ | |- |
||
+ | |1||2||organic industry (e.g. forest)||suffix 'Forest' or 'Woods' if wood is produced||Standard primary-industry production change |
||
+ | |- |
||
+ | |2||4||processing industry (e.g. steel mill)||none||Standard processing-industry closing-behaviour |
||
+ | |} |
||
Setting this property to 0 means no production changes and no closing, like e.g. the power station. |
Setting this property to 0 means no production changes and no closing, like e.g. the power station. |
||
Line 140: | Line 140: | ||
(a) Behaviour of OTTD. TTDP behaviour is different. |
(a) Behaviour of OTTD. TTDP behaviour is different. |
||
− | ==Industry messages (0C..0E), new industry text ID (1B)== |
+ | ===Industry messages (0C..0E), new industry text ID (1B)=== |
− | The text associated with these textID will be shown if the industry announces closedown, if the industry increases production, if the industry decreases production or when the industry is |
+ | The text associated with these textID will be shown if the industry announces closedown, if the industry increases production, if the industry decreases production or when the industry is generated during the game. |
− | |||
− | generated during the game. |
||
For the generation message, by default, all industries have "New xxx is being constructed near yyy", except forests, that have "New Forest is being planted near yyy". |
For the generation message, by default, all industries have "New xxx is being constructed near yyy", except forests, that have "New Forest is being planted near yyy". |
||
− | ==Production cargo types (10)== |
+ | ===Production cargo types (10)=== |
Two climate-dependent cargo numbers representing the cargo types the industry can produce. Unused slots can be filled with FFh. List of valid types: [[CargoTypes]] |
Two climate-dependent cargo numbers representing the cargo types the industry can produce. Unused slots can be filled with FFh. List of valid types: [[CargoTypes]] |
||
− | ==Acceptance cargo types (11)== |
+ | ===Acceptance cargo types (11)=== |
Three climate-dependent cargo numbers representing the cargo types the industry can accept, plus a fourth filler byte which is always ignored. Unused slots can be filled with FFh. List of valid types: [[CargoTypes]] |
Three climate-dependent cargo numbers representing the cargo types the industry can accept, plus a fourth filler byte which is always ignored. Unused slots can be filled with FFh. List of valid types: [[CargoTypes]] |
||
Line 160: | Line 158: | ||
From GRF version 7 and above, the meaning of the above two properties will change: instead of climate-dependent cargo slot numbers, you have to give climate-independent cargo IDs. If your GRF has a cargo translation table, then this ID is the index in that table; otherwise, it's the cargo bit. Cargoes not currently present will be changed to FFh. Please note that TTD stops processing these lists at the first FFh value, so specifying absent cargoes isn't always safe. |
From GRF version 7 and above, the meaning of the above two properties will change: instead of climate-dependent cargo slot numbers, you have to give climate-independent cargo IDs. If your GRF has a cargo translation table, then this ID is the index in that table; otherwise, it's the cargo bit. Cargoes not currently present will be changed to FFh. Please note that TTD stops processing these lists at the first FFh value, so specifying absent cargoes isn't always safe. |
||
− | ==Production multipliers (12, 13)== |
+ | ===Production multipliers (12, 13)=== |
If nonzero, the industry periodically (every 256 ticks, that is 8 or 9 times in a month) produces the given amount from the according cargo type. The properties specify the amount produced at default production level, they are scaled equally on [[Callbacks#Random_production_change_29_|production changes]]. |
If nonzero, the industry periodically (every 256 ticks, that is 8 or 9 times in a month) produces the given amount from the according cargo type. The properties specify the amount produced at default production level, they are scaled equally on [[Callbacks#Random_production_change_29_|production changes]]. |
||
− | ==Minimal amount of cargo distributed (14)== |
+ | ===Minimal amount of cargo distributed (14)=== |
The produced cargo will be distributed to stations only after it exceeds this amount. |
The produced cargo will be distributed to stations only after it exceeds this amount. |
||
− | ==Random sound effects (15)== |
+ | ===Random sound effects (15)=== |
The data starts with a byte defining the number of available effects, then one byte per effect. TTD periodically picks one of the available effects randomly, and plays it. |
The data starts with a byte defining the number of available effects, then one byte per effect. TTD periodically picks one of the available effects randomly, and plays it. |
||
− | ==Conflicting industry types (16)== |
+ | ===Conflicting industry types (16)=== |
3 bytes define 3 types that won't appear in the vicinity of this industry. If a byte has bit 7 set, the bottom 6 bits are the ID of a new type already defined in the current GRF file. If bit 7 is clear, the bottom 6 bits specify an old industry type. FFh can be used to fill unused entries. You shouldn't modify property 9 after the type has been referenced by a property 16. List of valid types: [[IndustryTypes]] |
3 bytes define 3 types that won't appear in the vicinity of this industry. If a byte has bit 7 set, the bottom 6 bits are the ID of a new type already defined in the current GRF file. If bit 7 is clear, the bottom 6 bits specify an old industry type. FFh can be used to fill unused entries. You shouldn't modify property 9 after the type has been referenced by a property 16. List of valid types: [[IndustryTypes]] |
||
− | ==Probability in random game (17), Probability during gameplay (18)== |
+ | ===Probability in random game (17), Probability during gameplay (18)=== |
Old types have probabilities between 0 and 10. If the random game probability value is nonzero, at least one instance of this type is guaranteed to appear on the map. |
Old types have probabilities between 0 and 10. If the random game probability value is nonzero, at least one instance of this type is guaranteed to appear on the map. |
||
Line 182: | Line 180: | ||
These probabilities are "relative probabilities". That is, if you set the probability of industry A to twice the probability of industry B, industry A will appear about twice as often as B. Increasing the probabilities of all industries on the other hand changes nothing. The appearance probabilities have no influence on how many industries are placed in total. |
These probabilities are "relative probabilities". That is, if you set the probability of industry A to twice the probability of industry B, industry A will appear about twice as often as B. Increasing the probabilities of all industries on the other hand changes nothing. The appearance probabilities have no influence on how many industries are placed in total. |
||
− | ==Map colour (19)== |
+ | ===Map colour (19)=== |
The value must be a color index from the DOS pallette. The following values are used by default industries: |
The value must be a color index from the DOS pallette. The following values are used by default industries: |
||
+ | {| |- |
||
− | ||Number|Colour|Example |
||
+ | !Number!!Colour!!Example |
||
+ | |- |
||
+ | |01||Black||Coal mine |
||
+ | |- |
||
+ | |0A||Gray||Steel mill |
||
+ | |- |
||
+ | |0F||White||Bank |
||
+ | |- |
||
+ | |25||Dark beige||Water supply |
||
+ | |- |
||
+ | |27||Light beige||Rubber plantation |
||
+ | |- |
||
+ | |30||Pink||Farm |
||
+ | |- |
||
+ | |37||Brown||Food processing plant |
||
+ | |- |
||
+ | |56||Green||Forest |
||
+ | |- |
||
+ | |98||Blue||Oil wells/oil rig |
||
+ | |- |
||
+ | |AE||Purple||Factory |
||
+ | |- |
||
+ | |B8||Red||Power station |
||
+ | |- |
||
+ | |BF||Yellow||Oil refinery |
||
+ | |- |
||
+ | |C2||Orange||Saw mill |
||
+ | |- |
||
+ | |D0||Light green||Water tower |
||
+ | |} |
||
+ | ===Special industry flags to define special behavior (1A)=== |
||
− | 01|Black|Coal mine |
||
+ | {| |- |
||
− | 0A|Gray|Steel mill |
||
+ | !Bit!!Value!!Meaning |
||
− | |||
+ | |- |
||
− | 0F|White|Bank |
||
+ | |0||1||The industry periodically plants fields around itself (temperate and arctic farms) |
||
− | |||
+ | |- |
||
− | 25|Dark beige|Water supply |
||
+ | |1||2||The industry cuts trees around itself and produces its first output cargo from them (lumber mill) |
||
− | |||
+ | |- |
||
− | 27|Light beige|Rubber plantation |
||
+ | |2||4||The industry is built on water (oil rig) |
||
− | |||
+ | |- |
||
− | 30|Pink|Farm |
||
+ | |3||8||The industry can only be built in towns (i.e. it has to replace houses) with population larger than 1200 (temperate bank) |
||
− | |||
+ | |- |
||
− | 37|Brown|Food processing plant |
||
+ | |4||10||The industry can only be built in towns (i.e. it has to replace houses) (arctic and tropic banks, water tower) |
||
− | |||
+ | |- |
||
− | 56|Green|Forest |
||
+ | |5||20||The industry is always built near towns (i.e. near town sign; additionally the industry is allowed to replace houses) (toy shop) |
||
− | |||
+ | |- |
||
− | 98|Blue|Oil wells/oil rig |
||
+ | |6||40||Fields are planted around the industry when it's built (all farms) |
||
− | |||
+ | |- |
||
− | AE|Purple|Factory |
||
+ | |7||80||The industry cannot increase its production on the temperate climate (oil wells) |
||
− | |||
+ | |- |
||
− | B8|Red|Power station |
||
+ | |8||100||The industry is built only before 1950 (oil wells) |
||
− | |||
+ | |- |
||
− | BF|Yellow|Oil refinery |
||
+ | |9||200||The industry is built only after 1960 (oil rig) |
||
− | |||
+ | |- |
||
− | C2|Orange|Saw mill |
||
+ | |10||400||AI players will attempt to establish air and ship routes going to this industry (oil rig) |
||
− | |||
+ | |- |
||
− | D0|Light green|Water tower|| |
||
+ | |11||800||The industry can be exploded by a military airplane (oil refinery) |
||
− | |||
+ | |- |
||
− | ==Special industry flags to define special behavior (1A)== |
||
+ | |12||1000||The industry can be exploded by a military helicopter (factory) |
||
− | |||
+ | |- |
||
− | ||Bit|Value|Meaning |
||
+ | |13||2000||The industry can cause a subsidence (coal mine) |
||
− | |||
+ | |- |
||
− | 0|1|The industry periodically plants fields around itself (temperate and arctic farms) |
||
+ | |14||4000||Automatic production multiplier handing (No industry has this bit set by default.) |
||
− | |||
+ | |- |
||
− | 1|2|The industry cuts trees around itself and produces its first output cargo from them (lumber mill) |
||
+ | |15||8000||The production callback needs random bits in var. 10 (No industry has this bit set by default.) |
||
− | |||
+ | |- |
||
− | 2|4|The industry is built on water (oil rig) |
||
+ | |16||10000||(since r1925) Do not force one instance of this type to appear during initial map generation (No industry has this bit set by default.) |
||
− | |||
+ | |- |
||
− | 3|8|The industry can only be built in towns (i.e. it has to replace houses) with population larger than 1200 (temperate bank) |
||
+ | |17||20000||(since r1925) Allow closing down the last instance of this type (No industry has this bit set by default.) |
||
− | |||
+ | |} |
||
− | 4|10|The industry can only be built in towns (i.e. it has to replace houses) (arctic and tropic banks, water tower) |
||
− | |||
− | 5|20|The industry is always built near towns (i.e. near town sign; additionally the industry is allowed to replace houses) (toy shop) |
||
− | |||
− | 6|40|Fields are planted around the industry when it's built (all farms) |
||
− | |||
− | 7|80|The industry cannot increase its production on the temperate climate (oil wells) |
||
− | |||
− | 8|100|The industry is built only before 1950 (oil wells) |
||
− | |||
− | 9|200|The industry is built only after 1960 (oil rig) |
||
− | |||
− | 10|400|AI players will attempt to establish air and ship routes going to this industry (oil rig) |
||
− | |||
− | 11|800|The industry can be exploded by a military airplane (oil refinery) |
||
− | |||
− | 12|1000|The industry can be exploded by a military helicopter (factory) |
||
− | |||
− | 13|2000|The industry can cause a subsidence (coal mine) |
||
− | |||
− | 14|4000|Automatic production multiplier handing (No industry has this bit set by default.) |
||
− | |||
− | 15|8000|The production callback needs random bits in var. 10 (No industry has this bit set by default.) |
||
− | |||
− | 16|10000|(since r1925) Do not force one instance of this type to appear during initial map generation (No industry has this bit set by default.) |
||
− | |||
− | 17|20000|(since r1925) Allow closing down the last instance of this type (No industry has this bit set by default.)|| |
||
If bit 14 is set, variables 40..42 will be divided by industry.prodmultiplier (variable 93), and the resulting instructions will be multiplied by the same amount before applying them. If you set this bit, please use small amounts in your instructions, since industry.prodmultiplier is 16 for default production, and can get as high as 128. |
If bit 14 is set, variables 40..42 will be divided by industry.prodmultiplier (variable 93), and the resulting instructions will be multiplied by the same amount before applying them. If you set this bit, please use small amounts in your instructions, since industry.prodmultiplier is 16 for default production, and can get as high as 128. |
||
Line 262: | Line 264: | ||
If you supply a lot of industry types but also want to support OpenTTD's small map sizes you should set bit 16 for the less important industry types which can be ommitted (there will likely not be enough space for an industry of every type). |
If you supply a lot of industry types but also want to support OpenTTD's small map sizes you should set bit 16 for the less important industry types which can be ommitted (there will likely not be enough space for an industry of every type). |
||
− | ==Input cargo multipliers for the three input cargo types (1C..1E)== |
+ | ===Input cargo multipliers for the three input cargo types (1C..1E)=== |
If the first (low) word of the property is M1 and the second (high) word is M2, and X units of the corresponding cargo is delivered to the industry, the output amounts are calculated this way: |
If the first (low) word of the property is M1 and the second (high) word is M2, and X units of the corresponding cargo is delivered to the industry, the output amounts are calculated this way: |
||
Line 272: | Line 274: | ||
The default value for old industry types is 0100h,0000h , so every unit of input cargo produces one unit of output cargo of the first type. Exceptions are temperate banks and oil rigs, that have the default value of 0000h,0000h ,so input cargo doesn't affect output. |
The default value for old industry types is 0100h,0000h , so every unit of input cargo produces one unit of output cargo of the first type. Exceptions are temperate banks and oil rigs, that have the default value of 0000h,0000h ,so input cargo doesn't affect output. |
||
− | ==Industry name (1F)== |
+ | ===Industry name (1F)=== |
This is the text ID that will be attached to the town name when TTD texts refer to the industry. |
This is the text ID that will be attached to the town name when TTD texts refer to the industry. |
||
− | ==Prospecting success chance (20)== |
+ | ===Prospecting success chance (20)=== |
This value is currently used only for extractive and organic industries (see property 0B for details). The higher this value is, the higher the chance that your industry can be built on a random place after prospecting. 0 means constant failure, while FFFFFFFFh means constant success. |
This value is currently used only for extractive and organic industries (see property 0B for details). The higher this value is, the higher the chance that your industry can be built on a random place after prospecting. 0 means constant failure, while FFFFFFFFh means constant success. |
||
− | ==Callback flags (21,22)== |
+ | ===Callback flags (21,22)=== |
Property 21 can have the following bits set: |
Property 21 can have the following bits set: |
||
+ | {| |- |
||
− | ||Bit|Value|Var. 0C|Callback |
||
+ | !Bit!!Value!!Var. 0C!!Callback |
||
− | |||
+ | |- |
||
− | 0|1|22|Determine whether the industry can be built |
||
+ | |0||1||22||Determine whether the industry can be built |
||
− | |||
+ | |- |
||
− | 1|2|00|Call the [[Action2Industries|production callback]] when cargo arrives at the industry |
||
+ | |1||2||00||Call the [[Action2Industries|production callback]] when cargo arrives at the industry |
||
− | |||
+ | |- |
||
− | 2|4|00|Call the [[Action2Industries|production callback]] every 256 ticks |
||
+ | |2||4||00||Call the [[Action2Industries|production callback]] every 256 ticks |
||
− | |||
+ | |- |
||
− | 3|8|28|Determine whether the industry can be built on given spot |
||
+ | |3||8||28||Determine whether the industry can be built on given spot |
||
− | |||
+ | |- |
||
− | 4|10|29|Control random production changes |
||
+ | |4||10||29||Control random production changes |
||
− | |||
+ | |- |
||
− | 5|20|35|Monthly random production change |
||
+ | |5||20||35||Monthly random production change |
||
− | |||
+ | |- |
||
− | 6|40|37|Cargo sub-type display |
||
+ | |6||40||37||Cargo sub-type display |
||
− | |||
+ | |- |
||
− | 7|80|38|(from 2.0.1 a72 and above) Additional text in industry fund window|| |
||
+ | |7||80||38||(from 2.0.1 a72 and above) Additional text in industry fund window |
||
+ | |} |
||
It should be noted that OpenTTD will use smooth economy (if enabled) changes if none of the production callbacks flags are set. |
It should be noted that OpenTTD will use smooth economy (if enabled) changes if none of the production callbacks flags are set. |
||
Line 308: | Line 312: | ||
Property 22 can have the following bits set: |
Property 22 can have the following bits set: |
||
+ | {| |- |
||
− | ||Bit|Value|Var. 0C|Callback |
||
+ | !Bit!!Value!!Var. 0C!!Callback |
||
+ | |- |
||
+ | |0||1||3A||(from 2.0.1 a72 and above) Show additional text in industry window |
||
+ | |- |
||
+ | |1||2||3B||(from 2.0.1 a73 and above) Control special industry effects |
||
+ | |- |
||
+ | |2||4||3D||(from 2.5 beta 4 and above) Opt out of accepting cargo |
||
+ | |- |
||
+ | |3||8||14A||(from 2.6 r1712 and above) Decide industry color |
||
+ | |- |
||
+ | |4||10||14B||(from 2.6 r1718 and above) Decide input cargo types |
||
+ | |- |
||
+ | |5||20||14C||(from 2.6 r1718 and above) Decide output cargo types |
||
+ | |} |
||
+ | ===Destruction cost multiplier (23)=== |
||
− | 0|1|3A|(from 2.0.1 a72 and above) Show additional text in industry window |
||
− | |||
− | 1|2|3B|(from 2.0.1 a73 and above) Control special industry effects |
||
− | |||
− | 2|4|3D|(from 2.5 beta 4 and above) Opt out of accepting cargo |
||
− | |||
− | 3|8|14A|(from 2.6 r1712 and above) Decide industry color |
||
− | |||
− | 4|10|14B|(from 2.6 r1718 and above) Decide input cargo types |
||
− | |||
− | 5|20|14C|(from 2.6 r1718 and above) Decide output cargo types|| |
||
− | |||
− | ==Destruction cost multiplier (23)== |
||
This value specifies the cost of removing the industry when the ctrl-dynamite function of morebuildoptions.removeindustry is enabled. This value is multiplied by the house removal cost multiplier to get the final cost. The default value is 1000 in TTDPatch, and 0 (zero) in OpenTTD. |
This value specifies the cost of removing the industry when the ctrl-dynamite function of morebuildoptions.removeindustry is enabled. This value is multiplied by the house removal cost multiplier to get the final cost. The default value is 1000 in TTDPatch, and 0 (zero) in OpenTTD. |
||
− | ==Default name for nearby station (24)== |
+ | ===Default name for nearby station (24)=== |
If non-zero, this text ID specifies an additional name option for stations built near this industry, which will be used before any of the standard TTD names. The text should contain a \80, which will be the name of the nearby town. |
If non-zero, this text ID specifies an additional name option for stations built near this industry, which will be used before any of the standard TTD names. The text should contain a \80, which will be the name of the nearby town. |
||
Line 333: | Line 339: | ||
Setting this to zero disables "\80 Oilfield" and "\80 Mines" without adding any additional station name options. |
Setting this to zero disables "\80 Oilfield" and "\80 Mines" without adding any additional station name options. |
||
+ | |||
+ | ==Example== |
Revision as of 21:55, 14 June 2011
Introduction
Industries work similarly to town buildings as well, except that the maximum number of possible industries is 37 in TTDPatch and 64 in OpenTTD. The non-overridden original types count towards this limit. Industries don't have a climate mask; you should simply not define an industry if it would be for the wrong climate.
Defining industries follows the same schema as houses do: to start using an ID, you first need to define it by setting property 8 for it. If you try to reference an ID (either via action0 or via action3) that isn't defined, your request is ignored, but not reported as an error, either. This means that if you want to conditionally define an ID, all you need to do is skipping the action0 that sets property8, and everything else gets skipped automatically.
Properties
Property | Version | Size | Description |
---|---|---|---|
08 | (a) | B | Substitute industry type |
09 | (a) | B | Industry type override |
0A | (a) | V | Set industry layout(s) |
0B | (a) | B | Industry production flags |
0C | (a) | W | Industry closure message |
0D | (a) | W | Production increase message |
0E | (a) | W | Production decrease message |
0F | (a) | B | Fund cost multiplier |
10 | (a) | W | Production cargo types |
11 | (a) | D | Acceptance cargo types |
12,13 | (a) | B | Production multipliers |
14 | (a) | B | Minimal amount of cargo distributed |
15 | (a) | V | Random sound effects |
16 | (a) | 3*B | Conflicting industry types |
17 | (a) | B | Probability in random game |
18 | (a) | B | Probability during gameplay |
19 | (a) | B | Map color |
1A | (a) | D | Special industry flags to define special behavior |
1B | (a) | W | New industry text ID |
1C,1D,1E | (a) | D | Input cargo multipliers for the three input cargo types |
1F | (b) | W | Industry name |
20 | (b) | D | Prospecting success chance |
21,22 | (b) | B | Callback flags |
23 | (c) | D | Destruction cost multiplier |
24 | (d) | W | Default text for nearby station |
(a) Available since TTDPatch 2.0.1 alpha 45
(b) Available since TTDPatch 2.0.1 alpha 49
(c) Available since TTDPatch 2.0.1 alpha 73
(d) Available since TTDPatch 2.6 alpha 0 r1782
Description
Substitute industry type (08)
Substitute industry type. The first assignment of this property copies all properties of the old type to this new type. Unlike for houses, the substitute type won't replace this new type if the definition becomes unavailable. List of valid types: IndustryTypes
There's a special use of this property beginning from alpha 70: if you set it to FFh, you can disable an original industry. In this case, the ID used must be the number of industry you want to disable. Disable requests are ignored for industries not present on the current climate and industries already overridden.
Industry type override (09)
Industry type override. The overridden industry type won't be built in new random games. If the GRF file becomes active after the game was started, industries of the overridden new type won't be replaced by the new type. List of valid types: IndustryTypes
By overriding an old type, you're saying "my type is a substitute for that old type". When GRFs ask information about the old type you've overridden (via industry variable 67, for example), they will get information about your type instead. If you want to replace an old industry type with something completely different, use the "disable" function of property 08 (see above), then define the new industry type without using property 09. A rule of thumb: if your industry accepts or produces different cargoes than the original one, it should not override the original one.
For example, if you want to replace the old coal mine with something that changes its coal production more dynamically, use property 09 to override industry 00. This way, other industries that want to be far from coal mines will stay far from your industry type too. If, however, you want to replace the coal mine with a potash mine, do not use property 09. This will ensure that other industries don't consider your type as a coal mine.
Please note, however, that only one new industry can override an old type. If two new types want to override the same old type, the first one wins, and the second is added normally, ignoring its property 09.
Set industry layout(s) (0A)
Format of industry layout tables:
Size | Variable | Meaning |
---|---|---|
B | numlayouts | The total number of layouts following |
D | size | The size of the whole definition, excluding numlayouts and size |
V | layouts | numlayout layouts, see format below |
Format of an industry layout:
As a special case, if the first byte of a new industry layout is FEh, then only two bytes follow: the industry number and the layout number. The specified layout of the specified old industry type will be added to the layout list of the current industry. The following applies only if the first byte wasn't FEh
Size | Variable | Meaning |
---|---|---|
B | xoffs | |
B | yoffs | Offsets counted from the northernmost tile of the industry, specifying the position of the current tile. Both are taken as signed integers, but cannot go negative except the special case mentioned below. |
B | oldtile | An old tile type to be put on the given tile |
--or-- | ||
0xFE,W | newtile | The ID of an already defined industry tile, padded with 0 to create a word value. This tile type will be placed on the given tile. |
--or-- | ||
0xFF | The given tile is checked for clearance, but nothing will be placed on it. Useful to ensure some free space around your industry. This is the only case where xoffs and yoffs can be negative. If xoffs is negative, yoffs must be one lower than the wanted value. |
The layout consists of a list of the above tile definitions, terminated by two bytes: 0,80h
Industry production flags (0B)
Bit | Value | Meaning | Effect on nearby stations (a) | Effect if CB 29 is disabled |
---|---|---|---|---|
0 | 1 | extractive industry (e.g. coal mine) | suffix 'Mines' if some non-liquid, non-passenger, non-mail cargo is produced | Standard primary-industry production change |
1 | 2 | organic industry (e.g. forest) | suffix 'Forest' or 'Woods' if wood is produced | Standard primary-industry production change |
2 | 4 | processing industry (e.g. steel mill) | none | Standard processing-industry closing-behaviour |
Setting this property to 0 means no production changes and no closing, like e.g. the power station.
(a) Behaviour of OTTD. TTDP behaviour is different.
Industry messages (0C..0E), new industry text ID (1B)
The text associated with these textID will be shown if the industry announces closedown, if the industry increases production, if the industry decreases production or when the industry is generated during the game.
For the generation message, by default, all industries have "New xxx is being constructed near yyy", except forests, that have "New Forest is being planted near yyy".
Production cargo types (10)
Two climate-dependent cargo numbers representing the cargo types the industry can produce. Unused slots can be filled with FFh. List of valid types: CargoTypes
Acceptance cargo types (11)
Three climate-dependent cargo numbers representing the cargo types the industry can accept, plus a fourth filler byte which is always ignored. Unused slots can be filled with FFh. List of valid types: CargoTypes
These cargo types will only be really accepted if the according acceptance of the industry tiles adds up to 8/8 or more.
From GRF version 7 and above, the meaning of the above two properties will change: instead of climate-dependent cargo slot numbers, you have to give climate-independent cargo IDs. If your GRF has a cargo translation table, then this ID is the index in that table; otherwise, it's the cargo bit. Cargoes not currently present will be changed to FFh. Please note that TTD stops processing these lists at the first FFh value, so specifying absent cargoes isn't always safe.
Production multipliers (12, 13)
If nonzero, the industry periodically (every 256 ticks, that is 8 or 9 times in a month) produces the given amount from the according cargo type. The properties specify the amount produced at default production level, they are scaled equally on production changes.
Minimal amount of cargo distributed (14)
The produced cargo will be distributed to stations only after it exceeds this amount.
Random sound effects (15)
The data starts with a byte defining the number of available effects, then one byte per effect. TTD periodically picks one of the available effects randomly, and plays it.
Conflicting industry types (16)
3 bytes define 3 types that won't appear in the vicinity of this industry. If a byte has bit 7 set, the bottom 6 bits are the ID of a new type already defined in the current GRF file. If bit 7 is clear, the bottom 6 bits specify an old industry type. FFh can be used to fill unused entries. You shouldn't modify property 9 after the type has been referenced by a property 16. List of valid types: IndustryTypes
Probability in random game (17), Probability during gameplay (18)
Old types have probabilities between 0 and 10. If the random game probability value is nonzero, at least one instance of this type is guaranteed to appear on the map.
These probabilities are "relative probabilities". That is, if you set the probability of industry A to twice the probability of industry B, industry A will appear about twice as often as B. Increasing the probabilities of all industries on the other hand changes nothing. The appearance probabilities have no influence on how many industries are placed in total.
Map colour (19)
The value must be a color index from the DOS pallette. The following values are used by default industries:
Number | Colour | Example |
---|---|---|
01 | Black | Coal mine |
0A | Gray | Steel mill |
0F | White | Bank |
25 | Dark beige | Water supply |
27 | Light beige | Rubber plantation |
30 | Pink | Farm |
37 | Brown | Food processing plant |
56 | Green | Forest |
98 | Blue | Oil wells/oil rig |
AE | Purple | Factory |
B8 | Red | Power station |
BF | Yellow | Oil refinery |
C2 | Orange | Saw mill |
D0 | Light green | Water tower |
Special industry flags to define special behavior (1A)
Bit | Value | Meaning |
---|---|---|
0 | 1 | The industry periodically plants fields around itself (temperate and arctic farms) |
1 | 2 | The industry cuts trees around itself and produces its first output cargo from them (lumber mill) |
2 | 4 | The industry is built on water (oil rig) |
3 | 8 | The industry can only be built in towns (i.e. it has to replace houses) with population larger than 1200 (temperate bank) |
4 | 10 | The industry can only be built in towns (i.e. it has to replace houses) (arctic and tropic banks, water tower) |
5 | 20 | The industry is always built near towns (i.e. near town sign; additionally the industry is allowed to replace houses) (toy shop) |
6 | 40 | Fields are planted around the industry when it's built (all farms) |
7 | 80 | The industry cannot increase its production on the temperate climate (oil wells) |
8 | 100 | The industry is built only before 1950 (oil wells) |
9 | 200 | The industry is built only after 1960 (oil rig) |
10 | 400 | AI players will attempt to establish air and ship routes going to this industry (oil rig) |
11 | 800 | The industry can be exploded by a military airplane (oil refinery) |
12 | 1000 | The industry can be exploded by a military helicopter (factory) |
13 | 2000 | The industry can cause a subsidence (coal mine) |
14 | 4000 | Automatic production multiplier handing (No industry has this bit set by default.) |
15 | 8000 | The production callback needs random bits in var. 10 (No industry has this bit set by default.) |
16 | 10000 | (since r1925) Do not force one instance of this type to appear during initial map generation (No industry has this bit set by default.) |
17 | 20000 | (since r1925) Allow closing down the last instance of this type (No industry has this bit set by default.) |
If bit 14 is set, variables 40..42 will be divided by industry.prodmultiplier (variable 93), and the resulting instructions will be multiplied by the same amount before applying them. If you set this bit, please use small amounts in your instructions, since industry.prodmultiplier is 16 for default production, and can get as high as 128.
By default, TTDPatch tries to ensure that cargo chains don't get broken. To achieve this, TTDPatch always generates at least one instance from every available industry type during random map generation, and prevents the last instance from closing down even when the production change callback says it should. If your industry type isn't essential for gameplay, or you want to handle this situation yourself, you can set bits 16 and/or 17 to turn off the default TTDPatch behavior.
If you supply a lot of industry types but also want to support OpenTTD's small map sizes you should set bit 16 for the less important industry types which can be ommitted (there will likely not be enough space for an industry of every type).
Input cargo multipliers for the three input cargo types (1C..1E)
If the first (low) word of the property is M1 and the second (high) word is M2, and X units of the corresponding cargo is delivered to the industry, the output amounts are calculated this way:
output_type1 = X*M1/256 output_type2 = X*M2/256
The default value for old industry types is 0100h,0000h , so every unit of input cargo produces one unit of output cargo of the first type. Exceptions are temperate banks and oil rigs, that have the default value of 0000h,0000h ,so input cargo doesn't affect output.
Industry name (1F)
This is the text ID that will be attached to the town name when TTD texts refer to the industry.
Prospecting success chance (20)
This value is currently used only for extractive and organic industries (see property 0B for details). The higher this value is, the higher the chance that your industry can be built on a random place after prospecting. 0 means constant failure, while FFFFFFFFh means constant success.
Callback flags (21,22)
Property 21 can have the following bits set:
Bit | Value | Var. 0C | Callback |
---|---|---|---|
0 | 1 | 22 | Determine whether the industry can be built |
1 | 2 | 00 | Call the production callback when cargo arrives at the industry |
2 | 4 | 00 | Call the production callback every 256 ticks |
3 | 8 | 28 | Determine whether the industry can be built on given spot |
4 | 10 | 29 | Control random production changes |
5 | 20 | 35 | Monthly random production change |
6 | 40 | 37 | Cargo sub-type display |
7 | 80 | 38 | (from 2.0.1 a72 and above) Additional text in industry fund window |
It should be noted that OpenTTD will use smooth economy (if enabled) changes if none of the production callbacks flags are set.
Otherwise, regular production changes will be used.
Property 22 can have the following bits set:
Bit | Value | Var. 0C | Callback |
---|---|---|---|
0 | 1 | 3A | (from 2.0.1 a72 and above) Show additional text in industry window |
1 | 2 | 3B | (from 2.0.1 a73 and above) Control special industry effects |
2 | 4 | 3D | (from 2.5 beta 4 and above) Opt out of accepting cargo |
3 | 8 | 14A | (from 2.6 r1712 and above) Decide industry color |
4 | 10 | 14B | (from 2.6 r1718 and above) Decide input cargo types |
5 | 20 | 14C | (from 2.6 r1718 and above) Decide output cargo types |
Destruction cost multiplier (23)
This value specifies the cost of removing the industry when the ctrl-dynamite function of morebuildoptions.removeindustry is enabled. This value is multiplied by the house removal cost multiplier to get the final cost. The default value is 1000 in TTDPatch, and 0 (zero) in OpenTTD.
Default name for nearby station (24)
If non-zero, this text ID specifies an additional name option for stations built near this industry, which will be used before any of the standard TTD names. The text should contain a \80, which will be the name of the nearby town.
If the newly built station cannot use the specified text (because that name has been used for another station in the same town) the default TTD naming system will be used, but without the names "\80 Oilfield" or "\80 Mines".
Setting this to zero disables "\80 Oilfield" and "\80 Mines" without adding any additional station name options.