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

Replaced concatenated strings with template literals (#1347)

This commit is contained in:
saile515 2022-01-22 09:50:02 +01:00 committed by GitHub
parent ade7176dba
commit a3dfe6f5fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 5 deletions

View File

@ -24,7 +24,7 @@ class Mod extends shapez.Mod {
if (state instanceof shapez.MainMenuState) { if (state instanceof shapez.MainMenuState) {
this.dialogs.showInfo( this.dialogs.showInfo(
"Welcome back", "Welcome back",
"You have launched this mod " + this.settings.timesLaunched + " times" `You have launched this mod ${this.settings.timesLaunched} times`
); );
} }
}); });

View File

@ -76,7 +76,7 @@ class FluidItem extends shapez.BaseItem {
*/ */
drawFullSizeOnCanvas(context, size) { drawFullSizeOnCanvas(context, size) {
if (!this.cachedSprite) { if (!this.cachedSprite) {
this.cachedSprite = shapez.Loader.getSprite("sprites/fluids/" + this.fluidType + ".png"); this.cachedSprite = shapez.Loader.getSprite(`sprites/fluids/${this.fluidType}.png`);
} }
this.cachedSprite.drawCentered(context, size / 2, size / 2, size); this.cachedSprite.drawCentered(context, size / 2, size / 2, size);
} }
@ -90,7 +90,7 @@ class FluidItem extends shapez.BaseItem {
drawItemCenteredClipped(x, y, parameters, diameter = globalConfig.defaultItemDiameter) { drawItemCenteredClipped(x, y, parameters, diameter = globalConfig.defaultItemDiameter) {
const realDiameter = diameter * 0.6; const realDiameter = diameter * 0.6;
if (!this.cachedSprite) { if (!this.cachedSprite) {
this.cachedSprite = shapez.Loader.getSprite("sprites/fluids/" + this.fluidType + ".png"); this.cachedSprite = shapez.Loader.getSprite(`sprites/fluids/${this.fluidType}.png`);
} }
this.cachedSprite.drawCachedCentered(parameters, x, y, realDiameter); this.cachedSprite.drawCachedCentered(parameters, x, y, realDiameter);
} }

View File

@ -16,7 +16,7 @@ class Mod extends shapez.Mod {
event.preventDefault(); event.preventDefault();
const data = event.clipboardData.getData("text"); const data = event.clipboardData.getData("text");
this.dialogs.showInfo("Pasted", "You pasted: '" + data + "'"); this.dialogs.showInfo("Pasted", `You pasted: '${data}'`);
}); });
}); });
} }

View File

@ -13,7 +13,7 @@ class Mod extends shapez.Mod {
init() { init() {
// Replace a builtin sprite // Replace a builtin sprite
["red", "green", "blue", "yellow", "purple", "cyan", "white"].forEach(color => { ["red", "green", "blue", "yellow", "purple", "cyan", "white"].forEach(color => {
this.modInterface.registerSprite("sprites/colors/" + color + ".png", RESOURCES[color + ".png"]); this.modInterface.registerSprite(`sprites/colors/${color}.png`, RESOURCES[color + ".png"]);
}); });
} }
} }