25-02-2021, Thursday-15:10:06
(Dieser Beitrag wurde zuletzt bearbeitet: 25-02-2021, Thursday-15:10:55 von Andarix.)
industry_manager.nut ab Zeile 323
1906_768x640-testnew6.sve ~ 2 MByte (bis 26.04.2021)
Simutrans r9641
pak64.german 0.122.0.0.3
sqai_rail Git Code
Code:
// find route
local nexttile = []
if (cnv.get_waytype() != wt_water && cnv.get_waytype() != wt_air) {
local entries = cnv.get_schedule().entries
local start = null
local end = null
if ( entries.len() >= 2 ) {
start = tile_x(entries[0].x, entries[0].y, entries[0].z)
end = tile_x(entries[entries.len()-1].x, entries[entries.len()-1].y, entries[entries.len()-1].z)
}
local asf = astar_route_finder(cnv.get_waytype())
local result = asf.search_route([start], [end])
// result is contains routes-array or error message
// route is backward from end to start
if ("err" in result) {
gui.add_message_at(our_player, " ### no route found: " + result.err, start)
gui.add_message_at(our_player, " ### line: " + line.get_name(), world.get_time())
gui.add_message_at(our_player, " ### start: " + coord_to_string(start) + " ### end: " + coord_to_string(end), start)
return nexttile
}
else {
//gui.add_message_at(our_player, " ### route found: length = " + result.routes.len(), start)
// route found, mark tiles
foreach(node in result.routes) {
local tile = tile_x(node.x, node.y, node.z)
nexttile.append(tile)
}
sleep()
}
}
1906_768x640-testnew6.sve ~ 2 MByte (bis 26.04.2021)
Simutrans r9641
pak64.german 0.122.0.0.3
sqai_rail Git Code
Script-KI für Simutrans r10894+ / Simutrans Nightly Builds