1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2026-02-13 11:29:20 +00:00

Simplify + Wording

Adding the requested change.

Changes sound to playSound.
Changes suppressSound to playSound.
Removes suppressSound to sound.
Inverts sound check so it works with new playSound.
This commit is contained in:
Triston Stuart 2020-06-24 11:08:22 -07:00
parent 3d227de71d
commit 02e3448ec6

View File

@ -368,15 +368,12 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
* @param {Vector} tile
* @param {boolean} suppressSound
*/
tryPlaceCurrentBuildingAt(tile, suppressSound = false) {
tryPlaceCurrentBuildingAt(tile, playSound = true) {
if (this.root.camera.zoomLevel < globalConfig.mapChunkOverviewMinZoom) {
// Dont allow placing in overview mode
return;
}
// Set sound to the opposite of suppressSound.
const sound = !suppressSound;
const metaBuilding = this.currentMetaBuilding.get();
const { rotation, rotationVariant } = metaBuilding.computeOptimalDirectionAndRotationVariantAtTile(
this.root,
@ -419,7 +416,7 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
}
// Building has been placed, play sound
if (sound) {
if (playSound) {
this.root.soundProxy.playUi(metaBuilding.getPlacementSound());
}
@ -467,10 +464,11 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
/*
Trys to place building.
Includes check to see if we should play sound.
2nd Argument is playSound.
*/
const placedBuilding = this.tryPlaceCurrentBuildingAt(
tile,
i == 0 || trySound ? false : true
i == 0 || trySound ? true : false
);
/*
If placedBuilding is false then the building didn't place.