Simutrans-Squirrel-API
Public Member Functions | Static Public Member Functions | List of all members

Public Member Functions

 command_x (tool_ids id)
 
integer get_flags ()
 
void set_flags (integer flags)
 
string work (player_x pl, coord3d pos)
 
string work (player_x pl, coord3d pos, string param)
 
string work (player_x pl, coord3d start, coord3d end, string param)
 

Static Public Member Functions

static string build_way (player_x pl, coord3d start, coord3d end, way_desc_x way, bool straight)
 
static string build_depot (player_x pl, coord3d pos, building_desc_x depot)
 
static string build_station (player_x pl, coord3d pos, building_desc_x station)
 
static string build_bridge (player_x pl, coord3d start, coord3d end, bridge_desc_x bridge)
 
static string build_bridge_at (player_x pl, coord3d start, bridge_desc_x bridge)
 
static string set_slope (player_x pl, coord3d pos, slope slope)
 
static string restore_slope (player_x pl, coord3d pos)
 
static string build_sign_at (player_x pl, coord3d pos, sign_desc_x sign)
 

Detailed Description

Proof-of-concept to make tools available to scripts.

The default_param is not checked. Use at own risk.

Definition at line 8 of file api_command.cc.

Constructor & Destructor Documentation

command_x::command_x ( tool_ids  id)

Constructor to obtain a tool.

Parameters
idid of the tool

Member Function Documentation

static string command_x::build_bridge ( player_x  pl,
coord3d  start,
coord3d  end,
bridge_desc_x  bridge 
)
static

Build a bridge. Similar to drag-and-build of bridges in-game.

Parameters
plplayer to pay for the work
startcoordinate, where bridge begins
endcoordinate, where bridge ends
bridgetype of bridge to be built
static string command_x::build_bridge_at ( player_x  pl,
coord3d  start,
bridge_desc_x  bridge 
)
static

Build a bridge. Similar to one click with mouse on suitable start tile: program will figure out bridge span itself.

Parameters
plplayer to pay for the work
startcoordinate, where bridge begins, the end point will be automatically determined
bridgetype of bridge to be built
static string command_x::build_depot ( player_x  pl,
coord3d  pos,
building_desc_x  depot 
)
static

Build a depot.

Parameters
plplayer to pay for the work
posposition to place the depot
depottype of depot to be built
static string command_x::build_sign_at ( player_x  pl,
coord3d  pos,
sign_desc_x  sign 
)
static

Build signal / road-sign. If such a sign already exists then change its direction.

Parameters
plplayer to pay for the work
posposition of tile
signtype of road-sign or signal to be built
static string command_x::build_station ( player_x  pl,
coord3d  pos,
building_desc_x  station 
)
static

Build a station or station extension building.

Parameters
plplayer to pay for the work
posposition to place the depot
stationtype of station to be built
static string command_x::build_way ( player_x  pl,
coord3d  start,
coord3d  end,
way_desc_x  way,
bool  straight 
)
static

Build a way.

Parameters
plplayer to pay for the work
startcoordinate, where work begins
endcoordinate, where work ends
waytype of way to be built
straightforce building of straight ways, similar as building way with control key pressed
integer command_x::get_flags ( )
Returns
flags set for this tool
static string command_x::restore_slope ( player_x  pl,
coord3d  pos 
)
static

Restore natural slope of one tile.

Parameters
plplayer to pay for the work
posposition of tile
void command_x::set_flags ( integer  flags)

Sets flags for this tool. Simulates pressing shift or ctrl while clicking with mouse.

Parameters
flagsbitmap, 1 = shift pressed, 2 = ctrl pressed
static string command_x::set_slope ( player_x  pl,
coord3d  pos,
slope  slope 
)
static

Modify the slope of one tile.

Parameters
plplayer to pay for the work
posposition of tile
slopenew slope, can also be one of slope::all_up_slope or slope::all_down_slope.
string command_x::work ( player_x  pl,
coord3d  pos 
)

Does the dirty work.

Note
In network games script will be suspended until the command is executed.
Parameters
plplayer to pay for the work
poscoordinate, where something should happen
Returns
null upon success, an error string otherwise
string command_x::work ( player_x  pl,
coord3d  pos,
string  param 
)

Does the dirty work.

Note
In network games script will be suspended until the command is executed.
Parameters
plplayer to pay for the work
poscoordinate, where something should happen
parammagic parameter string
Returns
null upon success, an error string otherwise
string command_x::work ( player_x  pl,
coord3d  start,
coord3d  end,
string  param 
)

Does the dirty work. Needs two positions for start and end of the work, for e.g., road building.

Note
In network games script will be suspended until the command is executed.
Parameters
plplayer to pay for the work
startcoordinate, where work begins
endcoordinate, where work ends
parammagic parameter string
Returns
null upon success, an error string otherwise

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