Difference between revisions of "Callback: Articulated engine"
m (Create a separate page for each callback) |
(Added note about ID numbers) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
== Articulated engine (16) == |
== Articulated engine (16) == |
||
− | This allows building articulated engines or wagons, i.e. vehicles made from several individual vehicles |
+ | This allows building articulated engines or wagons, i.e. vehicles made from several individual vehicles. |
+ | If this callback is in use, additional vehicles will be added as long as the callback says so. |
||
+ | {{grfTill|7}} For GRF version 7 and below the return value uses 8 bits. |
||
− | The callback return is interpreted as the ID of the vehicle to add. If 80 is added to the ID, the vehicle will be reversed (as if Ctrl was held while bought). |
||
+ | Bit 0 to 6 define the ID of the vehicle to add. If 80 is added to the ID, the vehicle will be reversed. Returning FF means to finish the articulated vehicle, and not attach more parts. Therefore IDs used for articulated parts must be less than 7E (7F if not reversed). |
||
+ | {{grfFrom|8}} For GRF version 8 and above the return value uses 15 bits. |
||
⚫ | |||
+ | Bit 0 to 13 define the ID of the vehicle to add. If 4000 is added to the ID, the vehicle will be reversed. Returning 7FFF means to finish the articulated vehicle, and not attach more parts. Therefore IDs used for articulated parts must be less than 3FFE (3FFF if not reversed). |
||
⚫ | |||
⚫ | If more than the first vehicle contains cargo, the callback must work in the buy menu as well. |
||
⚫ | {{ottdp|0.6|2.5|ttdprev=beta 8}} If more than the first vehicle contains cargo, the callback must work in the buy menu as well. This means that it will be called with cargo type FF in the action 3. Otherwise, the cargo amount shown in the buy menu will only be for the first part of the articulated vehicle. |
||
⚫ | In OpenTTD the cargo class of the first road vehicles is used to determine whether the vehicle can stop at bus or truck stops regardless of the capacity of the first vehicle. If the cargo class bit for passengers is set it can go to bus stops when the is not set it can go to truck stops. See also the page about [[VehicleRefitting|vehicle refitting]]. |
||
+ | |||
⚫ | {{ottd| }} In OpenTTD the cargo class of the first road vehicles is used to determine whether the vehicle can stop at bus or truck stops regardless of the capacity of the first vehicle. If the cargo class bit for passengers is set it can go to bus stops when the is not set it can go to truck stops. See also the page about [[VehicleRefitting|vehicle refitting]]. |
||
[[Category:Callbacks]] |
[[Category:Callbacks]] |
Latest revision as of 10:42, 3 December 2024
Articulated engine (16)
This allows building articulated engines or wagons, i.e. vehicles made from several individual vehicles. If this callback is in use, additional vehicles will be added as long as the callback says so.
GRFv≤7 For GRF version 7 and below the return value uses 8 bits. Bit 0 to 6 define the ID of the vehicle to add. If 80 is added to the ID, the vehicle will be reversed. Returning FF means to finish the articulated vehicle, and not attach more parts. Therefore IDs used for articulated parts must be less than 7E (7F if not reversed).
GRFv≥8 For GRF version 8 and above the return value uses 15 bits. Bit 0 to 13 define the ID of the vehicle to add. If 4000 is added to the ID, the vehicle will be reversed. Returning 7FFF means to finish the articulated vehicle, and not attach more parts. Therefore IDs used for articulated parts must be less than 3FFE (3FFF if not reversed).
Note that since the train is not yet built, you cannot use train variables in action 2. Instead, use the first byte of variable 10 (extra callback info 1), which is set to 01 for the first articulated part, 02 for the second and so on.
0.6 2.5 If more than the first vehicle contains cargo, the callback must work in the buy menu as well. This means that it will be called with cargo type FF in the action 3. Otherwise, the cargo amount shown in the buy menu will only be for the first part of the articulated vehicle.
In OpenTTD the cargo class of the first road vehicles is used to determine whether the vehicle can stop at bus or truck stops regardless of the capacity of the first vehicle. If the cargo class bit for passengers is set it can go to bus stops when the is not set it can go to truck stops. See also the page about vehicle refitting.