Difference between revisions of "NML:Changes 0.3"

From GRFSpecs
Jump to navigationJump to search
(fix link)
 
(16 intermediate revisions by 4 users not shown)
Line 1: Line 1:
  +
<div style="float:right; padding-left:12px; background:none;">{{NMLNavMain}}</div>
  +
 
== Introduction ==
 
== Introduction ==
 
Between NML 0.2.x and NML 0.3.x (and their corresponding nightlies) the generated NewGRF version by NML changed from v7 to v8. This brings lot of advantages, but requires a few changes to existing NML files. NewGRFs thus will require a minimum OpenTTD version of 1.2.0 (r23166).
 
Between NML 0.2.x and NML 0.3.x (and their corresponding nightlies) the generated NewGRF version by NML changed from v7 to v8. This brings lot of advantages, but requires a few changes to existing NML files. NewGRFs thus will require a minimum OpenTTD version of 1.2.0 (r23166).
Line 12: Line 14:
 
The callback "availability" is no longer available. Use the callback "construction_probability" instead.
 
The callback "availability" is no longer available. Use the callback "construction_probability" instead.
   
== Snowline height ==
+
== Changed variables ==
  +
The "snowline_height" variable now returns the height in tiles instead of "tiles * 8".
 
  +
=== snowline_height ===
 
The "snowline_height" variable returns the height in tiles instead of pixels (=tiles*8).
  +
  +
=== nearby_tile_height ===
  +
The "nearby_tile_height" variable returns the height in tiles instead of pixels (=tiles*8).
  +
  +
=== date_of_last_service ===
  +
This variable is no longer limited to the range of 1920 ... 2050. It returns now the year 0-based date.
  +
  +
== Base costs ==
  +
Base costs are treated in NewGRF v8 (NML 0.3.x) differently than in NewGRF v7 (NML 0.2.x and earlier). Base costs do '''NOT''' influence eachother anymore. You'll need to set all base costs directly and cannot rely anymore that any are set indirectly. See the [[NML:Base_cost_table| base costs table]] which will be influenced.
  +
  +
== New properties ==
  +
=== Railtypes: alternative_railtype_list ===
  +
This property allows to define a list of rail types which this rail type will also define - unless the rail type is defined separately.
  +
  +
=== Trains / Road vehicles: Length ===
  +
Trains and road vehicles now have a property 'length', this replaces the old property 'shorten_vehicle'.
  +
  +
=== Cargos: Capacity multiplier ===
  +
This new property allows answering the question: How much units of cargo X are equivalent to 1 ton of coal, resp. 1000 litres of water?
  +
  +
=== Houses: watched_cargo_types ===
  +
With the implementation of this property, the watched_cargo_accepted callback becomes usable.
  +
  +
== Vehicle refitting ==
  +
The 'xor'-property 'refittable_cargo_types' is no longer available; use 'cargo_allow_refit' resp. 'cargo_disallow_refit' instead. For trains, road vehicles and ships you can now specify a default cargo type.
  +
  +
== Alternative sprites ==
  +
The way OpenTTD supports 32bpp has been changed and enhanced. <code style="color:darkgreen">alternative_sprites</code> now takes more and different zoom level arguments and a type argument has been added as 8bpp sprites are now also permissible. See the description of the [[NML:Alternative_sprites| <code style="color:darkgreen">alternative_sprites</code>]] for details.
  +
  +
== Sounds ==
  +
It is now possible to specify a relative volume for sound effects. Additionally, the 64kB size limit has been removed.
  +
  +
== Cargo strings ==
  +
The cargo properties 'single_unit_text' and 'multiple_units_text' have been removed, as they didn't work properly in OpenTTD anyways. Use 'units_of_cargo' and 'items_of_cargo' instead.

Latest revision as of 13:04, 13 November 2020

Introduction

Between NML 0.2.x and NML 0.3.x (and their corresponding nightlies) the generated NewGRF version by NML changed from v7 to v8. This brings lot of advantages, but requires a few changes to existing NML files. NewGRFs thus will require a minimum OpenTTD version of 1.2.0 (r23166).

Callbacks

NML 0.3 only supports the new style callbacks. Thus all callback_flag properties have been removed as have the callback flag constants *CBF*. For a complete list of affected constants see the related commit

New named constants

A few constants have recently been introduced in both NML 0.2 and 0.3 that make the transition easier. Make sure to use them. For callback "articulated_part" use CB_RESULT_NO_MORE_ARTICULATED_PARTS and/or CB_RESULT_REVERSED_VEHICLE instead of hard-coded 0xFF / 0x80. For callbacks "cargo_subtype_text", "cargo_subtype_display" and "start_stop" use CB_RESULT_NO_TEXT instead of hard-coded 0xFF.

Industry availability

The callback "availability" is no longer available. Use the callback "construction_probability" instead.

Changed variables

snowline_height

The "snowline_height" variable returns the height in tiles instead of pixels (=tiles*8).

nearby_tile_height

The "nearby_tile_height" variable returns the height in tiles instead of pixels (=tiles*8).

date_of_last_service

This variable is no longer limited to the range of 1920 ... 2050. It returns now the year 0-based date.

Base costs

Base costs are treated in NewGRF v8 (NML 0.3.x) differently than in NewGRF v7 (NML 0.2.x and earlier). Base costs do NOT influence eachother anymore. You'll need to set all base costs directly and cannot rely anymore that any are set indirectly. See the base costs table which will be influenced.

New properties

Railtypes: alternative_railtype_list

This property allows to define a list of rail types which this rail type will also define - unless the rail type is defined separately.

Trains / Road vehicles: Length

Trains and road vehicles now have a property 'length', this replaces the old property 'shorten_vehicle'.

Cargos: Capacity multiplier

This new property allows answering the question: How much units of cargo X are equivalent to 1 ton of coal, resp. 1000 litres of water?

Houses: watched_cargo_types

With the implementation of this property, the watched_cargo_accepted callback becomes usable.

Vehicle refitting

The 'xor'-property 'refittable_cargo_types' is no longer available; use 'cargo_allow_refit' resp. 'cargo_disallow_refit' instead. For trains, road vehicles and ships you can now specify a default cargo type.

Alternative sprites

The way OpenTTD supports 32bpp has been changed and enhanced. alternative_sprites now takes more and different zoom level arguments and a type argument has been added as 8bpp sprites are now also permissible. See the description of the alternative_sprites for details.

Sounds

It is now possible to specify a relative volume for sound effects. Additionally, the 64kB size limit has been removed.

Cargo strings

The cargo properties 'single_unit_text' and 'multiple_units_text' have been removed, as they didn't work properly in OpenTTD anyways. Use 'units_of_cargo' and 'items_of_cargo' instead.