added double manning checkbox & support

This commit is contained in:
2023-10-28 15:33:09 +02:00
parent bea3c59405
commit c25a55a7d9
10 changed files with 70 additions and 38 deletions
-7
View File
@@ -1,7 +0,0 @@
const supportedConstructions = ["303e", "203e"];
export function locoSupportsColdStart(constructionType: string) {
return new RegExp(`(${supportedConstructions.join("|")})`).test(
constructionType,
);
}
+2
View File
@@ -16,5 +16,7 @@ export function calculateSpeedLimit(locoType: SpeedLimitLocoType, stockMass: num
}
export function calculateMassLimit(locoType: MassLimitLocoType, isTrainPassenger: boolean) {
if(massLimits[locoType] === undefined) return 0;
return massLimits[locoType][isTrainPassenger ? 0 : 1] || 0;
}
+9 -8
View File
@@ -33,8 +33,11 @@ export function locoDataList(state: IStore) {
sponsorsOnlyTimestamp: Number(sponsorsTimestamp),
imageSrc: '',
length: locoProps?.length && type.startsWith('2EN') ? locoProps.length * 2 : locoProps?.length || 0,
mass: locoProps?.mass && type.startsWith('2EN') ? 253 : locoProps?.mass || 0,
length: locoProps?.length && type.startsWith('2EN') ? locoProps.length * 2 : locoProps?.length ?? 0,
mass: locoProps?.mass && type.startsWith('2EN') ? 253 : locoProps?.mass ?? 0,
coldStart: locoProps?.coldStart ?? false,
doubleManned: locoProps?.doubleManned ?? false,
});
});
@@ -70,12 +73,10 @@ export function carDataList(state: IStore) {
maxSpeed: Number(maxSpeed),
imageSrc: '',
cargoList:
!carPropsData || carPropsData.cargo === null
? []
: carPropsData.cargo.split(';').map((cargo) => ({
id: cargo.split(':')[0],
totalMass: Number(cargo.split(':')[1]),
})),
carPropsData?.cargo?.split(';').map((cargo) => ({
id: cargo.split(':')[0],
totalMass: Number(cargo.split(':')[1]),
})) || [],
mass: carPropsData?.mass || 0,
length: carPropsData?.length || 0,