|
Simutrans-Squirrel-API OTRP v63_4
|
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_road (player_x pl, coord3d start, coord3d end, way_desc_x way, bool straight, table args) |
| 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, dir rotaton) |
| 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 | can_set_slope (player_x pl, coord3d pos, slope slope) |
| static integer | slope_get_price (slope) |
| static string | build_sign_at (player_x pl, coord3d pos, sign_desc_x sign) |
| static string | set_stop_before_check (player_x pl, coord3d pos, integer val) |
| static string | set_start_signal (player_x pl, coord3d pos, integer val) |
| static string | set_advance_to_end (player_x pl, coord3d pos, integer val) |
| static string | set_guide_signal (player_x pl, coord3d pos, int val) |
| static string | set_choose_signal (player_x pl, coord3d pos, int val) |
| static string | set_skip_default_route (player_x pl, coord3d pos, int val) |
| static string | set_length_based (player_x pl, coord3d pos, int val) |
| static string | set_margin_length (player_x pl, coord3d pos, int val) |
| static string | set_two_ways (player_x pl, coord3d pos, integer val) |
| static string | build_wayobj (player_x pl, coord3d start, coord3d end, wayobj_desc_x wayobj) |
| static string | change_climate_at (player_x pl, coord3d pos, integer climate) |
| static string | grid_lower (player_x pl, coord3d pos) |
| static string | grid_raise (player_x pl, coord3d pos) |
Proof-of-concept to make tools available to scripts.
The default_param is not checked. Use at own risk.
Definition at line 9 of file api_command.cc.
| command_x::command_x | ( | tool_ids | id | ) |
Constructor to obtain a tool.
| id | id of the tool |
|
static |
Build a bridge. Similar to drag-and-build of bridges in-game.
| pl | player to pay for the work |
| start | coordinate, where bridge begins |
| end | coordinate, where bridge ends |
| bridge | type of bridge to be built |
|
static |
Build a bridge. Similar to one click with mouse on suitable start tile: program will figure out bridge span itself.
| pl | player to pay for the work |
| start | coordinate, where bridge begins, the end point will be automatically determined |
| bridge | type of bridge to be built |
|
static |
Build a depot.
| pl | player to pay for the work |
| pos | position to place the depot |
| depot | type of depot to be built |
|
static |
Build a road.
| pl | player to pay for the work |
| start | coordinate, where work begins |
| end | coordinate, where work ends |
| way | type of way to be built |
| straight | force building of straight ways, similar as building way with control key pressed |
| args | table of arguments (keep_city_roads, overtaking_mode, street_flag, height_offset, vehicle_offset, allow_closed_diagonal (default true)) |
|
static |
Build signal / road-sign. If such a sign already exists then change its direction.
| pl | player to pay for the work |
| pos | position of tile |
| sign | type of road-sign or signal to be built |
|
static |
Build a station or station extension building.
| pl | player to pay for the work |
| pos | position to place the depot |
| station | type of station to be built |
| rotaton | (optional parameter) rotation of building (only used for flat docks, put direction from land to water here) |
|
static |
Build a way.
| pl | player to pay for the work |
| start | coordinate, where work begins |
| end | coordinate, where work ends |
| way | type of way to be built |
| straight | force building of straight ways, similar as building way with control key pressed |
|
static |
Build way-object.
| pl | player to pay for the work |
| start | coordinate, where work begins |
| end | coordinate, where work ends |
| wayobj | type of wayobj to be built |
Checks whether player pl can do this terraforming.
| pl | player |
| pos | position |
| slope | new slope, can also be one of slope::all_up_slope or slope::all_down_slope |
Change climate of tile
| pl | player to pay for the work |
| pos | coordinate of tile |
| climate | new climate, possible values see climates |
| integer command_x::get_flags | ( | ) |
Lower grid point
| pl | player to pay for the work |
| pos | coordinate of tile, grid point in nw corner will be lowered |
Raise grid point
| pl | player to pay for the work |
| pos | coordinate of tile, grid point in nw corner will be lowered |
Restore natural slope of one tile.
| pl | player to pay for the work |
| pos | position of tile |
Sets "advance to end" flag on a choose signal.
| pl | player executing the command |
| pos | position of signal |
| val | new state of the flag |
Sets "choose signal" flag on a signal.
| pl | player executing the command |
| pos | position of signal |
| val | new state of the flag |
| void command_x::set_flags | ( | integer | flags | ) |
Sets flags for this tool. Simulates pressing shift or ctrl while clicking with mouse.
| flags | bitmap, 1 = shift pressed, 2 = ctrl pressed |
Sets "require parent convoy to enter" (guide signal) flag on a signal.
| pl | player executing the command |
| pos | position of signal |
| val | new state of the flag |
Sets "length based" flag on a choose signal.
| pl | player executing the command |
| pos | position of signal |
| val | new state of the flag |
Sets "margin length" on a choose signal.
| pl | player executing the command |
| pos | position of signal |
| val | new margin length |
Sets "skip default route" flag on a choose signal.
| pl | player executing the command |
| pos | position of signal |
| val | new state of the flag |
Modify the slope of one tile.
| pl | player to pay for the work |
| pos | position of tile |
| slope | new slope, can also be one of slope::all_up_slope or slope::all_down_slope. |
Set or clear the "start signal" flag on a rail signal. When set, a convoy in CAN_START or CAN_START_ONE_MONTH state checks whether this signal (the next signal ahead) is clear before departing. If the signal is RED the convoy stays put; if GREEN it departs normally.
| pl | player who owns the signal |
| pos | position of the signal tile |
| val | 1 to enable, 0 to disable |
Set or clear the "stop before check" flag on a rail signal. Applicable to simple signals, longblock signals and choose signals.
| pl | player who owns the signal |
| pos | position of the signal tile |
| val | 1 to enable, 0 to disable |
Set or clear the "allow reverse passage" (two ways) flag of a signal. When set (true), trains coming from the reverse direction are allowed to pass the signal. When cleared (false), the signal strictly blocks trains from the reverse direction.
| pl | player who owns the signal |
| pos | position of the signal tile |
| val | 1 to enable, 0 to disable |
Does the dirty work.
| pl | player to pay for the work |
| pos | coordinate, where something should happen |
Does the dirty work.
| pl | player to pay for the work |
| pos | coordinate, where something should happen |
| param | magic parameter string |
Does the dirty work. Needs two positions for start and end of the work, for e.g., road building.
| pl | player to pay for the work |
| start | coordinate, where work begins |
| end | coordinate, where work ends |
| param | magic parameter string |