Zaktualizowano listę przeznaczeń wagonów towarowych

This commit is contained in:
2021-12-06 21:10:13 +01:00
parent e3ba9bc30a
commit 1d805df5be
5 changed files with 80 additions and 38 deletions
+5 -1
View File
@@ -43,9 +43,13 @@ export default defineComponent({
logoSVG: require('@/assets/logo.svg'),
}),
setup() {
async setup() {
const store = inject('Store') as IStore;
const readyStockJSON = await (await fetch('https://spythere.github.io/api/readyStock.json')).json();
return {
store,
};
+33 -14
View File
@@ -28,13 +28,25 @@
<div class="brief-info" v-if="store.chosenLoco || store.chosenCar">
<b class="text--accent">{{ (store.chosenLoco || store.chosenCar)?.type }}</b>
<div>{{ vehicleTypes[store.chosenLoco?.power || store.chosenCar?.useType || 'loco-e'] }}</div>
<div>
{{ (store.chosenCar || store.chosenLoco)?.length }}m | {{ (store.chosenCar || store.chosenLoco)?.mass }}t |
{{ (store.chosenCar || store.chosenLoco)?.maxSpeed }} km/h
<div style="color: #ccc">
<b>
{{ vehicleTypes[store.chosenLoco?.power || store.chosenCar?.useType || 'loco-e'] }}
</b>
<div>
{{ (store.chosenCar || store.chosenLoco)?.length }}m | {{ (store.chosenCar || store.chosenLoco)?.mass }}t |
{{ (store.chosenCar || store.chosenLoco)?.maxSpeed }} km/h
</div>
<div v-if="store.chosenLoco">Typ kabiny: {{ store.chosenLoco.cabinType }}</div>
<div v-if="store.chosenCar">
{{
store.chosenCar.useType == 'car-cargo'
? carUsage[store.chosenCar.constructionType]
: 'Typ konstrukcji: ' + store.chosenCar.constructionType
}}
</div>
</div>
<div v-if="store.chosenLoco">Typ kabiny: {{ store.chosenLoco.cabinType }}</div>
<div v-if="store.chosenCar">{{ carUsage[store.chosenCar.constructionType] }}</div>
</div>
</section>
@@ -184,7 +196,13 @@ export default defineComponent({
const attr = targetNode.attributes.getNamedItem('data-ignore-outside');
if (!attr && !(this.$refs['list'] as Node).contains(targetNode)) this.store.chosenStockListIndex = -1;
if (
!attr &&
!(this.$refs['list'] as Node).contains(targetNode) &&
targetNode.tagName.toLowerCase() != 'select' &&
targetNode.tagName.toLowerCase() != 'option'
)
this.store.chosenStockListIndex = -1;
});
},
@@ -230,6 +248,11 @@ export default defineComponent({
methods: {
copyToClipboard() {
if (Object.values(this.warnings).some((v) => v.value == true)) {
alert('Jazda tym pociągiem jest niezgodna z regulaminem symulatora! Zmień parametry zestawienia!');
return;
}
navigator.clipboard.writeText(this.stockString);
alert('Pociąg został skopiowany do schowka!');
@@ -341,12 +364,8 @@ export default defineComponent({
downloadStock() {
if (Object.values(this.warnings).some((v) => v.value == true)) {
``;
const allowDownload = confirm(
'Jazda tym pociągiem może być niezgodna z regulaminem symulatora! Czy na pewno chcesz kontynuować?'
);
if (!allowDownload) return;
alert('Jazda tym pociągiem może być niezgodna z regulaminem symulatora! Zmień parametry zestawienia!');
return;
}
const fileName = prompt('Nazwij plik:', 'pociag');
@@ -512,7 +531,7 @@ export default defineComponent({
font-size: 1.1em;
b {
font-size: 1.2em;
font-size: 1.1em;
}
div {
+25 -6
View File
@@ -145,6 +145,27 @@ export default defineComponent({
isPreviewLoading: false,
loadableByDefault: false,
cargoTypes: [
'203V',
'208Kf',
'209c',
'29R',
'304C',
'304Ca',
'401Ka',
'401Zb',
'408S',
'412W',
'412Z',
'424Z',
'426S',
'429W',
'441V',
'504a',
'612a',
'627Z',
],
carUsage: carUsage as { [key: string]: string },
}),
@@ -187,11 +208,6 @@ export default defineComponent({
return;
}
if (this.chosenMass > 2500) {
alert('Masa składu nie powinna przekraczać 2500t!');
return;
}
if (this.chosenLength > 650) {
alert('Długość składu nie może przekraczać 650m dla pociągów towarowych!');
return;
@@ -203,10 +219,13 @@ export default defineComponent({
if (this.store.stockList.length == 0 || !this.store.stockList[0].isLoco) {
this.store.stockList.length = 0;
const locoSet = this.locoDataList
let locoSet = this.locoDataList
.filter((loco) => loco.power == 'loco-e' || loco.power == 'loco-s')
.filter((loco) => (!this.includeSupporterVehicles && loco.supportersOnly ? false : true));
if (this.chosenCarTypes.some((car) => this.cargoTypes.includes(car)))
locoSet = locoSet.filter((loco) => !loco.type.startsWith('EP'));
const randLoco = locoSet[Math.floor(Math.random() * locoSet.length)];
this.addLoco(randLoco);
+2 -2
View File
@@ -15,11 +15,11 @@
"110a": "wagon pasażerski",
"101a": "wagon pasażerski",
"203V": "kruszywo, kamień wapienny, odpady kopalniane",
"208Kf": "drobnica, ładunki sypkie",
"208Kf": "drobnica, ładunki sypkie, ładunki sztukowe",
"209c": "wagon techniczny",
"29R": "produkty naftowe",
"304Ca": "pojazd specjalny",
"401Ka": "drobnica, ładunki sypkie",
"401Ka": "drobnica, ładunki sypkie, ładunki sztukowe",
"401Zb": "ładunki sypkie o dużej masie usypowej",
"408S": "cement, wapno, popioły lotne, żużel",
"412W": "drobnica, kruszywo, węgiel",