Skip to content

Commit

Permalink
Fix bug with frames not duplicating correctly. Adding multiple frames…
Browse files Browse the repository at this point in the history
… at once (say, internal bomb bays) would link their settings so checking lifting body for one would check it for all of them.
  • Loading branch information
Tetragramm committed Jul 10, 2024
1 parent 2402588 commit 293e53f
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion PlaneBuilder/Hangar/hangar.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion PlaneBuilder/plane_builder.js

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions PlaneBuilder/src/impl/Frames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,31 +206,31 @@ export class Frames extends Part {

public DuplicateSection(num: number, count: number = 1) {
const sec = this.section_list[num];
const new_section = {
frame: sec.frame, geodesic: sec.geodesic, monocoque: sec.monocoque,
lifting_body: sec.lifting_body, internal_bracing: sec.internal_bracing
};
if (new_section.internal_bracing) {
if (this.CountSections() + this.tail_section_list.length == this.interal_bracing_count)
return;
this.interal_bracing_count += count;
}
for (let i = 0; i < count; i++) {
const new_section = {
frame: sec.frame, geodesic: sec.geodesic, monocoque: sec.monocoque,
lifting_body: sec.lifting_body, internal_bracing: sec.internal_bracing
};
if (new_section.internal_bracing) {
if (this.CountSections() + this.tail_section_list.length == this.interal_bracing_count)
return;
this.interal_bracing_count += count;
}
this.section_list.splice(num, 0, new_section);
}
this.CalculateStats();
}

private DuplicateTailSection(num: number, count: number = 1) {
const sec = this.tail_section_list[num];
const new_section = {
frame: sec.frame, geodesic: sec.geodesic, monocoque: sec.monocoque,
lifting_body: sec.lifting_body, internal_bracing: sec.internal_bracing
};
if (new_section.internal_bracing && this.CountSections() == this.interal_bracing_count) {
return;
}
for (let i = 0; i < count; i++) {
const new_section = {
frame: sec.frame, geodesic: sec.geodesic, monocoque: sec.monocoque,
lifting_body: sec.lifting_body, internal_bracing: sec.internal_bracing
};
if (new_section.internal_bracing && this.CountSections() == this.interal_bracing_count) {
return;
}
this.tail_section_list.splice(num, 0, new_section);
}
this.CalculateStats();
Expand Down
2 changes: 1 addition & 1 deletion Test/Hangar/hangar.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Test/plane_builder.js

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions Test/src/impl/Frames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,31 +206,31 @@ export class Frames extends Part {

public DuplicateSection(num: number, count: number = 1) {
const sec = this.section_list[num];
const new_section = {
frame: sec.frame, geodesic: sec.geodesic, monocoque: sec.monocoque,
lifting_body: sec.lifting_body, internal_bracing: sec.internal_bracing
};
if (new_section.internal_bracing) {
if (this.CountSections() + this.tail_section_list.length == this.interal_bracing_count)
return;
this.interal_bracing_count += count;
}
for (let i = 0; i < count; i++) {
const new_section = {
frame: sec.frame, geodesic: sec.geodesic, monocoque: sec.monocoque,
lifting_body: sec.lifting_body, internal_bracing: sec.internal_bracing
};
if (new_section.internal_bracing) {
if (this.CountSections() + this.tail_section_list.length == this.interal_bracing_count)
return;
this.interal_bracing_count += count;
}
this.section_list.splice(num, 0, new_section);
}
this.CalculateStats();
}

private DuplicateTailSection(num: number, count: number = 1) {
const sec = this.tail_section_list[num];
const new_section = {
frame: sec.frame, geodesic: sec.geodesic, monocoque: sec.monocoque,
lifting_body: sec.lifting_body, internal_bracing: sec.internal_bracing
};
if (new_section.internal_bracing && this.CountSections() == this.interal_bracing_count) {
return;
}
for (let i = 0; i < count; i++) {
const new_section = {
frame: sec.frame, geodesic: sec.geodesic, monocoque: sec.monocoque,
lifting_body: sec.lifting_body, internal_bracing: sec.internal_bracing
};
if (new_section.internal_bracing && this.CountSections() == this.interal_bracing_count) {
return;
}
this.tail_section_list.splice(num, 0, new_section);
}
this.CalculateStats();
Expand Down

0 comments on commit 293e53f

Please sign in to comment.