MinchinWeb's MetaLibrary v.11
Library functions for OpenTTD AI (and GS) writers.
Loading...
Searching...
No Matches
_MinchinWeb_Engine_ Class Reference

Engine functions. More...

Classes

class  Info

Private Member Functions

 constructor ()

Static Private Member Functions

function Rate2 (EngineID, Cargo, TargetCapacity, MaxSpend=0)
 Vehicle Scoring v2. Deprecated in favour of v3.
function Rate3 (EngineID, Cargo, MonthlyProduction, TravelDistance, PayDistance=0, MaxSpend=0)
 Vehicle Scoring v3.

Detailed Description

Engine functions.

Version
v.1 (2025-07-19)
Author
W. Minchin (MinchinWeb)
Since
MetaLibrary v.11

These functions related to Engines.

Definition at line 25 of file Engine.nut.

Member Function Documentation

◆ constructor()

_MinchinWeb_Engine_::constructor ( )
inlineprivate

Definition at line 28 of file Engine.nut.

◆ Rate2()

function _MinchinWeb_Engine_::Rate2 ( EngineID ,
Cargo ,
TargetCapacity ,
MaxSpend = 0 )
staticprivate

Vehicle Scoring v2. Deprecated in favour of v3.

Given an EngineID, the function will score them; higher is better.

Parameters
CargoCargo 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.
MaxSpendHard upper limit on Engine cost. Set to zero (the default) to ignore. Does not include retrofit costs.
Note
Designed to run as a valuator on a AIList of EngineID's.
Capacity is measured in the default cargo.
Assumes this vehicle will be continuously replaced, rather than over a pre-defined "lifetime".
Does not check for vehicles type (assumes you'll do that)
Todo

Add example of validator code.

Implement vehicle capacity in given cargo.

Since
MetaLibrary v10.1
See also
_MinchinWeb_Marine_.RateShips2()
Rate3()

Definition at line 103 of file Engine.nut.

◆ Rate3()

function _MinchinWeb_Engine_::Rate3 ( EngineID ,
Cargo ,
MonthlyProduction ,
TravelDistance ,
PayDistance = 0,
MaxSpend = 0 )
staticprivate

Vehicle Scoring v3.

Given an EngineID, the function will score them; higher is better.

Parameters
CargoCargo you want to carry. Ensure that the ship can retrofit to the desired cargo.
MonthlyProductionAmount of cargo produced in a month.
TravelDistanceThe distance (in map tiles) that the engine is expected to travel between pickup and drop off. Assumes that the return distance is the same.
PayDistanceThe Manhattan distance between the source and destination (which is what is used for payments). If set to 0 (the default), TravelDistance will be used instead.
MaxSpendHard upper limit on Engine cost. Set to zero (the default) to ignore. Does not include retrofit costs.
Note
Designed to run as a valuator on a AIList of EngineID's.
Capacity is measured in the default cargo.
Assumes this vehicle will be continuously replaced, rather than over a pre-defined "lifetime".
Does not check for vehicles type (assumes you'll do that)
Will rate invalid vehicles as "0", which may be selected if every other vehicle would loose you money (as shown by a negative score).
Todo

Add example of validator code.

Implement vehicle capacity in given cargo.

Since
MetaLibrary v10.1
See also
_MinchinWeb_Marine_.RateShips3()

Definition at line 175 of file Engine.nut.


The documentation for this class was generated from the following file: