mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-03-02 03:39:21 +00:00
Add originalRotation to static comp in order to fix bugs with the automatic placement
This commit is contained in:
@@ -130,8 +130,8 @@ export class MetaBeltBaseBuilding extends MetaBuilding {
|
||||
const { ejectors, acceptors } = root.logic.getEjectorsAndAcceptorsAtTile(tile);
|
||||
|
||||
let hasBottomEjector = false;
|
||||
let hasLeftEjector = false;
|
||||
let hasRightEjector = false;
|
||||
let hasLeftEjector = false;
|
||||
|
||||
let hasTopAcceptor = false;
|
||||
let hasLeftAcceptor = false;
|
||||
@@ -144,9 +144,9 @@ export class MetaBeltBaseBuilding extends MetaBuilding {
|
||||
if (ejector.toDirection === topDirection) {
|
||||
hasBottomEjector = true;
|
||||
} else if (ejector.toDirection === leftDirection) {
|
||||
hasLeftEjector = true;
|
||||
} else if (ejector.toDirection === rightDirection) {
|
||||
hasRightEjector = true;
|
||||
} else if (ejector.toDirection === rightDirection) {
|
||||
hasLeftEjector = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +167,9 @@ export class MetaBeltBaseBuilding extends MetaBuilding {
|
||||
if (!hasBottomEjector) {
|
||||
// When something ejects to us from the left and nothing from the right,
|
||||
// do a curve from the left to the top
|
||||
if (hasLeftEjector && !hasRightEjector) {
|
||||
|
||||
if (hasRightEjector && !hasLeftEjector) {
|
||||
console.log("e - connect right");
|
||||
return {
|
||||
rotation: (rotation + 270) % 360,
|
||||
rotationVariant: 2,
|
||||
@@ -176,7 +178,8 @@ export class MetaBeltBaseBuilding extends MetaBuilding {
|
||||
|
||||
// When something ejects to us from the right and nothing from the left,
|
||||
// do a curve from the right to the top
|
||||
if (hasRightEjector && !hasLeftEjector) {
|
||||
if (hasLeftEjector && !hasRightEjector) {
|
||||
console.log("e - connect left");
|
||||
return {
|
||||
rotation: (rotation + 90) % 360,
|
||||
rotationVariant: 1,
|
||||
@@ -190,6 +193,7 @@ export class MetaBeltBaseBuilding extends MetaBuilding {
|
||||
// When there is an acceptor to the right but no acceptor to the left,
|
||||
// do a turn to the right
|
||||
if (hasRightAcceptor && !hasLeftAcceptor) {
|
||||
console.log("a - connect right");
|
||||
return {
|
||||
rotation,
|
||||
rotationVariant: 2,
|
||||
@@ -199,6 +203,7 @@ export class MetaBeltBaseBuilding extends MetaBuilding {
|
||||
// When there is an acceptor to the left but no acceptor to the right,
|
||||
// do a turn to the left
|
||||
if (hasLeftAcceptor && !hasRightAcceptor) {
|
||||
console.log("a - connect left");
|
||||
return {
|
||||
rotation,
|
||||
rotationVariant: 1,
|
||||
|
||||
@@ -109,12 +109,12 @@ export class MetaUndergroundBeltBuilding extends MetaBuilding {
|
||||
const undergroundComp = contents.components.UndergroundBelt;
|
||||
if (undergroundComp) {
|
||||
const staticComp = contents.components.StaticMapEntity;
|
||||
if (staticComp.rotationDegrees === targetRotation) {
|
||||
if (staticComp.rotation === targetRotation) {
|
||||
if (undergroundComp.mode !== enumUndergroundBeltMode.sender) {
|
||||
// If we encounter an underground receiver on our way which is also faced in our direction, we don't accept that
|
||||
break;
|
||||
}
|
||||
// console.log("GOT IT! rotation is", rotation, "and target is", staticComp.rotationDegrees);
|
||||
// console.log("GOT IT! rotation is", rotation, "and target is", staticComp.rotation);
|
||||
|
||||
return {
|
||||
rotation: targetRotation,
|
||||
|
||||
Reference in New Issue
Block a user