From 2d83994771dafb12191d34bf6622d1bdc81c1c51 Mon Sep 17 00:00:00 2001 From: dengr1065 Date: Tue, 30 Jun 2020 04:53:06 +0300 Subject: [PATCH 01/19] More debug info (toggle) --- src/css/ingame_hud/debug_info.scss | 7 +++++ src/js/game/hud/parts/debug_info.js | 41 +++++++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/src/css/ingame_hud/debug_info.scss b/src/css/ingame_hud/debug_info.scss index f370d04e..24bd856f 100644 --- a/src/css/ingame_hud/debug_info.scss +++ b/src/css/ingame_hud/debug_info.scss @@ -9,4 +9,11 @@ line-height: 15px; flex-direction: column; color: #fff; + + &:not(.debugFull) { + .mousePosition, + .cameraPosition { + display: none; + } + } } diff --git a/src/js/game/hud/parts/debug_info.js b/src/js/game/hud/parts/debug_info.js index 46ec2dcf..79004d8e 100644 --- a/src/js/game/hud/parts/debug_info.js +++ b/src/js/game/hud/parts/debug_info.js @@ -2,6 +2,7 @@ import { BaseHUDPart } from "../base_hud_part"; import { makeDiv, round3Digits, round2Digits } from "../../../core/utils"; import { DynamicDomAttach } from "../dynamic_dom_attach"; import { KEYMAPPINGS } from "../../key_action_mapper"; +import { Vector } from "../../../core/vector"; export class HUDDebugInfo extends BaseHUDPart { createElements(parent) { @@ -9,20 +10,54 @@ export class HUDDebugInfo extends BaseHUDPart { this.tickRateElement = makeDiv(this.element, null, ["tickRate"], "Ticks /s: 120"); this.fpsElement = makeDiv(this.element, null, ["fps"], "FPS: 60"); - this.tickDurationElement = makeDiv(this.element, null, ["tickDuration"], "Update time: 0.5ms"); + this.tickDurationElement = makeDiv(this.element, null, ["tickDuration"], "Tick dur: 0.5ms"); + this.mousePositionElement = makeDiv(this.element, null, ["mousePosition"], "Pos: 0 0"); + this.cameraPositionElement = makeDiv(this.element, null, ["cameraPosition"], "Center: 0 0"); + this.versionElement = makeDiv(this.element, null, ["version"], "version unknown"); } initialize() { this.lastTick = 0; this.visible = false; + this.full = false; this.domAttach = new DynamicDomAttach(this.root, this.element); this.root.keyMapper.getBinding(KEYMAPPINGS.ingame.toggleFPSInfo).add(() => this.toggle()); } + updateFullText() { + this.element.classList.toggle("debugFull", this.full); + + let version = `version ${G_BUILD_VERSION}`; + if (this.full) { + version += ` @ ${G_APP_ENVIRONMENT} @ ${G_BUILD_COMMIT_HASH}`; + } + + this.versionElement.innerText = version; + } + + updatePositions() { + let mousePos = this.root.app.mousePosition || new Vector(0, 0); + mousePos = this.root.camera.screenToWorld(mousePos).toTileSpace(); + const cameraPos = this.root.camera.center.toTileSpace(); + + this.mousePositionElement.innerText = `Pos: ${mousePos.x} ${mousePos.y}`; + this.cameraPositionElement.innerText = `Center: ${cameraPos.x} ${cameraPos.y}`; + } + toggle() { - this.visible = !this.visible; + if (this.visible) { + if (this.full) { + this.visible = false; + this.full = false; + } else { + this.full = true; + } + } else { + this.visible = true; + } + this.updateFullText(); this.domAttach.update(this.visible); } @@ -40,5 +75,7 @@ export class HUDDebugInfo extends BaseHUDPart { this.tickDurationElement.innerText = "Tick Dur: " + round3Digits(this.root.dynamicTickrate.averageTickDuration) + "ms"; } + + this.updatePositions(); } } From 6769e9c9b8ce2f822de14b28e0d53ae71c130920 Mon Sep 17 00:00:00 2001 From: dengr1065 Date: Wed, 1 Jul 2020 23:53:51 +0300 Subject: [PATCH 02/19] Use enum for debug overlay --- src/js/game/hud/parts/debug_info.js | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/js/game/hud/parts/debug_info.js b/src/js/game/hud/parts/debug_info.js index 79004d8e..d4baa18a 100644 --- a/src/js/game/hud/parts/debug_info.js +++ b/src/js/game/hud/parts/debug_info.js @@ -4,6 +4,8 @@ import { DynamicDomAttach } from "../dynamic_dom_attach"; import { KEYMAPPINGS } from "../../key_action_mapper"; import { Vector } from "../../../core/vector"; +export const enumDebugOverlayMode = { disabled: 'disabled', regular: 'regular', detailed: 'detailed'}; + export class HUDDebugInfo extends BaseHUDPart { createElements(parent) { this.element = makeDiv(parent, "ingame_HUD_DebugInfo", []); @@ -19,8 +21,7 @@ export class HUDDebugInfo extends BaseHUDPart { initialize() { this.lastTick = 0; - this.visible = false; - this.full = false; + this.mode = enumDebugOverlayMode.disabled; this.domAttach = new DynamicDomAttach(this.root, this.element); this.root.keyMapper.getBinding(KEYMAPPINGS.ingame.toggleFPSInfo).add(() => this.toggle()); @@ -47,18 +48,19 @@ export class HUDDebugInfo extends BaseHUDPart { } toggle() { - if (this.visible) { - if (this.full) { - this.visible = false; - this.full = false; - } else { - this.full = true; - } - } else { - this.visible = true; + switch (this.mode) { + case enumDebugOverlayMode.detailed: + this.mode = enumDebugOverlayMode.disabled; + break; + case enumDebugOverlayMode.regular: + this.mode = enumDebugOverlayMode.detailed; + break; + default: + this.mode = enumDebugOverlayMode.regular; + break; } this.updateFullText(); - this.domAttach.update(this.visible); + this.domAttach.update(this.mode != enumDebugOverlayMode.disabled); } update() { From 4bbbdafbb9c9ca84d9ae827b36891db3f61af104 Mon Sep 17 00:00:00 2001 From: dengr1065 Date: Thu, 2 Jul 2020 00:41:01 +0300 Subject: [PATCH 03/19] Fix copy-pasted code i hate myself --- src/js/game/hud/parts/debug_info.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/game/hud/parts/debug_info.js b/src/js/game/hud/parts/debug_info.js index d4baa18a..d79dd0a1 100644 --- a/src/js/game/hud/parts/debug_info.js +++ b/src/js/game/hud/parts/debug_info.js @@ -4,7 +4,7 @@ import { DynamicDomAttach } from "../dynamic_dom_attach"; import { KEYMAPPINGS } from "../../key_action_mapper"; import { Vector } from "../../../core/vector"; -export const enumDebugOverlayMode = { disabled: 'disabled', regular: 'regular', detailed: 'detailed'}; +export const enumDebugOverlayMode = { disabled: "disabled", regular: "regular", detailed: "detailed" }; export class HUDDebugInfo extends BaseHUDPart { createElements(parent) { From c29b505ef0d1ce0f06884a4ca8f1d38ddb0ebded Mon Sep 17 00:00:00 2001 From: dengr1065 Date: Thu, 2 Jul 2020 01:05:25 +0300 Subject: [PATCH 04/19] Add consistent enum comment --- src/js/game/hud/parts/debug_info.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/js/game/hud/parts/debug_info.js b/src/js/game/hud/parts/debug_info.js index d79dd0a1..33644f33 100644 --- a/src/js/game/hud/parts/debug_info.js +++ b/src/js/game/hud/parts/debug_info.js @@ -4,6 +4,7 @@ import { DynamicDomAttach } from "../dynamic_dom_attach"; import { KEYMAPPINGS } from "../../key_action_mapper"; import { Vector } from "../../../core/vector"; +/** @enum {string} */ export const enumDebugOverlayMode = { disabled: "disabled", regular: "regular", detailed: "detailed" }; export class HUDDebugInfo extends BaseHUDPart { From 8593e05de34e598b7f6af6a2fdb5a750bc52a102 Mon Sep 17 00:00:00 2001 From: Astavie Date: Sun, 5 Jul 2020 13:46:22 +0200 Subject: [PATCH 05/19] Update base-nl.yaml --- translations/base-nl.yaml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/translations/base-nl.yaml b/translations/base-nl.yaml index b1a2b172..e585f5b5 100644 --- a/translations/base-nl.yaml +++ b/translations/base-nl.yaml @@ -61,7 +61,7 @@ steamPage: [*] Aangepaste mappen aanmaken (Het kiezen van de hoeveelheid en de grootte van de grondstofbronnen, seeds, en meer) [*] Meer soorten vormen [*] Meer prestatieverbeteringen (Hoewel het spel al vrij goed loopt!) - [*] Kleurenblind-modus + [*] Kleurenblindmodus [*] En nog veel meer! [/list] @@ -528,12 +528,11 @@ storyRewards: reward_painter: title: Verven - desc: >- - The painter has been unlocked - Extract some color veins (just as you do with shapes) and combine it with a shape in the painter to color them!

PS: If you are colorblind, there is a color blind mode in the settings! + desc: De verver is ontgrendeld - Onttrek wat kleur (op dezelfde manier hoe je vormen onttrekt) en combineer het met een vorm in de verver om ze te kleuren!

PS: Als je kleurenblind bent, is er een kleurenblindmodus in de instellingen! reward_mixer: title: Kleuren mengen - desc: De menger is ontgrendeld - gebruik dit gebouw om twee kleuren te mengen via 'additive blending'! + desc: De menger is ontgrendeld - Gebruik dit gebouw om twee kleuren te mengen via 'additive blending'! reward_stacker: title: Stapelaar From 8c777a47127737ae57b1be03a8afc3fb4fe00802 Mon Sep 17 00:00:00 2001 From: Astavie Date: Sun, 5 Jul 2020 14:27:03 +0200 Subject: [PATCH 06/19] Additieve kleurmening --- translations/base-nl.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/translations/base-nl.yaml b/translations/base-nl.yaml index e585f5b5..4250db68 100644 --- a/translations/base-nl.yaml +++ b/translations/base-nl.yaml @@ -486,7 +486,7 @@ buildings: mixer: default: name: &mixer Kleurenmenger - description: Mengt twee kleuren. + description: Mengt twee kleuren met behulp van additieve kleurmenging. painter: default: @@ -532,7 +532,7 @@ storyRewards: reward_mixer: title: Kleuren mengen - desc: De menger is ontgrendeld - Gebruik dit gebouw om twee kleuren te mengen via 'additive blending'! + desc: De menger is ontgrendeld - Gebruik dit gebouw om twee kleuren te mengen met behulp van additieve kleurmenging! reward_stacker: title: Stapelaar From 322e7fbcc93b29cfaaab3362eec866df40a9ea7e Mon Sep 17 00:00:00 2001 From: MizardX Date: Thu, 2 Jul 2020 01:13:49 +0200 Subject: [PATCH 07/19] Initial planner direction based on cursor movement --- src/js/game/hud/parts/building_placer_logic.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/js/game/hud/parts/building_placer_logic.js b/src/js/game/hud/parts/building_placer_logic.js index d0737df8..73fe40b4 100644 --- a/src/js/game/hud/parts/building_placer_logic.js +++ b/src/js/game/hud/parts/building_placer_logic.js @@ -92,6 +92,12 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart { */ this.currentDirectionLockSide = 0; + /** + * Whether the side for direction lock has not yet been determined. + * @type {boolean} + */ + this.currentDirectionLockSideIndeterminate = true; + this.initializeBindings(); } @@ -204,6 +210,17 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart { const worldPos = this.root.camera.screenToWorld(mousePosition); const mouseTile = worldPos.toTileSpace(); + // Figure initial direction + const dx = Math.abs(this.lastDragTile.x - mouseTile.x); + const dy = Math.abs(this.lastDragTile.y - mouseTile.y); + if (dx === 0 && dy === 0) { + // Back at the start. Try a new direction. + this.currentDirectionLockSideIndeterminate = true; + } else if (this.currentDirectionLockSideIndeterminate) { + this.currentDirectionLockSideIndeterminate = false; + this.currentDirectionLockSide = dx <= dy ? 0 : 1; + } + if (this.currentDirectionLockSide === 0) { return new Vector(this.lastDragTile.x, mouseTile.y); } else { From 6546c023a6bca3bec49183fd0535c569ed696e17 Mon Sep 17 00:00:00 2001 From: dengr1065 Date: Mon, 6 Jul 2020 12:00:40 +0300 Subject: [PATCH 08/19] debug info css - prepare for attribute usage --- src/css/ingame_hud/debug_info.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/css/ingame_hud/debug_info.scss b/src/css/ingame_hud/debug_info.scss index 24bd856f..dc3e7221 100644 --- a/src/css/ingame_hud/debug_info.scss +++ b/src/css/ingame_hud/debug_info.scss @@ -10,7 +10,7 @@ flex-direction: column; color: #fff; - &:not(.debugFull) { + &:not([data-mode="full"]) { .mousePosition, .cameraPosition { display: none; From f4c9c663541a2196de17a352980df9eb78d64099 Mon Sep 17 00:00:00 2001 From: dengr1065 Date: Mon, 6 Jul 2020 12:02:31 +0300 Subject: [PATCH 09/19] debug info fixes --- src/js/game/hud/parts/debug_info.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/js/game/hud/parts/debug_info.js b/src/js/game/hud/parts/debug_info.js index 33644f33..bdce3071 100644 --- a/src/js/game/hud/parts/debug_info.js +++ b/src/js/game/hud/parts/debug_info.js @@ -29,7 +29,7 @@ export class HUDDebugInfo extends BaseHUDPart { } updateFullText() { - this.element.classList.toggle("debugFull", this.full); + this.element.setAttribute("data-mode", this.mode); let version = `version ${G_BUILD_VERSION}`; if (this.full) { @@ -61,12 +61,14 @@ export class HUDDebugInfo extends BaseHUDPart { break; } this.updateFullText(); - this.domAttach.update(this.mode != enumDebugOverlayMode.disabled); + this.domAttach.update(this.mode !== enumDebugOverlayMode.disabled); } update() { const now = this.root.time.realtimeNow(); - if (now - this.lastTick > 0.25 && this.visible) { + if (!this.visible) return; + + if (now - this.lastTick > 0.25) { this.lastTick = now; this.tickRateElement.innerText = "Tickrate: " + this.root.dynamicTickrate.currentTickRate; this.fpsElement.innerText = From b61e0aac73ef6941966ff4f35da3a4afadd2f3fd Mon Sep 17 00:00:00 2001 From: dengr1065 Date: Mon, 6 Jul 2020 12:07:46 +0300 Subject: [PATCH 10/19] debug info - fix lint fail github editor sucks without built-in prettier --- src/js/game/hud/parts/debug_info.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/game/hud/parts/debug_info.js b/src/js/game/hud/parts/debug_info.js index bdce3071..bfa09b1e 100644 --- a/src/js/game/hud/parts/debug_info.js +++ b/src/js/game/hud/parts/debug_info.js @@ -67,7 +67,7 @@ export class HUDDebugInfo extends BaseHUDPart { update() { const now = this.root.time.realtimeNow(); if (!this.visible) return; - + if (now - this.lastTick > 0.25) { this.lastTick = now; this.tickRateElement.innerText = "Tickrate: " + this.root.dynamicTickrate.currentTickRate; From b3c9c186d318792f22b52aec8babc7a174def431 Mon Sep 17 00:00:00 2001 From: dengr1065 Date: Mon, 6 Jul 2020 14:17:58 +0300 Subject: [PATCH 11/19] debug info - use "detailed" instead of "full" i'm retarded pls help --- src/css/ingame_hud/debug_info.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/css/ingame_hud/debug_info.scss b/src/css/ingame_hud/debug_info.scss index dc3e7221..de69a4f9 100644 --- a/src/css/ingame_hud/debug_info.scss +++ b/src/css/ingame_hud/debug_info.scss @@ -10,7 +10,7 @@ flex-direction: column; color: #fff; - &:not([data-mode="full"]) { + &:not([data-mode="detailed"]) { .mousePosition, .cameraPosition { display: none; From ef8d520d948c68984e5d6353b594f8076ed115fc Mon Sep 17 00:00:00 2001 From: tobspr Date: Mon, 6 Jul 2020 14:03:50 +0200 Subject: [PATCH 12/19] Add slovenian translation prefab --- translations/README.md | 1 + translations/base-sl.yaml | 887 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 888 insertions(+) create mode 100644 translations/base-sl.yaml diff --git a/translations/README.md b/translations/README.md index 30ec7828..8934bfa9 100644 --- a/translations/README.md +++ b/translations/README.md @@ -30,6 +30,7 @@ The base translation is `base-en.yaml`. It will always contain the latest phrase - [Danish](base-da.yaml) - [Finnish](base-fi.yaml) - [Catalan](base-cat.yaml) +- [Slovenian](base-sl.yaml) (If you want to translate into a new language, see below!) diff --git a/translations/base-sl.yaml b/translations/base-sl.yaml new file mode 100644 index 00000000..fd03ebff --- /dev/null +++ b/translations/base-sl.yaml @@ -0,0 +1,887 @@ +# +# GAME TRANSLATIONS +# +# Contributing: +# +# If you want to contribute, please make a pull request on this respository +# and I will have a look. +# +# Placeholders: +# +# Do *not* replace placeholders! Placeholders have a special syntax like +# `Hotkey: `. They are encapsulated within angle brackets. The correct +# translation for this one in German for example would be: `Taste: ` (notice +# how the placeholder stayed '' and was not replaced!) +# +# Adding a new language: +# +# If you want to add a new language, ask me in the discord and I will setup +# the basic structure so the game also detects it. +# + +steamPage: + # This is the short text appearing on the steam page + shortText: shapez.io is a game about building factories to automate the creation and processing of increasingly complex shapes across an infinitely expanding map. + + # This is the text shown above the discord link + discordLink: Official Discord - Chat with me! + + # This is the long description for the steam page - It is contained here so you can help to translate it, and I will regulary update the store page. + # NOTICE: + # - Do not translate the first line (This is the gif image at the start of the store) + # - Please keep the markup (Stuff like [b], [list] etc) in the same format + longText: >- + [img]{STEAM_APP_IMAGE}/extras/store_page_gif.gif[/img] + + shapez.io is a game about building factories to automate the creation and processing of increasingly complex shapes across an infinitely expanding map. + Upon delivering the requested shapes you will progress within the game and unlock upgrades to speed up your factory. + + As the demand for shapes increases, you will have to scale up your factory to meet the demand - Don't forget about resources though, you will have to expand across the [b]infinite map[/b]! + + Soon you will have to mix colors and paint your shapes with them - Combine red, green and blue color resources to produce different colors and paint shapes with it to satisfy the demand. + + This game features 18 progressive levels (Which should keep you busy for hours already!) but I'm constantly adding new content - There is a lot planned! + + Purchasing the game gives you access to the standalone version which has additional features and you'll also receive access to newly developed features. + + [img]{STEAM_APP_IMAGE}/extras/header_standalone_advantages.png[/img] + + [list] + [*] Dark Mode + [*] Unlimited Waypoints + [*] Unlimited Savegames + [*] Additional settings + [*] Coming soon: Wires & Energy! Aiming for (roughly) end of July 2020. + [*] Coming soon: More Levels + [*] Allows me to further develop shapez.io ❤️ + [/list] + + [img]{STEAM_APP_IMAGE}/extras/header_future_updates.png[/img] + + I am updating the game very often and trying to push an update at least every week! + + [list] + [*] Different maps and challenges (e.g. maps with obstacles) + [*] Puzzles (Deliver the requested shape with a restricted area / set of buildings) + [*] A story mode where buildings have a cost + [*] Configurable map generator (Configure resource/shape size/density, seed and more) + [*] Additional types of shapes + [*] Performance improvements (The game already runs pretty well!) + [*] And much more! + [/list] + + [img]{STEAM_APP_IMAGE}/extras/header_open_source.png[/img] + + Anybody can contribute, I'm actively involved in the community and attempt to review all suggestions and take feedback into consideration where possible. + Be sure to check out my trello board for the full roadmap! + + [img]{STEAM_APP_IMAGE}/extras/header_links.png[/img] + + [list] + [*] [url=https://discord.com/invite/HN7EVzV]Official Discord[/url] + [*] [url=https://trello.com/b/ISQncpJP/shapezio]Roadmap[/url] + [*] [url=https://www.reddit.com/r/shapezio]Subreddit[/url] + [*] [url=https://github.com/tobspr/shapez.io]Source code (GitHub)[/url] + [*] [url=https://github.com/tobspr/shapez.io/blob/master/translations/README.md]Help translate[/url] + [/list] + +global: + loading: Loading + error: Error + + # How big numbers are rendered, e.g. "10,000" + thousandsDivider: "," + + # The suffix for large numbers, e.g. 1.3k, 400.2M, etc. + suffix: + thousands: k + millions: M + billions: B + trillions: T + + # Shown for infinitely big numbers + infinite: inf + + time: + # Used for formatting past time dates + oneSecondAgo: one second ago + xSecondsAgo: seconds ago + oneMinuteAgo: one minute ago + xMinutesAgo: minutes ago + oneHourAgo: one hour ago + xHoursAgo: hours ago + oneDayAgo: one day ago + xDaysAgo: days ago + + # Short formats for times, e.g. '5h 23m' + secondsShort: s + minutesAndSecondsShort: m s + hoursAndMinutesShort: h m + + xMinutes: minutes + + keys: + tab: TAB + control: CTRL + alt: ALT + escape: ESC + shift: SHIFT + space: SPACE + +demoBanners: + # This is the "advertisement" shown in the main menu and other various places + title: Demo Version + intro: >- + Get the standalone to unlock all features! + +mainMenu: + play: Play + continue: Continue + newGame: New Game + changelog: Changelog + subreddit: Reddit + importSavegame: Import + openSourceHint: This game is open source! + discordLink: Official Discord Server + helpTranslate: Help translate! + madeBy: Made by + + # This is shown when using firefox and other browsers which are not supported. + browserWarning: >- + Sorry, but the game is known to run slow on your browser! Get the standalone version or download chrome for the full experience. + + savegameLevel: Level + savegameLevelUnknown: Unknown Level + + contests: + contest_01_03062020: + title: "Contest #01" + desc: Win $25 for the coolest base! + longDesc: >- + To give something back to you, I thought it would be cool to make weekly contests! +

+ This week's topic: Build the coolest base! +

+ Here's the deal:
+
    +
  • Submit a screenshot of your base to contest@shapez.io
  • +
  • Bonus points if you share it on social media!
  • +
  • I will choose 5 screenshots and showcase them to the discord community to vote.
  • +
  • The winner gets $25 (Paypal, Amazon Gift Card, whatever you prefer)
  • +
  • Deadline: 07.06.2020 12:00 AM CEST
  • +
+
+ I'm looking forward to seeing your awesome creations! + + showInfo: View + contestOver: This contest has ended - Join the discord to get noticed about new contests! + +dialogs: + buttons: + ok: OK + delete: Delete + cancel: Cancel + later: Later + restart: Restart + reset: Reset + getStandalone: Get Standalone + deleteGame: I know what I am doing + viewUpdate: View Update + showUpgrades: Show Upgrades + showKeybindings: Show Keybindings + + importSavegameError: + title: Import Error + text: >- + Failed to import your savegame: + + importSavegameSuccess: + title: Savegame Imported + text: >- + Your savegame has been successfully imported. + + gameLoadFailure: + title: Game is broken + text: >- + Failed to load your savegame: + + confirmSavegameDelete: + title: Confirm deletion + text: >- + Are you sure you want to delete the game? + + savegameDeletionError: + title: Failed to delete + text: >- + Failed to delete the savegame: + + restartRequired: + title: Restart required + text: >- + You need to restart the game to apply the settings. + + editKeybinding: + title: Change Keybinding + desc: Press the key or mouse button you want to assign, or escape to cancel. + + resetKeybindingsConfirmation: + title: Reset keybindings + desc: This will reset all keybindings to their default values. Please confirm. + + keybindingsResetOk: + title: Keybindings reset + desc: The keybindings have been reset to their respective defaults! + + featureRestriction: + title: Demo Version + desc: You tried to access a feature () which is not available in the demo. Consider getting the standalone version for the full experience! + + oneSavegameLimit: + title: Limited savegames + desc: You can only have one savegame at a time in the demo version. Please remove the existing one or get the standalone version! + + updateSummary: + title: New update! + desc: >- + Here are the changes since you last played: + + upgradesIntroduction: + title: Unlock Upgrades + desc: >- + All shapes you produce can be used to unlock upgrades - Don't destroy your old factories! + The upgrades tab can be found on the top right corner of the screen. + + massDeleteConfirm: + title: Confirm delete + desc: >- + You are deleting a lot of buildings ( to be exact)! Are you sure you want to do this? + + massCutConfirm: + title: Confirm cut + desc: >- + You are cutting a lot of buildings ( to be exact)! Are you sure you want to do this? + + massCutInsufficientConfirm: + title: Confirm cut + desc: >- + You can not afford to paste this area! Are you sure you want to cut it? + + blueprintsNotUnlocked: + title: Not unlocked yet + desc: >- + Complete level 12 to unlock Blueprints! + + keybindingsIntroduction: + title: Useful keybindings + desc: >- + This game has a lot of keybindings which make it easier to build big factories. + Here are a few, but be sure to check out the keybindings!

+ CTRL + Drag: Select an area.
+ SHIFT: Hold to place multiple of one building.
+ ALT: Invert orientation of placed belts.
+ + createMarker: + title: New Marker + desc: Give it a meaningful name, you can also include a short key of a shape (Which you can generate here) + + markerDemoLimit: + desc: You can only create two custom markers in the demo. Get the standalone for unlimited markers! + + exportScreenshotWarning: + title: Export screenshot + desc: You requested to export your base as a screenshot. Please note that this can be quite slow for a big base and even crash your game! + +ingame: + # This is shown in the top left corner and displays useful keybindings in + # every situation + keybindingsOverlay: + moveMap: Move + selectBuildings: Select area + stopPlacement: Stop placement + rotateBuilding: Rotate building + placeMultiple: Place multiple + reverseOrientation: Reverse orientation + disableAutoOrientation: Disable auto-orientation + toggleHud: Toggle HUD + placeBuilding: Place building + createMarker: Create marker + delete: Delete + pasteLastBlueprint: Paste last blueprint + lockBeltDirection: Enable belt planner + plannerSwitchSide: Flip planner side + cutSelection: Cut + copySelection: Copy + clearSelection: Clear selection + pipette: Pipette + switchLayers: Switch layers + + # Names of the colors, used for the color blind mode + colors: + red: Red + green: Green + blue: Blue + yellow: Yellow + purple: Purple + cyan: Cyan + white: White + black: Black + uncolored: No color + + # Everything related to placing buildings (I.e. as soon as you selected a building + # from the toolbar) + buildingPlacement: + # Buildings can have different variants which are unlocked at later levels, + # and this is the hint shown when there are multiple variants available. + cycleBuildingVariants: Press to cycle variants. + + # Shows the hotkey in the ui, e.g. "Hotkey: Q" + hotkeyLabel: >- + Hotkey: + + infoTexts: + speed: Speed + range: Range + storage: Storage + oneItemPerSecond: 1 item / second + itemsPerSecond: items / s + itemsPerSecondDouble: (x2) + + tiles: tiles + + # The notification when completing a level + levelCompleteNotification: + # is replaced by the actual level, so this gets 'Level 03' for example. + levelTitle: Level + completed: Completed + unlockText: Unlocked ! + buttonNextLevel: Next Level + + # Notifications on the lower right + notifications: + newUpgrade: A new upgrade is available! + gameSaved: Your game has been saved. + + # The "Upgrades" window + shop: + title: Upgrades + buttonUnlock: Upgrade + + # Gets replaced to e.g. "Tier IX" + tier: Tier + + # The roman number for each tier + tierLabels: [I, II, III, IV, V, VI, VII, VIII, IX, X] + + maximumLevel: MAXIMUM LEVEL (Speed x) + + # The "Statistics" window + statistics: + title: Statistics + dataSources: + stored: + title: Stored + description: Displaying amount of stored shapes in your central building. + produced: + title: Produced + description: Displaying all shapes your whole factory produces, including intermediate products. + delivered: + title: Delivered + description: Displaying shapes which are delivered to your central building. + noShapesProduced: No shapes have been produced so far. + + # Displays the shapes per minute, e.g. '523 / m' + shapesPerMinute: / m + + # Settings menu, when you press "ESC" + settingsMenu: + playtime: Playtime + + buildingsPlaced: Buildings + beltsPlaced: Belts + + buttons: + continue: Continue + settings: Settings + menu: Return to menu + + # Bottom left tutorial hints + tutorialHints: + title: Need help? + showHint: Show hint + hideHint: Close + + # When placing a blueprint + blueprintPlacer: + cost: Cost + + # Map markers + waypoints: + waypoints: Markers + hub: HUB + description: Left-click a marker to jump to it, right-click to delete it.

Press to create a marker from the current view, or right-click to create a marker at the selected location. + creationSuccessNotification: Marker has been created. + + # Shape viewer + shapeViewer: + title: Layers + empty: Empty + copyKey: Copy Key + + # Interactive tutorial + interactiveTutorial: + title: Tutorial + hints: + 1_1_extractor: Place an extractor on top of a circle shape to extract it! + 1_2_conveyor: >- + Connect the extractor with a conveyor belt to your hub!

Tip: Click and drag the belt with your mouse! + + 1_3_expand: >- + This is NOT an idle game! Build more extractors and belts to finish the goal quicker.

Tip: Hold SHIFT to place multiple extractors, and use R to rotate them. + +# All shop upgrades +shopUpgrades: + belt: + name: Belts, Distributor & Tunnels + description: Speed x → x + miner: + name: Extraction + description: Speed x → x + processors: + name: Cutting, Rotating & Stacking + description: Speed x → x + painting: + name: Mixing & Painting + description: Speed x → x + +# Buildings and their name / description +buildings: + hub: + deliver: Deliver + toUnlock: to unlock + levelShortcut: LVL + + belt: + default: + name: &belt Conveyor Belt + description: Transports items, hold and drag to place multiple. + + wire: + default: + name: &wire Wire + description: Allows you to transport energy + + miner: # Internal name for the Extractor + default: + name: &miner Extractor + description: Place over a shape or color to extract it. + + chainable: + name: Extractor (Chain) + description: Place over a shape or color to extract it. Can be chained. + + underground_belt: # Internal name for the Tunnel + default: + name: &underground_belt Tunnel + description: Allows you to tunnel resources under buildings and belts. + + tier2: + name: Tunnel Tier II + description: Allows you to tunnel resources under buildings and belts. + + splitter: # Internal name for the Balancer + default: + name: &splitter Balancer + description: Multifunctional - Evenly distributes all inputs onto all outputs. + + compact: + name: Merger (compact) + description: Merges two conveyor belts into one. + + compact-inverse: + name: Merger (compact) + description: Merges two conveyor belts into one. + + cutter: + default: + name: &cutter Cutter + description: Cuts shapes from top to bottom and outputs both halves. If you use only one part, be sure to destroy the other part or it will stall! + quad: + name: Cutter (Quad) + description: Cuts shapes into four parts. If you use only one part, be sure to destroy the other parts or it will stall! + + advanced_processor: + default: + name: &advanced_processor Advanced Processor + description: Advanced shape processing + + rotater: + default: + name: &rotater Rotate + description: Rotates shapes clockwise by 90 degrees. + ccw: + name: Rotate (CCW) + description: Rotates shapes counter-clockwise by 90 degrees. + + stacker: + default: + name: &stacker Stacker + description: Stacks both items. If they can not be merged, the right item is placed above the left item. + + mixer: + default: + name: &mixer Color Mixer + description: Mixes two colors using additive blending. + + painter: + default: + name: &painter Painter + description: &painter_desc Colors the whole shape on the left input with the color from the top input. + + mirrored: + name: *painter + description: *painter_desc + + double: + name: Painter (Double) + description: Colors the shapes on the left inputs with the color from the top input. + quad: + name: Painter (Quad) + description: Allows you to color each quadrant of the shape with a different color. + + trash: + default: + name: &trash Trash + description: Accepts inputs from all sides and destroys them. Forever. + + storage: + name: Storage + description: Stores excess items, up to a given capacity. Can be used as an overflow gate. + + energy_generator: + deliver: Deliver + + # This will be shown before the amount, so for example 'For 123 Energy' + toGenerateEnergy: For + + default: + name: &energy_generator Energy Generator + description: Generates energy by consuming shapes. Each energy generator requires a different shape. + +storyRewards: + # Those are the rewards gained from completing the store + reward_cutter_and_trash: + title: Cutting Shapes + desc: You just unlocked the cutter - it cuts shapes half from top to bottom regardless of its orientation!

Be sure to get rid of the waste, or otherwise it will stall - For this purpose I gave you a trash, which destroys everything you put into it! + + reward_rotater: + title: Rotating + desc: The rotater has been unlocked! It rotates shapes clockwise by 90 degrees. + + reward_painter: + title: Painting + desc: >- + The painter has been unlocked - Extract some color veins (just as you do with shapes) and combine it with a shape in the painter to color them!

PS: If you are colorblind, there is a colorblind mode in the settings! + + reward_mixer: + title: Color Mixing + desc: The mixer has been unlocked - Combine two colors using additive blending with this building! + + reward_stacker: + title: Combiner + desc: You can now combine shapes with the combiner! Both inputs are combined, and if they can be put next to each other, they will be fused. If not, the right input is stacked on top of the left input! + + reward_splitter: + title: Splitter/Merger + desc: The multifunctional balancer has been unlocked - It can be used to build bigger factories by splitting and merging items onto multiple belts!

+ + reward_tunnel: + title: Tunnel + desc: The tunnel has been unlocked - You can now tunnel items through belts and buildings with it! + + reward_rotater_ccw: + title: CCW Rotating + desc: You have unlocked a variant of the rotater - It allows you to rotate shapes counter-clockwise! To build it, select the rotater and press 'T' to cycle through its variants! + + reward_miner_chainable: + title: Chaining Extractor + desc: You have unlocked the chaining extractor! It can forward its resources to other extractors so you can more efficiently extract resources! + + reward_underground_belt_tier_2: + title: Tunnel Tier II + desc: You have unlocked a new variant of the tunnel - It has a bigger range, and you can also mix-n-match those tunnels now! + + reward_splitter_compact: + title: Compact Balancer + desc: >- + You have unlocked a compact variant of the balancer - It accepts two inputs and merges them into one belt! + + reward_cutter_quad: + title: Quad Cutting + desc: You have unlocked a variant of the cutter - It allows you to cut shapes in four parts instead of just two! + + reward_painter_double: + title: Double Painting + desc: You have unlocked a variant of the painter - It works as the regular painter but processes two shapes at once consuming just one color instead of two! + + reward_painter_quad: + title: Quad Painting + desc: You have unlocked a variant of the painter - It allows you to paint each part of the shape individually! + + reward_storage: + title: Storage Buffer + desc: You have unlocked a variant of the trash - It allows you to store items up to a given capacity! + + reward_freeplay: + title: Freeplay + desc: You did it! You unlocked the free-play mode! This means that shapes are now randomly generated! (No worries, more content is planned for the standalone!) + + reward_blueprints: + title: Blueprints + desc: You can now copy and paste parts of your factory! Select an area (Hold CTRL, then drag with your mouse), and press 'C' to copy it.

Pasting it is not free, you need to produce blueprint shapes to afford it! (Those you just delivered). + + # Special reward, which is shown when there is no reward actually + no_reward: + title: Next level + desc: >- + This level gave you no reward, but the next one will!

PS: Better don't destroy your existing factory - You need all those shapes later again to unlock upgrades! + + reward_wires: + title: Wires + desc: TODO + + no_reward_freeplay: + title: Next level + desc: >- + Congratulations! By the way, more content is planned for the standalone! + +settings: + title: Settings + categories: + game: Game + app: Application + + versionBadges: + dev: Development + staging: Staging + prod: Production + buildDate: Built + + labels: + uiScale: + title: Interface scale + description: >- + Changes the size of the user interface. The interface will still scale based on your device's resolution, but this setting controls the amount of scaling. + scales: + super_small: Super small + small: Small + regular: Regular + large: Large + huge: Huge + + autosaveInterval: + title: Autosave Interval + description: >- + Controls how often the game saves automatically. You can also disable it entirely here. + + intervals: + one_minute: 1 Minute + two_minutes: 2 Minutes + five_minutes: 5 Minutes + ten_minutes: 10 Minutes + twenty_minutes: 20 Minutes + disabled: Disabled + + scrollWheelSensitivity: + title: Zoom sensitivity + description: >- + Changes how sensitive the zoom is (Either mouse wheel or trackpad). + sensitivity: + super_slow: Super slow + slow: Slow + regular: Regular + fast: Fast + super_fast: Super fast + + movementSpeed: + title: Movement speed + description: >- + Changes how fast the view moves when using the keyboard. + speeds: + super_slow: Super slow + slow: Slow + regular: Regular + fast: Fast + super_fast: Super Fast + extremely_fast: Extremely Fast + + language: + title: Language + description: >- + Change the language. All translations are user-contributed and might be incomplete! + + enableColorBlindHelper: + title: Color Blind Mode + description: >- + Enables various tools which allow you to play the game if you are color blind. + + fullscreen: + title: Fullscreen + description: >- + It is recommended to play the game in fullscreen to get the best experience. Only available in the standalone. + + soundsMuted: + title: Mute Sounds + description: >- + If enabled, mutes all sound effects. + + musicMuted: + title: Mute Music + description: >- + If enabled, mutes all music. + + theme: + title: Game theme + description: >- + Choose the game theme (light / dark). + themes: + dark: Dark + light: Light + + refreshRate: + title: Simulation Target + description: >- + If you have a 144hz monitor, change the refresh rate here so the game will properly simulate at higher refresh rates. This might actually decrease the FPS if your computer is too slow. + + alwaysMultiplace: + title: Multiplace + description: >- + If enabled, all buildings will stay selected after placement until you cancel it. This is equivalent to holding SHIFT permanently. + + offerHints: + title: Hints & Tutorials + description: >- + Whether to offer hints and tutorials while playing. Also hides certain UI elements up to 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 you to drag tunnels and excess tunnels will get removed. + + vignette: + title: Vignette + description: >- + Enables the vignette, which darkens the screen corners and makes text easier to read. + + rotationByBuilding: + title: Rotation by building type + description: >- + Each building type remembers the rotation you last set it to individually. This may be more comfortable if you frequently switch between placing different building types. + + compactBuildingInfo: + title: Compact Building Infos + description: >- + Shortens info boxes for buildings by only showing their ratios. Otherwise a description and image is shown. + + disableCutDeleteWarnings: + title: Disable Cut/Delete Warnings + description: >- + Disables the warning dialogs brought up when cutting/deleting more than 100 entities. + +keybindings: + title: Keybindings + hint: >- + Tip: Be sure to make use of CTRL, SHIFT and ALT! They enable different placement options. + + resetKeybindings: Reset Keybindings + + categoryLabels: + general: Application + ingame: Game + navigation: Navigating + placement: Placement + massSelect: Mass Select + buildings: Building Shortcuts + placementModifiers: Placement Modifiers + + mappings: + confirm: Confirm + back: Back + mapMoveUp: Move Up + mapMoveRight: Move Right + mapMoveDown: Move Down + mapMoveLeft: Move Left + mapMoveFaster: Move Faster + centerMap: Center Map + + mapZoomIn: Zoom in + mapZoomOut: Zoom out + createMarker: Create Marker + + menuOpenShop: Upgrades + menuOpenStats: Statistics + menuClose: Close Menu + + toggleHud: Toggle HUD + toggleFPSInfo: Toggle FPS and Debug Info + switchLayers: Switch layers + exportScreenshot: Export whole Base as Image + belt: *belt + splitter: *splitter + underground_belt: *underground_belt + miner: *miner + cutter: *cutter + advanced_processor: *advanced_processor + rotater: *rotater + stacker: *stacker + mixer: *mixer + energy_generator: *energy_generator + painter: *painter + trash: *trash + wire: *wire + + pipette: Pipette + rotateWhilePlacing: Rotate + rotateInverseModifier: >- + Modifier: Rotate CCW instead + cycleBuildingVariants: Cycle Variants + confirmMassDelete: Delete area + pasteLastBlueprint: Paste last blueprint + cycleBuildings: Cycle Buildings + lockBeltDirection: Enable belt planner + switchDirectionLockSide: >- + Planner: Switch side + + massSelectStart: Hold and drag to start + massSelectSelectMultiple: Select multiple areas + massSelectCopy: Copy area + massSelectCut: Cut area + + placementDisableAutoOrientation: Disable automatic orientation + placeMultiple: Stay in placement mode + placeInverse: Invert automatic belt orientation + +about: + title: About this Game + body: >- + This game is open source and developed by Tobias Springer (this is me).

+ + If you want to contribute, check out shapez.io on github.

+ + This game wouldn't have been possible without the great discord community around my games - You should really join the discord server!

+ + The soundtrack was made by Peppsen - He's awesome.

+ + Finally, huge thanks to my best friend Niklas - Without our factorio sessions, this game would never have existed. + +changelog: + title: Changelog + +demo: + features: + restoringGames: Restoring savegames + importingGames: Importing savegames + oneGameLimit: Limited to one savegame + customizeKeybindings: Customizing Keybindings + exportingBase: Exporting whole Base as Image + + settingNotAvailable: Not available in the demo. From 756bcdb47313ca54fcea46f03988ccc16e6cd820 Mon Sep 17 00:00:00 2001 From: tobspr Date: Mon, 6 Jul 2020 14:19:46 +0200 Subject: [PATCH 13/19] Fix tunnels entrances connecting to exits sometimes when they shouldn't --- src/js/changelog.js | 1 + src/js/game/systems/underground_belt.js | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/js/changelog.js b/src/js/changelog.js index 09af611c..98388839 100644 --- a/src/js/changelog.js +++ b/src/js/changelog.js @@ -14,6 +14,7 @@ export const CHANGELOG = [ "Updated the soundtrack again, it is now 20 minutes in total!", "Updated and added new translations (Thanks to all contributors!)", "Show confirmation when cutting area which is too expensive to get pasted again (by isaisstillalive)", + "Fix tunnels entrances connecting to exits sometimes when they shouldn't", ], }, { diff --git a/src/js/game/systems/underground_belt.js b/src/js/game/systems/underground_belt.js index 7dd4234e..f5e1b0ab 100644 --- a/src/js/game/systems/underground_belt.js +++ b/src/js/game/systems/underground_belt.js @@ -309,17 +309,17 @@ export class UndergroundBeltSystem extends GameSystemWithFilter { continue; } - if (receiverUndergroundComp.mode !== enumUndergroundBeltMode.receiver) { - // Not a receiver - continue; - } - const receiverStaticComp = potentialReceiver.components.StaticMapEntity; if (receiverStaticComp.rotation !== targetRotation) { // Wrong rotation continue; } + if (receiverUndergroundComp.mode !== enumUndergroundBeltMode.receiver) { + // Not a receiver, but a sender -> Abort to make sure we don't deliver double + break; + } + return { entity: potentialReceiver, distance: searchOffset }; } From 22cba96f6e93421b9c252408611cd19fe5c57af6 Mon Sep 17 00:00:00 2001 From: tobspr Date: Mon, 6 Jul 2020 14:40:31 +0200 Subject: [PATCH 14/19] Refactor debug overlay --- src/css/ingame_hud/debug_info.scss | 19 +++- src/js/changelog.js | 3 +- src/js/game/hud/parts/debug_info.js | 146 +++++++++++++++++----------- 3 files changed, 110 insertions(+), 58 deletions(-) diff --git a/src/css/ingame_hud/debug_info.scss b/src/css/ingame_hud/debug_info.scss index de69a4f9..3a077d53 100644 --- a/src/css/ingame_hud/debug_info.scss +++ b/src/css/ingame_hud/debug_info.scss @@ -5,10 +5,12 @@ text-align: right; font-size: 15px; - display: flex; + display: grid; line-height: 15px; - flex-direction: column; color: #fff; + grid-gap: 2px; + text-shadow: 1px 1px 3px rgba(#000, 0.4); + font-weight: bold; &:not([data-mode="detailed"]) { .mousePosition, @@ -16,4 +18,17 @@ display: none; } } + + code { + background: #333; + min-width: 30px; + display: inline-flex; + align-items: center; + justify-content: center; + font-size: 14px; + line-height: 15px; + padding: 1px; + font-family: "GameFont"; + border-radius: 3px; + } } diff --git a/src/js/changelog.js b/src/js/changelog.js index 98388839..3e3e1a7d 100644 --- a/src/js/changelog.js +++ b/src/js/changelog.js @@ -9,11 +9,12 @@ export const CHANGELOG = [ "Allow binding TAB (by swtw7466)", "Added keybinding to close menus (by isaisstillalive / Sandwichs-del)", "Fix rare crash regarding the buildings toolbar (by isaisstillalive)", - "Fixed some phrases (By EnderDoom77)", + "Fixed some phrases (by EnderDoom77)", "Zoom towards mouse cursor (by Dimava)", "Updated the soundtrack again, it is now 20 minutes in total!", "Updated and added new translations (Thanks to all contributors!)", "Show confirmation when cutting area which is too expensive to get pasted again (by isaisstillalive)", + "Show mouse and camera tile on debug overlay (F4) (by dengr)", "Fix tunnels entrances connecting to exits sometimes when they shouldn't", ], }, diff --git a/src/js/game/hud/parts/debug_info.js b/src/js/game/hud/parts/debug_info.js index bfa09b1e..cdd00540 100644 --- a/src/js/game/hud/parts/debug_info.js +++ b/src/js/game/hud/parts/debug_info.js @@ -3,84 +3,120 @@ import { makeDiv, round3Digits, round2Digits } from "../../../core/utils"; import { DynamicDomAttach } from "../dynamic_dom_attach"; import { KEYMAPPINGS } from "../../key_action_mapper"; import { Vector } from "../../../core/vector"; +import { TrackedState } from "../../../core/tracked_state"; /** @enum {string} */ -export const enumDebugOverlayMode = { disabled: "disabled", regular: "regular", detailed: "detailed" }; +const enumDebugOverlayMode = { disabled: "disabled", regular: "regular", detailed: "detailed" }; + +/** + * Specifies which mode follows after which mode + * @enum {enumDebugOverlayMode} + */ +const enumDebugOverlayModeNext = { + [enumDebugOverlayMode.disabled]: enumDebugOverlayMode.regular, + [enumDebugOverlayMode.regular]: enumDebugOverlayMode.detailed, + [enumDebugOverlayMode.detailed]: enumDebugOverlayMode.disabled, +}; + +const UPDATE_INTERVAL_SECONDS = 0.25; export class HUDDebugInfo extends BaseHUDPart { createElements(parent) { this.element = makeDiv(parent, "ingame_HUD_DebugInfo", []); - this.tickRateElement = makeDiv(this.element, null, ["tickRate"], "Ticks /s: 120"); - this.fpsElement = makeDiv(this.element, null, ["fps"], "FPS: 60"); - this.tickDurationElement = makeDiv(this.element, null, ["tickDuration"], "Tick dur: 0.5ms"); - this.mousePositionElement = makeDiv(this.element, null, ["mousePosition"], "Pos: 0 0"); - this.cameraPositionElement = makeDiv(this.element, null, ["cameraPosition"], "Center: 0 0"); + const tickRateElement = makeDiv(this.element, null, ["tickRate"]); + this.trackedTickRate = new TrackedState(str => (tickRateElement.innerText = str)); + + const tickDurationElement = makeDiv(this.element, null, ["tickDuration"]); + this.trackedTickDuration = new TrackedState(str => (tickDurationElement.innerText = str)); + + const fpsElement = makeDiv(this.element, null, ["fps"]); + this.trackedFPS = new TrackedState(str => (fpsElement.innerText = str)); + + const mousePositionElement = makeDiv(this.element, null, ["mousePosition"]); + this.trackedMousePosition = new TrackedState(str => (mousePositionElement.innerHTML = str)); + + const cameraPositionElement = makeDiv(this.element, null, ["cameraPosition"]); + this.trackedCameraPosition = new TrackedState(str => (cameraPositionElement.innerHTML = str)); + this.versionElement = makeDiv(this.element, null, ["version"], "version unknown"); } initialize() { this.lastTick = 0; - this.mode = enumDebugOverlayMode.disabled; + this.trackedMode = new TrackedState(this.onModeChanged, this); this.domAttach = new DynamicDomAttach(this.root, this.element); - this.root.keyMapper.getBinding(KEYMAPPINGS.ingame.toggleFPSInfo).add(() => this.toggle()); + this.root.keyMapper.getBinding(KEYMAPPINGS.ingame.toggleFPSInfo).add(() => this.cycleModes()); + + // Set initial mode + this.trackedMode.set(enumDebugOverlayMode.disabled); } - updateFullText() { - this.element.setAttribute("data-mode", this.mode); - - let version = `version ${G_BUILD_VERSION}`; - if (this.full) { - version += ` @ ${G_APP_ENVIRONMENT} @ ${G_BUILD_COMMIT_HASH}`; - } - - this.versionElement.innerText = version; + /** + * Called when the mode changed + * @param {enumDebugOverlayMode} mode + */ + onModeChanged(mode) { + this.element.setAttribute("data-mode", mode); + this.versionElement.innerText = `${G_BUILD_VERSION} @ ${G_APP_ENVIRONMENT} @ ${G_BUILD_COMMIT_HASH}`; } - updatePositions() { - let mousePos = this.root.app.mousePosition || new Vector(0, 0); - mousePos = this.root.camera.screenToWorld(mousePos).toTileSpace(); - const cameraPos = this.root.camera.center.toTileSpace(); - - this.mousePositionElement.innerText = `Pos: ${mousePos.x} ${mousePos.y}`; - this.cameraPositionElement.innerText = `Center: ${cameraPos.x} ${cameraPos.y}`; - } - - toggle() { - switch (this.mode) { - case enumDebugOverlayMode.detailed: - this.mode = enumDebugOverlayMode.disabled; - break; - case enumDebugOverlayMode.regular: - this.mode = enumDebugOverlayMode.detailed; - break; - default: - this.mode = enumDebugOverlayMode.regular; - break; - } - this.updateFullText(); - this.domAttach.update(this.mode !== enumDebugOverlayMode.disabled); - } - - update() { - const now = this.root.time.realtimeNow(); - if (!this.visible) return; - - if (now - this.lastTick > 0.25) { - this.lastTick = now; - this.tickRateElement.innerText = "Tickrate: " + this.root.dynamicTickrate.currentTickRate; - this.fpsElement.innerText = - "FPS: " + + /** + * Updates the labels + */ + updateLabels() { + this.trackedTickRate.set("Tickrate: " + this.root.dynamicTickrate.currentTickRate); + this.trackedFPS.set( + "FPS: " + Math.round(this.root.dynamicTickrate.averageFps) + " (" + round2Digits(1000 / this.root.dynamicTickrate.averageFps) + - " ms)"; - this.tickDurationElement.innerText = - "Tick Dur: " + round3Digits(this.root.dynamicTickrate.averageTickDuration) + "ms"; + " ms)" + ); + this.trackedTickDuration.set( + "Tick: " + round3Digits(this.root.dynamicTickrate.averageTickDuration) + "ms" + ); + } + + /** + * Updates the detailed information + */ + updateDetailedInformation() { + const mousePos = this.root.app.mousePosition || new Vector(0, 0); + const mouseTile = this.root.camera.screenToWorld(mousePos).toTileSpace(); + const cameraTile = this.root.camera.center.toTileSpace(); + + this.trackedMousePosition.set(`Pos: ${mouseTile.x} / ${mouseTile.y}`); + this.trackedCameraPosition.set(`Center: ${cameraTile.x} / ${cameraTile.y}`); + } + + /** + * Cycles through the different modes + */ + cycleModes() { + this.trackedMode.set(enumDebugOverlayModeNext[this.trackedMode.get()]); + } + + update() { + const visible = this.trackedMode.get() !== enumDebugOverlayMode.disabled; + this.domAttach.update(visible); + + if (!visible) { + return; } - this.updatePositions(); + // Periodically update the text + const now = this.root.time.realtimeNow(); + if (now - this.lastTick > UPDATE_INTERVAL_SECONDS) { + this.lastTick = now; + this.updateLabels(); + } + + // Also update detailed information if required + if (this.trackedMode.get() === enumDebugOverlayMode.detailed) { + this.updateDetailedInformation(); + } } } From d87c9c9e1fc9860c090ca02d5085fd97d9f27674 Mon Sep 17 00:00:00 2001 From: tobspr Date: Mon, 6 Jul 2020 14:48:09 +0200 Subject: [PATCH 15/19] Update changelog --- src/js/changelog.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/js/changelog.js b/src/js/changelog.js index 3e3e1a7d..51dc7335 100644 --- a/src/js/changelog.js +++ b/src/js/changelog.js @@ -16,6 +16,7 @@ export const CHANGELOG = [ "Show confirmation when cutting area which is too expensive to get pasted again (by isaisstillalive)", "Show mouse and camera tile on debug overlay (F4) (by dengr)", "Fix tunnels entrances connecting to exits sometimes when they shouldn't", + "The initial belt planner direction is now based on the cursor movement (by MizardX)", ], }, { From 1e5aa3867d0681a66598879acf8c6322c0776184 Mon Sep 17 00:00:00 2001 From: tobspr Date: Mon, 6 Jul 2020 15:08:17 +0200 Subject: [PATCH 16/19] Allow building mac on windows, closes #355 --- gulp/standalone.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/gulp/standalone.js b/gulp/standalone.js index 4ba53d1c..22a6409c 100644 --- a/gulp/standalone.js +++ b/gulp/standalone.js @@ -178,6 +178,34 @@ function gulptasksStandalone($, gulp, buildFolder) { // "start shapezio --local --dev --disable-direct-composition --in-process-gpu\r\n" // ); } + + if (platform === "darwin") { + // Clear up framework folders + + const finalPath = path.join(appPath, "shapez.io-standalone.app"); + + const frameworksDir = path.join(finalPath, "Contents", "Frameworks"); + const frameworkFolders = fs + .readdirSync(frameworksDir) + .filter(fname => fname.endsWith(".framework")); + + for (let i = 0; i < frameworkFolders.length; ++i) { + const folderName = frameworkFolders[i]; + const frameworkFolder = path.join(frameworksDir, folderName); + console.log(" -> ", frameworkFolder); + + const filesToDelete = fs + .readdirSync(frameworkFolder) + .filter(fname => fname.toLowerCase() !== "versions"); + filesToDelete.forEach(fname => { + console.log(" -> Deleting", fname); + fs.unlinkSync(path.join(frameworkFolder, fname)); + }); + + const frameworkSourceDir = path.join(frameworkFolder, "Versions", "A"); + fse.copySync(frameworkSourceDir, frameworkFolder); + } + } }); cb(); From 830a1d6184b27232e25e8d6d4fe0f723a2eb1214 Mon Sep 17 00:00:00 2001 From: tobspr Date: Mon, 6 Jul 2020 15:18:18 +0200 Subject: [PATCH 17/19] Fix translation --- translations/base-nl.yaml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/translations/base-nl.yaml b/translations/base-nl.yaml index 4250db68..47e21712 100644 --- a/translations/base-nl.yaml +++ b/translations/base-nl.yaml @@ -528,7 +528,8 @@ storyRewards: reward_painter: title: Verven - desc: De verver is ontgrendeld - Onttrek wat kleur (op dezelfde manier hoe je vormen onttrekt) en combineer het met een vorm in de verver om ze te kleuren!

PS: Als je kleurenblind bent, is er een kleurenblindmodus in de instellingen! + desc: >- + De verver is ontgrendeld - Onttrek wat kleur (op dezelfde manier hoe je vormen onttrekt) en combineer het met een vorm in de verver om ze te kleuren!

PS: Als je kleurenblind bent, is er een kleurenblindmodus in de instellingen! reward_mixer: title: Kleuren mengen @@ -724,11 +725,11 @@ settings: title: Kleurenblindmodus description: Schakelt verschillende hulpmiddelen in zodat je het spel alsnog kunt spelen wanneer je kleurenblind bent. rotationByBuilding: - title: Rotatie per type gebouw - description: >- - Elk type gebouw onthoud apart de rotatie waarin je het voor het laatst geplaatst hebt. - Dit kan handig zijn wanneer je vaak tussen verschillende - soorten gebouwen wisselt. + title: Rotatie per type gebouw + description: >- + Elk type gebouw onthoud apart de rotatie waarin je het voor het laatst geplaatst hebt. + Dit kan handig zijn wanneer je vaak tussen verschillende + soorten gebouwen wisselt. keybindings: title: Sneltoetsen From 0d74af92a75d52efa8a284389f10f26d799b7b4e Mon Sep 17 00:00:00 2001 From: tobspr Date: Mon, 6 Jul 2020 15:29:17 +0200 Subject: [PATCH 18/19] Further mac os fixes --- gulp/standalone.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gulp/standalone.js b/gulp/standalone.js index 22a6409c..c4f33417 100644 --- a/gulp/standalone.js +++ b/gulp/standalone.js @@ -158,7 +158,7 @@ function gulptasksStandalone($, gulp, buildFolder) { fs.writeFileSync(path.join(appPath, ".itch.toml"), tomlFile); - if (platform === "linux" || platform === "darwin") { + if (platform === "linux") { fs.writeFileSync( path.join(appPath, "play.sh"), '#!/usr/bin/env bash\n./shapezio --no-sandbox "$@"\n' @@ -181,6 +181,15 @@ function gulptasksStandalone($, gulp, buildFolder) { if (platform === "darwin") { // Clear up framework folders + fs.writeFileSync( + path.join(appPath, "play.sh"), + '#!/usr/bin/env bash\n./shapez.io-standalone.app/Contents/MacOS/shapezio --no-sandbox "$@"\n' + ); + fs.chmodSync(path.join(appPath, "play.sh"), 0o775); + fs.chmodSync( + path.join(appPath, "shapez.io-standalone.app", "Contents", "MacOS", "shapezio"), + 0o775 + ); const finalPath = path.join(appPath, "shapez.io-standalone.app"); From 0bba6a9d79080ea0363ad4276e53657433b8034b Mon Sep 17 00:00:00 2001 From: tobspr Date: Mon, 6 Jul 2020 18:36:10 +0200 Subject: [PATCH 19/19] Fix entity rendering bug when zooming out, add "Wires update" label to main menu --- src/css/states/main_menu.scss | 19 +++++++++++++++++++ src/js/game/map_view.js | 3 ++- src/js/game/root.js | 1 + src/js/game/systems/belt.js | 3 +++ src/js/states/main_menu.js | 25 ++++++++++--------------- 5 files changed, 35 insertions(+), 16 deletions(-) diff --git a/src/css/states/main_menu.scss b/src/css/states/main_menu.scss index be3bcce4..0981cdfc 100644 --- a/src/css/states/main_menu.scss +++ b/src/css/states/main_menu.scss @@ -147,6 +147,7 @@ flex-grow: 1; align-items: center; justify-content: center; + flex-direction: column; @include S(padding-top, 20px); img { @@ -160,6 +161,24 @@ background: uiResource("demo_badge.png") center center / contain no-repeat; display: inline-block; } + + position: relative; + .updateLabel { + position: absolute; + transform: translateX(50%) rotate(-5deg); + color: $colorRedBright; + @include Heading; + text-transform: uppercase; + font-weight: bold; + @include S(right, 40px); + @include S(bottom, 20px); + + @include InlineAnimation(1.3s ease-in-out infinite) { + 50% { + transform: translateX(50%) rotate(-7deg) scale(1.1); + } + } + } } .betaWarning { diff --git a/src/js/game/map_view.js b/src/js/game/map_view.js index 67ed143c..ed6c236c 100644 --- a/src/js/game/map_view.js +++ b/src/js/game/map_view.js @@ -35,6 +35,7 @@ export class MapView extends BaseMap { this.root.signals.entityAdded.add(this.onEntityChanged, this); this.root.signals.entityDestroyed.add(this.onEntityChanged, this); + this.root.signals.entityChanged.add(this.onEntityChanged, this); } cleanup() { @@ -44,7 +45,7 @@ export class MapView extends BaseMap { } /** - * Called when an entity was added or removed + * Called when an entity was added, removed or changed * @param {Entity} entity */ onEntityChanged(entity) { diff --git a/src/js/game/root.js b/src/js/game/root.js index 7bd42b4d..df0db09e 100644 --- a/src/js/game/root.js +++ b/src/js/game/root.js @@ -141,6 +141,7 @@ export class GameRoot { // Entities entityManuallyPlaced: /** @type {TypedSignal<[Entity]>} */ (new Signal()), entityAdded: /** @type {TypedSignal<[Entity]>} */ (new Signal()), + entityChanged: /** @type {TypedSignal<[Entity]>} */ (new Signal()), entityGotNewComponent: /** @type {TypedSignal<[Entity]>} */ (new Signal()), entityComponentRemoved: /** @type {TypedSignal<[Entity]>} */ (new Signal()), entityQueuedForDestroy: /** @type {TypedSignal<[Entity]>} */ (new Signal()), diff --git a/src/js/game/systems/belt.js b/src/js/game/systems/belt.js index 817fe1ed..19693c8b 100644 --- a/src/js/game/systems/belt.js +++ b/src/js/game/systems/belt.js @@ -185,6 +185,9 @@ export class BeltSystem extends GameSystemWithFilter { if (G_IS_DEV && globalConfig.debug.checkBeltPaths) { this.debug_verifyBeltPaths(); } + + // Make sure the chunks know about the update + this.root.signals.entityChanged.dispatch(targetEntity); } } } diff --git a/src/js/states/main_menu.js b/src/js/states/main_menu.js index 8f7d4a93..cf7a05ac 100644 --- a/src/js/states/main_menu.js +++ b/src/js/states/main_menu.js @@ -46,18 +46,15 @@ export class MainMenuState extends GameState { : "" } - - ${ - G_IS_STANDALONE - ? "" - : ` @@ -208,14 +205,12 @@ export class MainMenuState extends GameState { // Initialize video this.videoElement = this.htmlElement.querySelector("video"); - if (this.videoElement) { - this.videoElement.playbackRate = 0.9; - this.videoElement.addEventListener("canplay", () => { - if (this.videoElement) { - this.videoElement.classList.add("loaded"); - } - }); - } + this.videoElement.playbackRate = 0.9; + this.videoElement.addEventListener("canplay", () => { + if (this.videoElement) { + this.videoElement.classList.add("loaded"); + } + }); this.trackClicks(qs(".settingsButton"), this.onSettingsButtonClicked); this.trackClicks(qs(".changelog"), this.onChangelogClicked);