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:
parent
0deb08901b
commit
93ecc77792
@ -119,11 +119,11 @@ export class HUDWiresOverlay extends BaseHUDPart {
|
|||||||
// Check if slot is close to mouse
|
// Check if slot is close to mouse
|
||||||
// Dirty math that I don't like the look of
|
// Dirty math that I don't like the look of
|
||||||
const slotPos = staticComp.localTileToWorld(slot.pos).toWorldSpaceCenterOfTile();
|
const slotPos = staticComp.localTileToWorld(slot.pos).toWorldSpaceCenterOfTile();
|
||||||
const effectiveRotation = Math.radians(
|
const effectiveRotation = (staticComp.rotation + enumDirectionToAngle[slot.direction]) % 360;
|
||||||
staticComp.rotation + enumDirectionToAngle[slot.direction]
|
|
||||||
);
|
|
||||||
// -9.1 comes from systems > wired_pins.js > line 207
|
// -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();
|
const length = mouseTilePos.sub(valueSpritePos).length();
|
||||||
|
|
||||||
// If it is closer than 8 we can copy that value
|
// If it is closer than 8 we can copy that value
|
||||||
|
Loading…
Reference in New Issue
Block a user