Add setting to disable smart tunnels

This commit is contained in:
tobspr 2020-06-16 19:24:23 +02:00
parent 88fba76e3b
commit b753187cde
5 changed files with 24 additions and 5 deletions

View File

@ -2,7 +2,11 @@ export const CHANGELOG = [
{ {
version: "1.1.15", version: "1.1.15",
date: "unreleased", date: "unreleased",
entries: ["Added continue button to main menu and add seperate 'New game' button (by jaysc)"], entries: [
"Added continue button to main menu and add seperate 'New game' button (by jaysc)",
"Added setting to disable smart tunnel placement introduced with the last update",
"Update translations ",
],
}, },
{ {
version: "1.1.14", version: "1.1.14",

View File

@ -58,6 +58,11 @@ export class UndergroundBeltSystem extends GameSystemWithFilter {
* @param {Entity} entity * @param {Entity} entity
*/ */
onEntityPlaced(entity) { onEntityPlaced(entity) {
if (!this.root.app.settings.getAllSettings().enableTunnelSmartplace) {
// Smart-place disabled
return;
}
const undergroundComp = entity.components.UndergroundBelt; const undergroundComp = entity.components.UndergroundBelt;
if (undergroundComp && undergroundComp.mode === enumUndergroundBeltMode.receiver) { if (undergroundComp && undergroundComp.mode === enumUndergroundBeltMode.receiver) {
const staticComp = entity.components.StaticMapEntity; const staticComp = entity.components.StaticMapEntity;

View File

@ -146,6 +146,7 @@ export const allApplicationSettings = [
), ),
// GAME // GAME
new BoolSetting("offerHints", categoryGame, (app, value) => {}),
new EnumSetting("theme", { new EnumSetting("theme", {
options: Object.keys(THEMES), options: Object.keys(THEMES),
@ -197,7 +198,7 @@ export const allApplicationSettings = [
}), }),
new BoolSetting("alwaysMultiplace", categoryGame, (app, value) => {}), new BoolSetting("alwaysMultiplace", categoryGame, (app, value) => {}),
new BoolSetting("offerHints", categoryGame, (app, value) => {}), new BoolSetting("enableTunnelSmartplace", categoryGame, (app, value) => {}),
]; ];
export function getApplicationSettingById(id) { export function getApplicationSettingById(id) {
@ -219,6 +220,7 @@ class SettingsStorage {
this.alwaysMultiplace = false; this.alwaysMultiplace = false;
this.offerHints = true; this.offerHints = true;
this.enableTunnelSmartplace = true;
/** /**
* @type {Object.<string, number>} * @type {Object.<string, number>}
@ -408,7 +410,7 @@ export class ApplicationSettings extends ReadWriteProxy {
} }
getCurrentVersion() { getCurrentVersion() {
return 10; return 11;
} }
/** @param {{settings: SettingsStorage, version: number}} data */ /** @param {{settings: SettingsStorage, version: number}} data */
@ -445,6 +447,11 @@ export class ApplicationSettings extends ReadWriteProxy {
data.version = 10; data.version = 10;
} }
if (data.version < 11) {
data.settings.enableTunnelSmartplace = true;
data.version = 11;
}
return ExplainedResult.good(); return ExplainedResult.good();
} }
} }

View File

@ -675,6 +675,11 @@ settings:
description: >- description: >-
Whether to offer hints and tutorials while playing. Also hides certain UI elements onto a given level to make it easier to get into the game. Whether to offer hints and tutorials while playing. Also hides certain UI elements onto a given level to make it easier to get into the game.
enableTunnelSmartplace:
title: Smart Tunnels
description: >-
When enabled, placing tunnels will automatically remove unnecessary belts. This also enables to drag tunnels and excess tunnels will get removed.
keybindings: keybindings:
title: Keybindings title: Keybindings
hint: >- hint: >-

View File

@ -159,8 +159,6 @@ mainMenu:
showInfo: Wyświetl showInfo: Wyświetl
contestOver: Ten konkurs już się skończył - Dołącz do serwera Discord by nie przegapić kolejnych! contestOver: Ten konkurs już się skończył - Dołącz do serwera Discord by nie przegapić kolejnych!
continue: Continue
newGame: New Game
dialogs: dialogs:
buttons: buttons: