Simutrans-Squirrel-API
Public Member Functions | Public Attributes | List of all members
factory_x Class Reference
Inheritance diagram for factory_x:
coord extend_get ingame_object

Public Member Functions

 factory_x (integer x, integer y)
 
array< integer > get_boost_electric ()
 
array< integer > get_boost_mail ()
 
array< integer > get_boost_pax ()
 
array< coordget_consumers ()
 
factory_desc_x get_desc ()
 
integer get_field_count ()
 
array< tile_xget_fields_list ()
 
array< halt_xget_halt_list ()
 
array< integer > get_mail_arrived ()
 
array< integer > get_mail_departed ()
 
array< integer > get_mail_generated ()
 
integer get_min_field_count ()
 
string get_name ()
 
array< integer > get_pax_arrived ()
 
array< integer > get_pax_departed ()
 
array< integer > get_pax_generated ()
 
array< integer > get_power ()
 
array< integer > get_production ()
 
string get_raw_name ()
 
array< coordget_suppliers ()
 
array< tile_xget_tile_list ()
 
powerline_x get_transformer ()
 
bool is_transformer_connected ()
 
bool is_valid ()
 
void set_name (string)
 
- Public Member Functions inherited from coord
string _tostring ()
 
 coord (int x, int y)
 
string href (string text)
 
coord operator* (integer fac)
 
coord operator+ (coord other)
 
coord operator- (coord other)
 
coord operator- ()
 
coord operator/ (integer fac)
 
dir to_dir ()
 

Public Attributes

table< factory_production_xinput
 
table< factory_production_xoutput
 
- Public Attributes inherited from coord
integer x
 x-coordinate
 
integer y
 y-coordinate
 

Detailed Description

Class to access information about factories. Identified by coordinate.

Definition at line 36 of file api_factory.cc.

Constructor & Destructor Documentation

◆ factory_x()

factory_x::factory_x ( integer  x,
integer  y 
)

Constructor.

Parameters
xx-coordinate
yy-coordinate

Member Function Documentation

◆ get_boost_electric()

array<integer> factory_x::get_boost_electric ( )

Get monthly statistics of production boost due to electric power supply.

Returns
array, index [0] corresponds to current month

◆ get_boost_mail()

array<integer> factory_x::get_boost_mail ( )

Get monthly statistics of production boost due to arrived mail.

Returns
array, index [0] corresponds to current month

◆ get_boost_pax()

array<integer> factory_x::get_boost_pax ( )

Get monthly statistics of production boost due to arrived passengers.

Returns
array, index [0] corresponds to current month

◆ get_consumers()

array<coord> factory_x::get_consumers ( )

Get list of consumers of this factory.

Returns
array of coordinates of consumers

◆ get_desc()

factory_desc_x factory_x::get_desc ( )
Returns
factory descriptor

◆ get_field_count()

integer factory_x::get_field_count ( )
Returns
number of fields belonging to this factory

◆ get_fields_list()

array<tile_x> factory_x::get_fields_list ( )

Get list of all tiles occupied by fields belonging to this factory.

Returns
array of tile_x objects

◆ get_halt_list()

array<halt_x> factory_x::get_halt_list ( )

Get list of all halts that serve this this factory.

Returns
array of tile_x objects

◆ get_mail_arrived()

array<integer> factory_x::get_mail_arrived ( )

Get monthly statistics of arrived mail.

Returns
array, index [0] corresponds to current month

◆ get_mail_departed()

array<integer> factory_x::get_mail_departed ( )

Get monthly statistics of departed mail.

Returns
array, index [0] corresponds to current month

◆ get_mail_generated()

array<integer> factory_x::get_mail_generated ( )

Get monthly statistics of generated mail.

Returns
array, index [0] corresponds to current month

◆ get_min_field_count()

integer factory_x::get_min_field_count ( )
Returns
minimum number of fields required

◆ get_name()

string factory_x::get_name ( )

Get (translated or custom) name of factory.

Returns
name

◆ get_pax_arrived()

array<integer> factory_x::get_pax_arrived ( )

Get monthly statistics of arrived passengers.

Returns
array, index [0] corresponds to current month

◆ get_pax_departed()

array<integer> factory_x::get_pax_departed ( )

Get monthly statistics of departed passengers.

Returns
array, index [0] corresponds to current month

◆ get_pax_generated()

array<integer> factory_x::get_pax_generated ( )

Get monthly statistics of generated passengers.

Returns
array, index [0] corresponds to current month

◆ get_power()

array<integer> factory_x::get_power ( )

Get monthly statistics of power consumption/production.

Returns
array, index [0] corresponds to current month

◆ get_production()

array<integer> factory_x::get_production ( )

Get monthly statistics of production.

Returns
array, index [0] corresponds to current month

◆ get_raw_name()

string factory_x::get_raw_name ( )

Get untranslated name of factory.

Returns
name

◆ get_suppliers()

array<coord> factory_x::get_suppliers ( )

Get list of consumers of this factory.

Returns
array of coordinates of suppliers

◆ get_tile_list()

array<tile_x> factory_x::get_tile_list ( )

Get list of all tiles occupied by buildings belonging to this factory.

Returns
array of tile_x objects

◆ get_transformer()

powerline_x factory_x::get_transformer ( )

Get connected transformer (if any).

Returns
transformer

◆ is_transformer_connected()

bool factory_x::is_transformer_connected ( )

Checks whether a transformer is connected.

Returns
name

◆ is_valid()

bool factory_x::is_valid ( )
Returns
if object is still valid.

Member Data Documentation

◆ input

table<factory_production_x> factory_x::input

Table containing input/consumption slots. Entries can be retrieved by raw name of the good (as defined in the associated pak-file).

Entries are of type factory_production_x.

To print a list of all available goods names use this example:

foreach(key,value in input) {
// print raw name of the good
print("Input slot key: " + key)
// print current storage
print("Input slot storage: " + value.get_storage()[0])
}

To catch the output of this example see Logging and error handling.

Definition at line 61 of file api_factory.cc.

◆ output

table<factory_production_x> factory_x::output

Table containing output/production slots. Entries can be retrieved by raw name of the good (as defined in the associated pak-file).

Entries are of type factory_production_x.

For an example to retrieve the list of goods, see factory_x::input.

Definition at line 70 of file api_factory.cc.


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