Is there any means to build a tunnel with a script?
Any of command_x functions does not seem to take a tunnel_desc_x object as parameters.
is not yet implemented
This is what I used in the tutorial:
if (pot0==0){
local t_tunn = my_tile(start_tunn)
t_tunn.remove_object(player_x(0), mo_label)
local t = command_x(tool_build_tunnel)
t.set_flags(2)
t.work(player_x(1), t_tunn, sc_tunn_name)
pot0=1
}
if (pot0==1 && pot1==0){
local t_tun = command_x(tool_build_tunnel)
local c_list = c_tun_list
local t_start = my_tile(start_tunn)
for(local j = 0; j<(c_list.len()-1);j++){
local c = coord3d(c_list[j].x, c_list[j].y, (t_start.z-j))
t_tun.work(player_x(1), t_start, c, sc_tunn_name)
command_x.set_slope(player_x(1), c, slope.all_down_slope)
}
local c_start = c_tunn1.a
local c_end = c_tunn1.b
t_tun.work(player_x(1), c_start, c_end, sc_tunn_name)
}
The first block of code is to build the tunnel entrance.
The second block is to continue the tunnel going up / down a slope.
scenario <> script ai <> script tool
script ai
https://www.simutrans-forum.de/mybb/showthread.php?tid=9313&pid=119681#pid119681 (https://www.simutrans-forum.de/mybb/showthread.php?tid=9313&pid=119681#pid119681)
Quote from: 'Dwachs2' pid='119681' dateline='1615826019'
Das Problem mit Tunnel ist, das um einen Tunnel zu bauen, man Felder testen muss, die es gar nicht gibt (also im Untergrund).
...
Thanks to Yona-TYT, I got how to build a tunnel with a script.
However, since command_x.build_bridge() makes bridge constructions very handy, command_x.build_tunnel() should be very nice 8)