1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-12-13 10:11:50 +00:00

Replaced concatenated strings with template literals

This commit is contained in:
saile515 2022-01-21 23:28:02 +01:00
parent 7741d1590e
commit e98933f39c
4 changed files with 5 additions and 5 deletions

View File

@ -23,7 +23,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

@ -75,7 +75,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);
} }
@ -89,7 +89,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

@ -15,7 +15,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

@ -12,7 +12,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"]);
}); });
} }
} }