17-04-2020, Friday-15:49:36
(Dieser Beitrag wurde zuletzt bearbeitet: 17-04-2020, Friday-15:52:28 von Andarix.)
Wie ersetzt man in c_depot die Koordinaten?
Alles was ich bisher versucht habe mit meinem begrenztem Wissen führt zu Fehlern.
search_field definiert in welchem Umkreis um die Start- und Endstation Depots ermittelt werden.
Alles was ich bisher versucht habe mit meinem begrenztem Wissen führt zu Fehlern.
search_field definiert in welchem Umkreis um die Start- und Endstation Depots ermittelt werden.
Code:
case 5: // build depot
{
if ( print_message_box == 3 ) {
gui.add_message_at(our_player, "exists depots road", world.get_time())
}
local list_exists_depot = depot_x.get_depot_list(our_player, wt_road)
local seach_field = 5
local tile_min = [c_start.x - seach_field, c_start.y - seach_field, c_end.x - seach_field, c_end.y - seach_field]
local tile_max = [c_start.x + seach_field, c_start.y + seach_field, c_end.x + seach_field, c_end.y + seach_field]
local depot_found = false
foreach(key in list_exists_depot) {
if ( print_message_box == 3 ) {
gui.add_message_at(our_player," ... depot pos: " + key.get_pos(), world.get_time())
gui.add_message_at(our_player," ... c_start pos: " + coord_to_string(c_start) + " : c_end pos: " + coord_to_string(c_end), world.get_time())
}
if ( key.x >= tile_min[0] && key.y >= tile_min[1] && key.x <= tile_max[0] && key.y <= tile_max[1] ) {
//c_depot.x = key.x
//c_depot.y = key.y
//c_depot.z = key.z
if ( print_message_box == 3 ) {
gui.add_message_at(our_player," ---> depot found c_start: " + key.get_pos(), world.get_time())
}
break
} else if ( key.x >= tile_min[2] && key.y >= tile_min[3] && key.x <= tile_max[2] && key.y <= tile_max[3] ) {
//c_depot.x = key.x
//c_depot.y = key.y
//c_depot.z = key.z
if ( print_message_box == 3 ) {
gui.add_message_at(our_player," ---> depot found c_end: " + key.get_pos(), world.get_time())
}
break
} else {
if ( print_message_box == 3 ) {
gui.add_message_at(our_player," *** depot not found *** ", world.get_time())
}
}
}
Script-KI für Simutrans r10894+ / Simutrans Nightly Builds