1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2024-10-27 20:34:29 +00:00

use 90 degree rotation

This commit is contained in:
EmeraldBlock 2021-06-28 14:01:26 -05:00
parent 0deb08901b
commit 93ecc77792

View File

@ -119,11 +119,11 @@ export class HUDWiresOverlay extends BaseHUDPart {
// Check if slot is close to mouse
// Dirty math that I don't like the look of
const slotPos = staticComp.localTileToWorld(slot.pos).toWorldSpaceCenterOfTile();
const effectiveRotation = Math.radians(
staticComp.rotation + enumDirectionToAngle[slot.direction]
);
const effectiveRotation = (staticComp.rotation + enumDirectionToAngle[slot.direction]) % 360;
// -9.1 comes from systems > wired_pins.js > line 207
const valueSpritePos = slotPos.add(new Vector(0, -9.1).rotated(effectiveRotation));
const valueSpritePos = slotPos.add(
new Vector(0, -9.1).rotateInplaceFastMultipleOf90(effectiveRotation)
);
const length = mouseTilePos.sub(valueSpritePos).length();
// If it is closer than 8 we can copy that value