Simutrans-Squirrel-API
Modules | Classes | Functions
Functions to alter the state of the game and map

Modules

 Functions to rename something in the game
 

Classes

class  command_x
 

Functions

void depot_x::append_vehicle (player_x pl, convoy_x cnv, vehicle_desc_x desc)
 
void line_x::change_schedule (player_x, schedule_x)
 
void convoy_x::change_schedule (player_x, schedule_x)
 
string city_x::change_size (integer delta)
 
static string label_x::create (coord pos, player_x pl, string text)
 
void player_x::create_line (way_types wt)
 
void line_x::destroy (player_x)
 
void convoy_x::destroy (player_x)
 
string tile_x::remove_object (player_x pl, map_objects type)
 
void city_x::set_citygrowth_enabled (bool)
 
void convoy_x::set_line (player_x player, line_x line)
 
void depot_x::start_all_convoys (player_x)
 
void depot_x::start_convoy (player_x, convoy_x)
 
void convoy_x::toggle_withdraw (player_x)
 

Detailed Description

The player parameter in these functions represents the player that executes the command and pays for it. If the call is from an AI player then the parameter is set to player_x::self, and it will be checked whether the player is permitted to execute the command. Calls from scenario always pass this check.

In network games, the script is suspended until the command is executed, which is transparent to the script. Hence such commands cannot be called from within functions that should return immediately, see Functions that should return quickly..

Function Documentation

◆ append_vehicle()

void depot_x::append_vehicle ( player_x  pl,
convoy_x  cnv,
vehicle_desc_x  desc 
)

Append a car to the convoy in this depot. If the convoy does not exist, a new one is created first.

Parameters
plplayer owns the convoy
cnvthe convoy
descdecriptor of the vehicle

◆ change_schedule() [1/2]

void line_x::change_schedule ( player_x  ,
schedule_x   
)

Change schedule of line. Schedule should not contain doubled entries and more than two entries.

◆ change_schedule() [2/2]

void convoy_x::change_schedule ( player_x  ,
schedule_x   
)

Change schedule of convoy. Schedule should not contain doubled entries and more than two entries. This might make the convoy lose its line.

◆ change_size()

string city_x::change_size ( integer  delta)

Change city size. City will immediately grow.

Parameters
deltaCity size will change by this number.

◆ create()

static string label_x::create ( coord  pos,
player_x  pl,
string  text 
)
static

Creates a new marker.

Parameters
posposition
plowner
texttext

◆ create_line()

void player_x::create_line ( way_types  wt)

Creates a new line for the player of the given way type.

Parameters
wtway type

◆ destroy() [1/2]

void line_x::destroy ( player_x  )

Delete line

◆ destroy() [2/2]

void convoy_x::destroy ( player_x  )

Destroy the convoy. The convoy will be marked for destroying, it will be destroyed when the simulation continues. Call sleep to be sure that the convoy is destroyed before script continues.

◆ remove_object()

string tile_x::remove_object ( player_x  pl,
map_objects  type 
)

Remove object of given type from the tile. Type type must be one of the following: mo_label, mo_pedestrian, mo_city_car, mo_powerline, mo_transformer_s, mo_transformer_c, mo_signal, mo_roadsign, mo_wayobj, mo_tunnel, mo_bridge, mo_field, mo_building, mo_depot_rail. Setting type to mo_depot_rail deletes depots of every type.

Parameters
plplayer that pays for removal
typeobject type
Returns
null upon success, an error message otherwise
Warning
Does not work with all object types.

◆ set_citygrowth_enabled()

void city_x::set_citygrowth_enabled ( bool  )

Enable or disable city growth.

◆ set_line()

void convoy_x::set_line ( player_x  player,
line_x  line 
)

Assigns the convoy to the given line.

Parameters
player
line

◆ start_all_convoys()

void depot_x::start_all_convoys ( player_x  )

Start all convoys in this depot.

◆ start_convoy()

void depot_x::start_convoy ( player_x  ,
convoy_x   
)

Start the convoy in this depot.

◆ toggle_withdraw()

void convoy_x::toggle_withdraw ( player_x  )

Toggle the flag 'withdraw convoy'