Fixed track connections

*Fixed most of the tracks being connected in reverse
This commit is contained in:
izawartka 2025-06-03 19:05:03 +02:00
parent 971003b1f2
commit 519ed7aa1d
6 changed files with 16 additions and 18 deletions

View File

@ -11,8 +11,8 @@ export default class BezierTrack extends Track
control2: Vector3.zero() control2: Vector3.zero()
}; };
constructor(id, start, control1, end, control2, rot, len, r, previd, nextid, id_station, start_slope, end_slope, id_isolation, maxspeed, derailspeed) { constructor(id, start, control1, end, control2, rot, len, r, nextid, previd, id_station, start_slope, end_slope, id_isolation, maxspeed, derailspeed) {
super(id, start, rot, len, r, previd, nextid, id_station, start_slope, end_slope, id_isolation, maxspeed, derailspeed); super(id, start, rot, len, r, nextid, previd, id_station, start_slope, end_slope, id_isolation, maxspeed, derailspeed);
Object.assign(this.points, { Object.assign(this.points, {
start, start,
@ -34,8 +34,8 @@ export default class BezierTrack extends Track
Vector3.zero(), Vector3.zero(),
0, // len ?? 0, // len ??
0, // r ?? 0, // r ??
values[15], // previd values[15], // nextid
values[16], // nextid values[16], // previd
values[17], // id_station values[17], // id_station
...Track.slopesFromText(values[18]), // start_slope, end_slope ...Track.slopesFromText(values[18]), // start_slope, end_slope
values[21], // id_isolation values[21], // id_isolation

View File

@ -10,12 +10,12 @@ export default class PointTrack extends Track
end: Vector3.zero() end: Vector3.zero()
}; };
constructor(id, start, end, r, previd, nextid, id_station, start_slope, end_slope, id_isolation, maxspeed, derailspeed) { constructor(id, start, end, r, nextid, previd, id_station, start_slope, end_slope, id_isolation, maxspeed, derailspeed) {
const ry = AngleHelper.radToDeg(start.atanY(end)); const ry = AngleHelper.radToDeg(start.atanY(end));
const rot = new Vector3(0, ry, 0); const rot = new Vector3(0, ry, 0);
// TODO: fix rx and rz = 0 // TODO: fix rx and rz = 0
// TODO: calculate length // TODO: calculate length
super(id, start, rot, null, r, previd, nextid, id_station, start_slope, end_slope, id_isolation, maxspeed, derailspeed); super(id, start, rot, null, r, nextid, previd, id_station, start_slope, end_slope, id_isolation, maxspeed, derailspeed);
Object.assign(this.points, { Object.assign(this.points, {
start, end start, end

View File

@ -75,7 +75,7 @@ export default class Scenery
addTrackAlias(id, alias) { addTrackAlias(id, alias) {
if(this.trackAliases[alias]) { if(this.trackAliases[alias]) {
SceneryParserLog.warn('trackAliasAlreadyExists', `Track alias "${alias}" already exists for track "${this.trackAliases[alias]}". Cannot add alias for "${id}".`); SceneryParserLog.warn('trackAliasAlreadyExists', `Track alias "${alias}" already exists for track "${this.trackAliases[alias]}". Cannot add alias for "${id}"`);
return; return;
} }

View File

@ -11,8 +11,8 @@ export default class StandardTrack extends Track
circleCenter: Vector3.zero() circleCenter: Vector3.zero()
}; };
constructor(id, start, rot, len, r, previd, nextid, id_station, start_slope, end_slope, id_isolation, maxspeed, derailspeed) { constructor(id, start, rot, len, r, nextid, previd, id_station, start_slope, end_slope, id_isolation, maxspeed, derailspeed) {
super(id, start, rot, len, r, previd, nextid, id_station, start_slope, end_slope, id_isolation, maxspeed, derailspeed); super(id, start, rot, len, r, nextid, previd, id_station, start_slope, end_slope, id_isolation, maxspeed, derailspeed);
this._calcPoints(); this._calcPoints();
} }
@ -24,8 +24,8 @@ export default class StandardTrack extends Track
Vector3.fromValuesArray(values, 6), // rot Vector3.fromValuesArray(values, 6), // rot
parseFloat(values[9]), // len parseFloat(values[9]), // len
parseFloat(values[10]), // r parseFloat(values[10]), // r
values[11], // previd values[11], // nextid
values[12], // nextid values[12], // previd
values[13], // id_station values[13], // id_station
...Track.slopesFromText(values[14]), // start_slope, end_slope ...Track.slopesFromText(values[14]), // start_slope, end_slope
values[17], // id_isolation values[17], // id_isolation

View File

@ -115,8 +115,8 @@ export default class Switch extends SceneryObject {
this.pos.add(startPos.rotate(rotRad)), this.pos.add(startPos.rotate(rotRad)),
this.pos.add(endPos.rotate(rotRad)), this.pos.add(endPos.rotate(rotRad)),
r, r,
previd,
nextid, nextid,
previd,
this.id_switch, this.id_switch,
0, // start_slope 0, // start_slope
0, // end_slope 0, // end_slope

View File

@ -9,19 +9,17 @@ export default class Track extends SceneryObject {
derailspeed; derailspeed;
category = "tracks"; category = "tracks";
type = "Track"; type = "Track";
previd;
nextid; nextid;
prevTrack = null; previd;
nextTrack = null;
start_slope; start_slope;
end_slope; end_slope;
hide_isolation = false; hide_isolation = false;
constructor(id, pos, rot, len, r, previd, nextid, id_station, start_slope, end_slope, id_isolation, maxspeed, derailspeed) { constructor(id, pos, rot, len, r, nextid, previd, id_station, start_slope, end_slope, id_isolation, maxspeed, derailspeed) {
super(id, pos, rot); super(id, pos, rot);
Object.assign(this, { Object.assign(this, {
len, r, len, r,
previd, nextid, nextid, previd,
id_station, id_station,
start_slope, end_slope, start_slope, end_slope,
id_isolation, id_isolation,