mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
Merge branch 'master' of https://github.com/tobspr/shapez.io
This commit is contained in:
commit
eea02bf571
@ -106,13 +106,14 @@ export class HubGoals extends BasicSerializableObject {
|
||||
|
||||
// Allow quickly switching goals in dev mode
|
||||
if (G_IS_DEV) {
|
||||
if (G_IS_DEV) {
|
||||
window.addEventListener("keydown", ev => {
|
||||
if (ev.key === "b") {
|
||||
window.addEventListener("keydown", ev => {
|
||||
if (ev.key === "b") {
|
||||
// root is not guaranteed to exist within ~0.5s after loading in
|
||||
if (this.root && this.root.app && this.root.app.gameAnalytics) {
|
||||
this.onGoalCompleted();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -322,7 +322,12 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
|
||||
|
||||
// Try to extract the building
|
||||
const extracted = this.hack_reconstructMetaBuildingAndVariantFromBuilding(contents);
|
||||
if (!extracted) {
|
||||
// If the building we are picking is the same as the one we have, clear the cursor.
|
||||
if (
|
||||
!extracted ||
|
||||
(extracted.metaBuilding === this.currentMetaBuilding.get() &&
|
||||
extracted.variant === this.currentVariant.get())
|
||||
) {
|
||||
this.currentMetaBuilding.set(null);
|
||||
return;
|
||||
}
|
||||
@ -558,8 +563,15 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
|
||||
|
||||
// Figure which points the line visits
|
||||
const worldPos = this.root.camera.screenToWorld(mousePosition);
|
||||
const mouseTile = worldPos.toTileSpace();
|
||||
const startTile = this.lastDragTile;
|
||||
let endTile = worldPos.toTileSpace();
|
||||
let startTile = this.lastDragTile;
|
||||
|
||||
// if the alt key is pressed, reverse belt planner direction by switching start and end tile
|
||||
if (this.root.keyMapper.getBinding(KEYMAPPINGS.placementModifiers.placeInverse).pressed) {
|
||||
let tmp = startTile;
|
||||
startTile = endTile;
|
||||
endTile = tmp;
|
||||
}
|
||||
|
||||
// Place from start to corner
|
||||
const pathToCorner = this.currentDirectionLockCorner.sub(startTile);
|
||||
@ -580,7 +592,7 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
|
||||
}
|
||||
|
||||
// Place from corner to end
|
||||
const pathFromCorner = mouseTile.sub(this.currentDirectionLockCorner);
|
||||
const pathFromCorner = endTile.sub(this.currentDirectionLockCorner);
|
||||
const deltaFromCorner = pathFromCorner.normalize().round();
|
||||
const lengthFromCorner = Math.round(pathFromCorner.length());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user