Docs / Making content / HTML textures
The depot file: omsi.depot
omsi.depot describes what the bus's depot file (.hof) offers, so your page can build a
line picker or destination list without hard-coding anything. It is filled once, before the
first update. If the bus has no depot file it stays empty.
omsi.depot.routes[i]
| field | meaning |
|---|---|
index |
position in the list, the number you give to setRoute |
code |
the IBIS route code (line × 100 + route number, by the depot file's own rule) |
name |
name of the trip |
line |
the line text |
terminusCode |
the destination code of the route |
destinationIndex |
index in destinations, or -1 if there is none |
destination |
the text of that destination sign |
first, last |
name of the first and last stop |
stops |
names of all stops, in order |
Many depot files leave the line column as a placeholder like XXX. When that happens the
game works the line out from the route code instead (code 1203 becomes line 12).
omsi.depot.lines[] groups the same route objects by line: each entry has line and its
routes, in the order of the depot file.
omsi.depot.destinations[i] has index, code, id and name.
A small example, a line picker that starts the first route it finds:
function pickLine(text) {
var routes = omsi.depot.routes, i;
for (i = 0; i < routes.length; i++) {
if (routes[i].line === text) {
omsi.setRoute(routes[i].index);
return;
}
}
}A return trip is usually a route on the same line whose first is your last and whose
last is your first. Look for that pair and call setRoute with it.
Something wrong or missing? Fix it on GitHub or open an issue.