Allow to cycle variants backwards with SHIFT + T, other fixes and misc stuff

This commit is contained in:
tobspr 2020-12-07 18:30:33 +01:00
parent 503e643fd4
commit 3ada0d5774
5 changed files with 17 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 731 B

View File

@ -15,6 +15,11 @@
"vetur.format.defaultFormatter.ts": "vscode-typescript",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"files.trimTrailingWhitespace": true
"files.trimTrailingWhitespace": true,
"workbench.colorCustomizations": {
"activityBar.background": "#163328",
"titleBar.activeBackground": "#1F4738",
"titleBar.activeForeground": "#F7FBFA"
}
}
}

View File

@ -103,7 +103,7 @@
& {
/* @load-async */
background: uiResource("icons/pin.png") center center / 95% no-repeat;
background: uiResource("icons/unpin_shape.png") center center / 80% no-repeat;
}
}

View File

@ -6,7 +6,10 @@ export const CHANGELOG = [
"Added the ability to edit constant signals by left clicking them",
"You can now add markers in the wire layer (partially by daanbreur)",
"Allow to cycle backwards in the toolbar with SHIFT + Tab (idea by emeraldblock)",
"Allow to cycle variants backwards with SHIFT + T",
"Upgrade numbers now use roman numerals until tier 50 (by LeopoldTal)",
"Add button to unpin shapes from the left side (by artemisSystem)",
"Updated translations (Thanks to all contributors!)",
],
},
{

View File

@ -14,6 +14,7 @@ import { MetaMinerBuilding, enumMinerVariants } from "../../buildings/miner";
import { enumHubGoalRewards } from "../../tutorial_goals";
import { getBuildingDataFromCode, getCodeFromBuildingData } from "../../building_codes";
import { MetaHubBuilding } from "../../buildings/hub";
import { safeModulo } from "../../../core/utils";
/**
* Contains all logic for the building placer - this doesn't include the rendering
@ -467,7 +468,12 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
index = 0;
console.warn("Invalid variant selected:", this.currentVariant.get());
}
const newIndex = (index + 1) % availableVariants.length;
const direction = this.root.keyMapper.getBinding(KEYMAPPINGS.placement.rotateInverseModifier)
.pressed
? -1
: 1;
const newIndex = safeModulo(index + direction, availableVariants.length);
const newVariant = availableVariants[newIndex];
this.setVariant(newVariant);
}