Newgrf Airports Documentation

From PikkaWiki
(Difference between revisions)
Jump to: navigation, search
(New page: '''This is a proposed spec only''' __TOC__ =Preamble= =Airport Tiles= Airport tiles are the graphical component of the airport. They have no direct interaction or effect on the state...)
 
Line 1: Line 1:
 
'''This is a proposed spec only'''
 
'''This is a proposed spec only'''
 
__TOC__
 
  
 
=Preamble=
 
=Preamble=
  
  
 
+
__TOC__
 
=Airport Tiles=
 
=Airport Tiles=
Airport tiles are the graphical component of the airport.  They have no direct interaction or effect on the state machine on or aircraft.
+
'''Airport tiles''' are the graphical component of the airport.  They have no direct interaction or effect on the state machine on or aircraft.
  
 
==Action 0 Airport Tiles==
 
==Action 0 Airport Tiles==
 +
* Land shape flags
 +
* Animation information
 +
* Animation speed
 +
as per [http://wiki.ttdpatch.net/tiki-index.php?page=Action0IndustryTiles Properties for industry tiles 0D, 0F and 10]
  
* Land shape flags (0D)
+
* Tile Subname string (ie, clicking ? on this tile will give you "AirportName (TileSubname)")
* Animation information (0F)
+
* Animation speed (10)
+
 
+
all as per [http://wiki.ttdpatch.net/tiki-index.php?page=Action0IndustryTiles Properties for industry tiles 0D, 0F and 10]
+
  
 
==Action 2 Airport Tiles==
 
==Action 2 Airport Tiles==
Line 30: Line 28:
 
* Decide drawing default foundations (30)
 
* Decide drawing default foundations (30)
 
* Disable autosloping for industry tiles (3C)
 
* Disable autosloping for industry tiles (3C)
 +
 +
=Airports=
 +
'''Airports''' are the logical component of the airport.  The airport contains the state machine.
 +
 +
==Action 0 Airports==
 +
* Name
 +
* Class
 +
* Small/Large/Helipad/Oilrig (note: for backwards compatibility with vehicle var 44)
 +
* Years available
 +
* Catchment area
 +
* Noise level
 +
* Text string to show in the build list
 +
* Cost per new tile when building
 +
* Cost per overbuilt tile when building
 +
* Yearly facility maintanance cost (possibly ?)
 +
 +
* Tile array similar to [http://wiki.ttdpatch.net/tiki-index.php?page=Action0Industries Industry Property 0A]
 +
* Node array.  Each node has an x,y,z position, and a flag byte (hangar, contact point, loading bay) used for overbuilding, buying/selling aircraft in the hangar and, in the case of the contact point(s), aircraft interception from outside the state machine.
 +
 +
==Action 2 Airports==
 +
The icon to show in the build list.
 +
 +
==Var Action 2 Airports==
 +
* Year built
 +
* Days since an aircraft last arrived or was loading at any node
 +
* Days since an aircraft last arrived or was loading at a specific node (60+)
 +
* [http://wiki.ttdpatch.net/tiki-index.php?page=VariationalAction2 Variable 7C], 16 4-byte slots of persistent data
 +
 +
==Callbacks for Airports==
 +
 +
===statemachine callback===
 +
The statemachine callback is called when an aircraft wants to leave a node.  The 3rd nibble contains the following flags:
 +
 +
*0 = fly/taxi to the node specified in the low byte
 +
*1 = change the movement state to the value specified in the low byte and reiterate
 +
*2 = turn to the heading specified in the low byte and wait for 16 ticks before reiterating
 +
*8 = begin loading/unloading
 +
*A = play the sound effect specified in the low byte and reiterate
 +
*E = throw the alert message specified in the low byte and stop the aircraft (if it's on the ground) or leave the statemachine and move to the next order (if it's in the air)
 +
*F = leave the statemachine and move to the next order
 +
 +
(note: throwing an alert and stopping the aircraft is probably not a good idea unless the aircraft is in a hangar!)
 +
 +
Var 10 contains the number of the node that was triggered.
 +
Var 11 contains information on the aircraft's current plans:
 +
*0 = heading for a bay
 +
*1 = heading for a hangar
 +
*2 = heading for an exit
 +
*80 = this is a reiteration after waiting
 +
 +
Type 82 within the callback gets the variables of the aircraft which triggered the callback.  ''This callback + Variable 7C completely replaces the hardcoded state machine!!''
 +
 +
=Aircraft=
 +
Aircraft gain Variable 7C, and an additional property to provide information to the airport state machine.
 +
 +
==Action 0 Aircraft==
 +
===2B = basic aircraft information.===
 +
 +
*01-0F = runway length required
 +
*10 = large aircraft
 +
*20 = seaplane (only)
 +
*40 = amphibious
 +
*80 = special aircraft (airport may want to send it to a special bay/apron).
 +
 +
This property goes into 'uu' in [http://wiki.ttdpatch.net/tiki-index.php?page=VarAction2Vehicles Vehicle Variable 42].

Revision as of 01:38, 10 April 2009

This is a proposed spec only

Preamble

Contents

Airport Tiles

Airport tiles are the graphical component of the airport. They have no direct interaction or effect on the state machine on or aircraft.

Action 0 Airport Tiles

  • Land shape flags
  • Animation information
  • Animation speed

as per Properties for industry tiles 0D, 0F and 10

  • Tile Subname string (ie, clicking ? on this tile will give you "AirportName (TileSubname)")

Action 2 Airport Tiles

as per Action 2 for houses and industry tiles

Var Action 2 Airport Tiles

as per Variational Action 2 Variables for Industry Tiles, except of course "industry" -> "airport".

Callbacks for Airport Tiles

  • Next animation frame (1A/26/141)
  • Animation control (1B/25/140)
  • Custom shape check (2F)
  • Decide drawing default foundations (30)
  • Disable autosloping for industry tiles (3C)

Airports

Airports are the logical component of the airport. The airport contains the state machine.

Action 0 Airports

  • Name
  • Class
  • Small/Large/Helipad/Oilrig (note: for backwards compatibility with vehicle var 44)
  • Years available
  • Catchment area
  • Noise level
  • Text string to show in the build list
  • Cost per new tile when building
  • Cost per overbuilt tile when building
  • Yearly facility maintanance cost (possibly ?)
  • Tile array similar to Industry Property 0A
  • Node array. Each node has an x,y,z position, and a flag byte (hangar, contact point, loading bay) used for overbuilding, buying/selling aircraft in the hangar and, in the case of the contact point(s), aircraft interception from outside the state machine.

Action 2 Airports

The icon to show in the build list.

Var Action 2 Airports

  • Year built
  • Days since an aircraft last arrived or was loading at any node
  • Days since an aircraft last arrived or was loading at a specific node (60+)
  • Variable 7C, 16 4-byte slots of persistent data

Callbacks for Airports

statemachine callback

The statemachine callback is called when an aircraft wants to leave a node. The 3rd nibble contains the following flags:

  • 0 = fly/taxi to the node specified in the low byte
  • 1 = change the movement state to the value specified in the low byte and reiterate
  • 2 = turn to the heading specified in the low byte and wait for 16 ticks before reiterating
  • 8 = begin loading/unloading
  • A = play the sound effect specified in the low byte and reiterate
  • E = throw the alert message specified in the low byte and stop the aircraft (if it's on the ground) or leave the statemachine and move to the next order (if it's in the air)
  • F = leave the statemachine and move to the next order

(note: throwing an alert and stopping the aircraft is probably not a good idea unless the aircraft is in a hangar!)

Var 10 contains the number of the node that was triggered. Var 11 contains information on the aircraft's current plans:

  • 0 = heading for a bay
  • 1 = heading for a hangar
  • 2 = heading for an exit
  • 80 = this is a reiteration after waiting

Type 82 within the callback gets the variables of the aircraft which triggered the callback. This callback + Variable 7C completely replaces the hardcoded state machine!!

Aircraft

Aircraft gain Variable 7C, and an additional property to provide information to the airport state machine.

Action 0 Aircraft

2B = basic aircraft information.

  • 01-0F = runway length required
  • 10 = large aircraft
  • 20 = seaplane (only)
  • 40 = amphibious
  • 80 = special aircraft (airport may want to send it to a special bay/apron).

This property goes into 'uu' in Vehicle Variable 42.

Personal tools