OpenTTD GameScript API 20241220-master-g59680867c3
|
Class that handles all engine related functions. More...
#include <script_engine.hpp>
Static Public Member Functions | |
static bool | IsValidEngine (EngineID engine_id) |
Checks whether the given engine type is valid. | |
static bool | IsBuildable (EngineID engine_id) |
Checks whether the given engine type is buildable for a company. | |
static string | GetName (EngineID engine_id) |
Get the name of an engine. | |
static CargoID | GetCargoType (EngineID engine_id) |
Get the cargo-type of an engine. | |
static bool | CanRefitCargo (EngineID engine_id, CargoID cargo_id) |
Check if the cargo of an engine can be refitted to your requested. | |
static bool | CanPullCargo (EngineID engine_id, CargoID cargo_id) |
Check if the engine can pull a wagon with the given cargo. | |
static int | GetCapacity (EngineID engine_id) |
Get the capacity of an engine. | |
static int | GetReliability (EngineID engine_id) |
Get the reliability of an engine. | |
static int | GetMaxSpeed (EngineID engine_id) |
Get the maximum speed of an engine. | |
static Money | GetPrice (EngineID engine_id) |
Get the new cost of an engine. | |
static int | GetMaxAge (EngineID engine_id) |
Get the maximum age of a brand new engine. | |
static Money | GetRunningCost (EngineID engine_id) |
Get the running cost of an engine. | |
static int | GetPower (EngineID engine_id) |
Get the power of an engine. | |
static int | GetWeight (EngineID engine_id) |
Get the weight of an engine. | |
static int | GetMaxTractiveEffort (EngineID engine_id) |
Get the maximum tractive effort of an engine. | |
static GSDate::Date | GetDesignDate (EngineID engine_id) |
Get the calendar-date this engine was designed. | |
static GSVehicle::VehicleType | GetVehicleType (EngineID engine_id) |
Get the type of an engine. | |
static bool | IsWagon (EngineID engine_id) |
Check if an engine is a wagon. | |
static bool | CanRunOnRail (EngineID engine_id, GSRail::RailType track_rail_type) |
Check if a train vehicle can run on a RailType. | |
static bool | HasPowerOnRail (EngineID engine_id, GSRail::RailType track_rail_type) |
Check if a train engine has power on a RailType. | |
static bool | CanRunOnRoad (EngineID engine_id, GSRoad::RoadType road_type) |
Check if a road vehicle can run on a RoadType. | |
static bool | HasPowerOnRoad (EngineID engine_id, GSRoad::RoadType road_type) |
Check if a road vehicle has power on a RoadType. | |
static GSRoad::RoadType | GetRoadType (EngineID engine_id) |
Get the RoadType of the engine. | |
static GSRail::RailType | GetRailType (EngineID engine_id) |
Get the RailType of the engine. | |
static bool | IsArticulated (EngineID engine_id) |
Check if the engine is articulated. | |
static GSAirport::PlaneType | GetPlaneType (EngineID engine_id) |
Get the PlaneType of the engine. | |
static int | GetMaximumOrderDistance (EngineID engine_id) |
Get the maximum allowed distance between two orders for an engine. | |
static bool | EnableForCompany (EngineID engine_id, GSCompany::CompanyID company_id) |
Allows a company to use an engine before its intro date or after retirement. | |
static bool | DisableForCompany (EngineID engine_id, GSCompany::CompanyID company_id) |
Forbids a company to use an engine before its natural retirement. | |
Class that handles all engine related functions.
Check if the engine can pull a wagon with the given cargo.
engine_id | The engine to check. |
cargo_id | The cargo to check. |
Check if the cargo of an engine can be refitted to your requested.
If the engine already allows this cargo, the function also returns true. In case of articulated vehicles the function decides whether at least one part can carry the cargo.
engine_id | The engine to check for refitting. |
cargo_id | The cargo to check for refitting. |
|
static |
Check if a train vehicle can run on a RailType.
engine_id | The engine to check. |
track_rail_type | The type you want to check. |
|
static |
Check if a road vehicle can run on a RoadType.
engine_id | The engine to check. |
road_type | Another RoadType. |
|
static |
Forbids a company to use an engine before its natural retirement.
engine_id | The engine to disable. |
company_id | The company to forbid using the engine. |
|
static |
Allows a company to use an engine before its intro date or after retirement.
engine_id | The engine to enable. |
company_id | The company to allow using the engine. |
|
static |
Get the capacity of an engine.
In case it can transport multiple cargoes, it returns the first/main.
engine_id | The engine to get the capacity of. |
Get the cargo-type of an engine.
In case it can transport multiple cargoes, it returns the first/main.
engine_id | The engine to get the cargo-type of. |
|
static |
Get the calendar-date this engine was designed.
engine_id | The engine to get the design date of. |
|
static |
Get the maximum age of a brand new engine.
engine_id | The engine to get the maximum age of. |
|
static |
Get the maximum allowed distance between two orders for an engine.
The distance returned is a vehicle-type specific distance independent from other map distances, you may use the result of this function to compare it with the result of GSOrder::GetOrderDistance.
engine_id | The engine to get the max distance for. |
|
static |
Get the maximum speed of an engine.
engine_id | The engine to get the maximum speed of. |
|
static |
Get the maximum tractive effort of an engine.
engine_id | The engine to get the maximum tractive effort of. |
|
static |
Get the name of an engine.
engine_id | The engine to get the name of. |
|
static |
Get the PlaneType of the engine.
engine_id | The engine to get the PlaneType of. |
|
static |
Get the power of an engine.
engine_id | The engine to get the power of. |
Get the new cost of an engine.
engine_id | The engine to get the new cost of. |
|
static |
Get the RailType of the engine.
engine_id | The engine to get the RailType of. |
|
static |
Get the reliability of an engine.
The value is between 0 and 100, where 100 means 100% reliability (never breaks down) and 0 means 0% reliability (you most likely don't want to buy it).
engine_id | The engine to get the reliability of. |
|
static |
Get the RoadType of the engine.
engine_id | The engine to get the RoadType of. |
Get the running cost of an engine.
engine_id | The engine to get the running cost of. |
|
static |
Get the type of an engine.
engine_id | The engine to get the type of. |
|
static |
Get the weight of an engine.
engine_id | The engine to get the weight of. |
|
static |
Check if a train engine has power on a RailType.
engine_id | The engine to check. |
track_rail_type | Another RailType. |
|
static |
Check if a road vehicle has power on a RoadType.
engine_id | The engine to check. |
road_type | Another RoadType. |
|
static |
Check if the engine is articulated.
engine_id | The engine to check. |
|
static |
Checks whether the given engine type is buildable for a company.
Outside GSCompanyMode scope (GSCompanyMode::IsDeity) the function checks whether the engine is currently buildable by all companies (no exclusive preview).
engine_id | The engine to check. |
|
static |
Checks whether the given engine type is valid.
An engine is valid for a company if it has at least one vehicle of this engine or it's currently buildable. Outside GSCompanyMode scope (GSCompanyMode::IsDeity) the function reports all engines valid, which were or will be available at some point.
engine_id | The engine to check. |
|
static |
Check if an engine is a wagon.
engine_id | The engine to check. |