chore: added train vmax field

This commit is contained in:
2025-01-29 16:02:06 +01:00
parent b901176e8c
commit 23e7d04dfa
4 changed files with 165 additions and 13 deletions
+1 -1
View File
@@ -152,7 +152,7 @@
</div> </div>
</td> </td>
<td class="text-center border border-white print:border-black" :class="{ 'text-stone-400 ': i > 0 }">70</td> <td class="text-center border border-white print:border-black" :class="{ 'text-stone-400 ': i > 0 }">{{ row.stockVmax }}</td>
</tr> </tr>
</tbody> </tbody>
</template> </template>
+6 -12
View File
@@ -26,23 +26,21 @@ const globalStore = useGlobalStore();
const apiStore = useApiStore(); const apiStore = useApiStore();
const computedTimetable = computed(() => { const computedTimetable = computed(() => {
if (!globalStore.selectedTrain) return []; if (!globalStore.selectedTrain || !globalStore.selectedTrain.timetable) return [];
const timetable = globalStore.selectedTrain.timetable; const { timetable, stockString, mass, length } = globalStore.selectedTrain;
if (!timetable) return [];
let timeFrom = Date.now(); let timeFrom = Date.now();
const headLocos = globalStore.selectedTrain.stockString const headLocos = stockString
.split(';') .split(';')
.slice(0, 3) .slice(0, 3)
.filter((s, i) => i == 0 || /-\d+$/.test(s)) .filter((s, i) => i == 0 || /-\d+$/.test(s))
.map((s) => s.slice(0, s.indexOf('-'))); .map((s) => s.slice(0, s.indexOf('-')));
const stockVmax = 70, const stockVmax = timetable.trainMaxSpeed,
stockMass = Math.floor(globalStore.selectedTrain.mass / 1000), stockMass = Math.floor(mass / 1000),
stockLength = globalStore.selectedTrain.length; stockLength = length;
const timetablePath = timetable.path.split(';').map((pathEl) => { const timetablePath = timetable.path.split(';').map((pathEl) => {
const [arrivalLine, scenery, departureLine] = pathEl.split(','); const [arrivalLine, scenery, departureLine] = pathEl.split(',');
@@ -204,8 +202,4 @@ function getAbbrevs(routeData: SceneryRoute) {
return abbrevs; return abbrevs;
} }
// function getRadioChannel() {
// return Math.floor(Math.random() * 6 + 1);
// }
</script> </script>
+157
View File
@@ -0,0 +1,157 @@
const speedLimits = {
EU07: {
passenger: {
'650000': 125,
},
cargo: {
'2000000': 70,
},
none: 110,
},
'4E': {
passenger: {
'650000': 125,
},
cargo: {
'2000000': 70,
},
none: 110,
},
EU07E: {
passenger: {
'650000': 125,
},
cargo: {
'2000000': 70,
},
none: 110,
},
EP07: {
passenger: {
'650000': 125,
},
cargo: null,
none: 110,
},
EP08: {
passenger: {
'650000': 140,
},
cargo: null,
none: 110,
},
EP09: {
passenger: {
'650000': 160,
},
cargo: null,
none: 160,
},
ET22: {
passenger: {
'650000': 125,
},
cargo: {
'1200000': 100,
'2000000': 90,
'2500000': 80,
'3100000': 70,
},
none: 125,
},
'201E': {
passenger: {
'650000': 125,
},
cargo: {
'1200000': 100,
'2000000': 90,
'2500000': 80,
'3100000': 70,
},
none: 125,
},
ET41: {
passenger: {
'700000': 125,
},
cargo: {
'4000000': 70,
},
none: 110,
},
SM42: {
passenger: {
'95000': 90,
'200000': 80,
'300000': 70,
'450000': 60,
'750000': 50,
'1130000': 40,
'1720000': 30,
'2400000': 20,
},
cargo: {
'95000': 90,
'200000': 80,
'300000': 70,
'450000': 60,
'750000': 50,
'1130000': 40,
'1720000': 30,
'2400000': 20,
},
none: 90,
},
M62: {
passenger: {
'500000': 100,
'800000': 80,
'1200000': 60,
'2000000': 40,
'3000000': 20,
},
cargo: {
'500000': 100,
'800000': 80,
'1200000': 60,
'2000000': 40,
'3000000': 20,
},
none: 100,
},
ST44: {
passenger: {
'500000': 100,
'800000': 80,
'1200000': 60,
'2000000': 40,
'3000000': 20,
},
cargo: {
'500000': 100,
'800000': 80,
'1200000': 60,
'2000000': 40,
'3000000': 20,
},
none: 100,
},
CTLR4C: {
passenger: {
'500000': 100,
'800000': 80,
'1200000': 60,
'2000000': 40,
'3000000': 20,
},
cargo: {
'500000': 100,
'800000': 80,
'1200000': 60,
'2000000': 40,
'3000000': 20,
},
none: 100,
},
};
+1
View File
@@ -38,6 +38,7 @@ export interface ActiveTrainTimetable {
timetableId: number; timetableId: number;
sceneries: string[]; sceneries: string[];
path: string; path: string;
trainMaxSpeed: number;
} }
export interface TimetableStop { export interface TimetableStop {