Compare commits

...

11 Commits

Author SHA1 Message Date
Spythere b35293575a Merge pull request #45 from Spythere/development
v1.9.2
2025-06-01 17:33:02 +02:00
Spythere 633f7f4c26 bump: v1.9.2 2025-06-01 17:25:41 +02:00
Spythere b68e9da715 chore: new cargo warning 2025-06-01 17:25:14 +02:00
Spythere 05ae446af7 chore: added additional cargo warnings 2025-05-31 23:32:41 +02:00
Spythere 09e5c53558 chore: updated acceptable mass limits 2025-05-31 15:38:15 +02:00
Spythere fe70b19f2a chore: added new container cargo to generator 2025-05-31 14:42:00 +02:00
Spythere 32fbf51943 refactor: calculating stock speed limit 2025-05-31 14:22:14 +02:00
Spythere 39f2688611 chore: prettier settings 2025-05-31 14:21:28 +02:00
Spythere 1090249e08 Merge pull request #44 from Spythere/development
v1.9.1 minor improvements
2025-04-15 21:19:11 +02:00
Spythere c38debb458 chore: replaced footer version check with vehicle counters 2025-04-15 21:18:18 +02:00
Spythere ee552d65ec chore: changed pwa cache settings 2025-04-15 21:17:45 +02:00
15 changed files with 453 additions and 318 deletions
+1 -1
View File
@@ -2,5 +2,5 @@
"semi": true,
"singleQuote": true,
"trailingComma": "es5",
"printWidth": 100
"printWidth": 150
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "pojazdownik",
"version": "1.9.1",
"version": "1.9.2",
"private": true,
"type": "module",
"scripts": {
+28 -1
View File
@@ -9,7 +9,13 @@
</i18n-t>
<div class="text--grayed" v-if="store.vehiclesData">
{{ $t('footer.version-check', { version: store.compatibleSimulatorVersion }) }}
{{
$t('footer.vehicles-count', {
all: vehiclesCounters.all,
units: vehiclesCounters.units,
cars: vehiclesCounters.cars,
})
}}
</div>
<div>
@@ -33,6 +39,27 @@ export default defineComponent({
store: useStore(),
};
},
computed: {
vehiclesCounters() {
let counters = {
all: 0,
cars: 0,
units: 0,
};
if (!this.store.vehiclesData) return counters;
this.store.vehiclesData?.forEach((v) => {
counters.all += 1;
if (v.group.locoProps !== null) counters.units += 1;
else counters.cars += 1;
});
return counters;
},
},
});
</script>
+5 -15
View File
@@ -2,10 +2,7 @@
<div class="stock-specs">
<div v-if="store.chosenStorageStockName || chosenRealComposition">
<b v-if="store.chosenStorageStockName">
<span
class="text--accent"
:title="store.chosenStorageStockName.length > 41 ? store.chosenStorageStockName : ''"
>
<span class="text--accent" :title="store.chosenStorageStockName.length > 41 ? store.chosenStorageStockName : ''">
<BookmarkCheck :size="19" />
{{ store.chosenStorageStockName.slice(0, 40) }}
{{ store.chosenStorageStockName.length > 41 ? '...' : '' }}
@@ -16,11 +13,7 @@
<b class="real-stock-info" v-if="chosenRealComposition">
<span class="text--accent">
<img
class="real-stock-icon"
:src="getIconURL(chosenRealComposition.type)"
:alt="chosenRealComposition.type"
/>
<img class="real-stock-icon" :src="getIconURL(chosenRealComposition.type)" :alt="chosenRealComposition.type" />
{{ chosenRealComposition.number }} {{ chosenRealComposition.name }}
</span>
</b>
@@ -30,14 +23,11 @@
{{ $t('stocklist.mass') }}
<span class="text--accent">{{ (store.totalWeight / 1000).toFixed(1) }}t</span>
({{ $t('stocklist.mass-accepted') }}:
<span class="text--accent">{{
store.acceptableWeight ? `${~~(store.acceptableWeight / 1000)}t` : '-'
}}</span
<span class="text--accent">{{ store.acceptableWeight ? `${~~(store.acceptableWeight / 1000)}t` : '-' }}</span
>) - {{ $t('stocklist.length') }}:
<span class="text--accent">{{ store.totalLength }}m</span>
- {{ $t('stocklist.vmax') }}
<span tabindex="0" :data-tooltip="$t('stocklist.disclaimer')">(?)</span>:
<span class="text--accent">{{ store.maxStockSpeed }} km/h</span>
- {{ $t('stocklist.vmax') }} <span tabindex="0" :data-tooltip="$t('stocklist.disclaimer')">(?)</span>:
<span class="text--accent">{{ isFinite(store.maxStockSpeed) ? store.maxStockSpeed : '--' }} km/h</span>
</span>
</div>
</template>
@@ -2,31 +2,25 @@
<div class="stock_warnings" v-if="hasAnyWarnings">
<div class="warning" v-if="locoNotSuitable">(!) {{ $t('stocklist.warning-not-suitable') }}</div>
<div class="warning" v-if="lengthExceeded && store.isTrainPassenger">
(!) {{ $t('stocklist.warning-passenger-too-long') }}
</div>
<div class="warning" v-if="lengthExceeded && store.isTrainPassenger">(!) {{ $t('stocklist.warning-passenger-too-long') }}</div>
<div class="warning" v-if="lengthExceeded && !store.isTrainPassenger">
(!) {{ $t('stocklist.warning-freight-too-long') }}
</div>
<div class="warning" v-if="lengthExceeded && !store.isTrainPassenger">(!) {{ $t('stocklist.warning-freight-too-long') }}</div>
<div class="warning" v-if="teamOnlyVehicles.length > 0">
(!)
{{
$t('stocklist.warning-team-only-vehicle', [
teamOnlyVehicles.map((v) => v.vehicleRef.type).join(', '),
])
}}
{{ $t('stocklist.warning-team-only-vehicle', [teamOnlyVehicles.map((v) => v.vehicleRef.type).join(', ')]) }}
</div>
<div class="warning" v-if="store.cargoWarnings.size > 0">
(!) <b>{{ $t('cargo-warnings.title') }}</b>
{{ [...store.cargoWarnings].map((v) => $t(`cargo-warnings.${v}`)).join('; ') }}
</div>
<div class="warning" v-if="weightExceeded">
(!)
<i18n-t keypath="stocklist.warning-too-heavy">
<template #href>
<a
target="_blank"
href="https://docs.google.com/spreadsheets/d/1BvTU-U7huIaEheov22TrhTtROUM4MwVfdbq03GVAEM8"
>
<a target="_blank" href="https://docs.google.com/spreadsheets/d/1BvTU-U7huIaEheov22TrhTtROUM4MwVfdbq03GVAEM8">
{{ $t('stocklist.acceptable-mass-docs') }}
</a>
</template>
@@ -55,16 +49,11 @@ export default defineComponent({
},
hasAnyWarnings() {
return (
this.weightExceeded || this.lengthExceeded || this.locoNotSuitable || this.teamOnlyVehicles
);
return this.weightExceeded || this.lengthExceeded || this.locoNotSuitable || this.teamOnlyVehicles;
},
lengthExceeded() {
return (
(this.store.totalLength > 350 && this.store.isTrainPassenger) ||
(this.store.totalLength > 650 && !this.store.isTrainPassenger)
);
return (this.store.totalLength > 350 && this.store.isTrainPassenger) || (this.store.totalLength > 650 && !this.store.isTrainPassenger);
},
weightExceeded() {
@@ -76,9 +65,7 @@ export default defineComponent({
!this.store.isTrainPassenger &&
this.store.stockList.length > 1 &&
!this.store.stockList.every((stock) => isTractionUnit(stock.vehicleRef)) &&
this.store.stockList.some(
(stock) => isTractionUnit(stock.vehicleRef) && stock.vehicleRef.type.startsWith('EP')
)
this.store.stockList.some((stock) => isTractionUnit(stock.vehicleRef) && stock.vehicleRef.type.startsWith('EP'))
);
},
},
+8 -1
View File
@@ -7,5 +7,12 @@
"EP08": [650000, 650000],
"EP09": [800000, 800000],
"ET41": [700000, 4000000],
"SM42": [2400000, 2400000]
"SM42": [2400000, 2400000],
"ET22": [650000, 3100000],
"201E": [650000, 3100000],
"ST44": [3000000, 3000000],
"M62": [3000000, 3000000],
"CTLR4C": [3000000, 3000000],
"SU45": [1500000, 1500000],
"SP45": [1500000, 1500000]
}
-153
View File
@@ -1,153 +0,0 @@
{
"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,
"3100000": 70
},
"none": 125
},
"201E": {
"passenger": {
"650000": 125
},
"cargo": {
"1200000": 100,
"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
}
}
+283 -28
View File
@@ -1,10 +1,197 @@
{
"cargo": {
"kontenery": ["627Z:all", "412Z:all"],
"chłodnia": ["202Lc:all"],
"drobnica": ["426S:all", "208Kf:all", "401Ka_PKP_Gags:all", "401Ka_PKPC_Gags:all"],
"węgiel": ["412W:coal_01", "413S:coal_413S", "429W:coal_01", "401Zb:coal_02"],
"ruda": ["412W:ore_01", "401Zl:ore_35", "429W:ore_01"],
"kontenery": [
"412Z:sc_20_red",
"412Z:sc_20_blue",
"412Z:sc_20_green",
"412Z:sc_20_APL",
"412Z:sc_20_CMA",
"412Z:sc_20_Cosco",
"412Z:sc_20_Evr1",
"412Z:sc_20_Evr2",
"412Z:sc_20_Finnlines",
"412Z:sc_20_Hamburg",
"412Z:sc_20_Hanjin",
"412Z:sc_20_HapagLloyd",
"412Z:sc_20_HMM",
"412Z:sc_20_KLine",
"412Z:sc_20_Maersk",
"412Z:sc_20_ONE",
"412Z:sc_20_OOCL",
"412Z:sc_20_Schavemaker",
"412Z:sc_20_TD2",
"412Z:sc_20_Titan",
"412Z:sc_20_Toll",
"412Z:sc_40_red",
"412Z:sc_40_blue",
"412Z:sc_40_green",
"412Z:sc_40_APL",
"412Z:sc_40_CMA",
"412Z:sc_40_Cosco",
"412Z:sc_40_Evr1",
"412Z:sc_40_Evr2",
"412Z:sc_40_Finnlines",
"412Z:sc_40_Hamburg",
"412Z:sc_40_Hanjin",
"412Z:sc_40_HapagLloyd",
"412Z:sc_40_HMM",
"412Z:sc_40_KLine",
"412Z:sc_40_Maersk",
"412Z:sc_40_ONE",
"412Z:sc_40_OOCL",
"412Z:sc_40_Schavemaker",
"412Z:sc_40_TD2",
"412Z:sc_40_Titan",
"412Z:sc_40_Toll",
"612Z:sc_20",
"612Z:sc_20_red",
"612Z:sc_20_blue",
"612Z:sc_20_green",
"612Z:sc_20_APL",
"612Z:sc_20_CMA",
"612Z:sc_20_Cosco",
"612Z:sc_20_Evr1",
"612Z:sc_20_Evr2",
"612Z:sc_20_Finnlines",
"612Z:sc_20_Hamburg",
"612Z:sc_20_Hanjin",
"612Z:sc_20_HapagLloyd",
"612Z:sc_20_HMM",
"612Z:sc_20_KLine",
"612Z:sc_20_Maersk",
"612Z:sc_20_ONE",
"612Z:sc_20_OOCL",
"612Z:sc_20_Schavemaker",
"612Z:sc_20_TD2",
"612Z:sc_20_Titan",
"612Z:sc_20_Toll",
"612Z:sc_40_red",
"612Z:sc_40",
"612Z:sc_40_blue",
"612Z:sc_40_green",
"612Z:sc_40_APL",
"612Z:sc_40_CMA",
"612Z:sc_40_Cosco",
"612Z:sc_40_Evr1",
"612Z:sc_40_Evr2",
"612Z:sc_40_Finnlines",
"612Z:sc_40_Hamburg",
"612Z:sc_40_Hanjin",
"612Z:sc_40_HapagLloyd",
"612Z:sc_40_HMM",
"612Z:sc_40_KLine",
"612Z:sc_40_Maersk",
"612Z:sc_40_ONE",
"612Z:sc_40_OOCL",
"612Z:sc_40_Schavemaker",
"612Z:sc_40_TD2",
"612Z:sc_40_Titan",
"612Z:sc_40_Toll"
],
"biomasa": [
"412Z:wt_20_biomass",
"412Z:wt_20_mix_black_green_biomass",
"412Z:wt_20_mix_blue_biomass",
"412Z:wt_20_mix_blue_CDC_white_biomass",
"412Z:wt_20_mix_blue_white_biomass",
"412Z:wt_20_mix_EPC_biomass",
"412Z:wt_20_mix_green_biomass",
"412Z:wt_20_black_biomass",
"412Z:wt_20_blue_biomass",
"412Z:wt_20_blue_gr_biomass",
"412Z:wt_20_blue_gr_r_biomass",
"412Z:wt_20_CDC_biomass",
"412Z:wt_20_EPC_black_biomass",
"412Z:wt_20_EPC_red_biomass",
"412Z:wt_20_green_new_biomass",
"412Z:wt_20_green_old_biomass",
"412Z:wt_20_white_new_biomass",
"412Z:wt_20_white_old_biomass",
"412Z:wt_20_white_old_gr_biomass",
"412Z:wt_20_white_old_gr_r_biomass",
"627Z:wt_20_biomass",
"627Z:wt_20_mix_black_green_biomass",
"627Z:wt_20_mix_blue_biomass",
"627Z:wt_20_mix_blue_CDC_white_biomass",
"627Z:wt_20_mix_blue_white_biomass",
"627Z:wt_20_mix_EPC_biomass",
"627Z:wt_20_mix_green_biomass",
"627Z:wt_20_black_biomass",
"627Z:wt_20_blue_biomass",
"627Z:wt_20_blue_gr_biomass",
"627Z:wt_20_blue_gr_r_biomass",
"627Z:wt_20_CDC_biomass",
"627Z:wt_20_EPC_black_biomass",
"627Z:wt_20_EPC_red_biomass",
"627Z:wt_20_green_new_biomass",
"627Z:wt_20_green_old_biomass",
"627Z:wt_20_white_new_biomass",
"627Z:wt_20_white_old_biomass",
"627Z:wt_20_white_old_gr_biomass",
"627Z:wt_20_white_old_gr_r_biomass"
],
"biomasa-puste": [
"412Z:wt_20_empty",
"412Z:wt_20_mix_black_green_empty",
"412Z:wt_20_mix_blue_empty",
"412Z:wt_20_mix_blue_CDC_white_empty",
"412Z:wt_20_mix_blue_white_empty",
"412Z:wt_20_mix_EPC_empty",
"412Z:wt_20_mix_green_empty",
"412Z:wt_20_black_empty",
"412Z:wt_20_blue_empty",
"412Z:wt_20_blue_gr_empty",
"412Z:wt_20_blue_gr_r_empty",
"412Z:wt_20_CDC_empty",
"412Z:wt_20_EPC_black_empty",
"412Z:wt_20_EPC_red_empty",
"412Z:wt_20_green_new_empty",
"412Z:wt_20_green_old_empty",
"412Z:wt_20_white_new_empty",
"412Z:wt_20_white_old_empty",
"412Z:wt_20_white_old_gr_empty",
"412Z:wt_20_white_old_gr_r_empty",
"627Z:wt_20_empty",
"627Z:wt_20_mix_black_green_empty",
"627Z:wt_20_mix_blue_empty",
"627Z:wt_20_mix_blue_CDC_white_empty",
"627Z:wt_20_mix_blue_white_empty",
"627Z:wt_20_mix_EPC_empty",
"627Z:wt_20_mix_green_empty",
"627Z:wt_20_black_empty",
"627Z:wt_20_blue_empty",
"627Z:wt_20_blue_gr_empty",
"627Z:wt_20_blue_gr_r_empty",
"627Z:wt_20_CDC_empty",
"627Z:wt_20_EPC_black_empty",
"627Z:wt_20_EPC_red_empty",
"627Z:wt_20_green_new_empty",
"627Z:wt_20_green_old_empty",
"627Z:wt_20_white_new_empty",
"627Z:wt_20_white_old_empty",
"627Z:wt_20_white_old_gr_empty",
"627Z:wt_20_white_old_gr_r_empty"
],
"chłodnia": [
"202Lc:all"
],
"drobnica": [
"426S:all",
"208Kf:all",
"401Ka_PKP_Gags:all",
"401Ka_PKPC_Gags:all"
],
"węgiel": [
"412W:coal_01",
"413S:coal_413S",
"429W:coal_01",
"401Zb:coal_02"
],
"ruda": [
"412W:ore_01",
"401Zl:ore_35",
"429W:ore_01"
],
"piasek": [
"412W:sand_01",
"412W:sand_02",
@@ -16,7 +203,9 @@
"418Va:sand_418V",
"418Vb:sand_418V"
],
"kreda": ["413S:chalk_413S"],
"kreda": [
"413S:chalk_413S"
],
"kamień": [
"412W:stone_01",
"412W:stone_50",
@@ -26,32 +215,98 @@
"418Va:stone_418V",
"418Vb:stone_418V"
],
"złom": ["412W:scrap_01", "412W:scrap_02", "429W:scrap_01", "429W:scrap_02"],
"paliwo": ["29R_CTLL:all", "29R_PKP:all", "445Rb:all"],
"melasa": ["29R_PLPOL:all"],
"żwir": ["441V"],
"koła": ["424Z:wheels_01"],
"drewno": ["424Z:woods_01", "424Z:woods_02"],
"szyny": ["424Z:rails_01"],
"kable": ["424Z:cables_01", "24Z:cables_Ks", "401Ze:cables_02"],
"kruszywo": ["59WS:all"],
"techniczne": ["209c", "304Ca", "102a_PKPE", "401Ka_PKP_XGa:all"],
"poczta": ["211K:all"],
"złom": [
"412W:scrap_01",
"412W:scrap_02",
"429W:scrap_01",
"429W:scrap_02"
],
"paliwo": [
"29R_CTLL:all",
"29R_PKP:all",
"445Rb:all"
],
"melasa": [
"29R_PLPOL:all"
],
"żwir": [
"441V"
],
"koła": [
"424Z:wheels_01"
],
"drewno": [
"424Z:woods_01",
"424Z:woods_02"
],
"szyny": [
"424Z:rails_01"
],
"kable": [
"424Z:cables_01",
"24Z:cables_Ks",
"401Ze:cables_02"
],
"kruszywo": [
"59WS:all"
],
"techniczne": [
"209c",
"304Ca",
"102a_PKPE",
"401Ka_PKP_XGa:all"
],
"poczta": [
"211K:all"
],
"cement": [
"408S:cement_4",
"206S_CEMET:cement_3",
"206S_SPEED:cement_3",
"220S_CEMET:cement_3"
],
"wapno": ["408S:lime_4", "206S_CEMET:lime_3", "206S_SPEED:lime_3", "220S_CEMET:lime_3"],
"soda": ["408S:soda_4", "206S_CEMET:soda_3", "206S_SPEED:soda_3", "220S_CEMET:soda_3"],
"pszenica": ["206Sh_PKP_Ugpps:wheat_3", "206Sh_PKPC_Ugpps:wheat_3"],
"kukurydza": ["206Sh_PKP_Ugpps:corn_3", "206Sh_PKPC_Ugpps:corn_3"],
"pasza": ["206Sh_PKP_Ugpps:forage_3", "206Sh_PKPC_Ugpps:forage_3"],
"pojazdy": ["426Z:tank_01", "426Z:truck_01", "426Z:vehicles_01"],
"karbid": ["421S:carbide_01"],
"wrażliwe": ["425S:all", "421S:carbide_01"],
"stal": ["401Ze:steel_01", "401Ze:steel_02"],
"gaz": ["WB117:all"]
"wapno": [
"408S:lime_4",
"206S_CEMET:lime_3",
"206S_SPEED:lime_3",
"220S_CEMET:lime_3"
],
"soda": [
"408S:soda_4",
"206S_CEMET:soda_3",
"206S_SPEED:soda_3",
"220S_CEMET:soda_3"
],
"pszenica": [
"206Sh_PKP_Ugpps:wheat_3",
"206Sh_PKPC_Ugpps:wheat_3"
],
"kukurydza": [
"206Sh_PKP_Ugpps:corn_3",
"206Sh_PKPC_Ugpps:corn_3"
],
"pasza": [
"206Sh_PKP_Ugpps:forage_3",
"206Sh_PKPC_Ugpps:forage_3"
],
"pojazdy": [
"426Z:tank_01",
"426Z:truck_01",
"426Z:vehicles_01"
],
"karbid": [
"421S:carbide_01"
],
"wrażliwe": [
"425S:all",
"421S:carbide_01"
],
"stal": [
"401Ze:steel_01",
"401Ze:steel_02"
],
"gaz": [
"WB117:all"
]
}
}
}
+14 -2
View File
@@ -6,7 +6,8 @@
"disclaimer": "This site has only an informational intent. The author does not carry any responsibility for creating trains against {tos}!",
"tos": "Train Driver 2 simulator rules",
"tos-href": "https://docs.google.com/document/d/1UAAPUtN0d_RoS4RgOzEzllJZJhA0VcizzCzKW4QylbY/edit#heading=h.1ldcvhomwjp9",
"version-check": "Site is complete for version {version} of Train Driver 2 simulator"
"version-check": "Site is complete for version {version} of Train Driver 2 simulator",
"vehicles-count": "Site contains currently {all} vehicles - including {units} traction units and {cars} car wagons!"
},
"inputs": {
"title": "CHOOSE A VEHICLE",
@@ -100,7 +101,7 @@
"chosen-empty-warning": "Choose at least one cargo type to see available cars!",
"chosen-warning": "Cars containing chosen cargo are shown below. Hover over a type to see a preview of the car. Click it to include/exclude it from a drawing (only highlighted types will be included).",
"action-generate": "GENERATE",
"action-generate-empty": "GENERATE EMPTY",
"action-generate-empty": "GENERATE CARS ALONE",
"action-reset": "RESET CARGO"
},
"numgen": {
@@ -220,6 +221,8 @@
},
"cargo": {
"kontenery": "containers",
"biomasa": "biomass",
"biomasa-puste": "biomass (empty)",
"chłodnia": "refrigerator",
"drobnica": "loose cargo",
"węgiel": "coal",
@@ -322,5 +325,14 @@
"418Vb_WIEBE": "loose cargo (sand, stone)",
"418Vb_ZOS": "loose cargo (sand, stone)",
"418Vb_ZUE": "loose cargo (sand, stone)"
},
"cargo-warnings": {
"title": "Rolling stock containing extra cargo warnings:",
"warning_wt_20_pn": "PN: exceeded gauge (Innofreight - C45)",
"warning_un1965_twr": "TWR: LPG (UN 1965)",
"warning_un1965_tn": "TN: LPG - empty tank (UN 1965)",
"warning_un1202_twr": "TWR: diesel fuel (UN 1202)",
"warning_un1202_tn": "TN: diesel fuel - empty tank (UN 1202)",
"warning_military_pn": "PN: military transport"
}
}
+14 -2
View File
@@ -6,7 +6,8 @@
"disclaimer": "Ta strona ma charakter informacyjny. Autor nie ponosi odpowiedzialności za tworzenie pociągów niezgodnych z {tos}!",
"tos": "regulaminem symulatora Train Driver 2",
"tos-href": "https://docs.google.com/document/d/1UAAPUtN0d_RoS4RgOzEzllJZJhA0VcizzCzKW4QylbY/edit",
"version-check": "Strona jest kompletna dla wersji {version} symulatora TD2"
"version-check": "Strona jest kompletna dla wersji {version} symulatora TD2",
"vehicles-count": "Strona zawiera obecnie {all} pojazdów - w tym {units} jednostek trakcyjnych i {cars} wagonów!"
},
"inputs": {
"title": "WYBIERZ POJAZD",
@@ -100,7 +101,7 @@
"chosen-empty-warning": "Wybierz co najmniej jeden ładunek, aby zobaczyć wagony, które go posiadają!",
"chosen-warning": "Wagony posiadające wybrane ładunki. Najedź na nazwę, aby zobaczyć podgląd wagonu. Kliknij, aby wyłączyć z losowania (tylko podświetlone nazwy będą uwzględnione).",
"action-generate": "WYGENERUJ",
"action-generate-empty": "WYGENERUJ PRÓŻNE WAGONY",
"action-generate-empty": "WYGENERUJ SAME WAGONY",
"action-reset": "ZRESETUJ ŁADUNKI"
},
"numgen": {
@@ -220,6 +221,8 @@
},
"cargo": {
"kontenery": "kontenery",
"biomasa": "biomasa",
"biomasa-puste": "biomasa (puste)",
"chłodnia": "chłodnia",
"drobnica": "drobnica",
"węgiel": "węgiel",
@@ -321,5 +324,14 @@
"418Vb_WIEBE": "drobnica, ładunki sypkie (piasek, kamień)",
"418Vb_ZOS": "drobnica, ładunki sypkie (piasek, kamień)",
"418Vb_ZUE": "drobnica, ładunki sypkie (piasek, kamień)"
},
"cargo-warnings": {
"title": "Skład z dodatkowymi uwagami przewozowymi:",
"warning_wt_20_pn": "PN: przekroczona skrajnia (Innofreight - C45)",
"warning_un1965_twr": "TWR: gazy węglowodorowe skroplone (UN 1965)",
"warning_un1965_tn": "TN: gazy węglowodorowe skroplone - puste cysterny (UN 1965)",
"warning_un1202_twr": "TWR: olej napędowy (UN 1202)",
"warning_un1202_tn": "TN: olej napędowy - puste cysterny (UN 1202)",
"warning_military_pn": "PN: transport wojskowy"
}
}
+6 -13
View File
@@ -15,6 +15,7 @@ import { defineStore } from 'pinia';
import {
acceptableWeight,
carDataList,
getCargoWarnings,
isTractionUnit,
isTrainPassenger,
locoDataList,
@@ -25,13 +26,11 @@ import {
totalWeight,
} from './utils/vehicleUtils';
import i18n from './i18n-setup';
import http from './http';
import realCompositionsJSON from './data/realCompositions.json';
export const useStore = defineStore({
id: 'store',
export const useStore = defineStore('store', {
state: () => ({
chosenCar: null as ICarWagon | null,
chosenLoco: null as ILocomotive | null,
@@ -70,15 +69,13 @@ export const useStore = defineStore({
getters: {
locoDataList: (state) => locoDataList(state.vehiclesData),
carDataList: (state) => carDataList(state.vehiclesData),
vehicleDataList: (state) => [
...locoDataList(state.vehiclesData),
...carDataList(state.vehiclesData),
],
vehicleDataList: (state) => [...locoDataList(state.vehiclesData), ...carDataList(state.vehiclesData)],
totalWeight: (state) => totalWeight(state.stockList),
totalLength: (state) => totalLength(state.stockList),
maxStockSpeed: (state) => maxStockSpeed(state.stockList),
isTrainPassenger: (state) => isTrainPassenger(state.stockList),
acceptableWeight: (state) => acceptableWeight(state.stockList),
cargoWarnings: (state) => getCargoWarnings(state.stockList),
stockSupportsColdStart: (state) => stockSupportsColdStart(state.stockList),
stockSupportsDoubleManning: (state) => stockSupportsDoubleManning(state.stockList),
@@ -87,15 +84,11 @@ export const useStore = defineStore({
if (state.stockList.length == 0) return '';
const coldStartActive = state.isColdStart && stockSupportsColdStart(state.stockList);
const doubleManningActive =
state.isDoubleManned && stockSupportsDoubleManning(state.stockList);
const doubleManningActive = state.isDoubleManned && stockSupportsDoubleManning(state.stockList);
return state.stockList
.map((stock, i) => {
let stockTypeStr =
isTractionUnit(stock.vehicleRef) || !stock.cargo
? stock.vehicleRef.type
: `${stock.vehicleRef.type}:${stock.cargo.id}`;
let stockTypeStr = isTractionUnit(stock.vehicleRef) || !stock.cargo ? stock.vehicleRef.type : `${stock.vehicleRef.type}:${stock.cargo.id}`;
if (i == 0 && (coldStartActive || doubleManningActive))
return `${stockTypeStr},${coldStartActive ? 'c' : ''}${doubleManningActive ? 'd' : ''}`;
+15 -1
View File
@@ -28,12 +28,14 @@ export interface ILocomotive {
constructionType: string;
cabinType: string;
maxSpeed: number;
maxSpeedLoco: number;
weight: number;
length: number;
coldStart: boolean;
doubleManned: boolean;
sponsorOnlyTimestamp: number;
teamOnly: boolean;
massSpeeds: VehicleGroupMassSpeeds | null;
}
export interface ICarWagon {
@@ -42,11 +44,13 @@ export interface ICarWagon {
constructionType: string;
loadable: boolean;
maxSpeed: number;
maxSpeedLoaded: number;
weight: number;
length: number;
cargoTypes: ICargo[];
sponsorOnlyTimestamp: number;
teamOnly: boolean;
massSpeeds: VehicleGroupMassSpeeds | null;
}
export interface IStock {
@@ -70,6 +74,7 @@ export interface IVehicleData {
cabinName: string | null;
restrictions: IVehicleRestrictions | null;
vehicleGroupsId: number;
simulatorVersion: string;
group: IVehicleGroup;
}
@@ -82,10 +87,13 @@ export interface IVehicleGroup {
id: number;
name: string;
speed: number;
speedLoaded?: number;
speedLoco?: number;
length: number;
weight: number;
cargoTypes: IVehicleCargoType[] | null;
locoProps: IVehicleLocoProps | null;
massSpeeds: VehicleGroupMassSpeeds | null;
}
export interface IVehicleCargoType {
@@ -98,9 +106,15 @@ export interface IVehicleLocoProps {
doubleManned: boolean;
}
export interface VehicleGroupMassSpeeds {
passenger: Record<string, number> | null;
cargo: Record<string, number> | null;
none: number | null;
}
export interface StorageStockEntry {
id: string;
createdAt: number;
updatedAt?: number;
stockString: string;
}
}
+35 -17
View File
@@ -1,29 +1,47 @@
import speedLimits from '../constants/speedLimits.json';
import massLimits from '../constants/massLimits.json';
import { IStock } from '../types/common.types';
export type SpeedLimitLocoType = keyof typeof speedLimits;
export type MassLimitLocoType = keyof typeof massLimits;
export function calculateSpeedLimit(
locoType: SpeedLimitLocoType,
stockTotalWeight: number,
stockCount: number,
isTrainPassenger: boolean
) {
if (speedLimits[locoType] === undefined) return 0;
export function calculateSpeedLimit(stockList: IStock[], isPassenger: boolean, stockMass: number) {
// Check the whole consist speed limit
const stockMaxSpeed = stockList.reduce((acc, vehicle, i) => {
let vehicleSpeed = vehicle.vehicleRef.maxSpeed;
if (stockCount == 1) return speedLimits[locoType]['none'];
if (
vehicle.vehicleRef.group == 'wagon-freight' &&
vehicle.cargo !== undefined &&
vehicle.vehicleRef.maxSpeedLoaded
) {
vehicleSpeed = vehicle.vehicleRef.maxSpeedLoaded;
}
const stockType = isTrainPassenger ? 'passenger' : 'cargo';
const speedTable = speedLimits[locoType][stockType];
return Math.min(vehicleSpeed, acc);
}, Infinity);
if (!speedTable) return undefined;
// Check the head vehicle speed limit
const headVehicle = stockList[0];
let speedLimit = 0;
for (const mass in speedTable)
if (stockTotalWeight > Number(mass)) speedLimit = (speedTable as any)[mass];
// Omit speed check for head vehicle if there's no data for it
if (!headVehicle || !headVehicle.vehicleRef.massSpeeds) return stockMaxSpeed;
return speedLimit;
const massSpeeds =
headVehicle.vehicleRef.massSpeeds[
stockList.length == 1 ? 'none' : isPassenger ? 'passenger' : 'cargo'
];
// Omit speed check if there's no data on mass speeds
if (!massSpeeds) return stockMaxSpeed;
// Number type for locomotives alone
if (typeof massSpeeds === 'number') return massSpeeds;
// Record type for passenger or cargo, find the closest range
const massKey = Object.keys(massSpeeds).findLast((massKey) => stockMass >= Number(massKey));
const massMaxSpeed = massKey ? massSpeeds[massKey] : Infinity;
return Math.min(massMaxSpeed, stockMaxSpeed);
}
export function calculateMassLimit(locoType: MassLimitLocoType, isTrainPassenger: boolean) {
+30 -57
View File
@@ -1,18 +1,5 @@
import {
ICarWagon,
ILocomotive,
IStock,
IVehicleData,
IVehiclesAPIResponse,
LocoGroupType,
WagonGroupType,
} from '../types/common.types';
import {
MassLimitLocoType,
SpeedLimitLocoType,
calculateMassLimit,
calculateSpeedLimit,
} from './vehicleLimitsUtils';
import { ICarWagon, ILocomotive, IStock, IVehicleData, LocoGroupType, WagonGroupType } from '../types/common.types';
import { MassLimitLocoType, calculateMassLimit, calculateSpeedLimit } from './vehicleLimitsUtils';
export function isTractionUnit(vehicle: ILocomotive | ICarWagon): vehicle is ILocomotive {
return (vehicle as ILocomotive).cabinType !== undefined;
@@ -35,11 +22,14 @@ export function locoDataList(vehiclesData: IVehicleData[] | undefined) {
teamOnly: data.restrictions?.teamOnly ?? false,
maxSpeed: data.group.speed,
maxSpeedLoco: data.group.speedLoco ?? data.group.speed,
length: data.group.length,
weight: data.group.weight,
coldStart: data.group.locoProps?.coldStart ?? false,
doubleManned: data.group.locoProps?.doubleManned ?? false,
massSpeeds: data.group.massSpeeds,
});
return acc;
@@ -63,8 +53,12 @@ export function carDataList(vehiclesData: IVehicleData[] | undefined) {
teamOnly: data.restrictions?.teamOnly ?? false,
maxSpeed: data.group.speed,
maxSpeedLoaded: data.group.speedLoaded ?? data.group.speed,
length: data.group.length,
weight: data.group.weight,
massSpeeds: data.group.massSpeeds,
});
return acc;
@@ -72,10 +66,7 @@ export function carDataList(vehiclesData: IVehicleData[] | undefined) {
}
export function totalWeight(stockList: IStock[]) {
return stockList.reduce(
(acc, stock) => acc + (stock.vehicleRef.weight + (stock.cargo?.weight ?? 0)),
0
);
return stockList.reduce((acc, stock) => acc + (stock.vehicleRef.weight + (stock.cargo?.weight ?? 0)), 0);
}
export function totalLength(stockList: IStock[]) {
@@ -83,27 +74,7 @@ export function totalLength(stockList: IStock[]) {
}
export function maxStockSpeed(stockList: IStock[]) {
const stockSpeedLimit = stockList.reduce(
(acc, stock) => (stock.vehicleRef.maxSpeed < acc || acc == 0 ? stock.vehicleRef.maxSpeed : acc),
0
);
const headingLoco =
stockList[0] && isTractionUnit(stockList[0].vehicleRef) ? stockList[0] : undefined;
if (!headingLoco) return stockSpeedLimit;
const locoType = headingLoco.vehicleRef.type.split('-')[0];
if (/^(EN|2EN|SN)/.test(locoType)) return stockSpeedLimit;
const speedLimitByMass = calculateSpeedLimit(
locoType as SpeedLimitLocoType,
totalWeight(stockList),
stockList.length,
isTrainPassenger(stockList)
);
return speedLimitByMass ? Math.min(stockSpeedLimit, speedLimitByMass) : stockSpeedLimit;
return calculateSpeedLimit(stockList, isTrainPassenger(stockList), totalWeight(stockList));
}
export function acceptableWeight(stockList: IStock[]) {
@@ -111,10 +82,7 @@ export function acceptableWeight(stockList: IStock[]) {
const activeLocomotiveType = stockList[0].vehicleRef.type.split('-')[0];
const locoMassLimit = calculateMassLimit(
activeLocomotiveType as MassLimitLocoType,
isTrainPassenger(stockList)
);
const locoMassLimit = calculateMassLimit(activeLocomotiveType as MassLimitLocoType, isTrainPassenger(stockList));
return locoMassLimit;
}
@@ -123,23 +91,28 @@ export function isTrainPassenger(stockList: IStock[]) {
if (stockList.length == 0) return false;
if (stockList.every((stock) => isTractionUnit(stock.vehicleRef))) return false;
return stockList
.filter((stock) => !isTractionUnit(stock.vehicleRef))
.every((stock) => stock.vehicleRef.group === 'wagon-passenger');
return stockList.filter((stock) => !isTractionUnit(stock.vehicleRef)).every((stock) => stock.vehicleRef.group === 'wagon-passenger');
}
export function stockSupportsColdStart(stockList: IStock[]) {
return (
stockList.length == 1 &&
isTractionUnit(stockList[0].vehicleRef) &&
stockList[0].vehicleRef.coldStart
);
return stockList.length == 1 && isTractionUnit(stockList[0].vehicleRef) && stockList[0].vehicleRef.coldStart;
}
export function stockSupportsDoubleManning(stockList: IStock[]) {
return (
stockList.length != 0 &&
isTractionUnit(stockList[0].vehicleRef) &&
stockList[0].vehicleRef.doubleManned
);
return stockList.length != 0 && isTractionUnit(stockList[0].vehicleRef) && stockList[0].vehicleRef.doubleManned;
}
export function getCargoWarnings(stockList: IStock[]) {
let warnings: Set<string> = new Set();
stockList.forEach((stockVehicle) => {
if (stockVehicle.vehicleRef.group == 'wagon-freight') {
if (stockVehicle.cargo && stockVehicle.cargo.id.startsWith('wt_20')) warnings.add('warning_wt_20_pn');
else if (stockVehicle.cargo && /^(tank|vehicles|truck)/.test(stockVehicle.cargo.id)) warnings.add('warning_military_pn');
else if (stockVehicle.vehicleRef.type.startsWith('WB117')) warnings.add(stockVehicle.cargo ? 'warning_un1965_twr' : 'warning_un1965_tn');
else if (stockVehicle.vehicleRef.type.startsWith('445Rb')) warnings.add(stockVehicle.cargo ? 'warning_un1202_twr' : 'warning_un1202_tn');
}
});
return warnings;
}
+1 -1
View File
@@ -34,7 +34,7 @@ export default defineConfig({
runtimeCaching: [
{
urlPattern: /^https:\/\/.*\.spythere\.eu\/.*/i,
handler: 'StaleWhileRevalidate',
handler: 'NetworkFirst',
options: { cacheName: 'spythere-cache' },
},
],