OpenTTD GameScript API
20241117-master-ga6c526cfa0
|
Class that handles all industry related functions. More...
Public Types | |
enum | CargoAcceptState { CAS_NOT_ACCEPTED , CAS_ACCEPTED , CAS_TEMP_REFUSED } |
Ways for an industry to accept a cargo. More... | |
enum | IndustryControlFlags { INDCTL_NO_PRODUCTION_DECREASE , INDCTL_NO_PRODUCTION_INCREASE , INDCTL_NO_CLOSURE , INDCTL_EXTERNAL_PROD_LEVEL } |
Control flags for industry. More... | |
Static Public Member Functions | |
static int | GetIndustryCount () |
Gets the number of industries. More... | |
static bool | IsValidIndustry (IndustryID industry_id) |
Checks whether the given industry index is valid. More... | |
static IndustryID | GetIndustryID (TileIndex tile) |
Get the IndustryID of a tile, if there is an industry. More... | |
static string | GetName (IndustryID industry_id) |
Get the name of the industry. More... | |
static GSDate::Date | GetConstructionDate (IndustryID industry_id) |
Get the construction calendar-date of an industry. More... | |
static bool | SetText (IndustryID industry_id, Text *text) |
Set the custom text of an industry, shown in the GUI. More... | |
static CargoAcceptState | IsCargoAccepted (IndustryID industry_id, CargoID cargo_id) |
See whether an industry currently accepts a certain cargo. More... | |
static int | GetStockpiledCargo (IndustryID industry_id, CargoID cargo_id) |
Get the amount of cargo stockpiled for processing. More... | |
static int | GetLastMonthProduction (IndustryID industry_id, CargoID cargo_id) |
Get the total last economy-month's production of the given cargo at an industry. More... | |
static int | GetLastMonthTransported (IndustryID industry_id, CargoID cargo_id) |
Get the total amount of cargo transported from an industry last economy-month. More... | |
static int | GetLastMonthTransportedPercentage (IndustryID industry_id, CargoID cargo_id) |
Get the percentage of cargo transported from an industry last economy-month. More... | |
static TileIndex | GetLocation (IndustryID industry_id) |
Gets the location of the industry. More... | |
static int | GetAmountOfStationsAround (IndustryID industry_id) |
Get the number of stations around an industry. More... | |
static int | GetDistanceManhattanToTile (IndustryID industry_id, TileIndex tile) |
Get the manhattan distance from the tile to the GSIndustry::GetLocation() of the industry. More... | |
static int | GetDistanceSquareToTile (IndustryID industry_id, TileIndex tile) |
Get the square distance from the tile to the GSIndustry::GetLocation() of the industry. More... | |
static bool | IsBuiltOnWater (IndustryID industry_id) |
Is this industry built on water. More... | |
static bool | HasHeliport (IndustryID industry_id) |
Does this industry have a heliport? More... | |
static TileIndex | GetHeliportLocation (IndustryID industry_id) |
Gets the location of the industry's heliport. More... | |
static bool | HasDock (IndustryID industry_id) |
Does this industry have a dock? More... | |
static TileIndex | GetDockLocation (IndustryID industry_id) |
Gets the location of the industry's dock. More... | |
static IndustryType | GetIndustryType (IndustryID industry_id) |
Get the IndustryType of the industry. More... | |
static int | GetLastProductionYear (IndustryID industry_id) |
Get the last economy-year this industry had any production output. More... | |
static GSDate::Date | GetCargoLastAcceptedDate (IndustryID industry_id, CargoID cargo_type) |
Get the last economy-date this industry accepted any cargo delivery. More... | |
static int | GetControlFlags (IndustryID industry_id) |
Get the current control flags for an industry. More... | |
static bool | SetControlFlags (IndustryID industry_id, int control_flags) |
Change the control flags for an industry. More... | |
static GSCompany::CompanyID | GetExclusiveSupplier (IndustryID industry_id) |
Find out which company currently has the exclusive rights to deliver cargo to the industry. More... | |
static bool | SetExclusiveSupplier (IndustryID industry_id, GSCompany::CompanyID company_id) |
Sets or resets the company that has exclusive right to deliver cargo to the industry. More... | |
static GSCompany::CompanyID | GetExclusiveConsumer (IndustryID industry_id) |
Find out which company currently has the exclusive rights to take cargo from the industry. More... | |
static bool | SetExclusiveConsumer (IndustryID industry_id, GSCompany::CompanyID company_id) |
Sets or resets the company that has exclusive right to take cargo from the industry. More... | |
static int | GetProductionLevel (IndustryID industry_id) |
Gets the current production level of an industry. More... | |
static bool | SetProductionLevel (IndustryID industry_id, int prod_level, bool show_news, Text *custom_news) |
Sets the current production level of an industry. More... | |
Class that handles all industry related functions.
Control flags for industry.
|
static |
Get the number of stations around an industry.
All stations that can service the industry are counted, your own stations but also your opponents stations.
industry_id | The index of the industry. |
|
static |
Get the last economy-date this industry accepted any cargo delivery.
industry_id | The index of the industry. |
cargo_type | The cargo to query, or INVALID_CARGO to query latest of all accepted cargoes. |
|
static |
Get the construction calendar-date of an industry.
industry_id | The index of the industry. |
|
static |
Get the current control flags for an industry.
industry_id | The index of the industry. |
|
static |
Get the manhattan distance from the tile to the GSIndustry::GetLocation() of the industry.
industry_id | The industry to get the distance to. |
tile | The tile to get the distance to. |
|
static |
Get the square distance from the tile to the GSIndustry::GetLocation() of the industry.
industry_id | The industry to get the distance to. |
tile | The tile to get the distance to. |
|
static |
Gets the location of the industry's dock.
industry_id | The index of the industry. |
|
static |
Find out which company currently has the exclusive rights to take cargo from the industry.
industry_id | The index of the industry. |
|
static |
Find out which company currently has the exclusive rights to deliver cargo to the industry.
industry_id | The index of the industry. |
|
static |
Gets the location of the industry's heliport.
industry_id | The index of the industry. |
|
static |
Gets the number of industries.
|
static |
Get the IndustryID of a tile, if there is an industry.
tile | The tile to find the IndustryID of. |
|
static |
Get the IndustryType of the industry.
industry_id | The index of the industry. |
|
static |
Get the total last economy-month's production of the given cargo at an industry.
industry_id | The index of the industry. |
cargo_id | The index of the cargo. |
|
static |
Get the total amount of cargo transported from an industry last economy-month.
industry_id | The index of the industry. |
cargo_id | The index of the cargo. |
|
static |
Get the percentage of cargo transported from an industry last economy-month.
industry_id | The index of the industry. |
cargo_id | The index of the cargo. |
|
static |
Get the last economy-year this industry had any production output.
industry_id | The index of the industry. |
|
static |
Gets the location of the industry.
industry_id | The index of the industry. |
|
static |
Get the name of the industry.
industry_id | The industry to get the name of. |
|
static |
Gets the current production level of an industry.
industry_id | The index of the industry. |
|
static |
Get the amount of cargo stockpiled for processing.
industry_id | The index of the industry. |
cargo_id | The index of the cargo. |
|
static |
Does this industry have a dock?
industry_id | The index of the industry. |
|
static |
Does this industry have a heliport?
industry_id | The index of the industry. |
|
static |
Is this industry built on water.
industry_id | The index of the industry. |
|
static |
See whether an industry currently accepts a certain cargo.
industry_id | The index of the industry. |
cargo_id | The index of the cargo. |
|
static |
Checks whether the given industry index is valid.
industry_id | The index to check. |
|
static |
Change the control flags for an industry.
industry_id | The index of the industry. |
control_flags | New flags as a combination of IndustryControlFlags values. |
|
static |
Sets or resets the company that has exclusive right to take cargo from the industry.
industry_id | The index of the industry. |
company_id | The company to set (GSCompany::COMPANY_INVALID to reset). |
|
static |
Sets or resets the company that has exclusive right to deliver cargo to the industry.
industry_id | The index of the industry. |
company_id | The company to set (GSCompany::COMPANY_INVALID to reset). |
|
static |
Sets the current production level of an industry.
industry_id | The index of the industry. |
prod_level | The production level to set. |
show_news | If set to true and the production changed, generate a production change news message. If set to false, no news message is shown. |
custom_news | Custom news message text to override the default news text with. Pass null to use the default text. Only used if show_news is set to true. |
|
static |
Set the custom text of an industry, shown in the GUI.
industry_id | The industry to set the custom text of. |
text | The text to set it to (can be either a raw string, or a GSText object). If null, or an empty string, is passed, the text will be removed. |