mirror of
https://github.com/Spythere/pojazdownik.git
synced 2026-05-03 11:45:34 +00:00
chore(generator): removed additional cargo for intermodals; added new vehicle api types
This commit is contained in:
@@ -110,7 +110,7 @@ import { isTractionUnit } from '../../../utils/vehicleUtils';
|
||||
import stockMixin from '../../../mixins/stockMixin';
|
||||
import { useStockListUtils } from '../../../utils/stockListUtils';
|
||||
|
||||
import { getCurrentStockFileName, getStockStringOutput } from '../../../composables/file';
|
||||
import { getCurrentStockFileName } from '../../../composables/file';
|
||||
|
||||
import {
|
||||
Bookmark,
|
||||
@@ -166,7 +166,7 @@ export default defineComponent({
|
||||
|
||||
methods: {
|
||||
copyToClipboard() {
|
||||
navigator.clipboard.writeText(getStockStringOutput());
|
||||
navigator.clipboard.writeText(this.store.stockString);
|
||||
|
||||
setTimeout(() => {
|
||||
alert(this.$t('stocklist.alert-copied'));
|
||||
@@ -224,7 +224,7 @@ export default defineComponent({
|
||||
|
||||
if (!fileName) return;
|
||||
|
||||
const blob = new Blob([getStockStringOutput()]);
|
||||
const blob = new Blob([this.store.stockString]);
|
||||
const file = fileName + '.con';
|
||||
|
||||
var e = document.createEvent('MouseEvents'),
|
||||
|
||||
@@ -25,6 +25,7 @@ export function getCurrentStockFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
// UNUSED - PARSES ADDITIONAL CARGO FOR INTERMODALS
|
||||
export function getStockStringOutput() {
|
||||
const store = useStore();
|
||||
|
||||
|
||||
@@ -4,11 +4,14 @@
|
||||
"food": ["412Z:tc_20_loaded", "627Z:tc_20_loaded"],
|
||||
"food-empty": ["412Z:tc_20_empty", "627Z:tc_20_empty"],
|
||||
"intermodal": [
|
||||
"627Z:627Z_mix1_sctc_loaded",
|
||||
"627Z:627Z_mix2_sctc_loaded",
|
||||
"627Z:627Z_mix3_sctc_loaded",
|
||||
"412Z:412Z_mix1_sctc_loaded",
|
||||
"412Z:412Z_mix1_sctc_empty"
|
||||
"627Z:sc_20",
|
||||
"627Z:sc_40",
|
||||
"627Z:tc_20_empty",
|
||||
"627Z:tc_20_loaded",
|
||||
"412Z:sc_20",
|
||||
"412Z:sc_40",
|
||||
"412Z:tc_20_empty",
|
||||
"412Z:tc_20_loaded"
|
||||
],
|
||||
"biomass": ["412Z:wt_20_biomass", "627Z:wt_20_biomass"],
|
||||
"biomass-empty": [
|
||||
|
||||
+13
-12
@@ -1,7 +1,7 @@
|
||||
import { defineComponent } from 'vue';
|
||||
import { useStore } from '../store';
|
||||
import { ICarWagon, ILocomotive, IStock, ICargo, IVehicle } from '../types/common.types';
|
||||
import { additionalCargoTypes, isTractionUnit } from '../utils/vehicleUtils';
|
||||
import { isTractionUnit } from '../utils/vehicleUtils';
|
||||
|
||||
export default defineComponent({
|
||||
setup() {
|
||||
@@ -75,21 +75,22 @@ export default defineComponent({
|
||||
this.store.isDoubleManned = spawnProps.includes('d');
|
||||
}
|
||||
} else {
|
||||
const [carType, ...cargo] = type.split(':');
|
||||
const [carType, cargo] = type.split(':');
|
||||
vehicle = this.store.carDataList.find((car) => car.type == carType) || null;
|
||||
|
||||
if (vehicle && cargo.length > 0) {
|
||||
if (/412Z|627Z/.test(vehicle.constructionType)) {
|
||||
const additionalCargo = additionalCargoTypes.find(
|
||||
(c) => c.groupType == vehicle!.constructionType && c.cargoStringVariations.includes(cargo.join(':'))
|
||||
);
|
||||
if (cargo) {
|
||||
vehicleCargo = vehicle?.cargoTypes.find((c) => c.id == cargo) || null;
|
||||
|
||||
if (additionalCargo) {
|
||||
cargo[0] = additionalCargo.id;
|
||||
}
|
||||
}
|
||||
// UNUSED - ADDITIONAL INTERMODAL CARGO TEST
|
||||
// if (/412Z|627Z/.test(vehicle.constructionType)) {
|
||||
// const additionalCargo = additionalCargoTypes.find(
|
||||
// (c) => c.groupType == vehicle!.constructionType && c.cargoStringVariations.includes(cargo.join(':'))
|
||||
// );
|
||||
|
||||
vehicleCargo = vehicle?.cargoTypes.find((c) => c.id == cargo[0]) || null;
|
||||
// if (additionalCargo) {
|
||||
// cargo[0] = additionalCargo.id;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-3
@@ -14,7 +14,6 @@ import {
|
||||
import { defineStore } from 'pinia';
|
||||
import {
|
||||
acceptableWeight,
|
||||
additionalCargoTypes,
|
||||
carDataList,
|
||||
getCargoWarnings,
|
||||
isTractionUnit,
|
||||
@@ -29,6 +28,7 @@ import {
|
||||
|
||||
import realCompositionsJSON from './data/realCompositions.json';
|
||||
import { HttpClient } from './http';
|
||||
import { API } from './types/api.types';
|
||||
|
||||
const baseURL = import.meta.env.VITE_API_DEV === '1' && import.meta.env.DEV ? 'http://localhost:3001' : 'https://stacjownik.spythere.eu';
|
||||
|
||||
@@ -129,8 +129,10 @@ export const useStore = defineStore('store', {
|
||||
actions: {
|
||||
async fetchVehiclesAPI() {
|
||||
try {
|
||||
const vehiclesData = await this.httpClient.get<IVehiclesAPIResponse>('api/getVehicles');
|
||||
this.vehiclesData = vehiclesData;
|
||||
const response = await this.httpClient.get<API.VehiclesData.Response>('api/getVehiclesData');
|
||||
// this.vehiclesData = response.;
|
||||
|
||||
console.log(response);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
+45
-83
@@ -1,87 +1,49 @@
|
||||
// API namespace
|
||||
export namespace API {
|
||||
export interface ActiveData {
|
||||
trains: Train[];
|
||||
activeSceneries: ActiveScenery[];
|
||||
export namespace VehiclesData {
|
||||
export interface VehicleObject {
|
||||
id: number;
|
||||
name: string;
|
||||
type: string;
|
||||
cabinName: string | null;
|
||||
restrictions: Record<string, any> | null;
|
||||
vehicleGroupsId: number;
|
||||
}
|
||||
|
||||
export interface VehicleGroupObject {
|
||||
id: number;
|
||||
name: string;
|
||||
speed: number;
|
||||
speedLoaded?: number;
|
||||
speedLoco?: number;
|
||||
length: number;
|
||||
weight: number;
|
||||
cargoTypes: VehicleCargo[] | null;
|
||||
|
||||
locoProps: {
|
||||
coldStart: boolean;
|
||||
doubleManned: boolean;
|
||||
} | null;
|
||||
|
||||
massSpeeds: VehicleGroupMassSpeeds | null;
|
||||
}
|
||||
|
||||
export interface VehicleGroupMassSpeeds {
|
||||
passenger: Record<string, number> | null;
|
||||
cargo: Record<string, number> | null;
|
||||
none: number | null;
|
||||
}
|
||||
|
||||
export interface VehicleCargo {
|
||||
id: string;
|
||||
weight: number;
|
||||
}
|
||||
|
||||
export interface Data {
|
||||
vehicles: VehicleObject[];
|
||||
vehicleGroups: VehicleGroupObject[];
|
||||
}
|
||||
|
||||
export type Response = Data;
|
||||
}
|
||||
}
|
||||
|
||||
export interface ActiveScenery {
|
||||
dispatcherId: number;
|
||||
dispatcherName: string;
|
||||
dispatcherIsSupporter: boolean;
|
||||
stationName: string;
|
||||
stationHash: string;
|
||||
region: string;
|
||||
maxUsers: number;
|
||||
currentUsers: number;
|
||||
spawn: number;
|
||||
lastSeen: number;
|
||||
dispatcherExp: number;
|
||||
nameFromHeader: string;
|
||||
spawnString?: string;
|
||||
networkConnectionString: string;
|
||||
isOnline: number;
|
||||
dispatcherRate: number;
|
||||
dispatcherStatus: number;
|
||||
}
|
||||
|
||||
export interface Train {
|
||||
id: string;
|
||||
trainNo: number;
|
||||
mass: number;
|
||||
speed: number;
|
||||
length: number;
|
||||
distance: number;
|
||||
stockString: string;
|
||||
driverName: string;
|
||||
driverId: number;
|
||||
driverIsSupporter: boolean;
|
||||
driverLevel: number;
|
||||
currentStationHash: string;
|
||||
currentStationName: string;
|
||||
signal: string;
|
||||
connectedTrack: string;
|
||||
online: number;
|
||||
lastSeen: number;
|
||||
region: string;
|
||||
isTimeout: boolean;
|
||||
timetable?: Timetable;
|
||||
}
|
||||
|
||||
export interface Timetable {
|
||||
SKR: boolean;
|
||||
TWR: boolean;
|
||||
hasDangerousCargo: boolean;
|
||||
hasExtraDeliveries: boolean;
|
||||
warningNotes: string;
|
||||
category: string;
|
||||
stopList: TimetableStop[];
|
||||
route: string;
|
||||
timetableId: number;
|
||||
sceneries: string[];
|
||||
path: string;
|
||||
}
|
||||
|
||||
export interface TimetableStop {
|
||||
stopName: string;
|
||||
stopNameRAW: string;
|
||||
stopType: string;
|
||||
stopDistance: number;
|
||||
pointId: string;
|
||||
comments?: (null | string)[];
|
||||
mainStop: boolean;
|
||||
arrivalLine?: string;
|
||||
arrivalTimestamp: number;
|
||||
arrivalRealTimestamp: number;
|
||||
arrivalDelay: number;
|
||||
departureLine?: string;
|
||||
departureTimestamp: number;
|
||||
departureRealTimestamp: number;
|
||||
departureDelay: number;
|
||||
beginsHere: boolean;
|
||||
terminatesHere: boolean;
|
||||
confirmed: number;
|
||||
stopped: number;
|
||||
stopTime?: number;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { ICarWagon, ILocomotive, IStock, IVehicleData, LocoGroupType, WagonGroupType } from '../types/common.types';
|
||||
import { MassLimitLocoType, calculateMassLimit, calculateSpeedLimit } from './vehicleLimitsUtils';
|
||||
|
||||
// UNUSED - ADDITIONAL CARGO TYPES FOR INTERMODALS
|
||||
export const additionalCargoTypes = [
|
||||
{
|
||||
groupType: '627Z',
|
||||
@@ -41,12 +42,12 @@ export const additionalCargoTypes = [
|
||||
groupType: '412Z',
|
||||
id: '412Z_mix1_sctc_loaded',
|
||||
weight: 43500,
|
||||
cargoStringVariations: ['sc_20:tc_20_loaded', 'tc_20_loaded:sc_20'],
|
||||
cargoStringVariations: ['sc_20:tc_20_loaded:tc_20_loaded'],
|
||||
},
|
||||
{
|
||||
groupType: '412Z',
|
||||
id: '412Z_mix1_sctc_empty',
|
||||
weight: 33970,
|
||||
weight: 37735,
|
||||
cargoStringVariations: ['sc_20:tc_20_empty:sc_20'],
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user