Fixed #4791 since it is 100% a bug (#4801)

* Fixed #4719 since it is 100% a bug

This fix is somewhat janky as it checks if the rotation matches the exact original rotation but the likelihood of someone needing bridges along a belt rotated 1 or -1 times is super low. https://aethex.is-a.fail/t13ETd.webm

* unjank rotation

* fix potential crash, styling

* Use mathf.mod
This commit is contained in:
buthed010203 2021-02-26 19:06:27 -05:00 committed by GitHub
parent ae6be1db3b
commit e4ecfc4ee7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -119,6 +119,7 @@ public class Placement{
var result = plans1.clear();
var team = player.team();
var rotated = plans.first().tile() != null && plans.first().tile().absoluteRelativeTo(plans.peek().x, plans.peek().y) == Mathf.mod(plans.first().rotation + 2, 4);
outer:
for(int i = 0; i < plans.size;){
@ -144,7 +145,11 @@ public class Placement{
//found a link, assign bridges
cur.block = bridge;
other.block = bridge;
cur.config = new Point2(other.x - cur.x, other.y - cur.y);
if(rotated){
other.config = new Point2(cur.x - other.x, cur.y - other.y);
}else{
cur.config = new Point2(other.x - cur.x, other.y - cur.y);
}
i = j;
continue outer;