MinchinWeb's MetaLibrary v.11
Library functions for OpenTTD AI (and GS) writers.
|
Water and Ship related functions. More...
Static Public Member Functions | |
function | DistanceShip (TileA, TileB) |
Distance, as measured by a ship. | |
function | GetPossibleDockTiles (IndustryID) |
Tiles where a dock can be built near an industry. | |
function | GetDockFrontTiles (Tile) |
The tiles a ship can access a dock from. | |
function | BuildBuoy (Tile) |
Builds a buoy. | |
function | BuildDepot (DockTile, Front, NotNextToDock=true) |
Build a (ship) depot next to a dock. | |
function | RateShips (EngineID, Life, Cargo) |
Ship Scoring. Deprecated in favour of RateShips2(). | |
function | RateShips2 (EngineID, Cargo, TargetCapacity, MaxSpend=0) |
Ship Scoring v2. Deprecated in favour of RateShips3(). | |
function | RateShips3 (EngineID, Cargo, MonthlyProduction, Distance, MaxSpend=0) |
Ship Scoring v3. | |
function | NearestDepot (TileID) |
Nearest ship depot. |
Private Attributes | |
main = null |
Water and Ship related functions.
Definition at line 84 of file Marine.nut.
|
static |
Builds a buoy.
Attempts to build a buoy, but first checks the box within _MinchinWeb_C_.BuoyOffset() for an existing buoy, and makes sure there's nothing but water between the two. If no existing buoy is found, one is built.
Definition at line 332 of file Marine.nut.
|
static |
Build a (ship) depot next to a dock.
Attempts to build a (water) depot, but first checks the box within _MinchinWeb_C_.WaterDepotOffset() for an existing depot, and makes sure there's nothing but water between the depot and dock. If no existing depot is found, one is built.
DockTile | Must be a water tile. |
NotNextToDock | When True, will keep the dock from being built next to an existing dock. |
Definition at line 384 of file Marine.nut.
|
static |
Distance, as measured by a ship.
Assuming open ocean, ship in OpenTTD will travel 45° angle where possible, and then finish up the trip by going along a cardinal direction.
Definition at line 229 of file Marine.nut.
|
static |
The tiles a ship can access a dock from.
Given a tile, returns an array of possible 'front' tiles that a ship could access the dock from.
Tile | Can be either the land tile of a dock, or the water tile. |
Definition at line 268 of file Marine.nut.
|
static |
Tiles where a dock can be built near an industry.
Given an industry (by IndustryID), searches for possible tiles to build a dock and returns the list as an array of TileIndexs.
IndustryID | The IndustryID you wanted checked. |
Definition at line 235 of file Marine.nut.
|
static |
Nearest ship depot.
Add check that depot is connected to the given TileID.
Check that there is a depot to return.
Definition at line 537 of file Marine.nut.
|
static |
Ship Scoring. Deprecated in favour of RateShips2().
Given an EngineID, the function will score them; higher is better.
Life | Desired lifespan of route, assumed to be in years. |
Cargo | Doesn't work yet. Capacity is measured in the default cargo. |
Definition at line 492 of file Marine.nut.
|
static |
Ship Scoring v2. Deprecated in favour of RateShips3().
Given an EngineID, the function will score them; higher is better.
Cargo | Cargo you want to carry. Ensure that the ship can retrofit to the desired cargo. |
TargetCapacity | (Approximate) amount of cargo you want to carry. Often the industry's monthly production. |
MaxSpend | Hard upper limit on (upfront) Engine cost. Set to zero (the default) to ignore. Does not include retrofit costs. |
Add example of validator code.
Implement ship capacity in given cargo.
Definition at line 517 of file Marine.nut.
|
static |
Ship Scoring v3.
Given an EngineID, the function will score them; higher is better.
Cargo | Cargo you want to carry. Ensure that the ship can retrofit to the desired cargo. |
MonthlyProduction | (Approximate) amount of cargo you want to carry. Often the industry's monthly production. |
Distance | The distance (in map tiles) that the engine is expected to travel between pickup and drop off. Assumes that the return distance is the same. |
MaxSpend | Hard upper limit on (upfront) Engine cost. Set to zero (the default) to ignore. Does not include retrofit costs. |
Add example of validator code.
Implement ship capacity in given cargo.
Definition at line 527 of file Marine.nut.
|
private |
Definition at line 85 of file Marine.nut.