Use numbers instead of strings for slopes
This commit is contained in:
parent
167f8d87fe
commit
fe17f058bb
@ -4,8 +4,8 @@ export default function TrackHoverInfoPopup(props) {
|
||||
const { track } = props;
|
||||
|
||||
const slopeArr = Array.from(new Set([
|
||||
Math.abs(track['start_slope']),
|
||||
Math.abs(track['end_slope'])
|
||||
Math.abs(track.start_slope).toFixed(1),
|
||||
Math.abs(track.end_slope).toFixed(1),
|
||||
]));
|
||||
const slopeOptions = {join: ' / ', subOptions: {suffix: ' ‰'}};
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ export default class StandardTrack extends Track {
|
||||
middle: Vector3.zero(),
|
||||
};
|
||||
|
||||
constructor(id, start, rot, len, r, connections, id_station, start_slope, end_slope, id_isolation, prefab_name, maxspeed, derailspeed, source = TrackSource.STANDARD) {
|
||||
constructor(id, start, rot, len, r, connections, id_station, start_slope, end_slope, id_isolation, prefab_name, maxspeed, derailspeed, source) {
|
||||
super(id, start, rot, len, r, connections, id_station, start_slope, end_slope, id_isolation, prefab_name, maxspeed, derailspeed, source);
|
||||
this._calcPoints();
|
||||
}
|
||||
@ -51,7 +51,8 @@ export default class StandardTrack extends Track {
|
||||
values[17], // id_isolation
|
||||
values[19], // prefab_name
|
||||
parseFloat(values[20]) || 0, // maxspeed
|
||||
parseFloat(values[21]) || 0 // derailspeed
|
||||
parseFloat(values[21]) || 0, // derailspeed,
|
||||
TrackSource.STANDARD,
|
||||
);
|
||||
|
||||
return track;
|
||||
|
||||
@ -56,7 +56,7 @@ export default class Track extends SceneryObject {
|
||||
}
|
||||
|
||||
static slopesFromText(text) {
|
||||
return text.split(",", 2);
|
||||
return text.split(",", 2).map((slope) => parseFloat(slope));
|
||||
}
|
||||
|
||||
getEndPos(end) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user